summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Davydov <davydden@gmail.com>2016-07-06 22:45:43 +0200
committerDenis Davydov <davydden@gmail.com>2016-07-06 22:45:43 +0200
commitc096bb332a7710a0618049f0e2df1800771bd3f9 (patch)
tree42ff0067896e144300813b1f9b5096882172a3de
parent081918d71a9d58108b8617d8324fd51542161a1e (diff)
downloadspack-c096bb332a7710a0618049f0e2df1800771bd3f9.tar.gz
spack-c096bb332a7710a0618049f0e2df1800771bd3f9.tar.bz2
spack-c096bb332a7710a0618049f0e2df1800771bd3f9.tar.xz
spack-c096bb332a7710a0618049f0e2df1800771bd3f9.zip
petsc: fix unit tests
-rw-r--r--var/spack/repos/builtin/packages/petsc/package.py30
1 files changed, 16 insertions, 14 deletions
diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py
index 6a7bee9788..90afdbdb90 100644
--- a/var/spack/repos/builtin/packages/petsc/package.py
+++ b/var/spack/repos/builtin/packages/petsc/package.py
@@ -149,20 +149,22 @@ class Petsc(Package):
make("install")
# solve Poisson equation in 2D to make sure nothing is broken:
- with working_dir('src/ksp/ksp/examples/tutorials'):
- cc = os.environ['CC'] if '~mpi' in self.spec else self.spec['mpi'].mpicc # NOQA: ignore=E501
- os.system('%s ex50.c -I%s -L%s -lpetsc -o ex50' % (
- cc, prefix.include, prefix.lib))
- ex50 = Executable('./ex50')
- ex50('-da_grid_x', '4', '-da_grid_y', '4')
- if 'superlu-dist' in spec:
- ex50('-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'lu', '-pc_factor_mat_solver_package', 'superlu_dist') # NOQA: ignore=E501
-
- if 'mumps' in spec:
- ex50('-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'lu', '-pc_factor_mat_solver_package', 'mumps') # NOQA: ignore=E501
-
- if 'hypre' in spec:
- ex50('-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'hypre', '-pc_hypre_type', 'boomeramg') # NOQA: ignore=E501
+ if ('mpi' in spec) and self.run_tests:
+ with working_dir('src/ksp/ksp/examples/tutorials'):
+ env['PETSC_DIR'] = self.prefix
+ cc = Executable(spec['mpi'].mpicc)
+ cc('ex50.c', '-I%s' % prefix.include, '-L%s' % prefix.lib,
+ '-lpetsc', '-o', 'ex50')
+ run = Executable(join_path(spec['mpi'].prefix.bin, 'mpirun'))
+ run('ex50', '-da_grid_x', '4', '-da_grid_y', '4')
+ if 'superlu-dist' in spec:
+ run('ex50', '-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'lu', '-pc_factor_mat_solver_package', 'superlu_dist') # NOQA: ignore=E501
+
+ if 'mumps' in spec:
+ run('ex50', '-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'lu', '-pc_factor_mat_solver_package', 'mumps') # NOQA: ignore=E501
+
+ if 'hypre' in spec:
+ run('ex50', '-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'hypre', '-pc_hypre_type', 'boomeramg') # NOQA: ignore=E501
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
# set up PETSC_DIR for everyone using PETSc package