diff options
author | Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> | 2024-09-27 04:42:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-27 05:42:42 -0600 |
commit | 0619a8bd4f2238d87b22779b30b6b923d83eb846 (patch) | |
tree | b9aeaf066a9aee7b0f508760af089a85b1f2dfff | |
parent | a3dc9e1eb8cfb018becafd38dc4a9af7cf6c13af (diff) | |
download | spack-0619a8bd4f2238d87b22779b30b6b923d83eb846.tar.gz spack-0619a8bd4f2238d87b22779b30b6b923d83eb846.tar.bz2 spack-0619a8bd4f2238d87b22779b30b6b923d83eb846.tar.xz spack-0619a8bd4f2238d87b22779b30b6b923d83eb846.zip |
axom/stand-alone tests: build and run in test stage directory (#46421)
* axom/stand-alone tests: build and run in test stage directory
* Removed unused glob
* axom/stand-alone tests: add example_stage_dir variable for clarity
-rw-r--r-- | var/spack/repos/builtin/packages/axom/package.py | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/var/spack/repos/builtin/packages/axom/package.py b/var/spack/repos/builtin/packages/axom/package.py index c3ebe66c9d..5791fa3df9 100644 --- a/var/spack/repos/builtin/packages/axom/package.py +++ b/var/spack/repos/builtin/packages/axom/package.py @@ -3,7 +3,6 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import glob import os import shutil import socket @@ -41,6 +40,8 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): git = "https://github.com/LLNL/axom.git" tags = ["radiuss"] + test_requires_compiler = True + license("BSD-3-Clause") version("main", branch="main") @@ -620,34 +621,29 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): @run_after("install") @on_package_attributes(run_tests=True) - def check_install(self): - """ - Checks the spack install of axom using axom's - using-with-cmake example - """ - - print("Checking Axom installation...") - spec = self.spec - install_prefix = spec.prefix - example_src_dir = join_path(install_prefix, "examples", "axom", "using-with-cmake") - example_build_dir = join_path(example_src_dir, "build") - print("Checking using-with-cmake example...") - with working_dir(example_build_dir, create=True): + def test_install_using_cmake(self): + """build example with cmake and run""" + example_src_dir = join_path(self.prefix.examples.axom, "using-with-cmake") + example_stage_dir = "./cmake" + shutil.copytree(example_src_dir, example_stage_dir) + with working_dir(join_path(example_stage_dir, "build"), create=True): cmake_args = ["-C ../host-config.cmake", example_src_dir] + cmake = self.spec["cmake"].command cmake(*cmake_args) make() example = Executable("./example") example() - print("Checking using-with-make example...") - example_src_dir = join_path(install_prefix, "examples", "axom", "using-with-make") - example_build_dir = join_path(example_src_dir, "build") - example_files = glob.glob(join_path(example_src_dir, "*")) - with working_dir(example_build_dir, create=True): - for example_file in example_files: - shutil.copy(example_file, ".") - make("AXOM_DIR={0}".format(install_prefix)) + make("clean") + + @run_after("install") + @on_package_attributes(run_tests=True) + def test_install_using_make(self): + """build example with make and run""" + example_src_dir = join_path(self.prefix.examples.axom, "using-with-make") + example_stage_dir = "./make" + shutil.copytree(example_src_dir, example_stage_dir) + with working_dir(example_stage_dir, create=True): + make(f"AXOM_DIR={self.prefix}") example = Executable("./example") example() - - def test_install(self): - self.check_install() + make("clean") |