From 0e32797a762dae30e3655ec158b8baef407e563e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Sch=C3=BCtt?= Date: Mon, 30 Jan 2023 10:56:41 +0100 Subject: [PATCH] Regtesting: Introduce tests/UNIT_TESTS file --- tests/UNIT_TESTS | 12 ++++++++++++ tools/regtesting/do_regtest.py | 18 +++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 tests/UNIT_TESTS diff --git a/tests/UNIT_TESTS b/tests/UNIT_TESTS new file mode 100644 index 0000000000..8ce8baa231 --- /dev/null +++ b/tests/UNIT_TESTS @@ -0,0 +1,12 @@ +# Binaries listed in this file will be executed as part of cp2k's regression testing. +# The binary name can be followed by required flags as reported by `cp2k --version`. + +dbt_tas_unittest +dbt_unittest +grid_unittest +libcp2k_unittest +memory_utilities_unittest +nequip_unittest libtorch +parallel_rng_types_unittest + +#EOF diff --git a/tools/regtesting/do_regtest.py b/tools/regtesting/do_regtest.py index a81cb0de93..468033befd 100755 --- a/tools/regtesting/do_regtest.py +++ b/tools/regtesting/do_regtest.py @@ -98,12 +98,17 @@ async def main() -> None: shutil.copytree(cfg.cp2k_root / "tests", cfg.work_base_dir) print(" done") - # Discover unit tests. - unittest_batch = Batch("UNIT", cfg) - unittest_batch.workdir.mkdir() - unittest_glob = (cfg.cp2k_root / "exe" / cfg.arch).glob(f"*_unittest.{cfg.version}") - for exe in unittest_glob: - unittest_batch.unittests.append(Unittest(exe.stem, unittest_batch.workdir)) + batches: List[Batch] = [] + + # Read UNIT_TESTS. + unit_tests_fn = cfg.cp2k_root / "tests" / "UNIT_TESTS" + for line in unit_tests_fn.read_text(encoding="utf8").split("\n"): + line = line.split("#", 1)[0].strip() + if line: + batch = Batch(f"UNIT/{line}", cfg) + batch.workdir.mkdir(parents=True) + batch.unittests.append(Unittest(line.split()[0], batch.workdir)) + batches.append(batch) # Read TEST_TYPES. test_types_fn = cfg.cp2k_root / "tests" / "TEST_TYPES" @@ -112,7 +117,6 @@ async def main() -> None: test_types += [TestType(l) for l in lines[1 : int(lines[0]) + 1]] # Read TEST_DIRS. - batches: List[Batch] = [unittest_batch] test_dirs_fn = cfg.cp2k_root / "tests" / "TEST_DIRS" for line in test_dirs_fn.read_text(encoding="utf8").split("\n"): line = line.split("#", 1)[0].strip()