[PATCH] test: py: add xfail test for surprising hush quoting behavior
Ahmad Fatoum
a.fatoum at pengutronix.de
Tue Jan 27 00:08:28 PST 2026
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 at 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
>
>
> + 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")
>
--
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 |
More information about the barebox
mailing list