summaryrefslogtreecommitdiff
path: root/tests/frontend/workspace.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/frontend/workspace.py')
-rw-r--r--tests/frontend/workspace.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index 8799362e8..1009ad3d8 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -782,3 +782,54 @@ def test_cache_key_workspace_in_dependencies(cli, tmpdir, datafiles, strict):
# Check that the original /usr/bin/hello is not in the checkout
assert not os.path.exists(os.path.join(checkout, 'usr', 'bin', 'hello'))
+
+
+# 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
+# but just successfully builds the workspaced element and happily
+# exits without completing the build.
+#
+TEST_DIR = os.path.join(
+ os.path.dirname(os.path.realpath(__file__))
+)
+
+
+@pytest.mark.datafiles(TEST_DIR)
+@pytest.mark.parametrize(
+ ["case", "non_workspaced_elements_state"],
+ [
+ ("workspaced-build-dep", ["waiting", "waiting", "waiting", "waiting", "waiting"]),
+ ("workspaced-runtime-dep", ["buildable", "buildable", "waiting", "waiting", "waiting"])
+ ],
+)
+@pytest.mark.parametrize("strict", [("strict"), ("non-strict")])
+def test_build_all(cli, tmpdir, datafiles, case, strict, non_workspaced_elements_state):
+ project = os.path.join(str(datafiles), case)
+ workspace = os.path.join(str(tmpdir), 'workspace')
+ non_leaf_elements = ["elem2.bst", "elem3.bst", "stack.bst", "elem4.bst", "elem5.bst"]
+ all_elements = ["elem1.bst", *non_leaf_elements]
+
+ # Configure strict mode
+ strict_mode = True
+ if strict != 'strict':
+ strict_mode = False
+ cli.configure({
+ 'projects': {
+ 'test': {
+ 'strict': strict_mode
+ }
+ }
+ })
+
+ # First open the workspace
+ result = cli.run(project=project, args=['workspace', 'open', 'elem1.bst', workspace])
+ result.assert_success()
+
+ # Now build the targets elem4.bst and elem5.bst
+ result = cli.run(project=project, args=['build', 'elem4.bst', 'elem5.bst'])
+ result.assert_success()
+
+ # Assert that the target is built
+ for element in all_elements:
+ assert cli.get_element_state(project, element) == 'cached'