Merge branch 'develop' into cmake-3.16
This commit is contained in:
@ -47,13 +47,6 @@ else()
|
||||
endif()
|
||||
list(APPEND TEST_CONFIG_DEFS -DLAMMPS_HAS_MPI=${HAS_MPI})
|
||||
|
||||
if(LAMMPS_EXCEPTIONS)
|
||||
set(HAS_EXCEPTIONS 1)
|
||||
else()
|
||||
set(HAS_EXCEPTIONS 0)
|
||||
endif()
|
||||
list(APPEND TEST_CONFIG_DEFS -DLAMMPS_HAS_EXCEPTIONS=${HAS_EXCEPTIONS})
|
||||
|
||||
foreach(WITH "JPEG" "PNG" "GZIP" "FFMPEG")
|
||||
if(WITH_${WITH})
|
||||
set(HAS_${WITH} 1)
|
||||
|
||||
@ -195,7 +195,7 @@ TEST_F(LibraryConfig, force_timeout)
|
||||
|
||||
TEST(LAMMPSConfig, exceptions)
|
||||
{
|
||||
EXPECT_EQ(lammps_config_has_exceptions(), LAMMPS_HAS_EXCEPTIONS);
|
||||
EXPECT_EQ(lammps_config_has_exceptions(), 1);
|
||||
};
|
||||
|
||||
TEST(LAMMPSConfig, mpi_support)
|
||||
|
||||
@ -518,9 +518,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
|
||||
|
||||
@ -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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -393,9 +393,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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -774,9 +774,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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -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<std::string> env = LAMMPS_NS::utils::split_words(var);
|
||||
|
||||
@ -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<std::string> env = split_words(var);
|
||||
|
||||
@ -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<std::string> env = split_words(var);
|
||||
|
||||
@ -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<std::string> env = split_words(var);
|
||||
|
||||
@ -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<std::string> env = split_words(var);
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -79,13 +79,10 @@ if(Python_EXECUTABLE)
|
||||
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
|
||||
set_tests_properties(PythonOpen PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}")
|
||||
|
||||
# some of the tests in this file will fail without exceptions enabled
|
||||
if(LAMMPS_EXCEPTIONS)
|
||||
add_test(NAME PythonCommands
|
||||
COMMAND ${PYTHON_TEST_RUNNER} ${CMAKE_CURRENT_SOURCE_DIR}/python-commands.py -v
|
||||
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
|
||||
set_tests_properties(PythonCommands PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}")
|
||||
endif()
|
||||
add_test(NAME PythonCommands
|
||||
COMMAND ${PYTHON_TEST_RUNNER} ${CMAKE_CURRENT_SOURCE_DIR}/python-commands.py -v
|
||||
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
|
||||
set_tests_properties(PythonCommands PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}")
|
||||
|
||||
add_test(NAME PythonNumpy
|
||||
COMMAND ${PYTHON_TEST_RUNNER} ${CMAKE_CURRENT_SOURCE_DIR}/python-numpy.py -v
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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).
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user