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)
This commit is contained in:
Tamara Dahlgren 2023-05-27 18:46:11 -07:00 committed by GitHub
parent c8eb0f9361
commit 3b9454a5cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()