* [PATCH] test: py: add xfail test for surprising hush quoting behavior
@ 2026-01-26 9:19 Ahmad Fatoum
2026-01-27 8:08 ` Ahmad Fatoum
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-01-26 9:19 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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@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
+@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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] test: py: add xfail test for surprising hush quoting behavior
2026-01-26 9:19 [PATCH] test: py: add xfail test for surprising hush quoting behavior Ahmad Fatoum
@ 2026-01-27 8:08 ` Ahmad Fatoum
0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2026-01-27 8:08 UTC (permalink / raw)
To: Ahmad Fatoum, barebox
Hello,
On 1/26/26 10:19, Ahmad Fatoum wrote:
> 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@pengutronix.de>
Please dismiss this patch. Despite it being xfail (expected to fail),
it triggers a CI breakage for multi_v8_defconfig that I don't yet
understand[1].
[1]: https://github.com/a3f/barebox/actions/runs/21372244214/job/61519530966
> ---
> 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
>
>
> +@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")
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-27 8:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-26 9:19 [PATCH] test: py: add xfail test for surprising hush quoting behavior Ahmad Fatoum
2026-01-27 8:08 ` Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox