summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZack Galbreath <zack.galbreath@kitware.com>2023-02-10 13:01:05 -0500
committerGitHub <noreply@github.com>2023-02-10 12:01:05 -0600
commit82041ac5a30ec551fd45b8db3ae8ee4366d3a1aa (patch)
tree1366b8077039e9fd0617044940dcd7c13ca4135e /lib
parentecf93c77aec46b05a68cf3d38c2bf96f152e2ff2 (diff)
downloadspack-82041ac5a30ec551fd45b8db3ae8ee4366d3a1aa.tar.gz
spack-82041ac5a30ec551fd45b8db3ae8ee4366d3a1aa.tar.bz2
spack-82041ac5a30ec551fd45b8db3ae8ee4366d3a1aa.tar.xz
spack-82041ac5a30ec551fd45b8db3ae8ee4366d3a1aa.zip
Restore our ability to submit build/test results to CDash from GitLab CI (#35328)
* Restore our ability to submit build/test results to CDash from GitLab CI * Don't use CDash upload URL as report filename
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/ci.py3
-rw-r--r--lib/spack/spack/cmd/test.py24
-rw-r--r--lib/spack/spack/test/cmd/test.py23
3 files changed, 36 insertions, 14 deletions
diff --git a/lib/spack/spack/cmd/ci.py b/lib/spack/spack/cmd/ci.py
index 1b695284b8..aadc47fc2c 100644
--- a/lib/spack/spack/cmd/ci.py
+++ b/lib/spack/spack/cmd/ci.py
@@ -530,10 +530,9 @@ def ci_rebuild(args):
if not verify_binaries:
install_args.append("--no-check-signature")
- cdash_args = []
if cdash_handler:
# Add additional arguments to `spack install` for CDash reporting.
- cdash_args.extend(cdash_handler.args())
+ install_args.extend(cdash_handler.args())
slash_hash = "/{}".format(job_spec.dag_hash())
deps_install_args = install_args
diff --git a/lib/spack/spack/cmd/test.py b/lib/spack/spack/cmd/test.py
index f3248f4eb5..bac2f30f81 100644
--- a/lib/spack/spack/cmd/test.py
+++ b/lib/spack/spack/cmd/test.py
@@ -227,22 +227,22 @@ def test_run(args):
)
+def report_filename(args, test_suite):
+ if args.log_file:
+ if os.path.isabs(args.log_file):
+ return args.log_file
+ else:
+ log_dir = os.getcwd()
+ return os.path.join(log_dir, args.log_file)
+ else:
+ return os.path.join(os.getcwd(), "test-%s" % test_suite.name)
+
+
def create_reporter(args, specs_to_test, test_suite):
if args.log_format is None:
return None
- filename = args.cdash_upload_url
- if not filename:
- if args.log_file:
- if os.path.isabs(args.log_file):
- log_file = args.log_file
- else:
- log_dir = os.getcwd()
- log_file = os.path.join(log_dir, args.log_file)
- else:
- log_file = os.path.join(os.getcwd(), "test-%s" % test_suite.name)
- filename = log_file
-
+ filename = report_filename(args, test_suite)
context_manager = spack.report.test_context_manager(
reporter=args.reporter(),
filename=filename,
diff --git a/lib/spack/spack/test/cmd/test.py b/lib/spack/spack/test/cmd/test.py
index 14cf5c3c6b..b76d0494df 100644
--- a/lib/spack/spack/test/cmd/test.py
+++ b/lib/spack/spack/test/cmd/test.py
@@ -319,3 +319,26 @@ def test_test_results_status(mock_packages, mock_test_stage, status, expected):
else:
assert status in results
assert expected in results
+
+
+@pytest.mark.regression("35337")
+def test_report_filename_for_cdash(install_mockery_mutable_config, mock_fetch):
+ """Test that the temporary file used to write Testing.xml for CDash is not the upload URL"""
+ name = "trivial"
+ spec = spack.spec.Spec("trivial-smoke-test").concretized()
+ suite = spack.install_test.TestSuite([spec], name)
+ suite.ensure_stage()
+
+ parser = argparse.ArgumentParser()
+ spack.cmd.test.setup_parser(parser)
+ args = parser.parse_args(
+ [
+ "run",
+ "--cdash-upload-url=https://blahblah/submit.php?project=debugging",
+ "trivial-smoke-test",
+ ]
+ )
+
+ spack.cmd.common.arguments.sanitize_reporter_options(args)
+ filename = spack.cmd.test.report_filename(args, suite)
+ assert filename != "https://blahblah/submit.php?project=debugging"