diff options
author | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2018-10-11 15:39:35 +0100 |
---|---|---|
committer | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2018-10-30 15:42:05 +0000 |
commit | 79d1bb7f5f92739ffe0501360b7bdbdc6873a257 (patch) | |
tree | 63f465cf84623db701ed86326370be3016838925 /tests/integration/shell.py | |
parent | cf7218387976946a0a0ba223dbd0347fb1e5a40e (diff) | |
download | buildstream-79d1bb7f5f92739ffe0501360b7bdbdc6873a257.tar.gz |
tests: Add tests for 'bst shell --sysroot'
This is related to #539
Diffstat (limited to 'tests/integration/shell.py')
-rw-r--r-- | tests/integration/shell.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/integration/shell.py b/tests/integration/shell.py index cd3c1a977..1db29a0c4 100644 --- a/tests/integration/shell.py +++ b/tests/integration/shell.py @@ -302,6 +302,35 @@ def test_workspace_visible(cli, tmpdir, datafiles): assert result.output == workspace_hello +# Test that '--sysroot' works +@pytest.mark.datafiles(DATA_DIR) +def test_sysroot(cli, tmpdir, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + base_element = "base/base-alpine.bst" + # test element only needs to be something lightweight for this test + test_element = "script/script.bst" + checkout_dir = os.path.join(str(tmpdir), 'alpine-sysroot') + test_file = 'hello' + + # Build and check out a sysroot + res = cli.run(project=project, args=['build', base_element]) + res.assert_success() + res = cli.run(project=project, args=['checkout', base_element, checkout_dir]) + res.assert_success() + + # Mutate the sysroot + test_path = os.path.join(checkout_dir, test_file) + with open(test_path, 'w') as f: + f.write('hello\n') + + # Shell into the sysroot and check the test file exists + res = cli.run(project=project, args=[ + 'shell', '--build', '--sysroot', checkout_dir, test_element, '--', + 'grep', '-q', 'hello', '/' + test_file + ]) + res.assert_success() + + # Test system integration commands can access devices in /dev @pytest.mark.datafiles(DATA_DIR) def test_integration_devices(cli, tmpdir, datafiles): |