diff options
author | Thomas Coldrick <thomas.coldrick@codethink.co.uk> | 2019-09-10 10:53:17 +0100 |
---|---|---|
committer | Thomas Coldrick <othko97@gmail.com> | 2019-09-16 06:55:56 +0000 |
commit | 8ff9262d9843a8e858a594c787ddbd156b4b3d3b (patch) | |
tree | b566da3f861a1b1e1d0ebe10692d3e50506691ef /tests | |
parent | 766c6c8d3e051011f90a920ece736de36f380bdd (diff) | |
download | buildstream-8ff9262d9843a8e858a594c787ddbd156b4b3d3b.tar.gz |
filter.py: Allow passing integration commands
It is tedious to manually copy the integration commands of the parent
element into a filter element, so this allows it to be done
automatically. Here we modify FilterElement.integrate() to allow us to
pass through the parent's integration commands, iff an option is set.
Also adds a test for the new feature, but this is not as comprehensive
as would be idea, as getting to the integration commands which are run
is a little more difficult.
Addresses #1107
Diffstat (limited to 'tests')
-rw-r--r-- | tests/elements/filter.py | 29 | ||||
-rw-r--r-- | tests/elements/filter/basic/elements/input.bst | 3 | ||||
-rw-r--r-- | tests/elements/filter/basic/elements/no-pass-integration.bst | 6 | ||||
-rw-r--r-- | tests/elements/filter/basic/elements/pass-integration.bst | 6 |
4 files changed, 44 insertions, 0 deletions
diff --git a/tests/elements/filter.py b/tests/elements/filter.py index d8370c6bb..ea6bd2306 100644 --- a/tests/elements/filter.py +++ b/tests/elements/filter.py @@ -522,3 +522,32 @@ def test_filter_fails_for_nonexisting_domain(datafiles, cli): 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 + +# TODO: Figure out how to check if the passed integration commands +# are actually correct, this just makes sure things build and +# some integration commands attempt to run +# +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) +def test_filter_pass_integration(datafiles, cli): + project = str(datafiles) + + # Explicitly not passing integration commands should be fine + result = cli.run(project=project, args=['build', 'no-pass-integration.bst']) + result.assert_success() + + # Passing integration commands should build nicely + result = cli.run(project=project, args=['build', 'pass-integration.bst']) + result.assert_success() + + # Checking out elements which don't pass integration commands should still work + checkout_dir = os.path.join(project, 'no-pass') + result = cli.run(project=project, args=['artifact', 'checkout', '--integrate', + '--directory', checkout_dir, 'no-pass-integration.bst']) + result.assert_success() + + # Checking out the artifact should fail if we run integration commands, as + # the staged artifacts don't have a shell + checkout_dir = os.path.join(project, 'pass') + result = cli.run(project=project, args=['artifact', 'checkout', '--integrate', + '--directory', checkout_dir, 'pass-integration.bst']) + result.assert_main_error(ErrorDomain.STREAM, "missing-command") diff --git a/tests/elements/filter/basic/elements/input.bst b/tests/elements/filter/basic/elements/input.bst index fb3f5d194..94d8c17c4 100644 --- a/tests/elements/filter/basic/elements/input.bst +++ b/tests/elements/filter/basic/elements/input.bst @@ -9,3 +9,6 @@ public: - /foo bar: - /bar + integration-commands: + - foo + - bar diff --git a/tests/elements/filter/basic/elements/no-pass-integration.bst b/tests/elements/filter/basic/elements/no-pass-integration.bst new file mode 100644 index 000000000..e512ade01 --- /dev/null +++ b/tests/elements/filter/basic/elements/no-pass-integration.bst @@ -0,0 +1,6 @@ +kind: filter +depends: +- filename: input.bst + type: build +config: + pass-integration: False diff --git a/tests/elements/filter/basic/elements/pass-integration.bst b/tests/elements/filter/basic/elements/pass-integration.bst new file mode 100644 index 000000000..77b462cd0 --- /dev/null +++ b/tests/elements/filter/basic/elements/pass-integration.bst @@ -0,0 +1,6 @@ +kind: filter +depends: +- filename: input.bst + type: build +config: + pass-integration: True |