bricks: convert to new stand-alone test process (#35694)

This commit is contained in:
Tamara Dahlgren 2023-05-11 05:39:09 -07:00 committed by GitHub
parent 040c6e486e
commit d8a72b68dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,8 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack.package import *
@ -71,25 +73,17 @@ def copy_test_sources(self):
]
self.cache_extra_test_sources(srcs)
def test(self):
"""Test bricklib package"""
# Test prebuilt binary
def test_bricklib_example(self):
"""build and run pre-built example"""
source_dir = join_path(self.test_suite.current_test_cache_dir, "examples", "external")
if not os.path.exists(source_dir):
raise SkipTest("{0} is missing".format(source_dir))
self.run_test(
exe="cmake", options=["."], purpose="Configure bricklib example", work_dir=source_dir
)
with working_dir(source_dir):
cmake = which(self.spec["cmake"].prefix.bin.cmake)
cmake(".")
self.run_test(
exe="cmake",
options=["--build", "."],
purpose="Build bricklib example",
work_dir=source_dir,
)
cmake("--build", ".")
self.run_test(
exe=join_path(source_dir, "example"),
options=[],
purpose="Execute bricklib example",
work_dir=source_dir,
)
example = which("example")
example()