summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Coldrick <thomas.coldrick@codethink.co.uk>2019-09-10 11:14:45 +0100
committerThomas Coldrick <othko97@gmail.com>2019-09-16 06:55:56 +0000
commitb2af82add70ca6c582d08d916fb243493de397e2 (patch)
tree417f41ff5448489e3589bb5207838768761324a1 /tests
parent8ff9262d9843a8e858a594c787ddbd156b4b3d3b (diff)
downloadbuildstream-b2af82add70ca6c582d08d916fb243493de397e2.tar.gz
filter.py: Fail if parent element is a stack
As stack elements do not provide any artifacts, it is misleading to allow them as dependencies for filter elements. This commit makes a dependency on a stack element a failure with a descriptive error message. Additionally adds a test to make sure this works. Addresses #1104
Diffstat (limited to 'tests')
-rw-r--r--tests/elements/filter.py8
-rw-r--r--tests/elements/filter/basic/elements/forbidden-stack-dep.bst4
-rw-r--r--tests/elements/filter/basic/elements/stack.bst3
3 files changed, 15 insertions, 0 deletions
diff --git a/tests/elements/filter.py b/tests/elements/filter.py
index ea6bd2306..b8dd4351e 100644
--- a/tests/elements/filter.py
+++ b/tests/elements/filter.py
@@ -551,3 +551,11 @@ def test_filter_pass_integration(datafiles, cli):
result = cli.run(project=project, args=['artifact', 'checkout', '--integrate',
'--directory', checkout_dir, 'pass-integration.bst'])
result.assert_main_error(ErrorDomain.STREAM, "missing-command")
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic'))
+def test_filter_stack_depend_failure(datafiles, cli):
+ project = str(datafiles)
+
+ result = cli.run(project=project, args=['build', 'forbidden-stack-dep.bst'])
+ result.assert_main_error(ErrorDomain.ELEMENT, "filter-bdepend-is-stack")
diff --git a/tests/elements/filter/basic/elements/forbidden-stack-dep.bst b/tests/elements/filter/basic/elements/forbidden-stack-dep.bst
new file mode 100644
index 000000000..6624c5d9a
--- /dev/null
+++ b/tests/elements/filter/basic/elements/forbidden-stack-dep.bst
@@ -0,0 +1,4 @@
+kind: filter
+depends:
+- filename: stack.bst
+ type: build
diff --git a/tests/elements/filter/basic/elements/stack.bst b/tests/elements/filter/basic/elements/stack.bst
new file mode 100644
index 000000000..daea67ccf
--- /dev/null
+++ b/tests/elements/filter/basic/elements/stack.bst
@@ -0,0 +1,3 @@
+kind: stack
+depends:
+- filename: input.bst