summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-05-16 15:09:42 +0100
committerJames Ennis <james.ennis@codethink.com>2019-05-17 07:33:15 +0000
commit220404db88b3fc5faae8cc14583ce5a89810cd52 (patch)
treea76a8c48c63e1ca25dd883e76381346e0fe13934 /tests
parent8a16aa6f7af238fb77e90c6f4e7d4f1457507b85 (diff)
downloadbuildstream-220404db88b3fc5faae8cc14583ce5a89810cd52.tar.gz
element.py: fix init_workspace for multiple sourcesraoul/440-fix
Noticed a mistake that got into !1214, so only the last source gets initialised in a workspace. Added a test for this.
Diffstat (limited to 'tests')
-rw-r--r--tests/frontend/workspace.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index 1db23ccc4..0f5d73db8 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -1231,6 +1231,35 @@ def test_external_list(cli, datafiles, tmpdir_factory):
result.assert_success()
+@pytest.mark.datafiles(DATA_DIR)
+def test_multisource_workspace(cli, datafiles, tmpdir):
+ # checks that if an element has multiple sources, then the opened workspace
+ # will contain them
+ project = str(datafiles)
+ element_name = "multisource.bst"
+ element = {
+ 'kind': 'import',
+ 'sources': [{
+ 'kind': 'local',
+ 'path': 'files/bin-files'
+ }, {
+ 'kind': 'local',
+ 'path': 'files/dev-files'
+ }]
+ }
+ element_path = os.path.join(project, 'elements', element_name)
+ _yaml.dump(element, element_path)
+
+ workspace_dir = os.path.join(str(tmpdir), 'multisource')
+ res = cli.run(project=project,
+ args=['workspace', 'open', 'multisource.bst',
+ '--directory', workspace_dir])
+ res.assert_success()
+
+ directories = os.listdir(os.path.join(workspace_dir, 'usr'))
+ assert 'bin' in directories and 'include' in directories
+
+
# This strange test tests against a regression raised in issue #919,
# where opening a workspace on a runtime dependency of a build only
# dependency causes `bst build` to not build the specified target