summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/frontend/workspace.py55
-rw-r--r--tests/frontend/workspaced-build-dep/elements/elem1.bst5
-rw-r--r--tests/frontend/workspaced-build-dep/elements/elem2.bst8
-rw-r--r--tests/frontend/workspaced-build-dep/elements/elem3.bst8
-rw-r--r--tests/frontend/workspaced-build-dep/elements/elem4.bst8
-rw-r--r--tests/frontend/workspaced-build-dep/elements/elem5.bst8
-rw-r--r--tests/frontend/workspaced-build-dep/elements/stack.bst4
-rw-r--r--tests/frontend/workspaced-build-dep/files/file10
-rw-r--r--tests/frontend/workspaced-build-dep/files/file20
-rw-r--r--tests/frontend/workspaced-build-dep/files/file30
-rw-r--r--tests/frontend/workspaced-build-dep/files/file40
-rw-r--r--tests/frontend/workspaced-build-dep/project.conf8
-rw-r--r--tests/frontend/workspaced-runtime-dep/elements/elem1.bst5
-rw-r--r--tests/frontend/workspaced-runtime-dep/elements/elem2.bst8
-rw-r--r--tests/frontend/workspaced-runtime-dep/elements/elem3.bst8
-rw-r--r--tests/frontend/workspaced-runtime-dep/elements/elem4.bst8
-rw-r--r--tests/frontend/workspaced-runtime-dep/elements/elem5.bst8
-rw-r--r--tests/frontend/workspaced-runtime-dep/elements/stack.bst4
-rw-r--r--tests/frontend/workspaced-runtime-dep/files/file10
-rw-r--r--tests/frontend/workspaced-runtime-dep/files/file20
-rw-r--r--tests/frontend/workspaced-runtime-dep/files/file30
-rw-r--r--tests/frontend/workspaced-runtime-dep/files/file40
-rw-r--r--tests/frontend/workspaced-runtime-dep/project.conf8
23 files changed, 153 insertions, 0 deletions
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index c47424ec6..e570c2899 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -1229,3 +1229,58 @@ def test_external_list(cli, datafiles, tmpdir_factory):
result = cli.run(project=project, args=['-C', workspace, 'workspace', 'list'])
result.assert_success()
+
+
+# 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', '--directory', workspace, 'elem1.bst'])
+ result.assert_success()
+
+ # Ensure all elements are waiting build the first
+ assert cli.get_element_states(project, all_elements) == \
+ dict(zip(all_elements, ['buildable', *non_workspaced_elements_state]))
+
+ # 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
+ assert cli.get_element_states(project, all_elements) == \
+ {elem: "cached" for elem in all_elements}
diff --git a/tests/frontend/workspaced-build-dep/elements/elem1.bst b/tests/frontend/workspaced-build-dep/elements/elem1.bst
new file mode 100644
index 000000000..eed39a95a
--- /dev/null
+++ b/tests/frontend/workspaced-build-dep/elements/elem1.bst
@@ -0,0 +1,5 @@
+kind: import
+
+sources:
+- kind: local
+ path: files/file1
diff --git a/tests/frontend/workspaced-build-dep/elements/elem2.bst b/tests/frontend/workspaced-build-dep/elements/elem2.bst
new file mode 100644
index 000000000..78af3ba44
--- /dev/null
+++ b/tests/frontend/workspaced-build-dep/elements/elem2.bst
@@ -0,0 +1,8 @@
+kind: import
+
+build-depends:
+- elem1.bst
+
+sources:
+- kind: local
+ path: files/file2
diff --git a/tests/frontend/workspaced-build-dep/elements/elem3.bst b/tests/frontend/workspaced-build-dep/elements/elem3.bst
new file mode 100644
index 000000000..6e1de0de4
--- /dev/null
+++ b/tests/frontend/workspaced-build-dep/elements/elem3.bst
@@ -0,0 +1,8 @@
+kind: import
+
+build-depends:
+- elem2.bst
+
+sources:
+- kind: local
+ path: files/file3
diff --git a/tests/frontend/workspaced-build-dep/elements/elem4.bst b/tests/frontend/workspaced-build-dep/elements/elem4.bst
new file mode 100644
index 000000000..a04f509a6
--- /dev/null
+++ b/tests/frontend/workspaced-build-dep/elements/elem4.bst
@@ -0,0 +1,8 @@
+kind: import
+
+build-depends:
+- stack.bst
+
+sources:
+- kind: local
+ path: files/file4
diff --git a/tests/frontend/workspaced-build-dep/elements/elem5.bst b/tests/frontend/workspaced-build-dep/elements/elem5.bst
new file mode 100644
index 000000000..4fb3af822
--- /dev/null
+++ b/tests/frontend/workspaced-build-dep/elements/elem5.bst
@@ -0,0 +1,8 @@
+kind: import
+
+build-depends:
+- elem3.bst
+
+sources:
+- kind: local
+ path: files/file4
diff --git a/tests/frontend/workspaced-build-dep/elements/stack.bst b/tests/frontend/workspaced-build-dep/elements/stack.bst
new file mode 100644
index 000000000..b4c6002f0
--- /dev/null
+++ b/tests/frontend/workspaced-build-dep/elements/stack.bst
@@ -0,0 +1,4 @@
+kind: stack
+
+depends:
+- elem3.bst
diff --git a/tests/frontend/workspaced-build-dep/files/file1 b/tests/frontend/workspaced-build-dep/files/file1
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/frontend/workspaced-build-dep/files/file1
diff --git a/tests/frontend/workspaced-build-dep/files/file2 b/tests/frontend/workspaced-build-dep/files/file2
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/frontend/workspaced-build-dep/files/file2
diff --git a/tests/frontend/workspaced-build-dep/files/file3 b/tests/frontend/workspaced-build-dep/files/file3
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/frontend/workspaced-build-dep/files/file3
diff --git a/tests/frontend/workspaced-build-dep/files/file4 b/tests/frontend/workspaced-build-dep/files/file4
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/frontend/workspaced-build-dep/files/file4
diff --git a/tests/frontend/workspaced-build-dep/project.conf b/tests/frontend/workspaced-build-dep/project.conf
new file mode 100644
index 000000000..e017957da
--- /dev/null
+++ b/tests/frontend/workspaced-build-dep/project.conf
@@ -0,0 +1,8 @@
+# Unique project name
+name: test
+
+# Required BuildStream format version
+format-version: 12
+
+# Subdirectory where elements are stored
+element-path: elements
diff --git a/tests/frontend/workspaced-runtime-dep/elements/elem1.bst b/tests/frontend/workspaced-runtime-dep/elements/elem1.bst
new file mode 100644
index 000000000..eed39a95a
--- /dev/null
+++ b/tests/frontend/workspaced-runtime-dep/elements/elem1.bst
@@ -0,0 +1,5 @@
+kind: import
+
+sources:
+- kind: local
+ path: files/file1
diff --git a/tests/frontend/workspaced-runtime-dep/elements/elem2.bst b/tests/frontend/workspaced-runtime-dep/elements/elem2.bst
new file mode 100644
index 000000000..a841b9fd0
--- /dev/null
+++ b/tests/frontend/workspaced-runtime-dep/elements/elem2.bst
@@ -0,0 +1,8 @@
+kind: import
+
+runtime-depends:
+- elem1.bst
+
+sources:
+- kind: local
+ path: files/file2
diff --git a/tests/frontend/workspaced-runtime-dep/elements/elem3.bst b/tests/frontend/workspaced-runtime-dep/elements/elem3.bst
new file mode 100644
index 000000000..d817f4bb0
--- /dev/null
+++ b/tests/frontend/workspaced-runtime-dep/elements/elem3.bst
@@ -0,0 +1,8 @@
+kind: import
+
+runtime-depends:
+- elem2.bst
+
+sources:
+- kind: local
+ path: files/file3
diff --git a/tests/frontend/workspaced-runtime-dep/elements/elem4.bst b/tests/frontend/workspaced-runtime-dep/elements/elem4.bst
new file mode 100644
index 000000000..a04f509a6
--- /dev/null
+++ b/tests/frontend/workspaced-runtime-dep/elements/elem4.bst
@@ -0,0 +1,8 @@
+kind: import
+
+build-depends:
+- stack.bst
+
+sources:
+- kind: local
+ path: files/file4
diff --git a/tests/frontend/workspaced-runtime-dep/elements/elem5.bst b/tests/frontend/workspaced-runtime-dep/elements/elem5.bst
new file mode 100644
index 000000000..4fb3af822
--- /dev/null
+++ b/tests/frontend/workspaced-runtime-dep/elements/elem5.bst
@@ -0,0 +1,8 @@
+kind: import
+
+build-depends:
+- elem3.bst
+
+sources:
+- kind: local
+ path: files/file4
diff --git a/tests/frontend/workspaced-runtime-dep/elements/stack.bst b/tests/frontend/workspaced-runtime-dep/elements/stack.bst
new file mode 100644
index 000000000..b4c6002f0
--- /dev/null
+++ b/tests/frontend/workspaced-runtime-dep/elements/stack.bst
@@ -0,0 +1,4 @@
+kind: stack
+
+depends:
+- elem3.bst
diff --git a/tests/frontend/workspaced-runtime-dep/files/file1 b/tests/frontend/workspaced-runtime-dep/files/file1
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/frontend/workspaced-runtime-dep/files/file1
diff --git a/tests/frontend/workspaced-runtime-dep/files/file2 b/tests/frontend/workspaced-runtime-dep/files/file2
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/frontend/workspaced-runtime-dep/files/file2
diff --git a/tests/frontend/workspaced-runtime-dep/files/file3 b/tests/frontend/workspaced-runtime-dep/files/file3
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/frontend/workspaced-runtime-dep/files/file3
diff --git a/tests/frontend/workspaced-runtime-dep/files/file4 b/tests/frontend/workspaced-runtime-dep/files/file4
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/frontend/workspaced-runtime-dep/files/file4
diff --git a/tests/frontend/workspaced-runtime-dep/project.conf b/tests/frontend/workspaced-runtime-dep/project.conf
new file mode 100644
index 000000000..e017957da
--- /dev/null
+++ b/tests/frontend/workspaced-runtime-dep/project.conf
@@ -0,0 +1,8 @@
+# Unique project name
+name: test
+
+# Required BuildStream format version
+format-version: 12
+
+# Subdirectory where elements are stored
+element-path: elements