summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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"