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
This commit is contained in:
parent
a3dc9e1eb8
commit
0619a8bd4f
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
import glob
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import socket
|
import socket
|
||||||
@ -41,6 +40,8 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
|
|||||||
git = "https://github.com/LLNL/axom.git"
|
git = "https://github.com/LLNL/axom.git"
|
||||||
tags = ["radiuss"]
|
tags = ["radiuss"]
|
||||||
|
|
||||||
|
test_requires_compiler = True
|
||||||
|
|
||||||
license("BSD-3-Clause")
|
license("BSD-3-Clause")
|
||||||
|
|
||||||
version("main", branch="main")
|
version("main", branch="main")
|
||||||
@ -620,34 +621,29 @@ def build_test(self):
|
|||||||
|
|
||||||
@run_after("install")
|
@run_after("install")
|
||||||
@on_package_attributes(run_tests=True)
|
@on_package_attributes(run_tests=True)
|
||||||
def check_install(self):
|
def test_install_using_cmake(self):
|
||||||
"""
|
"""build example with cmake and run"""
|
||||||
Checks the spack install of axom using axom's
|
example_src_dir = join_path(self.prefix.examples.axom, "using-with-cmake")
|
||||||
using-with-cmake example
|
example_stage_dir = "./cmake"
|
||||||
"""
|
shutil.copytree(example_src_dir, example_stage_dir)
|
||||||
|
with working_dir(join_path(example_stage_dir, "build"), create=True):
|
||||||
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):
|
|
||||||
cmake_args = ["-C ../host-config.cmake", example_src_dir]
|
cmake_args = ["-C ../host-config.cmake", example_src_dir]
|
||||||
|
cmake = self.spec["cmake"].command
|
||||||
cmake(*cmake_args)
|
cmake(*cmake_args)
|
||||||
make()
|
make()
|
||||||
example = Executable("./example")
|
example = Executable("./example")
|
||||||
example()
|
example()
|
||||||
print("Checking using-with-make example...")
|
make("clean")
|
||||||
example_src_dir = join_path(install_prefix, "examples", "axom", "using-with-make")
|
|
||||||
example_build_dir = join_path(example_src_dir, "build")
|
@run_after("install")
|
||||||
example_files = glob.glob(join_path(example_src_dir, "*"))
|
@on_package_attributes(run_tests=True)
|
||||||
with working_dir(example_build_dir, create=True):
|
def test_install_using_make(self):
|
||||||
for example_file in example_files:
|
"""build example with make and run"""
|
||||||
shutil.copy(example_file, ".")
|
example_src_dir = join_path(self.prefix.examples.axom, "using-with-make")
|
||||||
make("AXOM_DIR={0}".format(install_prefix))
|
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 = Executable("./example")
|
||||||
example()
|
example()
|
||||||
|
make("clean")
|
||||||
def test_install(self):
|
|
||||||
self.check_install()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user