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>
This commit is contained in:
parent
8755fc7291
commit
974033be80
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
|
||||||
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
@ -274,37 +272,35 @@ def cmake_args(self):
|
|||||||
#
|
#
|
||||||
# export SPACK_USER_CACHE_PATH=/tmp/spack
|
# export SPACK_USER_CACHE_PATH=/tmp/spack
|
||||||
# export SPACK_DISABLE_LOCAL_CONFIG=true
|
# 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 = [
|
def run_hiop(self, raja):
|
||||||
["NlpMdsEx1.exe", "400", "100", "0", "-selfcheck"],
|
if raja:
|
||||||
["NlpMdsEx1.exe", "400", "100", "1", "-selfcheck"],
|
exName = "NlpMdsEx1Raja.exe"
|
||||||
["NlpMdsEx1.exe", "400", "100", "0", "-empty_sp_row", "-selfcheck"],
|
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:
|
exe = which(exe)
|
||||||
tests.extend(
|
|
||||||
[
|
|
||||||
["NlpMdsEx1Raja.exe", "400", "100", "0", "-selfcheck"],
|
|
||||||
["NlpMdsEx1Raja.exe", "400", "100", "1", "-selfcheck"],
|
|
||||||
["NlpMdsEx1Raja.exe", "400", "100", "0", "-empty_sp_row", "-selfcheck"],
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
for i, test in enumerate(tests):
|
for i, args in enumerate(options):
|
||||||
exe = os.path.join(self.prefix.bin, test[0])
|
with test_part(self, f"test_{exName}_{i+1}", purpose=" ".join(args)):
|
||||||
args = test[1:]
|
exe(*args)
|
||||||
reason = 'test {0}: "{1}"'.format(i, " ".join(test))
|
|
||||||
self.run_test(
|
def test_NlpMdsEx1(self):
|
||||||
exe,
|
"""Test NlpMdsEx1"""
|
||||||
args,
|
self.run_hiop(False)
|
||||||
[],
|
|
||||||
0,
|
def test_NlpMdsEx1Raja(self):
|
||||||
installed=False,
|
"""Test NlpMdsEx1 with +raja"""
|
||||||
purpose=reason,
|
if "+raja" not in self.spec:
|
||||||
skip_missing=True,
|
raise SkipTest("Package must be installed with +raja")
|
||||||
work_dir=self.prefix.bin,
|
self.run_hiop(True)
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user