libpressio: old to new test API (#45151)
* libpressio: old to new test API * libpressio: minor stand-alone test simplifications --------- Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
This commit is contained in:
		| @@ -303,7 +303,7 @@ class Libpressio(CMakePackage, CudaPackage): | ||||
|     ) | ||||
|     for cuda_compressor in ["cusz", "mgard", "zfp", "ndzip"]: | ||||
|         conflicts( | ||||
|             "~cuda+{pkg} ^ {pkg}+cuda".format(pkg=cuda_compressor), | ||||
|             f"~cuda+{cuda_compressor} ^ {cuda_compressor}+cuda", | ||||
|             msg="compiling a CUDA compressor without a CUDA support makes no sense", | ||||
|         ) | ||||
|     depends_on("sz3", when="+sz3") | ||||
| @@ -387,7 +387,7 @@ def cmake_args(self): | ||||
|             args.append("-DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined") | ||||
|         # libpressio needs to know where to install the python libraries | ||||
|         if "+python" in self.spec: | ||||
|             args.append("-DLIBPRESSIO_PYTHON_SITELIB={0}".format(python_platlib)) | ||||
|             args.append(f"-DLIBPRESSIO_PYTHON_SITELIB={python_platlib}") | ||||
|         # help ensure that libpressio finds the correct HDF5 package | ||||
|         if "+hdf5" in self.spec: | ||||
|             args.append("-DHDF5_ROOT=" + self.spec["hdf5"].prefix) | ||||
| @@ -410,30 +410,30 @@ def install_docs(self): | ||||
| 
 | ||||
|     @run_after("install") | ||||
|     def copy_test_sources(self): | ||||
|         if self.version < Version("0.88.3"): | ||||
|         if self.spec.satisfies("@:0.88.2"): | ||||
|             return | ||||
|         srcs = [ | ||||
|             join_path("test", "smoke_test", "smoke_test.cc"), | ||||
|             join_path("test", "smoke_test", "CMakeLists.txt"), | ||||
|         ] | ||||
|         self.cache_extra_test_sources(srcs) | ||||
|         cache_extra_test_sources(self, srcs) | ||||
| 
 | ||||
|     def test(self): | ||||
|         if self.version < Version("0.88.3"): | ||||
|             return | ||||
|     def test_smoke(self): | ||||
|         """Run smoke test""" | ||||
|         # this works for cmake@3.14: which is required for this package | ||||
|         if self.spec.satisfies("@:0.88.2"): | ||||
|             raise SkipTest("Package must be installed as version @0.88.3 or later") | ||||
| 
 | ||||
|         args = self.cmake_args() | ||||
|         args.append( | ||||
|             "-S{}".format(join_path(self.test_suite.current_test_cache_dir, "test", "smoke_test")) | ||||
|         ) | ||||
|         args.append( | ||||
|             "-DCMAKE_PREFIX_PATH={};{}".format(self.spec["libstdcompat"].prefix, self.prefix) | ||||
|         ) | ||||
|         args.append(f"-S{join_path(self.test_suite.current_test_cache_dir, 'test', 'smoke_test')}") | ||||
|         args.append(f"-DCMAKE_PREFIX_PATH={self.spec['libstdcompat'].prefix};{self.prefix}") | ||||
| 
 | ||||
|         self.run_test("cmake", args, purpose="cmake configuration works") | ||||
|         cmake = self.spec["cmake"].command | ||||
|         cmake(*args) | ||||
|         cmake("--build", ".") | ||||
| 
 | ||||
|         # this works for cmake@3.14: which is required for this package | ||||
|         args = ["--build", "."] | ||||
|         self.run_test("cmake", args, purpose="cmake builds works") | ||||
|         exe = which("pressio_smoke_tests") | ||||
|         out = exe(output=str.split, error=str.split) | ||||
| 
 | ||||
|         self.run_test("./pressio_smoke_tests", expected="all passed") | ||||
|         expected = "all passed" | ||||
|         assert expected in out | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 AcriusWinter
					AcriusWinter