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
This commit is contained in:
Zack Galbreath 2023-02-10 13:01:05 -05:00 committed by GitHub
parent ecf93c77ae
commit 82041ac5a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 14 deletions

View File

@ -530,10 +530,9 @@ def ci_rebuild(args):
if not verify_binaries: if not verify_binaries:
install_args.append("--no-check-signature") install_args.append("--no-check-signature")
cdash_args = []
if cdash_handler: if cdash_handler:
# Add additional arguments to `spack install` for CDash reporting. # 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()) slash_hash = "/{}".format(job_spec.dag_hash())
deps_install_args = install_args deps_install_args = install_args

View File

@ -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): def create_reporter(args, specs_to_test, test_suite):
if args.log_format is None: if args.log_format is None:
return None return None
filename = args.cdash_upload_url filename = report_filename(args, test_suite)
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
context_manager = spack.report.test_context_manager( context_manager = spack.report.test_context_manager(
reporter=args.reporter(), reporter=args.reporter(),
filename=filename, filename=filename,

View File

@ -319,3 +319,26 @@ def test_test_results_status(mock_packages, mock_test_stage, status, expected):
else: else:
assert status in results assert status in results
assert expected 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"