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"]: |     for cuda_compressor in ["cusz", "mgard", "zfp", "ndzip"]: | ||||||
|         conflicts( |         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", |             msg="compiling a CUDA compressor without a CUDA support makes no sense", | ||||||
|         ) |         ) | ||||||
|     depends_on("sz3", when="+sz3") |     depends_on("sz3", when="+sz3") | ||||||
| @@ -387,7 +387,7 @@ def cmake_args(self): | |||||||
|             args.append("-DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined") |             args.append("-DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined") | ||||||
|         # libpressio needs to know where to install the python libraries |         # libpressio needs to know where to install the python libraries | ||||||
|         if "+python" in self.spec: |         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 |         # help ensure that libpressio finds the correct HDF5 package | ||||||
|         if "+hdf5" in self.spec: |         if "+hdf5" in self.spec: | ||||||
|             args.append("-DHDF5_ROOT=" + self.spec["hdf5"].prefix) |             args.append("-DHDF5_ROOT=" + self.spec["hdf5"].prefix) | ||||||
| @@ -410,30 +410,30 @@ def install_docs(self): | |||||||
| 
 | 
 | ||||||
|     @run_after("install") |     @run_after("install") | ||||||
|     def copy_test_sources(self): |     def copy_test_sources(self): | ||||||
|         if self.version < Version("0.88.3"): |         if self.spec.satisfies("@:0.88.2"): | ||||||
|             return |             return | ||||||
|         srcs = [ |         srcs = [ | ||||||
|             join_path("test", "smoke_test", "smoke_test.cc"), |             join_path("test", "smoke_test", "smoke_test.cc"), | ||||||
|             join_path("test", "smoke_test", "CMakeLists.txt"), |             join_path("test", "smoke_test", "CMakeLists.txt"), | ||||||
|         ] |         ] | ||||||
|         self.cache_extra_test_sources(srcs) |         cache_extra_test_sources(self, srcs) | ||||||
| 
 | 
 | ||||||
|     def test(self): |     def test_smoke(self): | ||||||
|         if self.version < Version("0.88.3"): |         """Run smoke test""" | ||||||
|             return |         # 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 = self.cmake_args() | ||||||
|         args.append( |         args.append(f"-S{join_path(self.test_suite.current_test_cache_dir, 'test', 'smoke_test')}") | ||||||
|             "-S{}".format(join_path(self.test_suite.current_test_cache_dir, "test", "smoke_test")) |         args.append(f"-DCMAKE_PREFIX_PATH={self.spec['libstdcompat'].prefix};{self.prefix}") | ||||||
|         ) |  | ||||||
|         args.append( |  | ||||||
|             "-DCMAKE_PREFIX_PATH={};{}".format(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 |         exe = which("pressio_smoke_tests") | ||||||
|         args = ["--build", "."] |         out = exe(output=str.split, error=str.split) | ||||||
|         self.run_test("cmake", args, purpose="cmake builds works") |  | ||||||
| 
 | 
 | ||||||
|         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