diff options
author | Sergei Shudler <shudler1@llnl.gov> | 2021-02-08 11:21:52 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 11:21:52 -0800 |
commit | 6447ec6ff5007a5cc15882f2bcd661de62a5c619 (patch) | |
tree | 923ea9ced1dc46001922e1ea4437656d3c3b4ebf /var | |
parent | c01065ee7361b66cb8735a29e75c876d6b4228df (diff) | |
download | spack-6447ec6ff5007a5cc15882f2bcd661de62a5c619.tar.gz spack-6447ec6ff5007a5cc15882f2bcd661de62a5c619.tar.bz2 spack-6447ec6ff5007a5cc15882f2bcd661de62a5c619.tar.xz spack-6447ec6ff5007a5cc15882f2bcd661de62a5c619.zip |
Smoke test for parallel-netcdf package (#21400)
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/parallel-netcdf/package.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/parallel-netcdf/package.py b/var/spack/repos/builtin/packages/parallel-netcdf/package.py index 8f0ee740eb..648756d727 100644 --- a/var/spack/repos/builtin/packages/parallel-netcdf/package.py +++ b/var/spack/repos/builtin/packages/parallel-netcdf/package.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * +import os class ParallelNetcdf(AutotoolsPackage): @@ -19,6 +20,8 @@ class ParallelNetcdf(AutotoolsPackage): maintainers = ['skosukhin'] + test_requires_compiler = True + def url_for_version(self, version): if version >= Version('1.11.0'): url = "https://parallel-netcdf.github.io/Release/pnetcdf-{0}.tar.gz" @@ -169,3 +172,32 @@ class ParallelNetcdf(AutotoolsPackage): args.append('--enable-burst-buffering') return args + + examples_src_dir = 'examples/CXX' + + @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([self.examples_src_dir]) + + def test(self): + test_dir = join_path(self.install_test_root, self.examples_src_dir) + # pnetcdf has many examples to serve as a suitable smoke check. + # column_wise was chosen based on the E4S test suite. Other + # examples should work as well. + test_exe = 'column_wise' + options = ['{0}.cpp'.format(test_exe), '-o', test_exe, '-lpnetcdf'] + reason = 'test: compiling and linking pnetcdf example' + self.run_test(self.spec['mpi'].mpicxx, options, [], + installed=False, purpose=reason, work_dir=test_dir) + mpiexe_list = ['mpirun', 'mpiexec', 'srun'] + for mpiexe in mpiexe_list: + if os.path.isfile(mpiexe): + self.run_test(mpiexe, ['-n', '4', test_exe], [], + installed=False, + purpose='test: pnetcdf smoke test', + skip_missing=True, + work_dir=test_dir) + break + self.run_test('rm', ['-f', test_exe], work_dir=test_dir) |