diff options
Diffstat (limited to 'var/spack/repos/builtin/packages/libsigsegv/package.py')
-rw-r--r-- | var/spack/repos/builtin/packages/libsigsegv/package.py | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/var/spack/repos/builtin/packages/libsigsegv/package.py b/var/spack/repos/builtin/packages/libsigsegv/package.py index 7aab695b76..119778f018 100644 --- a/var/spack/repos/builtin/packages/libsigsegv/package.py +++ b/var/spack/repos/builtin/packages/libsigsegv/package.py @@ -3,8 +3,6 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * - class Libsigsegv(AutotoolsPackage, GNUMirrorPackage): """GNU libsigsegv is a library for handling page faults in user mode.""" @@ -18,5 +16,60 @@ class Libsigsegv(AutotoolsPackage, GNUMirrorPackage): patch('patch.new_config_guess', when='@2.10') + test_requires_compiler = True + def configure_args(self): return ['--enable-shared'] + + extra_install_tests = 'tests/.libs' + + @run_after('install') + def setup_build_tests(self): + """Copy the build test files after the package is installed to an + install test subdirectory for use during `spack test run`.""" + self.cache_extra_test_sources(self.extra_install_tests) + + def _run_smoke_tests(self): + """Build and run the added smoke (install) test.""" + data_dir = self.test_suite.current_test_data_dir + prog = 'smoke_test' + src = data_dir.join('{0}.c'.format(prog)) + + options = [ + '-I{0}'.format(self.prefix.include), + src, + '-o', + prog, + '-L{0}'.format(self.prefix.lib), + '-lsigsegv', + '{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 + expected = get_escaped_text_output(data_dir.join('smoke_test.out')) + reason = 'test: checking ability to use the library' + 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() |