summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-02-20 08:15:24 +0000
committerJürg Billeter <j@bitron.ch>2020-02-20 08:15:24 +0000
commit9c57c847279839b142e123149f51a262bcf9e265 (patch)
tree5642369c8963d6b16ce94c6dadb2e6da33b14a26
parentf126f0afcd4df803d4a13a0f54b26afd1b173dd9 (diff)
parentfb91adcc4e05aabf9055b7c2a4e706dd7da91ed7 (diff)
downloadbuildstream-9c57c847279839b142e123149f51a262bcf9e265.tar.gz
Merge branch 'abderrahim/simple-host-files' into 'master'
_project.py: fix the case where a simple string is passed to host-files See merge request BuildStream/buildstream!1820
-rw-r--r--src/buildstream/_project.py2
-rw-r--r--tests/integration/shell.py11
2 files changed, 8 insertions, 5 deletions
diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py
index ed3810350..0593abe6f 100644
--- a/src/buildstream/_project.py
+++ b/src/buildstream/_project.py
@@ -764,7 +764,7 @@ class Project:
host_files = shell_options.get_sequence("host-files", default=[])
for host_file in host_files:
if isinstance(host_file, ScalarNode):
- mount = HostMount(host_file)
+ mount = HostMount(host_file.as_str())
else:
# Some validation
host_file.validate_keys(["path", "host_path", "optional"])
diff --git a/tests/integration/shell.py b/tests/integration/shell.py
index c4725ec07..cd93923b7 100644
--- a/tests/integration/shell.py
+++ b/tests/integration/shell.py
@@ -159,7 +159,7 @@ def test_no_shell(cli, datafiles):
# Test that bind mounts defined in project.conf work
-@pytest.mark.parametrize("path", [("/etc/pony.conf"), ("/usr/share/pony/pony.txt")])
+@pytest.mark.parametrize("path", [("/etc/pony.conf"), ("/usr/share/pony/pony.txt"), (None)])
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox")
@pytest.mark.xfail(
@@ -169,9 +169,12 @@ def test_no_shell(cli, datafiles):
def test_host_files(cli, datafiles, path):
project = str(datafiles)
ponyfile = os.path.join(project, "files", "shell-mount", "pony.txt")
- result = execute_shell(
- cli, project, ["cat", path], config={"shell": {"host-files": [{"host_path": ponyfile, "path": path}]}}
- )
+ if path is None:
+ result = execute_shell(cli, project, ["cat", ponyfile], config={"shell": {"host-files": [ponyfile]}})
+ else:
+ result = execute_shell(
+ cli, project, ["cat", path], config={"shell": {"host-files": [{"host_path": ponyfile, "path": path}]}}
+ )
assert result.exit_code == 0
assert result.output == "pony\n"