diff options
author | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2019-07-26 13:18:13 +0100 |
---|---|---|
committer | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2019-07-26 13:23:46 +0100 |
commit | 847ce7255a90deb52dbdeab3a142517c50cd1eca (patch) | |
tree | 79b6599428ee7022cb9f75db424b92afbae61bc7 | |
parent | 638f213ed07d2209ff827a6710e5dea97d0b60f0 (diff) | |
download | buildstream-847ce7255a90deb52dbdeab3a142517c50cd1eca.tar.gz |
tests: Check that progress tallies are correct, including across junctions
-rw-r--r-- | tests/frontend/show.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/frontend/show.py b/tests/frontend/show.py index d173fd80a..0aa720681 100644 --- a/tests/frontend/show.py +++ b/tests/frontend/show.py @@ -40,6 +40,16 @@ def test_show(cli, datafiles, target, fmt, expected): .format(expected, result.output)) +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'project')) +def test_show_progress_tally(cli, datafiles): + # Check that the progress reporting messages give correct tallies + project = str(datafiles) + result = cli.run(project=project, args=['show', 'compose-all.bst']) + result.assert_success() + assert " 3 subtasks processed" in result.stderr + assert "3 of 3 subtasks processed" in result.stderr + + @pytest.mark.datafiles(os.path.join( os.path.dirname(os.path.realpath(__file__)), "invalid_element_path", @@ -387,6 +397,40 @@ def test_fetched_junction(cli, tmpdir, datafiles, element_name, workspaced): assert 'junction.bst:import-etc.bst-buildable' in results +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'project')) +def test_junction_tally(cli, tmpdir, datafiles): + # Check that the progress reporting messages count elements in junctions + project = str(datafiles) + subproject_path = os.path.join(project, 'files', 'sub-project') + junction_path = os.path.join(project, 'elements', 'junction.bst') + element_path = os.path.join(project, 'elements', 'junction-dep.bst') + + # Create a repo to hold the subproject and generate a junction element for it + generate_junction(tmpdir, subproject_path, junction_path, store_ref=True) + + # Create a stack element to depend on a cross junction element + # + element = { + 'kind': 'stack', + 'depends': [ + { + 'junction': 'junction.bst', + 'filename': 'import-etc.bst' + } + ] + } + _yaml.roundtrip_dump(element, element_path) + + result = cli.run(project=project, silent=True, args=[ + 'source', 'fetch', 'junction.bst']) + result.assert_success() + + # Assert the correct progress tallies are in the logging + result = cli.run(project=project, args=['show', 'junction-dep.bst']) + assert " 2 subtasks processed" in result.stderr + assert "2 of 2 subtasks processed" in result.stderr + + ############################################################### # Testing recursion depth # ############################################################### |