diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-05-21 14:08:46 +0100 |
---|---|---|
committer | Angelos Evripiotis <angelos.evripiotis@gmail.com> | 2019-05-22 09:02:03 +0000 |
commit | c7430dd6941bde02477b146aa1b9a84a18db60a3 (patch) | |
tree | 941a978889885049523e0cb2aff9ad84aa8f94ff /tests | |
parent | 25172ed2d7b39cab799b1f2788d818d39ce3ee33 (diff) | |
download | buildstream-c7430dd6941bde02477b146aa1b9a84a18db60a3.tar.gz |
tests/frontend/logging.py: fix error message regex
This regex was not matching, and therefore the assert was not doing
anything.
Fix the regex to match BuildStream's current output.
Add a check to make sure that we get exactly the number of expected
matches. This means we get an obvious error if the regex stops matching
again.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/frontend/logging.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/frontend/logging.py b/tests/frontend/logging.py index e7279ac4c..31a2dd909 100644 --- a/tests/frontend/logging.py +++ b/tests/frontend/logging.py @@ -109,8 +109,19 @@ def test_failed_build_listing(cli, datafiles): result = cli.run(project=project, args=['--on-error=continue', 'build', *element_names]) result.assert_main_error(ErrorDomain.STREAM, None) + # Check that we re-print the failure summaries only in the "Failure Summary" + # section. + # e.g. + # + # Failure Summary + # testfail-0.bst: + # [00:00:00][44f1b8c3][ build:testfail-0.bst ] FAILURE Running 'commands' + # failure_heading_pos = re.search(r'^Failure Summary$', result.stderr, re.MULTILINE).start() pipeline_heading_pos = re.search(r'^Pipeline Summary$', result.stderr, re.MULTILINE).start() failure_summary_range = range(failure_heading_pos, pipeline_heading_pos) - assert all(m.start() in failure_summary_range and m.end() in failure_summary_range - for m in re.finditer(r'^\s+testfail-.\.bst.+?\s+Log file', result.stderr, re.MULTILINE)) + matches = tuple(re.finditer(r'^\s+testfail-.\.bst:$', result.stderr, re.MULTILINE)) + for m in matches: + assert m.start() in failure_summary_range + assert m.end() in failure_summary_range + assert len(matches) == 3 # each element should be matched once. |