diff options
author | Richarda Butler <39577672+RikkiButler20@users.noreply.github.com> | 2021-05-21 15:07:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-21 15:07:21 -0700 |
commit | cd61b2352d5bd8599f364a2b2462cac6fb5a2c5f (patch) | |
tree | 8fb5e640e1c47c22ecceb62f38f4ccacf5670037 | |
parent | 21fd449a03e2e22cec36a7a9e0442524980f4e49 (diff) | |
download | spack-cd61b2352d5bd8599f364a2b2462cac6fb5a2c5f.tar.gz spack-cd61b2352d5bd8599f364a2b2462cac6fb5a2c5f.tar.bz2 spack-cd61b2352d5bd8599f364a2b2462cac6fb5a2c5f.tar.xz spack-cd61b2352d5bd8599f364a2b2462cac6fb5a2c5f.zip |
Slepc: Add E4S testsuite smoke test (#21600)
-rw-r--r-- | var/spack/repos/builtin/packages/slepc/package.py | 38 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/slepc/test/hello.c | 14 |
2 files changed, 47 insertions, 5 deletions
diff --git a/var/spack/repos/builtin/packages/slepc/package.py b/var/spack/repos/builtin/packages/slepc/package.py index f33101df94..7a46eccefd 100644 --- a/var/spack/repos/builtin/packages/slepc/package.py +++ b/var/spack/repos/builtin/packages/slepc/package.py @@ -17,6 +17,8 @@ class Slepc(Package): maintainers = ['joseeroman', 'balay'] + test_requires_compiler = True + version('main', branch='main') version('3.15.0', sha256='e53783ae13acadce274ea65c67186b5ab12332cf17125a694e21d598aa6b5f00') version('3.14.2', sha256='3e54578dda1f4c54d35ac27d02f70a43f6837906cb7604dbcec0e033cfb264c8') @@ -133,9 +135,35 @@ class Slepc(Package): make('install', parallel=False) def setup_run_environment(self, env): - # set SLEPC_DIR in the module file - env.set('SLEPC_DIR', self.prefix) - - def setup_dependent_build_environment(self, env, dependent_spec): - # set up SLEPC_DIR for everyone using SLEPc package + # set SLEPC_DIR & PETSC_DIR in the module file env.set('SLEPC_DIR', self.prefix) + env.set('PETSC_DIR', self.spec['petsc'].prefix) + + def run_hello_test(self): + """Run stand alone test: hello""" + test_dir = self.test_suite.current_test_data_dir + + if not os.path.exists(test_dir): + print('Skipping slepc test') + return + + exe = 'hello' + cc_exe = os.environ['CC'] + + self.run_test(exe=cc_exe, + options=['-I{0}'.format(self.prefix.include), + '-L', self.prefix.lib, '-l', 'slepc', + '-L', self.spec['petsc'].prefix.lib, '-l', 'petsc', + '-L', self.spec['mpi'].prefix.lib, '-l', 'mpi', + '-o', exe, join_path(test_dir, 'hello.c')], + purpose='test: compile {0} example'.format(exe), + work_dir=test_dir) + + self.run_test(exe=exe, + options=[], + expected=['Hello world'], + purpose='test: run {0} example'.format(exe), + work_dir=test_dir) + + def test(self): + self.run_hello_test() diff --git a/var/spack/repos/builtin/packages/slepc/test/hello.c b/var/spack/repos/builtin/packages/slepc/test/hello.c new file mode 100644 index 0000000000..8a9ca8674a --- /dev/null +++ b/var/spack/repos/builtin/packages/slepc/test/hello.c @@ -0,0 +1,14 @@ +static char help[] = "Hello World example program\n"; + +#include "slepcsys.h" + +int main( int argc, char **argv ) +{ + int ierr; + + SlepcInitialize(&argc,&argv,(char*)0,help); + ierr = PetscPrintf(PETSC_COMM_WORLD,"Hello world\n"); + + return ierr; +} + |