tests: Fix filter tests not checking whether files should be missing.

They weren't actually catching it if you checked-out the entire depended
element, instead of just the specified split domains
diff --git a/tests/plugins/filter.py b/tests/plugins/filter.py
index 45d6794..4a5ff34 100644
--- a/tests/plugins/filter.py
+++ b/tests/plugins/filter.py
@@ -21,6 +21,20 @@
     result = cli.run(project=project, args=['checkout', 'output-include.bst', checkout])
     result.assert_success()
     assert 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_include_dynamic(datafiles, cli, tmpdir):
+    project = os.path.join(datafiles.dirname, datafiles.basename)
+    result = cli.run(project=project, args=['build', 'output-dynamic-include.bst'])
+    result.assert_success()
+
+    checkout = os.path.join(tmpdir.dirname, tmpdir.basename, 'checkout')
+    result = cli.run(project=project, args=['checkout', 'output-dynamic-include.bst', checkout])
+    result.assert_success()
+    assert 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'))
@@ -32,6 +46,7 @@
     checkout = os.path.join(tmpdir.dirname, tmpdir.basename, 'checkout')
     result = cli.run(project=project, args=['checkout', 'output-exclude.bst', checkout])
     result.assert_success()
+    assert not os.path.exists(os.path.join(checkout, "foo"))
     assert os.path.exists(os.path.join(checkout, "bar"))
 
 
diff --git a/tests/plugins/filter/basic/element_plugins/dynamic.py b/tests/plugins/filter/basic/element_plugins/dynamic.py
new file mode 100644
index 0000000..1208a4a
--- /dev/null
+++ b/tests/plugins/filter/basic/element_plugins/dynamic.py
@@ -0,0 +1,35 @@
+from buildstream import Element, Scope
+
+
+# Copies files from the dependent element but inserts split-rules using dynamic data
+class DynamicElement(Element):
+    def configure(self, node):
+        self.node_validate(node, ['split-rules'])
+        self.split_rules = self.node_get_member(node, dict, 'split-rules')
+
+    def preflight(self):
+        pass
+
+    def get_unique_key(self):
+        return {'split-rules': self.split_rules}
+
+    def configure_sandbox(self, sandbox):
+        pass
+
+    def stage(self, sandbox):
+        pass
+
+    def assemble(self, sandbox):
+        with self.timed_activity("Staging artifact", silent_nested=True):
+            for dep in self.dependencies(Scope.BUILD):
+                dep.stage_artifact(sandbox)
+
+        bstdata = self.get_public_data("bst")
+        bstdata["split-rules"] = self.split_rules
+        self.set_public_data("bst", bstdata)
+
+        return ""
+
+
+def setup():
+    return DynamicElement
diff --git a/tests/plugins/filter/basic/elements/input-dynamic.bst b/tests/plugins/filter/basic/elements/input-dynamic.bst
new file mode 100644
index 0000000..e39cefe
--- /dev/null
+++ b/tests/plugins/filter/basic/elements/input-dynamic.bst
@@ -0,0 +1,10 @@
+kind: dynamic
+depends:
+- filename: input.bst
+  type: build
+config:
+  split-rules:
+    foo:
+    - /foo
+    bar:
+    - /bar
diff --git a/tests/plugins/filter/basic/elements/output-dynamic-include.bst b/tests/plugins/filter/basic/elements/output-dynamic-include.bst
new file mode 100644
index 0000000..ea45c96
--- /dev/null
+++ b/tests/plugins/filter/basic/elements/output-dynamic-include.bst
@@ -0,0 +1,7 @@
+kind: filter
+depends:
+- filename: input-dynamic.bst
+  type: build
+config:
+  include:
+  - foo
diff --git a/tests/plugins/filter/basic/project.conf b/tests/plugins/filter/basic/project.conf
index 6275225..418ed02 100644
--- a/tests/plugins/filter/basic/project.conf
+++ b/tests/plugins/filter/basic/project.conf
@@ -1,2 +1,7 @@
 name: test
 element-path: elements
+plugins:
+- origin: local
+  path: element_plugins
+  elements:
+    dynamic: 0