[PATCH] test: py: add xfail test for surprising hush quoting behavior
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Jan 26 01:19:46 PST 2026
When mixing both double quotes and single quotes in a command and
passing it through labgrid, the quoting labgrid does on top will exceed
barebox hush's abilities. Fixing this is likely an involved matter, but
let's add a test that's expected to fail, so this can be revisited in
the future.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
test/py/test_shell.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/test/py/test_shell.py b/test/py/test_shell.py
index 6591b3097be3..50ae497fc6c3 100644
--- a/test/py/test_shell.py
+++ b/test/py/test_shell.py
@@ -2,6 +2,7 @@
from .helper import skip_disabled
import json
+import pytest
def test_barebox_true(barebox, barebox_config):
@@ -18,6 +19,19 @@ def test_barebox_false(barebox, barebox_config):
assert returncode == 1
+ at pytest.mark.xfail(reason="barebox Hush quote handling is bogus")
+def test_shell_quoting(barebox):
+ # Labgrid will write this command to a file and execute that and add
+ # extra quoting in the process, which we want hush to be able to handle
+ # Below is equivalent to
+ # echo > testcmd 'echo > /tmp/script '"'"'var="A B"'"'"''; sh testcmd
+ barebox.console.sendline(r"""echo -o testcmd 'echo -o /tmp/script '"'"'var="A B"'"'"''; sh testcmd""")
+ barebox._await_prompt()
+ assert barebox.run_check('cat testcmd') == [r"""echo -o /tmp/script 'var="A B"'"""]
+ assert barebox.run_check('cat /tmp/script') == [r'''var="A B"''']
+ assert barebox.run_check('source /tmp/script && echo "$var"') == "A B"
+
+
def test_barebox_md5sum(barebox, barebox_config):
skip_disabled(barebox_config, "CONFIG_CMD_MD5SUM", "CONFIG_CMD_ECHO")
--
2.47.3
More information about the barebox
mailing list