diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-04-12 21:00:29 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-04-12 21:39:06 +0900 |
commit | fece8cc81e8d8412e32c6667682a33e7d2f9dafe (patch) | |
tree | aeed15fca8bd1a5ba3ffcc2b2238d106f61c5c02 /tests/frontend | |
parent | 95d1dafc688fbc1a76cc50c2c60825d68f64f7c9 (diff) | |
download | buildstream-fece8cc81e8d8412e32c6667682a33e7d2f9dafe.tar.gz |
_frontend/cli.py, _pipeline.py: Add options for cross junction tracking.
This patch makes cross junction tracking disabled by default, which
was the initial intention when landing project.refs but never got around
to doing this (intended to get addressing of junctioned elements via
command line sorted first, but didnt happen).
This adds the following options to enable cross-junction tracking:
o bst build -J / --track-cross-junctions
o bst fetch -J / --track-cross-junctions
o bst track -J / --cross-junctions
This also fixes `bst fetch --track` which had a bug, it was avoiding
to track and fetch elements which are in a `cached` consistency state,
which is wrong when `--track` is specified.
This also updates some test cases which were broken by
this change.
This fixes issue #354
Diffstat (limited to 'tests/frontend')
-rw-r--r-- | tests/frontend/track.py | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/tests/frontend/track.py b/tests/frontend/track.py index 6fa61f343..5142dee45 100644 --- a/tests/frontend/track.py +++ b/tests/frontend/track.py @@ -215,8 +215,9 @@ def test_track_optional(cli, tmpdir, datafiles, ref_storage): @pytest.mark.datafiles(os.path.join(TOP_DIR, 'track-cross-junction')) +@pytest.mark.parametrize("cross_junction", [('cross'), ('nocross')]) @pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')]) -def test_track_cross_junction(cli, tmpdir, datafiles, ref_storage): +def test_track_cross_junction(cli, tmpdir, datafiles, cross_junction, ref_storage): project = os.path.join(datafiles.dirname, datafiles.basename) dev_files_path = os.path.join(project, 'files') target_path = os.path.join(project, 'target.bst') @@ -267,14 +268,27 @@ def test_track_cross_junction(cli, tmpdir, datafiles, ref_storage): assert get_subproject_element_state() == 'no reference' # Track recursively across the junction - result = cli.run(project=project, args=['track', '--deps', 'all', 'target.bst']) + args = ['track', '--deps', 'all'] + if cross_junction == 'cross': + args += ['--cross-junctions'] + args += ['target.bst'] + + result = cli.run(project=project, args=args) if ref_storage == 'inline': - # - # Cross junction tracking is not allowed when the toplevel project - # is using inline ref storage. - # - result.assert_main_error(ErrorDomain.PIPELINE, 'untrackable-sources') + + if cross_junction == 'cross': + # + # Cross junction tracking is not allowed when the toplevel project + # is using inline ref storage. + # + result.assert_main_error(ErrorDomain.PIPELINE, 'untrackable-sources') + else: + # + # No cross juction tracking was requested + # + result.assert_success() + assert get_subproject_element_state() == 'no reference' else: # # Tracking is allowed with project.refs ref storage @@ -282,9 +296,12 @@ def test_track_cross_junction(cli, tmpdir, datafiles, ref_storage): result.assert_success() # - # Assert that we now have a ref for the subproject element + # If cross junction tracking was enabled, we should now be buildable # - assert get_subproject_element_state() == 'buildable' + if cross_junction == 'cross': + assert get_subproject_element_state() == 'buildable' + else: + assert get_subproject_element_state() == 'no reference' @pytest.mark.datafiles(os.path.join(TOP_DIR, 'consistencyerror')) |