mptensor: Changed skiptest, test name, and added docstring (#44909)
* mptensor: Changed skiptest, test name, and added docstring * mptensor: make stand-alone test method name and docstring more specific --------- Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
This commit is contained in:
parent
21a2c3a591
commit
e40c10509d
@ -70,33 +70,41 @@ def cmake_args(self):
|
|||||||
def setup_build_tests(self):
|
def setup_build_tests(self):
|
||||||
"""Copy the build test files after the package is installed to an
|
"""Copy the build test files after the package is installed to an
|
||||||
install test subdirectory for use during `spack test run`."""
|
install test subdirectory for use during `spack test run`."""
|
||||||
|
|
||||||
|
# Tests only supported when spec built with mpi
|
||||||
|
if "+mpi" not in self.spec:
|
||||||
|
print("Skipping copy of stand-alone test files: requires +mpi build")
|
||||||
|
return
|
||||||
|
|
||||||
self.cache_extra_test_sources(".")
|
self.cache_extra_test_sources(".")
|
||||||
|
|
||||||
def test(self):
|
# Clean cached makefiles now so only done once
|
||||||
|
print("Converting cached Makefile for stand-alone test use")
|
||||||
|
with working_dir(join_path(install_test_root(self), "tests")):
|
||||||
|
make("clean")
|
||||||
|
makefile = FileFilter("Makefile")
|
||||||
|
makefile.filter("g++", f"{spack_cxx}", string=True)
|
||||||
|
|
||||||
|
print("Converting cached Makefile.option for stand-alone test use")
|
||||||
|
with working_dir(join_path(install_test_root(self))):
|
||||||
|
makefile = FileFilter("Makefile.option")
|
||||||
|
makefile.filter("CXX =.*", f"CXX ={self.spec['mpi'].mpicxx}")
|
||||||
|
makefile.filter("CXXFLAGS =.*", f"CXXFLAGS ={self.compiler.cxx11_flag}")
|
||||||
|
|
||||||
|
def test_tensor_test(self):
|
||||||
|
"""build and run tensor_test"""
|
||||||
if "+mpi" not in self.spec:
|
if "+mpi" not in self.spec:
|
||||||
print("Test of mptensor only runs with +mpi option.")
|
raise SkipTest("Package must be installed with +mpi")
|
||||||
else:
|
|
||||||
with working_dir(join_path(self.install_test_root, "tests"), create=False):
|
|
||||||
make("clean")
|
|
||||||
makefile = FileFilter("Makefile")
|
|
||||||
makefile.filter("g++", "{0}".format(spack_cxx), string=True)
|
|
||||||
|
|
||||||
with working_dir(join_path(self.install_test_root), create=False):
|
math_libs = self.spec["scalapack"].libs + self.spec["lapack"].libs + self.spec["blas"].libs
|
||||||
makefile = FileFilter("Makefile.option")
|
|
||||||
makefile.filter("CXX =.*", "CXX ={0}".format(self.spec["mpi"].mpicxx))
|
|
||||||
makefile.filter("CXXFLAGS =.*", "CXXFLAGS ={0}".format(self.compiler.cxx11_flag))
|
|
||||||
|
|
||||||
math_libs = (
|
with working_dir(self.test_suite.current_test_cache_dir.tests):
|
||||||
self.spec["scalapack"].libs + self.spec["lapack"].libs + self.spec["blas"].libs
|
make = which("make")
|
||||||
)
|
make(f"LDFLAGS={math_libs.ld_flags}")
|
||||||
|
|
||||||
with working_dir(join_path(self.install_test_root, "tests"), create=False):
|
mpirun = which(self.spec["mpi"].prefix.bin.mpirun)
|
||||||
make("LDFLAGS={0}".format(math_libs.ld_flags))
|
mpirun("-n", "1", "tensor_test.out")
|
||||||
|
|
||||||
mpirun = self.spec["mpi"].prefix.bin.mpirun
|
# Test of mptensor has checker
|
||||||
mpiexec = Executable(mpirun)
|
# and checker is abort when check detect any errors.
|
||||||
mpiexec("-n", "1", "tensor_test.out")
|
print("Test of mptensor PASSED !")
|
||||||
|
|
||||||
# Test of mptensor has checker
|
|
||||||
# and checker is abort when check detect any errors.
|
|
||||||
print("Test of mptensor PASSED !")
|
|
||||||
|
Loading…
Reference in New Issue
Block a user