xref: /petsc/src/sys/tests/ex75.c (revision 6dd63270497ad23dcf16ae500a87ff2b2a0b7474)
1 static char help[] = "Error handling for external library call in void function.\n";
2 
3 #include <petscsys.h>
4 
5 int ReturnAnError(PETSC_UNUSED int dummy)
6 {
7   return 1;
8 }
9 
10 void MakeAnError(void)
11 {
12   PetscCallExternalAbort(ReturnAnError, 0);
13 }
14 
15 int main(int argc, char **argv)
16 {
17   PetscFunctionBeginUser;
18   PetscCall(PetscInitialize(&argc, &argv, NULL, help));
19   MakeAnError();
20   PetscCall(PetscFinalize());
21   return 0;
22 }
23 
24 /*TEST
25 
26    test:
27      requires: !defined(PETSCTEST_VALGRIND) defined(PETSC_USE_DEBUG) !defined(PETSC_HAVE_SANITIZER)
28      args: -petsc_ci_portable_error_output -error_output_stdout
29      filter: grep -E -v "(memory block|leaked context|not freed before MPI_Finalize|Could be the program crashed|PETSc Option Table entries|source: environment)"
30 
31 TEST*/
32