summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/filter.py36
-rw-r--r--tests/integration/project/elements/filter/filter.bst16
-rw-r--r--tests/integration/project/elements/filter/parent.bst20
3 files changed, 72 insertions, 0 deletions
diff --git a/tests/integration/filter.py b/tests/integration/filter.py
new file mode 100644
index 000000000..1d9c11b01
--- /dev/null
+++ b/tests/integration/filter.py
@@ -0,0 +1,36 @@
+# Pylint doesn't play well with fixtures and dependency injection from pytest
+# pylint: disable=redefined-outer-name
+
+import os
+import shutil
+import pytest
+
+from buildstream.testing import cli # pylint: disable=unused-import
+from buildstream.testing.integration import assert_contains
+from buildstream.testing._utils.site import HAVE_SANDBOX
+
+
+DATA_DIR = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)),
+ 'project'
+)
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR))
+@pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox')
+def test_filter_pass_integration(datafiles, cli):
+ project = str(datafiles)
+
+ # Passing integration commands should build nicely
+ result = cli.run(project=project, args=['build', 'filter/filter.bst'])
+ result.assert_success()
+
+ # Checking out the element should work
+ checkout_dir = os.path.join(project, 'filter')
+ result = cli.run(project=project, args=['artifact', 'checkout', '--integrate', '--hardlinks',
+ '--directory', checkout_dir, 'filter/filter.bst'])
+ result.assert_success()
+
+ # Check that the integration command was run
+ assert_contains(checkout_dir, ['/foo'])
+ shutil.rmtree(checkout_dir)
diff --git a/tests/integration/project/elements/filter/filter.bst b/tests/integration/project/elements/filter/filter.bst
new file mode 100644
index 000000000..78b5ff12d
--- /dev/null
+++ b/tests/integration/project/elements/filter/filter.bst
@@ -0,0 +1,16 @@
+kind: filter
+depends:
+- filename: filter/parent.bst
+ type: build
+config:
+ pass-integration: True
+
+ # `sh` is `/bin/sh`, and `/bin` is not covered by any split rule
+ # As a result, to include `sh` in the image, we need to include orphans
+ #
+ # However we can use this to minimise the size of the artifacts, which
+ # will hopefully reduce test time
+ #
+ include-orphans: True
+ exclude:
+ - runtime
diff --git a/tests/integration/project/elements/filter/parent.bst b/tests/integration/project/elements/filter/parent.bst
new file mode 100644
index 000000000..35ac74d35
--- /dev/null
+++ b/tests/integration/project/elements/filter/parent.bst
@@ -0,0 +1,20 @@
+kind: compose
+depends:
+- filename: base.bst
+ type: build
+public:
+ bst:
+ integration-commands:
+ - touch /foo
+config:
+ # `sh` is `/bin/sh`, and `/bin` is not covered by any split rule
+ # As a result, to include `sh` in the image, we need to include orphans
+ #
+ # However we can use this to minimise the size of the artifacts, which
+ # will hopefully reduce test time
+ #
+ include-orphans: True
+ include:
+ - runtime
+ exclude:
+ - runtime