From 0de653ff016003c62b5e491646f62b3d644b835f Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Mon, 12 Jun 2017 09:47:46 -0500 Subject: Add an installcheck phase to MakefilePackage (#4476) * Add an installcheck phase to MakefilePackage * Minor changes to ESMF --- lib/spack/spack/build_systems/makefile.py | 12 +++++++++++ var/spack/repos/builtin/packages/esmf/package.py | 26 ++++++++---------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/lib/spack/spack/build_systems/makefile.py b/lib/spack/spack/build_systems/makefile.py index a014ed7c15..2311158bfe 100644 --- a/lib/spack/spack/build_systems/makefile.py +++ b/lib/spack/spack/build_systems/makefile.py @@ -75,6 +75,9 @@ class MakefilePackage(PackageBase): #: Callback names for build-time test build_time_test_callbacks = ['check'] + #: Callback names for install-time test + install_time_test_callbacks = ['installcheck'] + @property def build_directory(self): """Returns the directory containing the main Makefile @@ -113,5 +116,14 @@ class MakefilePackage(PackageBase): self._if_make_target_execute('test') self._if_make_target_execute('check') + run_after('install')(PackageBase._run_default_install_time_test_callbacks) + + def installcheck(self): + """Searches the Makefile for an ``installcheck`` target + and runs it if found. + """ + with working_dir(self.build_directory): + self._if_make_target_execute('installcheck') + # Check that self.prefix is there after installation run_after('install')(PackageBase.sanity_check_prefix) diff --git a/var/spack/repos/builtin/packages/esmf/package.py b/var/spack/repos/builtin/packages/esmf/package.py index 9d68d17846..9c8b9d2c2e 100644 --- a/var/spack/repos/builtin/packages/esmf/package.py +++ b/var/spack/repos/builtin/packages/esmf/package.py @@ -26,7 +26,7 @@ from spack import * import os -class Esmf(Package): +class Esmf(MakefilePackage): """The Earth System Modeling Framework (ESMF) is high-performance, flexible software infrastructure for building and coupling weather, climate, and related Earth science applications. The ESMF defines an architecture for @@ -47,25 +47,28 @@ class Esmf(Package): variant('debug', default=False, description='Make a debuggable version of the library') # Required dependencies - depends_on('mpi', when='+mpi') depends_on('zlib') depends_on('libxml2') - # depends_on('perl', type='test') # TODO: Add a test deptype # Optional dependencies + depends_on('mpi', when='+mpi') depends_on('lapack@3:', when='+lapack') depends_on('netcdf@3.6:', when='+netcdf') depends_on('netcdf-fortran@3.6:', when='+netcdf') depends_on('parallel-netcdf@1.2.0:', when='+pnetcdf') depends_on('xerces-c@3.1.0:', when='+xerces') + # Testing dependencies + # depends_on('perl', type='test') # TODO: Add a test deptype + # NOTE: ESMF cannot be installed with GCC 6. It uses constructs that # are no longer valid in GCC 6. GCC 4 is recommended for installation. + conflicts('%gcc@6:') def url_for_version(self, version): return "http://www.earthsystemmodeling.org/esmf_releases/non_public/ESMF_{0}/esmf_{0}_src.tar.gz".format(version.underscored) - def install(self, spec, prefix): + def edit(self, spec, prefix): # Installation instructions can be found at: # http://www.earthsystemmodeling.org/esmf_releases/last_built/ESMF_usrdoc/node9.html @@ -238,16 +241,5 @@ class Esmf(Package): # ESMF_XERCES_INCLUDE # ESMF_XERCES_LIBPATH - ################ - # Installation # - ################ - - make() - - if self.run_tests: - make('check', parallel=False) - - make('install') - - if self.run_tests: - make('installcheck') + def check(self): + make('check', parallel=False) -- cgit v1.2.3-70-g09d2