Superlu: Update Spack test dir (#27844)
Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
This commit is contained in:
parent
f2c5092588
commit
7268ab75f4
@ -3,6 +3,10 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from llnl.util import tty
|
||||||
|
|
||||||
|
|
||||||
class Superlu(CMakePackage):
|
class Superlu(CMakePackage):
|
||||||
"""SuperLU is a general purpose library for the direct solution of large,
|
"""SuperLU is a general purpose library for the direct solution of large,
|
||||||
@ -111,7 +115,7 @@ def cmake(self, spec, prefix):
|
|||||||
def cache_test_sources(self):
|
def cache_test_sources(self):
|
||||||
"""Copy the example source files after the package is installed to an
|
"""Copy the example source files after the package is installed to an
|
||||||
install test subdirectory for use during `spack test run`."""
|
install test subdirectory for use during `spack test run`."""
|
||||||
if self.version == Version('5.2.2'):
|
if self.spec.satisfies('@5.2.2:'):
|
||||||
# Include dir was hardcoded in 5.2.2
|
# Include dir was hardcoded in 5.2.2
|
||||||
filter_file(r'INCLUDEDIR = -I\.\./SRC',
|
filter_file(r'INCLUDEDIR = -I\.\./SRC',
|
||||||
'INCLUDEDIR = -I' + self.prefix.include,
|
'INCLUDEDIR = -I' + self.prefix.include,
|
||||||
@ -132,9 +136,9 @@ def _generate_make_hdr_for_test(self):
|
|||||||
'ARCH = ar',
|
'ARCH = ar',
|
||||||
'ARCHFLAGS = cr',
|
'ARCHFLAGS = cr',
|
||||||
'RANLIB = {0}'.format('ranlib' if which('ranlib') else 'echo'),
|
'RANLIB = {0}'.format('ranlib' if which('ranlib') else 'echo'),
|
||||||
'CC = {0}'.format(self.compiler.cc),
|
'CC = {0}'.format(env['CC']),
|
||||||
'FORTRAN = {0}'.format(self.compiler.fc),
|
'FORTRAN = {0}'.format(env['FC']),
|
||||||
'LOADER = {0}'.format(self.compiler.cc),
|
'LOADER = {0}'.format(env['CC']),
|
||||||
'CFLAGS = -O3 -DNDEBUG -DUSE_VENDOR_BLAS -DPRNTlevel=0 -DAdd_',
|
'CFLAGS = -O3 -DNDEBUG -DUSE_VENDOR_BLAS -DPRNTlevel=0 -DAdd_',
|
||||||
'NOOPTS = -O0'
|
'NOOPTS = -O0'
|
||||||
])
|
])
|
||||||
@ -158,20 +162,34 @@ def _generate_make_hdr_for_test(self):
|
|||||||
'ARCH = ar',
|
'ARCH = ar',
|
||||||
'ARCHFLAGS = cr',
|
'ARCHFLAGS = cr',
|
||||||
'RANLIB = {0}'.format('ranlib' if which('ranlib') else 'echo'),
|
'RANLIB = {0}'.format('ranlib' if which('ranlib') else 'echo'),
|
||||||
'CC = {0}'.format(self.compiler.cc),
|
'CC = {0}'.format(env['CC']),
|
||||||
'FORTRAN = {0}'.format(self.compiler.fc),
|
'FORTRAN = {0}'.format(env['FC']),
|
||||||
'LOADER = {0}'.format(self.compiler.cc),
|
'LOADER = {0}'.format(env['CC']),
|
||||||
'CFLAGS = -O3 -DNDEBUG -DUSE_VENDOR_BLAS -DPRNTlevel=0 -DAdd_',
|
'CFLAGS = -O3 -DNDEBUG -DUSE_VENDOR_BLAS -DPRNTlevel=0 -DAdd_',
|
||||||
'NOOPTS = -O0'
|
'NOOPTS = -O0'
|
||||||
])
|
])
|
||||||
|
|
||||||
return config_args
|
return config_args
|
||||||
|
|
||||||
|
def run_superlu_test(self, test_dir, exe, args):
|
||||||
|
if not self.run_test('make',
|
||||||
|
options=args,
|
||||||
|
purpose='test: compile {0} example'.format(exe),
|
||||||
|
work_dir=test_dir):
|
||||||
|
tty.warn('Skipping test: failed to compile example')
|
||||||
|
return
|
||||||
|
|
||||||
|
if not self.run_test(exe,
|
||||||
|
purpose='test: run {0} example'.format(exe),
|
||||||
|
work_dir=test_dir):
|
||||||
|
tty.warn('Skipping test: failed to run example')
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
config_args = self._generate_make_hdr_for_test()
|
config_args = self._generate_make_hdr_for_test()
|
||||||
|
|
||||||
# Write configuration options to make.inc file
|
# Write configuration options to make.inc file
|
||||||
make_file_inc = join_path(self.install_test_root, self.make_hdr_file)
|
make_file_inc = join_path(self.test_suite.current_test_cache_dir,
|
||||||
|
self.make_hdr_file)
|
||||||
with open(make_file_inc, 'w') as inc:
|
with open(make_file_inc, 'w') as inc:
|
||||||
for option in config_args:
|
for option in config_args:
|
||||||
inc.write('{0}\n'.format(option))
|
inc.write('{0}\n'.format(option))
|
||||||
@ -181,9 +199,13 @@ def test(self):
|
|||||||
args.append('HEADER=' + self.prefix.include)
|
args.append('HEADER=' + self.prefix.include)
|
||||||
args.append('superlu')
|
args.append('superlu')
|
||||||
|
|
||||||
test_dir = join_path(self.install_test_root, self.examples_src_dir)
|
test_dir = join_path(self.test_suite.current_test_cache_dir,
|
||||||
with working_dir(test_dir, create=False):
|
self.examples_src_dir)
|
||||||
make(*args, parallel=False)
|
exe = 'superlu'
|
||||||
self.run_test('./superlu', purpose='Smoke test for superlu',
|
|
||||||
work_dir='.')
|
if not os.path.isfile(join_path(test_dir, '{0}.c'.format(exe))):
|
||||||
make('clean')
|
tty.warn('Skipping superlu test:'
|
||||||
|
'missing file {0}.c'.format(exe))
|
||||||
|
return
|
||||||
|
|
||||||
|
self.run_superlu_test(test_dir, exe, args)
|
||||||
|
Loading…
Reference in New Issue
Block a user