summaryrefslogtreecommitdiff
path: root/tests/frontend/buildcheckout.py
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-01-22 07:57:47 +0100
committerJürg Billeter <j@bitron.ch>2019-01-24 14:38:50 +0100
commit3642c8e7b8106d4b8fba4f87d97f948c555a3d61 (patch)
tree29a07700b2d5c907ac85f0c713d05a67e5bfdb52 /tests/frontend/buildcheckout.py
parent99b5c0af611f1eaa2eff710c3e9ee4ff5325d301 (diff)
downloadbuildstream-3642c8e7b8106d4b8fba4f87d97f948c555a3d61.tar.gz
tests/frontend/buildcheckout.py: Add default target test with junction
Test that `bst build` does not fail in a project where the list of default targets includes a junction (junctions cannot be built).
Diffstat (limited to 'tests/frontend/buildcheckout.py')
-rw-r--r--tests/frontend/buildcheckout.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py
index 156fab990..b35b14820 100644
--- a/tests/frontend/buildcheckout.py
+++ b/tests/frontend/buildcheckout.py
@@ -580,6 +580,53 @@ def test_build_checkout_junction(cli, tmpdir, datafiles):
assert contents == 'animal=Pony\n'
+# Test that default targets work with projects with junctions
+@pytest.mark.datafiles(DATA_DIR + "_world")
+def test_build_checkout_junction_default_targets(cli, tmpdir, datafiles):
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ 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')
+ checkout = os.path.join(cli.directory, 'checkout')
+
+ # Create a repo to hold the subproject and generate a junction element for it
+ ref = generate_junction(tmpdir, subproject_path, junction_path)
+
+ # Create a stack element to depend on a cross junction element
+ #
+ element = {
+ 'kind': 'stack',
+ 'depends': [
+ {
+ 'junction': 'junction.bst',
+ 'filename': 'import-etc.bst'
+ }
+ ]
+ }
+ _yaml.dump(element, element_path)
+
+ # Now try to build it, this should automatically result in fetching
+ # the junction itself at load time.
+ result = cli.run(project=project, args=['build'])
+ result.assert_success()
+
+ # Assert that it's cached now
+ assert cli.get_element_state(project, 'junction-dep.bst') == 'cached'
+
+ # Now check it out
+ result = cli.run(project=project, args=[
+ 'artifact', 'checkout', 'junction-dep.bst', '--directory', checkout
+ ])
+ result.assert_success()
+
+ # Assert the content of /etc/animal.conf
+ filename = os.path.join(checkout, 'etc', 'animal.conf')
+ assert os.path.exists(filename)
+ with open(filename, 'r') as f:
+ contents = f.read()
+ assert contents == 'animal=Pony\n'
+
+
@pytest.mark.datafiles(DATA_DIR)
def test_build_checkout_workspaced_junction(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)