From 3b9454a5cc87b61296621aa4c87178d5fc61da3a Mon Sep 17 00:00:00 2001 From: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> Date: Sat, 27 May 2023 18:46:11 -0700 Subject: [PATCH] tests/bolt: convert to new stand-alone test process (#35695) * bolt: convert to new stand-alone test process * Remove redundant test_requires_compiler (so above directives) --- .../repos/builtin/packages/bolt/package.py | 37 ++++++++----------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/var/spack/repos/builtin/packages/bolt/package.py b/var/spack/repos/builtin/packages/bolt/package.py index acffd87afc..e575ee6cfd 100644 --- a/var/spack/repos/builtin/packages/bolt/package.py +++ b/var/spack/repos/builtin/packages/bolt/package.py @@ -5,8 +5,6 @@ import os -from llnl.util import tty - from spack.package import * @@ -26,6 +24,8 @@ class Bolt(CMakePackage): git = "https://github.com/pmodels/bolt.git" maintainers("shintaro-iwasaki") + test_requires_compiler = True + tags = ["e4s"] version("main", branch="main") @@ -33,8 +33,6 @@ class Bolt(CMakePackage): version("1.0.1", sha256="769e30dfc4042cee7ebbdadd23cf08796c03bcd8b335f516dc8cbc3f8adfa597") version("1.0", sha256="1c0d2f75597485ca36335d313a73736594e75c8a36123c5a6f54d01b5ba5c384") - test_requires_compiler = True - depends_on("argobots") depends_on("autoconf", type="build") depends_on("automake", type="build") @@ -55,20 +53,20 @@ def cache_test_sources(self): install test subdirectory for use during `spack test run`.""" self.cache_extra_test_sources(["examples"]) - def run_sample_nested_example(self): - """Run stand alone test: sample_nested""" + def test_sample_nested_example(self): + """build and run sample_nested""" - test_dir = join_path(self.test_suite.current_test_cache_dir, "examples") exe = "sample_nested" - source_file = "sample_nested.c" + source_file = "{0}.c".format(exe) - if not os.path.isfile(join_path(test_dir, source_file)): - tty.warn("Skipping bolt test:" "{0} does not exist".format(source_file)) - return + path = find_required_file( + self.test_suite.current_test_cache_dir, source_file, expected=1, recursive=True + ) - self.run_test( - exe=os.environ["CXX"], - options=[ + test_dir = os.path.dirname(path) + with working_dir(test_dir): + cxx = which(os.environ["CXX"]) + cxx( "-L{0}".format(self.prefix.lib), "-I{0}".format(self.prefix.include), "{0}".format(join_path(test_dir, source_file)), @@ -76,12 +74,7 @@ def run_sample_nested_example(self): exe, "-lomp", "-lbolt", - ], - purpose="test: compile {0} example".format(exe), - work_dir=test_dir, - ) + ) - self.run_test(exe, purpose="test: run {0} example".format(exe), work_dir=test_dir) - - def test(self): - self.run_sample_nested_example() + sample_nested = which(exe) + sample_nested()