diff --git a/unittest/force-styles/test_angle_style.cpp b/unittest/force-styles/test_angle_style.cpp index bf5cb34e7f..ff391127bd 100644 --- a/unittest/force-styles/test_angle_style.cpp +++ b/unittest/force-styles/test_angle_style.cpp @@ -246,6 +246,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // epsilon writer.emit("epsilon", config.epsilon); + // skip tests + block.clear(); + for (auto &skip_tests : config.skip_tests) { + if (block.empty()) block = skip_tests; + else block += " " + skip_tests; + } + writer.emit("skip_tests", block); + // prerequisites block.clear(); for (auto &prerequisite : config.prerequisites) { @@ -341,6 +349,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) TEST(AngleStyle, plain) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"AngleStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -567,6 +577,8 @@ TEST(AngleStyle, plain) TEST(AngleStyle, omp) { if (!LAMMPS::is_installed_pkg("USER-OMP")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"AngleStyle", "-log", "none", "-echo", "screen", "-nocite", "-pk", "omp", "4", "-sf", "omp"}; @@ -740,6 +752,8 @@ TEST(AngleStyle, omp) TEST(AngleStyle, single) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"AngleStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; diff --git a/unittest/force-styles/test_bond_style.cpp b/unittest/force-styles/test_bond_style.cpp index d6a6e9c82d..94d2344c03 100644 --- a/unittest/force-styles/test_bond_style.cpp +++ b/unittest/force-styles/test_bond_style.cpp @@ -246,6 +246,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // epsilon writer.emit("epsilon", config.epsilon); + // skip tests + block.clear(); + for (auto &skip_tests : config.skip_tests) { + if (block.empty()) block = skip_tests; + else block += " " + skip_tests; + } + writer.emit("skip_tests", block); + // prerequisites block.clear(); for (auto &prerequisite : config.prerequisites) { @@ -341,6 +349,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) TEST(BondStyle, plain) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"BondStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -567,6 +577,8 @@ TEST(BondStyle, plain) TEST(BondStyle, omp) { if (!LAMMPS::is_installed_pkg("USER-OMP")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"BondStyle", "-log", "none", "-echo", "screen", "-nocite", "-pk", "omp", "4", "-sf", "omp"}; @@ -739,6 +751,8 @@ TEST(BondStyle, omp) TEST(BondStyle, single) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"BondStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -995,6 +1009,8 @@ TEST(BondStyle, single) TEST(BondStyle, extract) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"BondStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; diff --git a/unittest/force-styles/test_config.h b/unittest/force-styles/test_config.h index baf3a5f29a..0417b306cb 100644 --- a/unittest/force-styles/test_config.h +++ b/unittest/force-styles/test_config.h @@ -14,6 +14,7 @@ #ifndef TEST_CONFIG_H #define TEST_CONFIG_H +#include #include #include #include @@ -32,6 +33,7 @@ public: std::string date_generated; std::string basename; double epsilon; + std::set skip_tests; std::vector> prerequisites; std::vector pre_commands; std::vector post_commands; @@ -74,6 +76,7 @@ public: init_vdwl(0), run_vdwl(0), init_coul(0), run_coul(0), init_stress({0, 0, 0, 0, 0, 0}), run_stress({0, 0, 0, 0, 0, 0}), global_scalar(0) { + skip_tests.clear(); prerequisites.clear(); pre_commands.clear(); post_commands.clear(); diff --git a/unittest/force-styles/test_config_reader.cpp b/unittest/force-styles/test_config_reader.cpp index 4ef3692f56..ed7ddf50a1 100644 --- a/unittest/force-styles/test_config_reader.cpp +++ b/unittest/force-styles/test_config_reader.cpp @@ -15,6 +15,7 @@ #include "test_config.h" #include "yaml.h" #include "yaml_reader.h" +#include "utils.h" #include #include @@ -25,11 +26,14 @@ #include #include +using LAMMPS_NS::utils::split_words; + TestConfigReader::TestConfigReader(TestConfig &config) : YamlReader(), config(config) { consumers["lammps_version"] = &TestConfigReader::lammps_version; consumers["date_generated"] = &TestConfigReader::date_generated; consumers["epsilon"] = &TestConfigReader::epsilon; + consumers["skip_tests"] = &TestConfigReader::skip_tests; consumers["prerequisites"] = &TestConfigReader::prerequisites; consumers["pre_commands"] = &TestConfigReader::pre_commands; consumers["post_commands"] = &TestConfigReader::post_commands; @@ -66,6 +70,13 @@ TestConfigReader::TestConfigReader(TestConfig &config) : YamlReader(), config(co consumers["equilibrium"] = &TestConfigReader::equilibrium; } +void TestConfigReader::skip_tests(const yaml_event_t &event) +{ + config.skip_tests.clear(); + for (auto &word : split_words((char *)event.data.scalar.value)) + config.skip_tests.insert(word); +} + void TestConfigReader::prerequisites(const yaml_event_t &event) { config.prerequisites.clear(); diff --git a/unittest/force-styles/test_config_reader.h b/unittest/force-styles/test_config_reader.h index 840228da3a..f82a2b7a15 100644 --- a/unittest/force-styles/test_config_reader.h +++ b/unittest/force-styles/test_config_reader.h @@ -23,6 +23,7 @@ class TestConfigReader : public YamlReader { public: TestConfigReader(TestConfig &config); + void skip_tests(const yaml_event_t &event); void prerequisites(const yaml_event_t &event); void pre_commands(const yaml_event_t &event); void post_commands(const yaml_event_t &event); diff --git a/unittest/force-styles/test_dihedral_style.cpp b/unittest/force-styles/test_dihedral_style.cpp index a27c50afb7..f8ad0a60eb 100644 --- a/unittest/force-styles/test_dihedral_style.cpp +++ b/unittest/force-styles/test_dihedral_style.cpp @@ -344,6 +344,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) TEST(DihedralStyle, plain) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"DihedralStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -570,6 +572,8 @@ TEST(DihedralStyle, plain) TEST(DihedralStyle, omp) { if (!LAMMPS::is_installed_pkg("USER-OMP")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"DihedralStyle", "-log", "none", "-echo", "screen", "-nocite", "-pk", "omp", "4", "-sf", "omp"}; diff --git a/unittest/force-styles/test_fix_timestep.cpp b/unittest/force-styles/test_fix_timestep.cpp index 2680367c88..3fa2e78813 100644 --- a/unittest/force-styles/test_fix_timestep.cpp +++ b/unittest/force-styles/test_fix_timestep.cpp @@ -204,6 +204,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // epsilon writer.emit("epsilon", config.epsilon); + // skip tests + block.clear(); + for (auto &skip_tests : config.skip_tests) { + if (block.empty()) block = skip_tests; + else block += " " + skip_tests; + } + writer.emit("skip_tests", block); + // prerequisites block.clear(); for (auto &prerequisite : config.prerequisites) { @@ -287,6 +295,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) TEST(FixTimestep, plain) { if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"FixTimestep", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -729,6 +739,8 @@ TEST(FixTimestep, omp) { if (!LAMMPS::is_installed_pkg("USER-OMP")) GTEST_SKIP(); if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"FixTimestep", "-log", "none", "-echo", "screen", "-nocite", "-pk", "omp", "4", "-sf", "omp"}; diff --git a/unittest/force-styles/test_improper_style.cpp b/unittest/force-styles/test_improper_style.cpp index b13b571546..9e38c03cd1 100644 --- a/unittest/force-styles/test_improper_style.cpp +++ b/unittest/force-styles/test_improper_style.cpp @@ -246,6 +246,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // epsilon writer.emit("epsilon", config.epsilon); + // skip tests + block.clear(); + for (auto &skip_tests : config.skip_tests) { + if (block.empty()) block = skip_tests; + else block += " " + skip_tests; + } + writer.emit("skip_tests", block); + // prerequisites block.clear(); for (auto &prerequisite : config.prerequisites) { @@ -335,6 +343,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) TEST(ImproperStyle, plain) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"ImproperStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -561,6 +571,8 @@ TEST(ImproperStyle, plain) TEST(ImproperStyle, omp) { if (!LAMMPS::is_installed_pkg("USER-OMP")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"ImproperStyle", "-log", "none", "-echo", "screen", "-nocite", "-pk", "omp", "4", "-sf", "omp"}; diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index 61815ec5f4..0e61bacfbd 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -255,6 +255,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // epsilon writer.emit("epsilon", config.epsilon); + // skip tests + block.clear(); + for (auto &skip_tests : config.skip_tests) { + if (block.empty()) block = skip_tests; + else block += " " + skip_tests; + } + writer.emit("skip_tests", block); + // prerequisites block.clear(); for (auto &prerequisite : config.prerequisites) { @@ -350,6 +358,8 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) TEST(PairStyle, plain) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -632,6 +642,8 @@ TEST(PairStyle, plain) TEST(PairStyle, omp) { if (!LAMMPS::is_installed_pkg("USER-OMP")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-pk", "omp", "4", "-sf", "omp"}; @@ -814,6 +826,8 @@ TEST(PairStyle, omp) TEST(PairStyle, gpu) { if (!LAMMPS::is_installed_pkg("GPU")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args_neigh[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-sf", "gpu"}; const char *args_noneigh[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-sf", "gpu", "-pk", "gpu", "0", "neigh", "no"}; @@ -933,6 +947,8 @@ TEST(PairStyle, gpu) TEST(PairStyle, intel) { if (!LAMMPS::is_installed_pkg("USER-INTEL")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-pk", "intel", "0", "mode", "double", "omp", "4", "lrt", "no", "-sf", "intel"}; @@ -1073,6 +1089,8 @@ TEST(PairStyle, intel) TEST(PairStyle, opt) { if (!LAMMPS::is_installed_pkg("OPT")) GTEST_SKIP(); + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-sf", "opt"}; char **argv = (char **)args; @@ -1178,6 +1196,8 @@ TEST(PairStyle, opt) TEST(PairStyle, single) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args; @@ -1435,6 +1455,8 @@ TEST(PairStyle, single) TEST(PairStyle, extract) { + if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP(); + const char *args[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite"}; char **argv = (char **)args;