summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>2022-10-25 12:32:55 -0700
committerGitHub <noreply@github.com>2022-10-25 12:32:55 -0700
commit512f8d14d28ab4fe0667905b899efed1f785c755 (patch)
tree8844307708eec6a72260305822bbbd350e7a4b39
parent9d5151ba25394b35ff7fc4b06b858c53e638ec5d (diff)
downloadspack-512f8d14d28ab4fe0667905b899efed1f785c755.tar.gz
spack-512f8d14d28ab4fe0667905b899efed1f785c755.tar.bz2
spack-512f8d14d28ab4fe0667905b899efed1f785c755.tar.xz
spack-512f8d14d28ab4fe0667905b899efed1f785c755.zip
feature: Add -x|--explicit option to 'spack test run' (#32910)
-rw-r--r--lib/spack/spack/cmd/test.py18
-rw-r--r--lib/spack/spack/test/ci.py8
-rwxr-xr-xshare/spack/spack-completion.bash2
3 files changed, 21 insertions, 7 deletions
diff --git a/lib/spack/spack/cmd/test.py b/lib/spack/spack/cmd/test.py
index fcd72a123e..4da35c8a35 100644
--- a/lib/spack/spack/cmd/test.py
+++ b/lib/spack/spack/cmd/test.py
@@ -55,6 +55,12 @@ def setup_parser(subparser):
"--externals", action="store_true", help="Test packages that are externally installed."
)
run_parser.add_argument(
+ "-x",
+ "--explicit",
+ action="store_true",
+ help="Only test packages that are explicitly installed.",
+ )
+ run_parser.add_argument(
"--keep-stage", action="store_true", help="Keep testing directory for debugging"
)
run_parser.add_argument(
@@ -188,6 +194,9 @@ environment variables:
if args.fail_fast:
spack.config.set("config:fail_fast", True, scope="command_line")
+ explicit = args.explicit or any
+ explicit_str = "explicitly " if args.explicit else ""
+
# Get specs to test
env = ev.active_environment()
hashes = env.all_hashes() if env else None
@@ -195,9 +204,13 @@ environment variables:
specs = spack.cmd.parse_specs(args.specs) if args.specs else [None]
specs_to_test = []
for spec in specs:
- matching = spack.store.db.query_local(spec, hashes=hashes)
+ matching = spack.store.db.query_local(
+ spec,
+ hashes=hashes,
+ explicit=explicit,
+ )
if spec and not matching:
- tty.warn("No installed packages match spec %s" % spec)
+ tty.warn("No {0}installed packages match spec {1}".format(explicit_str, spec))
"""
TODO: Need to write out a log message and/or CDASH Testing
output that package not installed IF continue to process
@@ -208,6 +221,7 @@ environment variables:
# to ensure report package as skipped (e.g., for CI)
specs_to_test.append(spec)
"""
+
specs_to_test.extend(matching)
# test_stage_dir
diff --git a/lib/spack/spack/test/ci.py b/lib/spack/spack/test/ci.py
index b2c83ca2a9..06f212d92a 100644
--- a/lib/spack/spack/test/ci.py
+++ b/lib/spack/spack/test/ci.py
@@ -467,7 +467,7 @@ def test_affected_specs_on_first_concretization(mutable_mock_env_path, config):
@pytest.mark.skipif(
- sys.platform == "win32", reason="Reliance on bash script ot supported on Windows"
+ sys.platform == "win32", reason="Reliance on bash script not supported on Windows"
)
def test_ci_process_command(tmpdir):
repro_dir = tmpdir.join("repro_dir").strpath
@@ -479,7 +479,7 @@ def test_ci_process_command(tmpdir):
@pytest.mark.skipif(
- sys.platform == "win32", reason="Reliance on bash script ot supported on Windows"
+ sys.platform == "win32", reason="Reliance on bash script not supported on Windows"
)
def test_ci_process_command_fail(tmpdir, monkeypatch):
import subprocess
@@ -526,7 +526,7 @@ def test_ci_run_standalone_tests_missing_requirements(
@pytest.mark.skipif(
- sys.platform == "win32", reason="Reliance on bash script ot supported on Windows"
+ sys.platform == "win32", reason="Reliance on bash script not supported on Windows"
)
def test_ci_run_standalone_tests_not_installed_junit(
tmpdir, working_env, config, mock_packages, mock_test_stage, capfd
@@ -547,7 +547,7 @@ def test_ci_run_standalone_tests_not_installed_junit(
@pytest.mark.skipif(
- sys.platform == "win32", reason="Reliance on bash script ot supported on Windows"
+ sys.platform == "win32", reason="Reliance on bash script not supported on Windows"
)
def test_ci_run_standalone_tests_not_installed_cdash(
tmpdir, working_env, config, mock_packages, mock_test_stage, capfd
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash
index dac7f67f99..48e4c86b42 100755
--- a/share/spack/spack-completion.bash
+++ b/share/spack/spack-completion.bash
@@ -1738,7 +1738,7 @@ _spack_test() {
_spack_test_run() {
if $list_options
then
- SPACK_COMPREPLY="-h --help --alias --fail-fast --fail-first --externals --keep-stage --log-format --log-file --cdash-upload-url --cdash-build --cdash-site --cdash-track --cdash-buildstamp --help-cdash --clean --dirty"
+ SPACK_COMPREPLY="-h --help --alias --fail-fast --fail-first --externals -x --explicit --keep-stage --log-format --log-file --cdash-upload-url --cdash-build --cdash-site --cdash-track --cdash-buildstamp --help-cdash --clean --dirty"
else
_installed_packages
fi