summaryrefslogtreecommitdiff
path: root/tests/elements
diff options
context:
space:
mode:
authorJames Ennis <james.ennis@codethink.com>2019-01-30 17:28:21 +0000
committerJames Ennis <james.ennis@codethink.com>2019-02-04 13:53:42 +0000
commitc93450146a63cdae40611024a31908cc4022b499 (patch)
tree60d7c0e9ee216d225c0ccdf9878a1a1b9d0a05dd /tests/elements
parent4109a34a537648d46ac85ab981fc0a2a665cc94e (diff)
downloadbuildstream-c93450146a63cdae40611024a31908cc4022b499.tar.gz
filter.py: Fail if declared domains do not exist in the parent elementjennis/warn_for_nonexistent_domains
This patch also uncovered the fact that our test_filter_deps_ok() test has been inaccurate. Thus the element built in this test (deps-permitted.bst) has been modified so that it build depends on the input.bst element, as it should. tests/filter.py: Ensure deps_ok test passes
Diffstat (limited to 'tests/elements')
-rw-r--r--tests/elements/filter.py11
-rw-r--r--tests/elements/filter/basic/elements/deps-permitted.bst2
-rw-r--r--tests/elements/filter/basic/elements/output-include-nonexistent-domain.bst8
3 files changed, 20 insertions, 1 deletions
diff --git a/tests/elements/filter.py b/tests/elements/filter.py
index 8ff642c64..d40a8bdd1 100644
--- a/tests/elements/filter.py
+++ b/tests/elements/filter.py
@@ -484,3 +484,14 @@ def test_filter_include_with_indirect_deps(datafiles, cli, tmpdir):
# indirect dependencies shouldn't be staged and filtered
assert not os.path.exists(os.path.join(checkout, "foo"))
assert not os.path.exists(os.path.join(checkout, "bar"))
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic'))
+def test_filter_fails_for_nonexisting_domain(datafiles, cli, tmpdir):
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ result = cli.run(project=project, args=['build', 'output-include-nonexistent-domain.bst'])
+ result.assert_main_error(ErrorDomain.STREAM, None)
+
+ error = "Unknown domains were used in output-include-nonexistent-domain.bst [line 7 column 2]"
+ assert error in result.stderr
+ assert '- unknown_file' in result.stderr
diff --git a/tests/elements/filter/basic/elements/deps-permitted.bst b/tests/elements/filter/basic/elements/deps-permitted.bst
index 00883b1f8..9fd41c543 100644
--- a/tests/elements/filter/basic/elements/deps-permitted.bst
+++ b/tests/elements/filter/basic/elements/deps-permitted.bst
@@ -1,6 +1,6 @@
kind: filter
depends:
-- filename: output-include.bst
+- filename: input.bst
type: build
- filename: output-exclude.bst
type: runtime
diff --git a/tests/elements/filter/basic/elements/output-include-nonexistent-domain.bst b/tests/elements/filter/basic/elements/output-include-nonexistent-domain.bst
new file mode 100644
index 000000000..59706375d
--- /dev/null
+++ b/tests/elements/filter/basic/elements/output-include-nonexistent-domain.bst
@@ -0,0 +1,8 @@
+kind: filter
+depends:
+- filename: input.bst
+ type: build
+config:
+ include:
+ - unknown_file
+