summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/parallel-netcdf/package.py32
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)