Actual source code: ex1.c


  2: static char help[] = "Demonstrates PETSc error handlers.\n";

  4: #include <petscsys.h>

  6: int CreateError(int n)
  7: {
  9:   CreateError(n-1);
 10:   return 0;
 11: }

 13: int main(int argc,char **argv)
 14: {
 15:   PetscInitialize(&argc,&argv,(char*)0,help);
 16:   PetscFPrintf(PETSC_COMM_WORLD,stdout,"Demonstrates PETSc Error Handlers\n");
 17:   PetscFPrintf(PETSC_COMM_WORLD,stdout,"The error is a contrived error to test error handling\n");
 18:   PetscSynchronizedFlush(PETSC_COMM_WORLD,PETSC_STDOUT);
 19:   CreateError(5);
 20:   PetscFinalize();
 21:   return 0;
 22: }

 24: /*TEST

 26:  # Testing errors so only look for errors
 27:    test:
 28:      args: -error_output_stdout
 29:      filter: egrep "(PETSC ERROR)" | egrep "(Error Created|CreateError\(\)|main\(\))" | cut -f1,2,3,4,5,6 -d " "
 30:      TODO:  Does not always produce exactly expected output on all systems for all runs

 32: TEST*/