diff options
author | Valentin David <valentin.david@codethink.co.uk> | 2018-05-04 16:26:50 +0200 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-06-08 21:07:22 +0000 |
commit | af10c1ba62ebf030511ccb38ae58b7baffa4032f (patch) | |
tree | da6dd78dc0d13b04e1808fbec2436f459fb295b0 /tests/loader | |
parent | 8f2bf4e6e97f3ff859653c6cf60010ce9a2ebca0 (diff) | |
download | buildstream-af10c1ba62ebf030511ccb38ae58b7baffa4032f.tar.gz |
Interpret names as colon separated junction path in loader.
'a.bst:b.bst' gets interpreted as 'b.bst' from junction 'a.bst'.
Part of #359.
Diffstat (limited to 'tests/loader')
-rw-r--r-- | tests/loader/junctions.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/loader/junctions.py b/tests/loader/junctions.py index 635a987bd..a02961fb5 100644 --- a/tests/loader/junctions.py +++ b/tests/loader/junctions.py @@ -260,3 +260,43 @@ def test_git_build(cli, tmpdir, datafiles): # Check that the checkout contains the expected files from both projects assert(os.path.exists(os.path.join(checkoutdir, 'base.txt'))) assert(os.path.exists(os.path.join(checkoutdir, 'foo.txt'))) + + +@pytest.mark.datafiles(DATA_DIR) +def test_cross_junction_names(cli, tmpdir, datafiles): + project = os.path.join(str(datafiles), 'foo') + copy_subprojects(project, datafiles, ['base']) + + element_list = cli.get_pipeline(project, ['base.bst:target.bst']) + assert 'base.bst:target.bst' in element_list + + +@pytest.mark.datafiles(DATA_DIR) +def test_build_git_cross_junction_names(cli, tmpdir, datafiles): + project = os.path.join(str(datafiles), 'foo') + checkoutdir = os.path.join(str(tmpdir), "checkout") + + # Create the repo from 'base' subdir + repo = create_repo('git', str(tmpdir)) + ref = repo.create(os.path.join(str(datafiles), 'base')) + + # Write out junction element with git source + element = { + 'kind': 'junction', + 'sources': [ + repo.source_config(ref=ref) + ] + } + _yaml.dump(element, os.path.join(project, 'base.bst')) + + print(element) + print(cli.get_pipeline(project, ['base.bst'])) + + # Build (with implicit fetch of subproject), checkout + result = cli.run(project=project, args=['build', 'base.bst:target.bst']) + assert result.exit_code == 0 + result = cli.run(project=project, args=['checkout', 'base.bst:target.bst', checkoutdir]) + assert result.exit_code == 0 + + # Check that the checkout contains the expected files from both projects + assert(os.path.exists(os.path.join(checkoutdir, 'base.txt'))) |