libsigsegv: convert to new stand-alone test process (#37691)
This commit is contained in:
parent
3ae8a3a517
commit
37e95713f4
@ -2,7 +2,7 @@
|
|||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
import os
|
||||||
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
@ -13,6 +13,8 @@ class Libsigsegv(AutotoolsPackage, GNUMirrorPackage):
|
|||||||
homepage = "https://www.gnu.org/software/libsigsegv/"
|
homepage = "https://www.gnu.org/software/libsigsegv/"
|
||||||
gnu_mirror_path = "libsigsegv/libsigsegv-2.13.tar.gz"
|
gnu_mirror_path = "libsigsegv/libsigsegv-2.13.tar.gz"
|
||||||
|
|
||||||
|
test_requires_compiler = True
|
||||||
|
|
||||||
version("2.14", sha256="cdac3941803364cf81a908499beb79c200ead60b6b5b40cad124fd1e06caa295")
|
version("2.14", sha256="cdac3941803364cf81a908499beb79c200ead60b6b5b40cad124fd1e06caa295")
|
||||||
version("2.13", sha256="be78ee4176b05f7c75ff03298d84874db90f4b6c9d5503f0da1226b3a3c48119")
|
version("2.13", sha256="be78ee4176b05f7c75ff03298d84874db90f4b6c9d5503f0da1226b3a3c48119")
|
||||||
version("2.12", sha256="3ae1af359eebaa4ffc5896a1aee3568c052c99879316a1ab57f8fe1789c390b6")
|
version("2.12", sha256="3ae1af359eebaa4ffc5896a1aee3568c052c99879316a1ab57f8fe1789c390b6")
|
||||||
@ -21,21 +23,19 @@ class Libsigsegv(AutotoolsPackage, GNUMirrorPackage):
|
|||||||
|
|
||||||
patch("patch.new_config_guess", when="@2.10")
|
patch("patch.new_config_guess", when="@2.10")
|
||||||
|
|
||||||
test_requires_compiler = True
|
|
||||||
|
|
||||||
def configure_args(self):
|
def configure_args(self):
|
||||||
return ["--enable-shared"]
|
return ["--enable-shared"]
|
||||||
|
|
||||||
extra_install_tests = "tests/.libs"
|
extra_install_tests = "tests/.libs"
|
||||||
|
|
||||||
@run_after("install")
|
@run_after("install")
|
||||||
def setup_build_tests(self):
|
def setup_tests(self):
|
||||||
"""Copy the build test files after the package is installed to an
|
"""Copy the build test files after the package is installed to an
|
||||||
install test subdirectory for use during `spack test run`."""
|
install test subdirectory for use during `spack test run`."""
|
||||||
self.cache_extra_test_sources(self.extra_install_tests)
|
self.cache_extra_test_sources(self.extra_install_tests)
|
||||||
|
|
||||||
def _run_smoke_tests(self):
|
def test_smoke_test(self):
|
||||||
"""Build and run the added smoke (install) test."""
|
"""build and run smoke test"""
|
||||||
data_dir = self.test_suite.current_test_data_dir
|
data_dir = self.test_suite.current_test_data_dir
|
||||||
prog = "smoke_test"
|
prog = "smoke_test"
|
||||||
src = data_dir.join("{0}.c".format(prog))
|
src = data_dir.join("{0}.c".format(prog))
|
||||||
@ -49,32 +49,11 @@ def _run_smoke_tests(self):
|
|||||||
"-lsigsegv",
|
"-lsigsegv",
|
||||||
"{0}{1}".format(self.compiler.cc_rpath_arg, self.prefix.lib),
|
"{0}{1}".format(self.compiler.cc_rpath_arg, self.prefix.lib),
|
||||||
]
|
]
|
||||||
reason = "test: checking ability to link to the library"
|
|
||||||
self.run_test("cc", options, [], installed=False, purpose=reason)
|
|
||||||
|
|
||||||
# Now run the program and confirm the output matches expectations
|
cc = which(os.environ["CC"])
|
||||||
|
cc(*options)
|
||||||
|
|
||||||
|
exe = which(prog)
|
||||||
|
out = exe(output=str.split, error=str.split)
|
||||||
expected = get_escaped_text_output(data_dir.join("smoke_test.out"))
|
expected = get_escaped_text_output(data_dir.join("smoke_test.out"))
|
||||||
reason = "test: checking ability to use the library"
|
check_outputs(expected, out)
|
||||||
self.run_test(prog, [], expected, purpose=reason)
|
|
||||||
|
|
||||||
def _run_build_tests(self):
|
|
||||||
"""Run selected build tests."""
|
|
||||||
passed = "Test passed"
|
|
||||||
checks = {
|
|
||||||
"sigsegv1": [passed],
|
|
||||||
"sigsegv2": [passed],
|
|
||||||
"sigsegv3": ["caught", passed],
|
|
||||||
"stackoverflow1": ["recursion", "Stack overflow", passed],
|
|
||||||
"stackoverflow2": ["recursion", "overflow", "violation", passed],
|
|
||||||
}
|
|
||||||
|
|
||||||
for exe, expected in checks.items():
|
|
||||||
reason = "test: checking {0} output".format(exe)
|
|
||||||
self.run_test(exe, [], expected, installed=True, purpose=reason, skip_missing=True)
|
|
||||||
|
|
||||||
def test(self):
|
|
||||||
# Run the simple built-in smoke test
|
|
||||||
self._run_smoke_tests()
|
|
||||||
|
|
||||||
# Run test programs pulled from the build
|
|
||||||
self._run_build_tests()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user