summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2018-10-11 15:39:35 +0100
committerJonathan Maw <jonathan.maw@codethink.co.uk>2018-10-30 12:53:04 +0000
commit83ee7277287b5bd11dcccc7c9ab0c9601f3f6c31 (patch)
tree08e61396b1c0afad2148fcc8fa750fc58c419167
parent4d47f1f78590da1ca1837ddc48d2b3cdc3c0841b (diff)
downloadbuildstream-jonathan/debug-remote-failed-builds.tar.gz
tests: Add tests for 'bst shell --sysroot'jonathan/debug-remote-failed-builds
This is related to #539
-rw-r--r--tests/integration/shell.py29
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):