diff options
author | AcriusWinter <152348900+AcriusWinter@users.noreply.github.com> | 2024-06-27 17:02:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-27 18:02:42 -0600 |
commit | 974033be80d6e0c51dba368b08b5f8bc86f43c0d (patch) | |
tree | 9a7337f063a9f7696679a06f8b762b5055251ac0 | |
parent | 8755fc72917dbe1d2e47e530b2698095c792181e (diff) | |
download | spack-974033be80d6e0c51dba368b08b5f8bc86f43c0d.tar.gz spack-974033be80d6e0c51dba368b08b5f8bc86f43c0d.tar.bz2 spack-974033be80d6e0c51dba368b08b5f8bc86f43c0d.tar.xz spack-974033be80d6e0c51dba368b08b5f8bc86f43c0d.zip |
hiop: Corrected test name, added docstring, and changed test to new API (#44765)
* Changed test method from old method to new method
* Corrected test name and added docstring
* Split test method into stand alone-tests
* Added SkipTest
* code refactor
* removed repeated code
* Remove exe from test part purpose
---------
Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
-rw-r--r-- | var/spack/repos/builtin/packages/hiop/package.py | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/var/spack/repos/builtin/packages/hiop/package.py b/var/spack/repos/builtin/packages/hiop/package.py index 188e51357c..6b60965b19 100644 --- a/var/spack/repos/builtin/packages/hiop/package.py +++ b/var/spack/repos/builtin/packages/hiop/package.py @@ -5,8 +5,6 @@ import os -import llnl.util.tty as tty - from spack.package import * @@ -274,37 +272,35 @@ class Hiop(CMakePackage, CudaPackage, ROCmPackage): # # export SPACK_USER_CACHE_PATH=/tmp/spack # export SPACK_DISABLE_LOCAL_CONFIG=true - def test(self): - if not self.spec.satisfies("@develop") or not os.path.isdir(self.prefix.bin): - tty.info("Skipping: checks not installed in bin for v{0}".format(self.version)) - return - - tests = [ - ["NlpMdsEx1.exe", "400", "100", "0", "-selfcheck"], - ["NlpMdsEx1.exe", "400", "100", "1", "-selfcheck"], - ["NlpMdsEx1.exe", "400", "100", "0", "-empty_sp_row", "-selfcheck"], + + def run_hiop(self, raja): + if raja: + exName = "NlpMdsEx1Raja.exe" + else: + exName = "NlpMdsEx1.exe" + + exe = os.path.join(self.prefix.bin, exName) + if not os.path.exists(exe): + raise SkipTest(f"{exName} does not exist in version {self.version}") + + options = [ + ["400", "100", "0", "-selfcheck"], + ["400", "100", "1", "-selfcheck"], + ["400", "100", "0", "-empty_sp_row", "-selfcheck"], ] - if "+raja" in self.spec: - tests.extend( - [ - ["NlpMdsEx1Raja.exe", "400", "100", "0", "-selfcheck"], - ["NlpMdsEx1Raja.exe", "400", "100", "1", "-selfcheck"], - ["NlpMdsEx1Raja.exe", "400", "100", "0", "-empty_sp_row", "-selfcheck"], - ] - ) + exe = which(exe) - for i, test in enumerate(tests): - exe = os.path.join(self.prefix.bin, test[0]) - args = test[1:] - reason = 'test {0}: "{1}"'.format(i, " ".join(test)) - self.run_test( - exe, - args, - [], - 0, - installed=False, - purpose=reason, - skip_missing=True, - work_dir=self.prefix.bin, - ) + for i, args in enumerate(options): + with test_part(self, f"test_{exName}_{i+1}", purpose=" ".join(args)): + exe(*args) + + def test_NlpMdsEx1(self): + """Test NlpMdsEx1""" + self.run_hiop(False) + + def test_NlpMdsEx1Raja(self): + """Test NlpMdsEx1 with +raja""" + if "+raja" not in self.spec: + raise SkipTest("Package must be installed with +raja") + self.run_hiop(True) |