From 6610edc1cc1364db53950690ae8ac47592ffbba6 Mon Sep 17 00:00:00 2001 From: Stefano Zampini Date: Sun, 25 Jun 2023 03:14:15 +0300 Subject: [PATCH] Disable FPE trapping in some tests with older versions of PETSc --- tests/petsc/petsc_snes_06.cc | 8 ++++++++ tests/petsc/petsc_snes_07.cc | 8 ++++++++ tests/petsc/petsc_ts_04.cc | 8 ++++++++ tests/petsc/petsc_ts_05.cc | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/tests/petsc/petsc_snes_06.cc b/tests/petsc/petsc_snes_06.cc index 5c8661a111..12320877b9 100644 --- a/tests/petsc/petsc_snes_06.cc +++ b/tests/petsc/petsc_snes_06.cc @@ -66,6 +66,14 @@ main(int argc, char **argv) last_residual_eval = X(0); }; + // This test triggers false positives in FPE trapping for some versions of + // PETSc +#if DEAL_II_PETSC_VERSION_LT(3, 19, 2) && defined(DEBUG) && \ + defined(DEAL_II_HAVE_FP_EXCEPTIONS) + PetscErrorCode ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF); + (void)ierr; +#endif + for (int setjac = 0; setjac < 2; setjac++) { if (setjac) diff --git a/tests/petsc/petsc_snes_07.cc b/tests/petsc/petsc_snes_07.cc index 64d9328b42..22f72e4906 100644 --- a/tests/petsc/petsc_snes_07.cc +++ b/tests/petsc/petsc_snes_07.cc @@ -153,6 +153,14 @@ run_test(int testcase, bool recoverable) x(0) = starting_x; x.compress(VectorOperation::insert); + // This test triggers false positives in FPE trapping for some versions of + // PETSc +#if DEAL_II_PETSC_VERSION_LT(3, 19, 2) && defined(DEBUG) && \ + defined(DEAL_II_HAVE_FP_EXCEPTIONS) + PetscErrorCode ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF); + (void)ierr; +#endif + deallog << "Running testcase " << testcase << std::endl; try { diff --git a/tests/petsc/petsc_ts_04.cc b/tests/petsc/petsc_ts_04.cc index e27545bb11..8db0853c15 100644 --- a/tests/petsc/petsc_ts_04.cc +++ b/tests/petsc/petsc_ts_04.cc @@ -231,6 +231,14 @@ main(int argc, char **argv) deallog << "# Testing Parameters" << std::endl; prm.print_parameters(deallog.get_file_stream(), ParameterHandler::ShortText); + // This test triggers false positives in FPE trapping for some versions of + // PETSc +#if DEAL_II_PETSC_VERSION_LT(3, 19, 2) && defined(DEBUG) && \ + defined(DEAL_II_HAVE_FP_EXCEPTIONS) + PetscErrorCode ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF); + (void)ierr; +#endif + for (int recerri = 0; recerri < 2; recerri++) { bool recerr = recerri ? false : true; diff --git a/tests/petsc/petsc_ts_05.cc b/tests/petsc/petsc_ts_05.cc index 2b8e98de18..aebefeb21c 100644 --- a/tests/petsc/petsc_ts_05.cc +++ b/tests/petsc/petsc_ts_05.cc @@ -220,6 +220,14 @@ main(int argc, char **argv) deallog << "# Testing Parameters" << std::endl; prm.print_parameters(deallog.get_file_stream(), ParameterHandler::ShortText); + // This test triggers false positives in FPE trapping for some versions of + // PETSc +#if DEAL_II_PETSC_VERSION_LT(3, 19, 2) && defined(DEBUG) && \ + defined(DEAL_II_HAVE_FP_EXCEPTIONS) + PetscErrorCode ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF); + (void)ierr; +#endif + for (int seterri = 0; seterri < 2; seterri++) { bool seterr = seterri ? true : false; -- 2.39.5