Skip to content

Commit

Permalink
Regtesting: Introduce tests/UNIT_TESTS file
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed Jan 30, 2023
1 parent e3281e0 commit 0e32797
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
12 changes: 12 additions & 0 deletions tests/UNIT_TESTS
Original file line number Diff line number Diff line change
@@ -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
18 changes: 11 additions & 7 deletions tools/regtesting/do_regtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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()
Expand Down

0 comments on commit 0e32797

Please sign in to comment.