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:
parent
07e50c1732
commit
295377b2b4
@ -161,14 +161,21 @@ def build_report_for_package(self, directory_name, package, duration):
|
|||||||
report_data[phase]['log'] = \
|
report_data[phase]['log'] = \
|
||||||
'\n'.join(report_data[phase]['loglines'])
|
'\n'.join(report_data[phase]['loglines'])
|
||||||
errors, warnings = parse_log_events(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.
|
# Cap the number of errors and warnings at 50 each.
|
||||||
errors = errors[:50]
|
errors = errors[:50]
|
||||||
warnings = warnings[:50]
|
warnings = warnings[:50]
|
||||||
nerrors = len(errors)
|
nerrors = len(errors)
|
||||||
|
|
||||||
if phase == 'configure' and nerrors > 0:
|
if nerrors > 0:
|
||||||
report_data[phase]['status'] = 1
|
|
||||||
self.success = False
|
self.success = False
|
||||||
|
if phase == 'configure':
|
||||||
|
report_data[phase]['status'] = 1
|
||||||
|
|
||||||
if phase == 'build':
|
if phase == 'build':
|
||||||
# Convert log output from ASCII to Unicode and escape for XML.
|
# Convert log output from ASCII to Unicode and escape for XML.
|
||||||
@ -189,13 +196,6 @@ def clean_log_event(event):
|
|||||||
event['source_file'])
|
event['source_file'])
|
||||||
return event
|
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]['errors'] = []
|
||||||
report_data[phase]['warnings'] = []
|
report_data[phase]['warnings'] = []
|
||||||
for error in errors:
|
for error in errors:
|
||||||
|
@ -743,6 +743,25 @@ def test_cdash_auth_token(tmpdir, install_mockery, capfd):
|
|||||||
assert 'Using CDash auth token from environment' in out
|
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(
|
def test_compiler_bootstrap(
|
||||||
install_mockery_mutable_config, mock_packages, mock_fetch,
|
install_mockery_mutable_config, mock_packages, mock_fetch,
|
||||||
mock_archive, mutable_config, monkeypatch):
|
mock_archive, mutable_config, monkeypatch):
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
|
||||||
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
|
from spack import *
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigureWarning(AutotoolsPackage):
|
||||||
|
"""This package prints output that looks like an error during configure, but
|
||||||
|
it actually installs successfully."""
|
||||||
|
|
||||||
|
homepage = "http://www.example.com"
|
||||||
|
url = "http://www.example.com/configure-warning-1.0.tar.gz"
|
||||||
|
|
||||||
|
version('1.0', '0123456789abcdef0123456789abcdef')
|
||||||
|
|
||||||
|
parallel = False
|
||||||
|
|
||||||
|
def autoreconf(self, spec, prefix):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def configure(self, spec, prefix):
|
||||||
|
print('foo: No such file or directory')
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def build(self, spec, prefix):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def install(self, spec, prefix):
|
||||||
|
# sanity_check_prefix requires something in the install directory
|
||||||
|
# Test requires overriding the one provided by `AutotoolsPackage`
|
||||||
|
mkdirp(prefix.bin)
|
Loading…
Reference in New Issue
Block a user