Skip to content

Commit a947538

Browse files
committed
Enable unit tests
Co-authored-by: laraPPr <[email protected]> Closes #3785 Supersedes #3789
1 parent 217e21d commit a947538

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

easybuild/easyblocks/l/lammps.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,23 @@ def configure_step(self, **kwargs):
607607
else:
608608
raise EasyBuildError("Expected to find a Python dependency as sanity check commands rely on it!")
609609

610+
# Testing (PyYAML must be installed)
611+
if self.cfg['runtest'] is None or self.cfg['runtest']:
612+
if LooseVersion(self.cur_version) >= LooseVersion(translate_lammps_version('29Aug2024')):
613+
# Testing of KOKKOS+CUDA builds does not work for version < 22Jul2025
614+
# See: https://github.com/lammps/lammps/issues/405
615+
if LooseVersion(self.cur_version) < LooseVersion(translate_lammps_version('22Jul2025')) \
616+
and self.cfg['kokkos'] and self.cuda:
617+
print_warning("Skipping tests: KOKKOS+CUDA builds have broken testing in LAMMPS < 22Jul2025.")
618+
self.cfg['runtest'] = False
619+
else:
620+
self.cfg['runtest'] = True
621+
if 'PyYAML' not in (dep['name'] for dep in self.cfg.builddependencies()):
622+
raise EasyBuildError("PyYAML not included as build dependency: cannot run tests.")
623+
self.cfg.update('configopts', '-DENABLE_TESTING=on')
624+
else:
625+
self.cfg['runtest'] = False
626+
610627
return super().configure_step()
611628

612629
def install_step(self):
@@ -653,6 +670,19 @@ def install_step(self):
653670

654671
run_shell_cmd(cmd)
655672

673+
def test_step(self):
674+
"""Filter the ctests that should be run"""
675+
# add flags to test_cmd to ignore some tests
676+
if self.cfg.get('runtest') is True and not self.cfg.get('test_cmd'):
677+
test_cmd = 'ctest'
678+
if LooseVersion(self.cmake_version) >= '3.17.0':
679+
test_cmd += ' --no-tests=error'
680+
test_cmd += ' -LE unstable -E "TestMliapPyUnified|AtomicPairStyle:meam_spline|KSpaceStyle:scafacos.*"'
681+
self.log.debug(f"Running tests using test_cmd = '{test_cmd}' as test_cmd")
682+
self.cfg['test_cmd'] = test_cmd
683+
684+
super().test_step()
685+
656686
def sanity_check_step(self, *args, **kwargs):
657687
"""Run custom sanity checks for LAMMPS files, dirs and commands."""
658688

0 commit comments

Comments
 (0)