diff options
author | Zack Galbreath <zack.galbreath@kitware.com> | 2021-04-27 14:20:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-27 12:20:32 -0600 |
commit | 295377b2b4695f30e79f4bd877fd85476a8febb9 (patch) | |
tree | 6dbcd0978500042f6d6c56174fba8eb6df3b37cb /lib | |
parent | 07e50c1732e1f0aef81f4e54d488826bf17625fa (diff) | |
download | spack-295377b2b4695f30e79f4bd877fd85476a8febb9.tar.gz spack-295377b2b4695f30e79f4bd877fd85476a8febb9.tar.bz2 spack-295377b2b4695f30e79f4bd877fd85476a8febb9.tar.xz spack-295377b2b4695f30e79f4bd877fd85476a8febb9.zip |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/reporters/cdash.py | 18 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/install.py | 19 |
2 files changed, 28 insertions, 9 deletions
diff --git a/lib/spack/spack/reporters/cdash.py b/lib/spack/spack/reporters/cdash.py index 7adee52917..36660fa890 100644 --- a/lib/spack/spack/reporters/cdash.py +++ b/lib/spack/spack/reporters/cdash.py @@ -161,14 +161,21 @@ class CDash(Reporter): 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 @@ class CDash(Reporter): 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: diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py index 674897b933..73d701c06f 100644 --- a/lib/spack/spack/test/cmd/install.py +++ b/lib/spack/spack/test/cmd/install.py @@ -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): |