xref: /petsc/src/sys/tests/ex75.c (revision e62afa4902f02c3c2b179f3f7367344c73802710)
1*1fc6d13cSAlexander static char help[] = "Error handling for external library call in void function.\n";
2*1fc6d13cSAlexander 
3*1fc6d13cSAlexander #include <petscsys.h>
4*1fc6d13cSAlexander 
ReturnAnError(PETSC_UNUSED int dummy)5*1fc6d13cSAlexander int ReturnAnError(PETSC_UNUSED int dummy)
6*1fc6d13cSAlexander {
7*1fc6d13cSAlexander   return 1;
8*1fc6d13cSAlexander }
9*1fc6d13cSAlexander 
MakeAnError(void)10*1fc6d13cSAlexander void MakeAnError(void)
11*1fc6d13cSAlexander {
12*1fc6d13cSAlexander   PetscCallExternalAbort(ReturnAnError, 0);
13*1fc6d13cSAlexander }
14*1fc6d13cSAlexander 
main(int argc,char ** argv)15*1fc6d13cSAlexander int main(int argc, char **argv)
16*1fc6d13cSAlexander {
17*1fc6d13cSAlexander   PetscFunctionBeginUser;
18*1fc6d13cSAlexander   PetscCall(PetscInitialize(&argc, &argv, NULL, help));
19*1fc6d13cSAlexander   MakeAnError();
20*1fc6d13cSAlexander   PetscCall(PetscFinalize());
21*1fc6d13cSAlexander   return 0;
22*1fc6d13cSAlexander }
23*1fc6d13cSAlexander 
24*1fc6d13cSAlexander /*TEST
25*1fc6d13cSAlexander 
26*1fc6d13cSAlexander    test:
27*1fc6d13cSAlexander      requires: !defined(PETSCTEST_VALGRIND) defined(PETSC_USE_DEBUG) !defined(PETSC_HAVE_SANITIZER)
28*1fc6d13cSAlexander      args: -petsc_ci_portable_error_output -error_output_stdout
29*1fc6d13cSAlexander      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*1fc6d13cSAlexander 
31*1fc6d13cSAlexander TEST*/
32