summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicharda Butler <39577672+RikkiButler20@users.noreply.github.com>2022-01-25 17:10:28 -0800
committerGitHub <noreply@github.com>2022-01-26 01:10:28 +0000
commit38a1036c46c14dd65aef7a8167d6443692920711 (patch)
tree6097ddf676b6e8e157d4cbd6921097bdb5d0f762
parent75db515af22b5827db298a982f2b2d3329b34df0 (diff)
downloadspack-38a1036c46c14dd65aef7a8167d6443692920711.tar.gz
spack-38a1036c46c14dd65aef7a8167d6443692920711.tar.bz2
spack-38a1036c46c14dd65aef7a8167d6443692920711.tar.xz
spack-38a1036c46c14dd65aef7a8167d6443692920711.zip
Bugfix: Tasmanian stand alone test (#28496)
-rw-r--r--var/spack/repos/builtin/packages/tasmanian/package.py58
1 files changed, 52 insertions, 6 deletions
diff --git a/var/spack/repos/builtin/packages/tasmanian/package.py b/var/spack/repos/builtin/packages/tasmanian/package.py
index bdfb680d77..a957f749f0 100644
--- a/var/spack/repos/builtin/packages/tasmanian/package.py
+++ b/var/spack/repos/builtin/packages/tasmanian/package.py
@@ -3,6 +3,10 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import os
+
+from llnl.util import tty
+
from spack import *
@@ -153,10 +157,52 @@ class Tasmanian(CMakePackage, CudaPackage, ROCmPackage):
return args
+ # TODO: Replace this method and its 'get' use for cmake path with
+ # join_path(self.spec['cmake'].prefix.bin, 'cmake') once stand-alone
+ # tests can access build dependencies through self.spec['cmake'].
+ def cmake_bin(self, set=True):
+ """(Hack) Set/get cmake dependency path."""
+ filepath = join_path(self.install_test_root, 'cmake_bin_path.txt')
+ if set:
+ with open(filepath, 'w') as out_file:
+ cmake_bin = join_path(self.spec['cmake'].prefix.bin, 'cmake')
+ out_file.write('{0}\n'.format(cmake_bin))
+ elif os.path.isfile(filepath):
+ with open(filepath, 'r') as in_file:
+ return in_file.read().strip()
+
+ @run_after('install')
+ def setup_smoke_test(self):
+ if not self.spec['cmake'].satisfies('@3.10:'):
+ tty.msg('Error tasmanian test: CMake 3.10 or higher is required')
+ return
+
+ install_tree(self.prefix.share.Tasmanian.testing,
+ join_path(self.install_test_root, 'testing'))
+ self.cmake_bin(set=True)
+
def test(self):
- # using the tests installed in <prefix>/share/Tasmanian/testing
- cmake_dir = join_path(self.prefix, 'share', 'Tasmanian', 'testing')
- with working_dir(self.test_suite.current_test_cache_dir, create=True):
- cmake(cmake_dir)
- make()
- make('test')
+ cmake_bin = self.cmake_bin(set=False)
+
+ if not cmake_bin:
+ tty.msg('Skipping tasmanian test: cmake_bin_path.txt not found')
+ return
+
+ # using the tests copied from <prefix>/share/Tasmanian/testing
+ cmake_dir = self.test_suite.current_test_cache_dir.testing
+
+ if not self.run_test(cmake_bin,
+ options=[cmake_dir],
+ purpose='Generate the Makefile'):
+ tty.msg('Skipping tasmanian test: failed to generate Makefile')
+ return
+
+ if not self.run_test('make',
+ purpose='Build test software'):
+ tty.msg('Skipping tasmanian test: failed to build test')
+ return
+
+ if not self.run_test('make',
+ options=['test'],
+ purpose='Run test'):
+ tty.msg('Failed tasmanian test: failed to run test')