From dfc0aa86eead19aaaf54a57c4cb8f2e18c338454 Mon Sep 17 00:00:00 2001 From: Richarda Butler <39577672+RikkiButler20@users.noreply.github.com> Date: Wed, 21 Jul 2021 12:40:14 -0700 Subject: Bolt: Add E4S testsuite stand alone test (#24846) --- var/spack/repos/builtin/packages/bolt/package.py | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/bolt/package.py b/var/spack/repos/builtin/packages/bolt/package.py index c3f7870f3f..3b7b775ca3 100644 --- a/var/spack/repos/builtin/packages/bolt/package.py +++ b/var/spack/repos/builtin/packages/bolt/package.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import os + from spack import * @@ -27,6 +29,8 @@ class Bolt(CMakePackage): version("1.0.1", sha256="769e30dfc4042cee7ebbdadd23cf08796c03bcd8b335f516dc8cbc3f8adfa597") version("1.0", sha256="1c0d2f75597485ca36335d313a73736594e75c8a36123c5a6f54d01b5ba5c384") + test_requires_compiler = True + depends_on('argobots') depends_on('autoconf', type='build') depends_on('automake', type='build') @@ -40,3 +44,37 @@ class Bolt(CMakePackage): ] return options + + @run_after('install') + def cache_test_sources(self): + """Copy the example source files after the package is installed to an + install test subdirectory for use during `spack test run`.""" + self.cache_extra_test_sources(['examples']) + + def run_sample_nested_example(self): + """Run stand alone test: sample_nested""" + + test_dir = join_path(self.test_suite.current_test_cache_dir, 'examples') + + if not os.path.exists(test_dir): + print('Skipping bolt test') + return + + exe = 'sample_nested' + + # TODO: Either change to use self.compiler.cc (so using the build-time compiler) + # or add test parts that compile with the different supported compilers. + self.run_test('gcc', + options=['-lomp', '-o', exe, + '-L{0}'.format(join_path(self.prefix, 'lib')), + '{0}'.format(join_path(test_dir, 'sample_nested.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): + print("Running bolt test") + self.run_sample_nested_example() -- cgit v1.2.3-70-g09d2