archer: convert to new stand-alone test process (#35697)

This commit is contained in:
Tamara Dahlgren 2023-05-28 00:41:38 -07:00 committed by GitHub
parent 3b9454a5cc
commit ab3ffd9361
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack.package import *
@ -50,25 +49,17 @@ def cache_test_sources(self):
install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(["test"])
def run_parallel_example_test(self):
"""Run stand alone test: parallel-simple"""
def test_run_parallel_example(self):
"""build and run parallel-simple"""
test_dir = join_path(self.test_suite.current_test_cache_dir, "test", "parallel")
if not os.path.exists(test_dir):
print("Skipping archer test")
return
raise SkipTest("Parallel test directory does not exist")
exe = "parallel-simple"
test_exe = "parallel-simple"
test_src = "{0}.c".format(test_exe)
with working_dir(test_dir):
clang = which("clang-archer")
clang("-o", test_exe, test_src)
self.run_test(
"clang-archer",
options=["-o", exe, "{0}".format(join_path(test_dir, "parallel-simple.c"))],
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_parallel_example_test()
parallel_simple = which(test_exe)
parallel_simple()