Don't report configure errors to CDash for successful packages (#23286)

Convert configure errors detected by our log scraper into warnings when
the package being installed reports that it was successful.
This commit is contained in:
Zack Galbreath
2021-04-27 14:20:32 -04:00
committed by GitHub
parent 07e50c1732
commit 295377b2b4
3 changed files with 61 additions and 9 deletions

View File

@@ -161,14 +161,21 @@ def build_report_for_package(self, directory_name, package, duration):
report_data[phase]['log'] = \
'\n'.join(report_data[phase]['loglines'])
errors, warnings = parse_log_events(report_data[phase]['loglines'])
# Convert errors to warnings if the package reported success.
if package['result'] == 'success':
warnings = errors + warnings
errors = []
# Cap the number of errors and warnings at 50 each.
errors = errors[:50]
warnings = warnings[:50]
nerrors = len(errors)
if phase == 'configure' and nerrors > 0:
report_data[phase]['status'] = 1
if nerrors > 0:
self.success = False
if phase == 'configure':
report_data[phase]['status'] = 1
if phase == 'build':
# Convert log output from ASCII to Unicode and escape for XML.
@@ -189,13 +196,6 @@ def clean_log_event(event):
event['source_file'])
return event
# Convert errors to warnings if the package reported success.
if package['result'] == 'success':
warnings = errors + warnings
errors = []
else:
self.success = False
report_data[phase]['errors'] = []
report_data[phase]['warnings'] = []
for error in errors:

View File

@@ -743,6 +743,25 @@ def test_cdash_auth_token(tmpdir, install_mockery, capfd):
assert 'Using CDash auth token from environment' in out
@pytest.mark.disable_clean_stage_check
def test_cdash_configure_warning(tmpdir, mock_fetch, install_mockery, capfd):
# capfd interferes with Spack's capturing of e.g., Build.xml output
with capfd.disabled():
with tmpdir.as_cwd():
# Test would fail if install raised an error.
install(
'--log-file=cdash_reports',
'--log-format=cdash',
'configure-warning')
# Verify Configure.xml exists with expected contents.
report_dir = tmpdir.join('cdash_reports')
assert report_dir in tmpdir.listdir()
report_file = report_dir.join('Configure.xml')
assert report_file in report_dir.listdir()
content = report_file.open().read()
assert 'foo: No such file or directory' in content
def test_compiler_bootstrap(
install_mockery_mutable_config, mock_packages, mock_fetch,
mock_archive, mutable_config, monkeypatch):