summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/qthreads/package.py53
1 files changed, 52 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/qthreads/package.py b/var/spack/repos/builtin/packages/qthreads/package.py
index a50acdee81..6bbe9a2532 100644
--- a/var/spack/repos/builtin/packages/qthreads/package.py
+++ b/var/spack/repos/builtin/packages/qthreads/package.py
@@ -29,6 +29,10 @@ class Qthreads(AutotoolsPackage):
homepage = "http://www.cs.sandia.gov/qthreads/"
url = "https://github.com/Qthreads/qthreads/releases/download/1.10/qthread-1.10.tar.bz2"
+ test_requires_compiler = True
+ test_base_path = 'test/basics/'
+ test_list = ['hello_world_multi', 'hello_world']
+
version("1.14", sha256="16f15e5b2e35b6329a857d24c283a1e43cd49921ee49a1446d4f31bf9c6f5cf9")
version("1.12", sha256="2c13a5f6f45bc2f22038d272be2e748e027649d3343a9f824da9e86a88b594c9")
version("1.11", sha256="dbde6c7cb7de7e89921e47363d09cecaebf775c9d090496c2be8350355055571")
@@ -83,5 +87,52 @@ class Qthreads(AutotoolsPackage):
args.append('--with-scheduler=%s'
% self.spec.variants['scheduler'].value)
-
return args
+
+ @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`."""
+ tests = self.test_list
+ relative_test_dir = self.test_base_path
+ files_to_cpy = []
+ header = 'test/argparsing.h'
+ for test in tests:
+ test_path = join_path(relative_test_dir, test + '.c')
+ files_to_cpy.append(test_path)
+ files_to_cpy.append(header)
+ self.cache_extra_test_sources(files_to_cpy)
+
+ def build_tests(self):
+ """Build and run the added smoke (install) test."""
+ tests = self.test_list
+ relative_test_dir = self.test_base_path
+
+ for test in tests:
+ options = [
+ '-I{0}'.format(self.prefix.include),
+ '-I{0}'.format(self.install_test_root + '/test'),
+ join_path(self.install_test_root, relative_test_dir,
+ test + '.c'),
+ '-o',
+ test,
+ '-L{0}'.format(self.prefix.lib),
+ '-lqthread',
+ '{0}{1}'.format(self.compiler.cc_rpath_arg,
+ self.prefix.lib)]
+ reason = 'test:{0}: Checking ability to link to the library.'\
+ .format(test)
+ self.run_test('cc', options, [], installed=False, purpose=reason)
+
+ def run_tests(self):
+ tests = self.test_list
+ # Now run the program
+ for test in tests:
+ reason = 'test:{0}: Checking ability to execute.'.format(test)
+ self.run_test(test, [], purpose=reason)
+
+ def test(self):
+ # Build
+ self.build_tests()
+ # Run test programs pulled from the build
+ self.run_tests()