diff options
author | Richarda Butler <39577672+RikkiButler20@users.noreply.github.com> | 2021-08-31 15:56:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-31 15:56:20 -0700 |
commit | 2633cf7da6edde6104b9dd0b0422ff6b2c831a47 (patch) | |
tree | 406881fafe8ef3b349a28c6ec555bf8b7b1988c0 /var | |
parent | 3c6050d3a20e1d4f76c553780fb93d897b2112b9 (diff) | |
download | spack-2633cf7da6edde6104b9dd0b0422ff6b2c831a47.tar.gz spack-2633cf7da6edde6104b9dd0b0422ff6b2c831a47.tar.bz2 spack-2633cf7da6edde6104b9dd0b0422ff6b2c831a47.tar.xz spack-2633cf7da6edde6104b9dd0b0422ff6b2c831a47.zip |
Papyrus: Add E4S testsuite stand alone test (#25324)
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/papyrus/package.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/papyrus/package.py b/var/spack/repos/builtin/packages/papyrus/package.py index b2d3688df5..e5f17e6562 100644 --- a/var/spack/repos/builtin/packages/papyrus/package.py +++ b/var/spack/repos/builtin/packages/papyrus/package.py @@ -22,6 +22,8 @@ class Papyrus(CMakePackage): depends_on('mpi') + test_requires_compiler = True + def setup_run_environment(self, env): if os.path.isdir(self.prefix.lib64): lib_dir = self.prefix.lib64 @@ -31,3 +33,54 @@ class Papyrus(CMakePackage): env.prepend_path('CPATH', self.prefix.include) env.prepend_path('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() |