Slepc: Add E4S testsuite smoke test (#21600)

This commit is contained in:
Richarda Butler 2021-05-21 15:07:21 -07:00 committed by GitHub
parent 21fd449a03
commit cd61b2352d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 4 deletions

View File

@ -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 @@ def install(self, spec, prefix):
make('install', parallel=False)
def setup_run_environment(self, env):
# set SLEPC_DIR in the module file
# set SLEPC_DIR & PETSC_DIR in the module file
env.set('SLEPC_DIR', self.prefix)
env.set('PETSC_DIR', self.spec['petsc'].prefix)
def setup_dependent_build_environment(self, env, dependent_spec):
# set up SLEPC_DIR for everyone using SLEPc package
env.set('SLEPC_DIR', self.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()

View File

@ -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;
}