From 081918d71a9d58108b8617d8324fd51542161a1e Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Wed, 6 Jul 2016 22:45:30 +0200 Subject: add --run-tests argument for install() --- lib/spack/spack/cmd/install.py | 5 +++++ lib/spack/spack/package.py | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py index 9d3175786b..fadfa7f7c3 100644 --- a/lib/spack/spack/cmd/install.py +++ b/lib/spack/spack/cmd/install.py @@ -55,6 +55,10 @@ def setup_parser(subparser): help="Fake install. Just remove the prefix and touch a fake file in it.") subparser.add_argument( 'packages', nargs=argparse.REMAINDER, help="specs of packages to install") + subparser.add_argument( + '--run-tests', action='store_true', dest='run_tests', + help="Run tests during installation of a package.") + def install(parser, args): @@ -77,6 +81,7 @@ def install(parser, args): keep_stage=args.keep_stage, ignore_deps=args.ignore_deps, make_jobs=args.jobs, + run_tests=args.run_tests, verbose=args.verbose, fake=args.fake, explicit=True) diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 53c521b776..bce6af9c02 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -311,6 +311,8 @@ class Package(object): parallel = True """# jobs to use for parallel make. If set, overrides default of ncpus.""" make_jobs = None + """By default do not run tests within package's install()""" + run_tests = False """Most packages are NOT extendable. Set to True if you want extensions.""" extendable = False """List of prefix-relative file paths (or a single path). If these do @@ -755,7 +757,7 @@ class Package(object): self.stage.check() self.stage.cache_local() - + def do_stage(self, mirror_only=False): """Unpacks the fetched tarball, then changes into the expanded tarball @@ -881,6 +883,7 @@ class Package(object): skip_patch=False, verbose=False, make_jobs=None, + run_tests=False, fake=False, explicit=False, install_phases = install_phases): @@ -900,6 +903,7 @@ class Package(object): skip_patch -- Skip patch stage of build if True. verbose -- Display verbose build output (by default, suppresses it) make_jobs -- Number of make jobs to use for install. Default is ncpus + run_tests -- Runn tests within the package's install() """ if not self.spec.concrete: raise ValueError("Can only install concrete packages.") @@ -930,7 +934,11 @@ class Package(object): fake=fake, skip_patch=skip_patch, verbose=verbose, - make_jobs=make_jobs) + make_jobs=make_jobs, + run_tests=run_tests) + + # Set run_tests flag before starting build. + self.run_tests = run_tests # Set parallelism before starting build. self.make_jobs = make_jobs @@ -1527,15 +1535,15 @@ class StagedPackage(Package): raise InstallError("Package %s provides no install_setup() method!" % self.name) def install_configure(self): - """Runs the configure process.""" + """Runs the configure process.""" raise InstallError("Package %s provides no install_configure() method!" % self.name) def install_build(self): - """Runs the build process.""" + """Runs the build process.""" raise InstallError("Package %s provides no install_build() method!" % self.name) def install_install(self): - """Runs the install process.""" + """Runs the install process.""" raise InstallError("Package %s provides no install_install() method!" % self.name) def install(self, spec, prefix): -- cgit v1.2.3-60-g2f50