Papyrus: Add E4S testsuite stand alone test (#25324)
This commit is contained in:
parent
3c6050d3a2
commit
2633cf7da6
@ -22,6 +22,8 @@ class Papyrus(CMakePackage):
|
|||||||
|
|
||||||
depends_on('mpi')
|
depends_on('mpi')
|
||||||
|
|
||||||
|
test_requires_compiler = True
|
||||||
|
|
||||||
def setup_run_environment(self, env):
|
def setup_run_environment(self, env):
|
||||||
if os.path.isdir(self.prefix.lib64):
|
if os.path.isdir(self.prefix.lib64):
|
||||||
lib_dir = self.prefix.lib64
|
lib_dir = self.prefix.lib64
|
||||||
@ -31,3 +33,54 @@ def setup_run_environment(self, env):
|
|||||||
env.prepend_path('CPATH', self.prefix.include)
|
env.prepend_path('CPATH', self.prefix.include)
|
||||||
env.prepend_path('LIBRARY_PATH', lib_dir)
|
env.prepend_path('LIBRARY_PATH', lib_dir)
|
||||||
env.prepend_path('LD_LIBRARY_PATH', lib_dir)
|
env.prepend_path('LD_LIBRARY_PATH', lib_dir)
|
||||||
|
|
||||||
|
@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([join_path('kv', 'tests')])
|
||||||
|
|
||||||
|
def run_example_tests(self):
|
||||||
|
"""Run all c & c++ stand alone test"""
|
||||||
|
|
||||||
|
example_dir = join_path(self.test_suite.current_test_cache_dir, 'kv', 'tests')
|
||||||
|
|
||||||
|
if not os.path.exists(example_dir):
|
||||||
|
print('Skipping all test')
|
||||||
|
return
|
||||||
|
|
||||||
|
if os.path.isdir(self.prefix.lib64):
|
||||||
|
lib_dir = self.prefix.lib64
|
||||||
|
else:
|
||||||
|
lib_dir = self.prefix.lib
|
||||||
|
|
||||||
|
example_list = ['01_open_close', '02_put_get', '03_barrier',
|
||||||
|
'04_delete', '05_fence', '06_signal',
|
||||||
|
'07_consistency', '08_protect', '09_cache',
|
||||||
|
'10_checkpoint', '11_restart', '12_free']
|
||||||
|
|
||||||
|
for example in example_list:
|
||||||
|
|
||||||
|
test_dir = join_path(self.test_suite.current_test_cache_dir,
|
||||||
|
'kv', 'tests', example)
|
||||||
|
test_example = 'test{0}.c'.format(example)
|
||||||
|
|
||||||
|
if not os.path.exists(test_dir):
|
||||||
|
print('Skipping {0} test'.format(example))
|
||||||
|
continue
|
||||||
|
|
||||||
|
self.run_test(self.spec['mpi'].mpicxx,
|
||||||
|
options=['{0}'.format(join_path(test_dir, test_example)),
|
||||||
|
'-I{0}'.format(join_path(self.prefix, 'include')),
|
||||||
|
'-L{0}'.format(lib_dir), '-lpapyruskv', '-g', '-o',
|
||||||
|
example, '-lpthread', '-lm'],
|
||||||
|
purpose='test: compile {0} example'.format(example),
|
||||||
|
work_dir=test_dir)
|
||||||
|
|
||||||
|
self.run_test(self.spec['mpi'].prefix.bin.mpirun,
|
||||||
|
options=['-np', '4', example],
|
||||||
|
purpose='test: run {0} example'.format(example),
|
||||||
|
work_dir=test_dir)
|
||||||
|
|
||||||
|
def test(self):
|
||||||
|
self.run_example_tests()
|
||||||
|
Loading…
Reference in New Issue
Block a user