summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin David <valentin.david@codethink.co.uk>2019-11-20 15:35:53 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-11-26 15:46:33 +0000
commit3c093d1f15e2400230d332cd3baf3d2d850f1279 (patch)
treec2a130182950e3dd035030e2b0ddf85ab7cdc3ca
parent23c0e689a319f876f62d7e581974cdeeb52c29b8 (diff)
downloadbuildstream-3c093d1f15e2400230d332cd3baf3d2d850f1279.tar.gz
compose: Allow compose elements to run integration commands
-rw-r--r--src/buildstream/plugins/elements/compose.py3
-rw-r--r--tests/integration/compose.py33
-rw-r--r--tests/integration/project/elements/compose/test-integration.bst10
3 files changed, 43 insertions, 3 deletions
diff --git a/src/buildstream/plugins/elements/compose.py b/src/buildstream/plugins/elements/compose.py
index 063c5d44f..3ac5dec8d 100644
--- a/src/buildstream/plugins/elements/compose.py
+++ b/src/buildstream/plugins/elements/compose.py
@@ -58,9 +58,6 @@ class ComposeElement(Element):
# This plugin has been modified to avoid the use of Sandbox.get_directory
BST_VIRTUAL_DIRECTORY = True
- # Compose elements do not run any commands
- BST_RUN_COMMANDS = False
-
def configure(self, node):
node.validate_keys(["integrate", "include", "exclude", "include-orphans"])
diff --git a/tests/integration/compose.py b/tests/integration/compose.py
index 638dbc8dd..5fb79d051 100644
--- a/tests/integration/compose.py
+++ b/tests/integration/compose.py
@@ -129,3 +129,36 @@ def test_compose_include(cli, datafiles, include_domains, exclude_domains, expec
assert result.exit_code == 0
assert set(walk_dir(checkout)) == set(expected)
+
+
+@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox")
+@pytest.mark.xfail(HAVE_SANDBOX == "buildbox", reason="Not working with BuildBox")
+def test_compose_run_integration(cli, datafiles):
+ project = str(datafiles)
+ checkout = os.path.join(cli.directory, "checkout")
+ element_path = os.path.join(project, "elements")
+ element_name = "compose/compose-amhello.bst"
+
+ element = {
+ "kind": "compose",
+ "depends": [
+ {"filename": "compose/amhello.bst", "type": "build"},
+ {"filename": "compose/test-integration.bst", "type": "build"},
+ ],
+ "config": {"include": ["runtime"]},
+ }
+
+ _yaml.roundtrip_dump(element, os.path.join(element_path, element_name))
+
+ result = cli.run(project=project, args=["source", "track", "compose/amhello.bst"])
+ assert result.exit_code == 0
+
+ result = cli.run(project=project, args=["build", element_name])
+ assert result.exit_code == 0
+
+ result = cli.run(project=project, args=["artifact", "checkout", element_name, "--directory", checkout])
+ assert result.exit_code == 0
+
+ test_file = os.path.join(checkout, "tests", "test")
+ assert os.path.isfile(test_file)
diff --git a/tests/integration/project/elements/compose/test-integration.bst b/tests/integration/project/elements/compose/test-integration.bst
new file mode 100644
index 000000000..2f9faf170
--- /dev/null
+++ b/tests/integration/project/elements/compose/test-integration.bst
@@ -0,0 +1,10 @@
+kind: stack
+
+runtime-depends:
+- base.bst
+
+public:
+ bst:
+ integration-commands:
+ - "mkdir -p /tests"
+ - "echo 'This is a test' > /tests/test"