diff options
author | William Salmon <will.salmon@codethink.co.uk> | 2019-07-16 11:31:47 +0100 |
---|---|---|
committer | William Salmon <will.salmon@codethink.co.uk> | 2019-07-25 13:57:18 +0100 |
commit | 3b2e5de22dd6c8a68e29930fc20ade39dff9364b (patch) | |
tree | 9463485690baf5e6284641ae5a793dbc2b9957cc /tests/integration | |
parent | 2f52b19ebc18fcefe70c8c04037b735b95c7bcf9 (diff) | |
download | buildstream-3b2e5de22dd6c8a68e29930fc20ade39dff9364b.tar.gz |
Test that commands can be found on PATH when links are present
This test reflects functionality that freedesktop-SDK use's but that bst
was not testing.
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/project/elements/symlinks/link-on-path-use.bst | 10 | ||||
-rw-r--r-- | tests/integration/project/elements/symlinks/link-on-path.bst | 13 | ||||
-rw-r--r-- | tests/integration/symlinks.py | 19 |
3 files changed, 42 insertions, 0 deletions
diff --git a/tests/integration/project/elements/symlinks/link-on-path-use.bst b/tests/integration/project/elements/symlinks/link-on-path-use.bst new file mode 100644 index 000000000..ce57872a6 --- /dev/null +++ b/tests/integration/project/elements/symlinks/link-on-path-use.bst @@ -0,0 +1,10 @@ +kind: manual + +depends: + - filename: symlinks/link-on-path.bst + +config: + build-commands: + - touch %{install-root}/foo + + diff --git a/tests/integration/project/elements/symlinks/link-on-path.bst b/tests/integration/project/elements/symlinks/link-on-path.bst new file mode 100644 index 000000000..d74cbb81c --- /dev/null +++ b/tests/integration/project/elements/symlinks/link-on-path.bst @@ -0,0 +1,13 @@ +kind: manual + +depends: +- filename: base.bst + type: build + +config: + install-commands: + - | + cd "%{install-root}" + cp -r /bin /lib . + mv bin altbin + ln -s altbin bin diff --git a/tests/integration/symlinks.py b/tests/integration/symlinks.py index ed6ee109c..85bbc53fd 100644 --- a/tests/integration/symlinks.py +++ b/tests/integration/symlinks.py @@ -70,3 +70,22 @@ def test_detect_symlink_overlaps_pointing_outside_sandbox(cli, datafiles): result = cli.run(project=project, args=['artifact', 'checkout', element_name, '--directory', checkout]) assert result.exit_code == -1 assert 'Destination is a symlink, not a directory: /opt/escape-hatch' in result.stderr + + +@pytest.mark.datafiles(DATA_DIR) +@pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') +def test_symlink_in_sandbox_path(cli, datafiles): + project = str(datafiles) + element_name = 'symlinks/link-on-path-use.bst' + base_element_name = 'symlinks/link-on-path.bst' + # This test is inspired by how freedesktop-SDK has /bin -> /usr/bin + + # Create a element that has sh in altbin and a link from bin to altbin + result1 = cli.run(project=project, args=['build', base_element_name]) + result1.assert_success() + # Build a element that uses the element that has sh in altbin. + result2 = cli.run(project=project, args=['build', element_name]) + result2.assert_success() + # When this element is built it demonstrates that the virtual sandbox + # can detect sh across links and that the sandbox can find sh accross + # the link from its PATH. |