diff options
author | Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> | 2023-06-26 06:10:55 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-26 15:10:55 +0200 |
commit | 8528106484a14db8dd490d7da613bcd4891d4194 (patch) | |
tree | b923fc8386d98c90fd3780b453ef8e6bbb7c0e55 /var | |
parent | 134dceb055692ff6bf9ad5edabf033b974f66ee3 (diff) | |
download | spack-8528106484a14db8dd490d7da613bcd4891d4194.tar.gz spack-8528106484a14db8dd490d7da613bcd4891d4194.tar.bz2 spack-8528106484a14db8dd490d7da613bcd4891d4194.tar.xz spack-8528106484a14db8dd490d7da613bcd4891d4194.zip |
tests/heffte/tasmanian: convert to new stand-alone test process (#35750)
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/heffte/package.py | 74 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/tasmanian/package.py | 82 |
2 files changed, 37 insertions, 119 deletions
diff --git a/var/spack/repos/builtin/packages/heffte/package.py b/var/spack/repos/builtin/packages/heffte/package.py index c123251444..0a502588fd 100644 --- a/var/spack/repos/builtin/packages/heffte/package.py +++ b/var/spack/repos/builtin/packages/heffte/package.py @@ -3,10 +3,6 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import os - -from llnl.util import tty - from spack.package import * @@ -130,68 +126,38 @@ class Heffte(CMakePackage, CudaPackage, ROCmPackage): return args - def cmake_bin(self, set_path=True): - """(Hack) Set/get cmake dependency path. Sync with Tasmanian.""" - filepath = join_path(self.install_test_root, "cmake_bin_path.txt") - if set_path: - with open(filepath, "w") as out_file: - cmake_bin = join_path(self.spec["cmake"].prefix.bin, "cmake") - out_file.write("{0}\n".format(cmake_bin)) - elif os.path.isfile(filepath): - with open(filepath, "r") as in_file: - return in_file.read().strip() - @run_after("install") def setup_smoke_test(self): install_tree( self.prefix.share.heffte.testing, join_path(self.install_test_root, "testing") ) - self.cmake_bin(set_path=True) - - def test(self): - cmake_bin = self.cmake_bin(set_path=False) - - if not cmake_bin: - tty.msg("Skipping heffte test: cmake_bin_path.txt not found") - return + def test_make_test(self): + """build and run make(test)""" # using the tests copied from <prefix>/share/heffte/testing cmake_dir = self.test_suite.current_test_cache_dir.testing options = [cmake_dir] if "+rocm" in self.spec: - options.append( - "-Dhip_DIR=" + join_path(self.spec["hip"].prefix, "lib", "cmake", "hip") - ) - options.append( - "-DAMDDeviceLibs_DIR=" - + join_path(self.spec["llvm-amdgpu"].prefix, "lib", "cmake", "AMDDeviceLibs") + options.extend( + [ + f"-Dhip_DIR={self.spec['hip'].prefix.lib.cmake.hip}", + "-DAMDDeviceLibs_DIR=" + + f"{self.spec['llvm-amdgpu'].prefix.lib.cmake.AMDDeviceLibs}", + f"-Damd_comgr_DIR={self.spec['comgr'].prefix.lib.cmake.amd_comgr}", + "-Dhsa-runtime64_DIR=" + + f"{self.spec['hsa-rocr-dev'].prefix.lib.cmake.hsa-runtime64}", + "-DHSA_HEADER={self.spec['hsa-rocr-dev'].prefix.include}", + "-Drocfft_DIR={self.spec['rocfft'].prefix.lib.cmake.rocfft}", + ] ) - options.append( - "-Damd_comgr_DIR=" - + join_path(self.spec["comgr"].prefix, "lib", "cmake", "amd_comgr") - ) - options.append( - "-Dhsa-runtime64_DIR=" - + join_path(self.spec["hsa-rocr-dev"].prefix, "lib", "cmake", "hsa-runtime64") - ) - options.append( - "-DHSA_HEADER=" + join_path(self.spec["hsa-rocr-dev"].prefix, "include") - ) - options.append( - "-Drocfft_DIR=" + join_path(self.spec["rocfft"].prefix, "lib", "cmake", "rocfft") - ) - - # Provide the path to the MPI dependency so that the test can find an MPI launcher - options.append("-DMPI_HOME=" + self.spec["mpi"].prefix) - if not self.run_test(cmake_bin, options=options, purpose="Generate the Makefile"): - tty.msg("Skipping heffte test: failed to generate Makefile") - return + # Provide the root directory of the MPI installation. + options.append(f"-DMPI_HOME={self.spec['mpi'].prefix}") - if not self.run_test("make", purpose="Build test software"): - tty.msg("Skipping heffte test: failed to build test") - return + cmake = which(self.spec["cmake"].prefix.bin.cmake) + cmake(*options) - if not self.run_test("make", options=["test"], purpose="Run test"): - tty.msg("Failed heffte test: failed to run test") + make = which("make") + make() + make("test") diff --git a/var/spack/repos/builtin/packages/tasmanian/package.py b/var/spack/repos/builtin/packages/tasmanian/package.py index 9895c3d2d1..f7176d31ed 100644 --- a/var/spack/repos/builtin/packages/tasmanian/package.py +++ b/var/spack/repos/builtin/packages/tasmanian/package.py @@ -3,10 +3,6 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import os - -from llnl.util import tty - from spack.package import * @@ -22,6 +18,8 @@ class Tasmanian(CMakePackage, CudaPackage, ROCmPackage): tags = ["e4s"] maintainers("mkstoyanov") + test_requires_compiler = True + version("develop", branch="master") version("7.9", sha256="decba62e6bbccf1bc26c6e773a8d4fd51d7f3e3e534ddd386ec41300694ce5cc") @@ -175,85 +173,39 @@ class Tasmanian(CMakePackage, CudaPackage, ROCmPackage): return args - # TODO: Replace this method and its 'get' use for cmake path with - # join_path(self.spec['cmake'].prefix.bin, 'cmake') once stand-alone - # tests can access build dependencies through self.spec['cmake']. - def cmake_bin(self, set=True): - """(Hack) Set/get cmake dependency path.""" - filepath = join_path(self.install_test_root, "cmake_bin_path.txt") - if set: - with open(filepath, "w") as out_file: - cmake_bin = join_path(self.spec["cmake"].prefix.bin, "cmake") - out_file.write("{0}\n".format(cmake_bin)) - elif os.path.isfile(filepath): - with open(filepath, "r") as in_file: - return in_file.read().strip() - @run_after("install") def setup_smoke_test(self): - if not self.spec["cmake"].satisfies("@3.10:"): - tty.msg("Error tasmanian test: CMake 3.10 or higher is required") - return - install_tree( self.prefix.share.Tasmanian.testing, join_path(self.install_test_root, "testing") ) - self.cmake_bin(set=True) - - def test(self): - cmake_bin = self.cmake_bin(set=False) - - if not cmake_bin: - tty.msg("Skipping tasmanian test: cmake_bin_path.txt not found") - return + def test_make_test(self): + """build and run make(test)""" # using the tests copied from <prefix>/share/Tasmanian/testing cmake_dir = self.test_suite.current_test_cache_dir.testing options = [cmake_dir] if "+rocm" in self.spec: options.append( - "-DAMDDeviceLibs_DIR=" - + join_path(self.spec["llvm-amdgpu"].prefix, "lib", "cmake", "AMDDeviceLibs") - ) - options.append( - "-Damd_comgr_DIR=" - + join_path(self.spec["comgr"].prefix, "lib", "cmake", "amd_comgr") - ) - options.append( - "-Dhsa-runtime64_DIR=" - + join_path(self.spec["hsa-rocr-dev"].prefix, "lib", "cmake", "hsa-runtime64") - ) - options.append( - "-DHSA_HEADER=" + join_path(self.spec["hsa-rocr-dev"].prefix, "include") - ) - options.append( - "-DCMAKE_INCLUDE_PATH=" - + join_path(self.spec["hsa-rocr-dev"].prefix, "include", "hsa") - ) - options.append( - "-Drocblas_DIR=" - + join_path(self.spec["rocblas"].prefix, "lib", "cmake", "rocblas") - ) - options.append( - "-Drocsparse_DIR=" - + join_path(self.spec["rocsparse"].prefix, "lib", "cmake", "rocsparse") + f"-DAMDDeviceLibs_DIR={self.spec['llvm-amdgpu'].prefix.lib.cmake.AMDDeviceLibs}" ) + options.append(f"-Damd_comgr_DIR={self.spec['comgr'].prefix.lib.cmake.amd_comgr}") options.append( - "-Drocsolver_DIR=" - + join_path(self.spec["rocsolver"].prefix, "lib", "cmake", "rocsolver") + f"-Dhsa-runtime64_DIR={self.spec['hsa-rocr-dev'].prefix.lib.cmake.hsa-runtime64}" ) + options.append(f"-DHSA_HEADER={self.spec['hsa-rocr-dev'].prefix.include}") + options.append(f"-DCMAKE_INCLUDE_PATH={self.spec['hsa-rocr-dev'].prefix.include.hsa}") + options.append(f"-Drocblas_DIR={self.spec['rocblas'].prefix.lib.cmake.rocblas}") + options.append(f"-Drocsparse_DIR={self.spec['rocsparse'].prefix.lib.cmake.rocsparse}") + options.append(f"-Drocsolver_DIR={self.spec['rocsolver'].prefix.lib.cmake.rocsolver}") if "+mpi" in self.spec: options.append("-DMPI_HOME=" + self.spec["mpi"].prefix) - if not self.run_test(cmake_bin, options=options, purpose="Generate the Makefile"): - tty.msg("Skipping tasmanian test: failed to generate Makefile") - return + cmake = which(self.spec["cmake"].prefix.bin.cmake) + cmake(*options) - if not self.run_test("make", purpose="Build test software"): - tty.msg("Skipping tasmanian test: failed to build test") - return + make = which("make") + make() - if not self.run_test("make", options=["test"], purpose="Run test"): - tty.msg("Failed tasmanian test: failed to run test") + make("test") |