Add Kokkos smoke test support (#22071)

Co-authored-by: Jan Ciesko (-EXP) <jciesko@sandia.gov>
Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
This commit is contained in:
Jan Ciesko 2021-03-22 12:51:59 -06:00 committed by GitHub
parent 623edc6674
commit 364b359c68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,7 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import * from spack import *
import os.path
class Kokkos(CMakePackage, CudaPackage, ROCmPackage): class Kokkos(CMakePackage, CudaPackage, ROCmPackage):
@ -11,12 +12,15 @@ class Kokkos(CMakePackage, CudaPackage, ROCmPackage):
homepage = "https://github.com/kokkos/kokkos" homepage = "https://github.com/kokkos/kokkos"
git = "https://github.com/kokkos/kokkos.git" git = "https://github.com/kokkos/kokkos.git"
url = "https://github.com/kokkos/kokkos/archive/3.1.01.tar.gz" url = "https://github.com/kokkos/kokkos/archive/3.3.01.tar.gz"
maintainers = ['jjwilke'] test_requires_compiler = True
maintainers = ['jjwilke', 'jciesko']
version('develop', branch='develop')
version('master', branch='master') version('master', branch='master')
version('develop', branch='develop')
version('3.3.01', sha256='4919b00bb7b6eb80f6c335a32f98ebe262229d82e72d3bae6dd91aaf3d234c37')
version('3.2.00', sha256='05e1b4dd1ef383ca56fe577913e1ff31614764e65de6d6f2a163b2bddb60b3e9') version('3.2.00', sha256='05e1b4dd1ef383ca56fe577913e1ff31614764e65de6d6f2a163b2bddb60b3e9')
version('3.1.01', sha256='ff5024ebe8570887d00246e2793667e0d796b08c77a8227fe271127d36eec9dd') version('3.1.01', sha256='ff5024ebe8570887d00246e2793667e0d796b08c77a8227fe271127d36eec9dd')
version('3.1.00', sha256="b935c9b780e7330bcb80809992caa2b66fd387e3a1c261c955d622dae857d878") version('3.1.00', sha256="b935c9b780e7330bcb80809992caa2b66fd387e3a1c261c955d622dae857d878")
@ -284,3 +288,48 @@ def cmake_args(self):
options.append('-DBUILD_SHARED_LIBS=%s' % ('+shared' in self.spec)) options.append('-DBUILD_SHARED_LIBS=%s' % ('+shared' in self.spec))
return options return options
test_script_relative_path = "scripts/spack_test"
@run_after('install')
def setup_build_tests(self):
# Skip if unsupported version
cmake_source_path = join_path(self.stage.source_path,
self.test_script_relative_path)
if not os.path.exists(cmake_source_path):
return
"""Copy test."""
cmake_out_path = join_path(self.test_script_relative_path, 'out')
cmake_args = [cmake_source_path,
"-DSPACK_PACKAGE_SOURCE_DIR:PATH={0}".
format(self.stage.source_path),
"-DSPACK_PACKAGE_TEST_ROOT_DIR:PATH={0}".
format(join_path(self.install_test_root, cmake_out_path)),
"-DSPACK_PACKAGE_INSTALL_DIR:PATH={0}".format(self.prefix)]
cmake(*cmake_args)
self.cache_extra_test_sources(cmake_out_path)
def build_tests(self):
"""Build test."""
cmake_path = join_path(self.install_test_root,
self.test_script_relative_path, 'out')
cmake_args = [cmake_path, '-DEXECUTABLE_OUTPUT_PATH=' + cmake_path]
cmake(*cmake_args)
make()
def run_tests(self):
"""Run test."""
reason = 'Checking ability to execute.'
run_path = join_path(self.install_test_root,
self.test_script_relative_path, 'out')
self.run_test('make', [run_path, 'test'], [], installed=False, purpose=reason)
def test(self):
# Skip if unsupported version
cmake_path = join_path(self.install_test_root,
self.test_script_relative_path, 'out')
if not os.path.exists(cmake_path):
print('Skipping smoke tests: {0} is missing'.format(cmake_path))
return
self.build_tests()
self.run_tests()