115858b40SBarry Smith static const char help[] = "Tests error message when previous error was not fully handled\n"; 215858b40SBarry Smith 315858b40SBarry Smith #include <petscsys.h> 415858b40SBarry Smith 515858b40SBarry Smith PetscErrorCode CreateError(int n) 615858b40SBarry Smith { 715858b40SBarry Smith PetscCheck(n, PETSC_COMM_SELF, PETSC_ERR_USER, "Error Created"); 815858b40SBarry Smith PetscCall(CreateError(n - 1)); 915858b40SBarry Smith return PETSC_SUCCESS; 1015858b40SBarry Smith } 1115858b40SBarry Smith 1215858b40SBarry Smith int main(int argc, char **argv) 1315858b40SBarry Smith { 1415858b40SBarry Smith PetscErrorCode ierr; 1515858b40SBarry Smith 1615858b40SBarry Smith PetscFunctionBeginUser; 1715858b40SBarry Smith PetscCall(PetscInitialize(&argc, &argv, (char *)0, help)); 1815858b40SBarry Smith PetscCall(PetscFPrintf(PETSC_COMM_WORLD, stdout, "Demonstrates PETSc Error Handlers\n")); 1915858b40SBarry Smith PetscCall(PetscFPrintf(PETSC_COMM_WORLD, stdout, "The error is a contrived error to test error handling\n")); 2015858b40SBarry Smith PetscCall(PetscSynchronizedFlush(PETSC_COMM_WORLD, PETSC_STDOUT)); 2115858b40SBarry Smith ierr = CreateError(5); 2215858b40SBarry Smith (void)ierr; /* this prevents the compiler from warning about unused error return code */ 2315858b40SBarry Smith ierr = CreateError(5); 2415858b40SBarry Smith (void)ierr; 2515858b40SBarry Smith PetscCall(CreateError(5)); 2615858b40SBarry Smith PetscCall(PetscFinalize()); 2715858b40SBarry Smith return 0; 2815858b40SBarry Smith } 2915858b40SBarry Smith 3015858b40SBarry Smith /*TEST 3115858b40SBarry Smith 3215858b40SBarry Smith test: 3315858b40SBarry Smith requires: !defined(PETSCTEST_VALGRIND) 3415858b40SBarry Smith args: -petsc_ci_portable_error_output -error_output_stdout 35*9beb8f72SToby Isaac filter: grep -E -v "(memory block|leaked context|not freed before MPI_Finalize|Could be the program crashed|PETSc Option Table entries|source: environment)" 3615858b40SBarry Smith 3715858b40SBarry Smith TEST*/ 38