Add testing option to dev-build command (#17293)

* ADD: testing to dev-build command

* RM: mutally exclusive group for testing in parser

* FIX: test option to subparser and not testing

* ADD: spack-completion.bash

* RM: local devbuildcosmo cmd

* FIX: bad merge --drop-in -b --before options forgotten

* FIX: --test place in spack-completion.bash

* FIX: typo

* FIX: blank line removing

* FIX: trailing white space

Co-authored-by: Elsa Germann <egermann@tsa-ln002.cm.cluster>
This commit is contained in:
elsagermann 2020-10-19 06:17:07 +02:00 committed by GitHub
parent 05ffbbc0be
commit 4750d479a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -39,6 +39,13 @@ def setup_parser(subparser):
subparser.add_argument( subparser.add_argument(
'--drop-in', type=str, dest='shell', default=None, '--drop-in', type=str, dest='shell', default=None,
help="drop into a build environment in a new shell, e.g. bash, zsh") help="drop into a build environment in a new shell, e.g. bash, zsh")
subparser.add_argument(
'--test', default=None,
choices=['root', 'all'],
help="""If 'root' is chosen, run package tests during
installation for top-level packages (but skip tests for dependencies).
if 'all' is chosen, run package tests during installation for all
packages. If neither are chosen, don't run tests for any packages.""")
arguments.add_common_arguments(subparser, ['spec']) arguments.add_common_arguments(subparser, ['spec'])
stop_group = subparser.add_mutually_exclusive_group() stop_group = subparser.add_mutually_exclusive_group()
@ -91,7 +98,14 @@ def dev_build(self, args):
if args.no_checksum: if args.no_checksum:
spack.config.set('config:checksum', False, scope='command_line') spack.config.set('config:checksum', False, scope='command_line')
tests = False
if args.test == 'all':
tests = True
elif args.test == 'root':
tests = [spec.name for spec in specs]
package.do_install( package.do_install(
tests=tests,
make_jobs=args.jobs, make_jobs=args.jobs,
keep_prefix=args.keep_prefix, keep_prefix=args.keep_prefix,
install_deps=not args.ignore_deps, install_deps=not args.ignore_deps,

View File

@ -719,7 +719,7 @@ _spack_deprecate() {
_spack_dev_build() { _spack_dev_build() {
if $list_options if $list_options
then then
SPACK_COMPREPLY="-h --help -j --jobs -d --source-path -i --ignore-dependencies -n --no-checksum --keep-prefix --skip-patch -q --quiet --drop-in -b --before -u --until --clean --dirty" SPACK_COMPREPLY="-h --help -j --jobs -d --source-path -i --ignore-dependencies -n --no-checksum --keep-prefix --skip-patch -q --quiet --drop-in --test -b --before -u --until --clean --dirty"
else else
_all_packages _all_packages
fi fi