diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2018-03-26 17:55:36 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-04-12 18:03:09 +0000 |
commit | eb522a4f16eb09a6d87443aed745d163472d728a (patch) | |
tree | 07cca1888a37c03b6b239c364a519ed7dba9c58d | |
parent | fc6d192dae90bfd9efd46ffc2d533b66f2968b6b (diff) | |
download | buildstream-eb522a4f16eb09a6d87443aed745d163472d728a.tar.gz |
tests: Check that output includes log files of failed builds
-rw-r--r-- | tests/frontend/logging.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/frontend/logging.py b/tests/frontend/logging.py index 5bfdbd6eb..46749f5d2 100644 --- a/tests/frontend/logging.py +++ b/tests/frontend/logging.py @@ -4,6 +4,7 @@ import re from tests.testutils import cli, create_repo, ALL_REPO_KINDS from buildstream import _yaml +from buildstream._exceptions import ErrorDomain # Project directory DATA_DIR = os.path.join( @@ -79,3 +80,30 @@ def test_custom_logging(cli, tmpdir, datafiles): m = re.search("\d\d:\d\d:\d\d,\d\d:\d\d:\d\d.\d{6},\d\d:\d\d:\d\d,,,SUCCESS,Checking sources", result.stderr) assert(m is not None) + + +@pytest.mark.datafiles(DATA_DIR) +def test_failed_build_listing(cli, tmpdir, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + element_names = [] + for i in range(3): + element_name = 'testfail-{}.bst'.format(i) + element_path = os.path.join('elements', element_name) + element = { + 'kind': 'script', + 'config': { + 'commands': [ + 'false' + ] + } + } + _yaml.dump(element, os.path.join(project, element_path)) + element_names.append(element_name) + result = cli.run(project=project, args=['--on-error=continue', 'build'] + element_names) + result.assert_main_error(ErrorDomain.PIPELINE, None) + + 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)) |