diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index d6dd55f75e..a684ce8c27 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -461,9 +461,6 @@ TEST_F(LibraryProperties, neighlist) TEST_F(LibraryProperties, has_error) { - // need errors to throw exceptions to be able to intercept them. - if (!lammps_config_has_exceptions()) GTEST_SKIP(); - EXPECT_EQ(lammps_has_error(lmp), 0); // trigger an error, but hide output diff --git a/unittest/commands/test_compute_chunk.cpp b/unittest/commands/test_compute_chunk.cpp index 3b306ab04b..8e919c0612 100644 --- a/unittest/commands/test_compute_chunk.cpp +++ b/unittest/commands/test_compute_chunk.cpp @@ -402,9 +402,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/commands/test_compute_global.cpp b/unittest/commands/test_compute_global.cpp index d7573d8d16..9f5dc5581d 100644 --- a/unittest/commands/test_compute_global.cpp +++ b/unittest/commands/test_compute_global.cpp @@ -301,9 +301,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/commands/test_delete_atoms.cpp b/unittest/commands/test_delete_atoms.cpp index e348000969..7c09e7497e 100644 --- a/unittest/commands/test_delete_atoms.cpp +++ b/unittest/commands/test_delete_atoms.cpp @@ -161,9 +161,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/commands/test_groups.cpp b/unittest/commands/test_groups.cpp index 57820a4548..b91a6108d9 100644 --- a/unittest/commands/test_groups.cpp +++ b/unittest/commands/test_groups.cpp @@ -469,9 +469,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/commands/test_kim_commands.cpp b/unittest/commands/test_kim_commands.cpp index 2e6e758c76..5f997dccdf 100644 --- a/unittest/commands/test_kim_commands.cpp +++ b/unittest/commands/test_kim_commands.cpp @@ -683,9 +683,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/commands/test_labelmap.cpp b/unittest/commands/test_labelmap.cpp index f25351e1d9..ebdab08ad3 100644 --- a/unittest/commands/test_labelmap.cpp +++ b/unittest/commands/test_labelmap.cpp @@ -299,9 +299,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/commands/test_lattice_region.cpp b/unittest/commands/test_lattice_region.cpp index 8dd15396b2..da36628b7f 100644 --- a/unittest/commands/test_lattice_region.cpp +++ b/unittest/commands/test_lattice_region.cpp @@ -632,9 +632,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/commands/test_regions.cpp b/unittest/commands/test_regions.cpp index 8d5134535a..370799afea 100644 --- a/unittest/commands/test_regions.cpp +++ b/unittest/commands/test_regions.cpp @@ -285,9 +285,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/commands/test_reset_atoms.cpp b/unittest/commands/test_reset_atoms.cpp index a0afe36324..d09a60c886 100644 --- a/unittest/commands/test_reset_atoms.cpp +++ b/unittest/commands/test_reset_atoms.cpp @@ -806,9 +806,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/commands/test_set_property.cpp b/unittest/commands/test_set_property.cpp index 62af47f2ed..36b86b3526 100644 --- a/unittest/commands/test_set_property.cpp +++ b/unittest/commands/test_set_property.cpp @@ -460,9 +460,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index db6ee3c1e7..1c995603e1 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -560,9 +560,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 8debb95b6a..530c33fcfe 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -726,9 +726,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/cplusplus/test_advanced_utils.cpp b/unittest/cplusplus/test_advanced_utils.cpp index 6b71c9ea34..0453ef0143 100644 --- a/unittest/cplusplus/test_advanced_utils.cpp +++ b/unittest/cplusplus/test_advanced_utils.cpp @@ -224,9 +224,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/cplusplus/test_error_class.cpp b/unittest/cplusplus/test_error_class.cpp index 779cbfbba6..b7eecb0337 100644 --- a/unittest/cplusplus/test_error_class.cpp +++ b/unittest/cplusplus/test_error_class.cpp @@ -125,9 +125,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (LAMMPS_NS::platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = LAMMPS_NS::utils::split_words(var); diff --git a/unittest/formats/test_file_operations.cpp b/unittest/formats/test_file_operations.cpp index d48dee34b2..f1a6ce42f5 100644 --- a/unittest/formats/test_file_operations.cpp +++ b/unittest/formats/test_file_operations.cpp @@ -618,9 +618,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = split_words(var); diff --git a/unittest/formats/test_molecule_file.cpp b/unittest/formats/test_molecule_file.cpp index 2f4336ab8a..8fe1fc1eab 100644 --- a/unittest/formats/test_molecule_file.cpp +++ b/unittest/formats/test_molecule_file.cpp @@ -409,9 +409,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = split_words(var); diff --git a/unittest/formats/test_potential_file_reader.cpp b/unittest/formats/test_potential_file_reader.cpp index b19c4166a1..3d14a73d31 100644 --- a/unittest/formats/test_potential_file_reader.cpp +++ b/unittest/formats/test_potential_file_reader.cpp @@ -323,9 +323,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = split_words(var); diff --git a/unittest/formats/test_text_file_reader.cpp b/unittest/formats/test_text_file_reader.cpp index 3146740b3a..8615b71b2a 100644 --- a/unittest/formats/test_text_file_reader.cpp +++ b/unittest/formats/test_text_file_reader.cpp @@ -166,9 +166,6 @@ int main(int argc, char **argv) MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); - if (platform::mpi_vendor() == "Open MPI" && !Info::has_exceptions()) - std::cout << "Warning: using OpenMPI without exceptions. Death tests will be skipped\n"; - // handle arguments passed via environment variable if (const char *var = getenv("TEST_ARGS")) { std::vector env = split_words(var); diff --git a/unittest/fortran/wrap_properties.cpp b/unittest/fortran/wrap_properties.cpp index 50704d326a..6f2b1f64f9 100644 --- a/unittest/fortran/wrap_properties.cpp +++ b/unittest/fortran/wrap_properties.cpp @@ -123,9 +123,6 @@ TEST_F(LAMMPS_properties, extract_setting) TEST_F(LAMMPS_properties, has_error) { - // need errors to throw exceptions to be able to intercept them. - if (!lammps_config_has_exceptions()) GTEST_SKIP(); - EXPECT_EQ(f_lammps_has_error(), lammps_has_error(lmp)); EXPECT_EQ(f_lammps_has_error(), 0); diff --git a/unittest/python/python-open.py b/unittest/python/python-open.py index 3c9165b8c8..f555be25dd 100644 --- a/unittest/python/python-open.py +++ b/unittest/python/python-open.py @@ -4,7 +4,7 @@ from lammps import lammps has_mpi=False has_mpi4py=False -has_exceptions=False + try: from mpi4py import __version__ as mpi4py_version # tested to work with mpi4py versions 2 and 3 @@ -19,7 +19,6 @@ try: machine = "" lmp = lammps(name=machine) has_mpi = lmp.has_mpi_support - has_exceptions = lmp.has_exceptions lmp.close() except: pass @@ -79,7 +78,6 @@ class PythonOpen(unittest.TestCase): self.assertEqual(lmp.opened,1) lmp.close() - @unittest.skipIf(not has_exceptions,"Skipping death test since LAMMPS isn't compiled with exception support") def testUnknownCommand(self): lmp = lammps(name=self.machine) @@ -88,7 +86,6 @@ class PythonOpen(unittest.TestCase): lmp.close() - @unittest.skipIf(not has_exceptions,"Skipping death test since LAMMPS isn't compiled with exception support") def testUnknownCommandInList(self): lmp = lammps(name=self.machine) @@ -97,7 +94,6 @@ class PythonOpen(unittest.TestCase): lmp.close() - @unittest.skipIf(not has_exceptions,"Skipping death test since LAMMPS isn't compiled with exception support") def testUnknownCommandInString(self): lmp = lammps(name=self.machine) diff --git a/unittest/testing/core.h b/unittest/testing/core.h index 272d1d21c5..88503dc188 100644 --- a/unittest/testing/core.h +++ b/unittest/testing/core.h @@ -32,21 +32,12 @@ using LAMMPS_NS::LAMMPSException; using ::testing::ContainsRegex; -#define TEST_FAILURE(errmsg, ...) \ - if (Info::has_exceptions()) { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_ANY_THROW({__VA_ARGS__}); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, ContainsRegex(errmsg)); \ - } else { \ - if (LAMMPS_NS::platform::mpi_vendor() != "Open MPI") { \ - ::testing::internal::CaptureStdout(); \ - ASSERT_DEATH({__VA_ARGS__}, ""); \ - auto mesg = ::testing::internal::GetCapturedStdout(); \ - ASSERT_THAT(mesg, ContainsRegex(errmsg)); \ - } else { \ - std::cerr << "[ ] [ INFO ] Skipping death test (no exception support) \n"; \ - } \ +#define TEST_FAILURE(errmsg, ...) \ + { \ + ::testing::internal::CaptureStdout(); \ + ASSERT_ANY_THROW({__VA_ARGS__}); \ + auto mesg = ::testing::internal::GetCapturedStdout(); \ + ASSERT_THAT(mesg, ContainsRegex(errmsg)); \ } // whether to print verbose output (i.e. not capturing LAMMPS screen output). diff --git a/unittest/utils/test_lepton.cpp b/unittest/utils/test_lepton.cpp index 415752c70d..7b2c86f05f 100644 --- a/unittest/utils/test_lepton.cpp +++ b/unittest/utils/test_lepton.cpp @@ -73,16 +73,14 @@ TEST_F(LeptonUtilsTest, substitute) lmp->update->reset_timestep(100LL, false); ASSERT_THAT(LeptonUtils::substitute("(2.5/v_pre)", lmp), StrEq("(2.5/0.1)")); - if (LAMMPS_NS::Info::has_exceptions()) { - bool caught = false; - try { - LeptonUtils::substitute("v_none", lmp); - } catch (std::exception &e) { - ASSERT_THAT(e.what(), StrEq("Variable none in expression v_none does not exist")); - caught = true; - } - ASSERT_TRUE(caught); + bool caught = false; + try { + LeptonUtils::substitute("v_none", lmp); + } catch (std::exception &e) { + ASSERT_THAT(e.what(), StrEq("Variable none in expression v_none does not exist")); + caught = true; } + ASSERT_TRUE(caught); } // zbl() custom function