[U-Boot] [PATCH] test/py: Add dependency on HUSH parser

Michal Simek monstr at monstr.eu
Thu Nov 30 16:27:00 UTC 2017


Hi,

On 15.11.2017 19:31, Stephen Warren wrote:
> On 11/15/2017 02:34 AM, Michal Simek wrote:
>> Hi,
>>
>> On 10.11.2017 22:34, Stephen Warren wrote:
>>> On 11/10/2017 04:01 AM, Michal Simek wrote:
>>>> After adding our small zynq uboot which has hush parser off these 3
>>>> tests
>>>> start to failed. It is probably just coincidence that others are
>>>> passing without hush parser.
>>>
>>> What was the exact problem here? The set of tests you've disabled all
>>> seem to rely on setenv/printenv and don't seem to do anything
>>> complicated shell syntax wise. Are you sure they shouldn't depend on
>>> setenv being available rather than hush_parser?
>>
>> These 3 tests. (html attached too.)
>>
>> Zynq> printenv baudrate
>> baudrate=115200
>> Zynq>
>> test/py/tests/test_env.py .sZynq> printenv test_env_0
>> ## Error: "test_env_0" not defined
>> Zynq> .sZynq> setenv test_env_0 "foo"
>> Zynq> printenv test_env_0
>> test_env_0="foo"
>> Zynq> F+u-boot-test-reset zynq_cse_qspi zc706
>>
>>
>>
>> Zynq> Zynq> setenv test_env_0 "bar"
>> Zynq> printenv test_env_0
>> test_env_0="bar"
>> Zynq> F
> 
> For those two failures, the issue is that the test is expecting setenv
> to print:
> 
> test_env_0=foo
> test_env_0=bar
> 
> ... but it prints:
> 
> test_env_0="foo"
> test_env_0="bar"
> 
> I guess this is because the set_var() function wraps the values in
> quotes to ensure that values that contain spaces work as expected, yet
> when not using Hush, quotes aren't processed.
> 
> I think the best solution is to enhance set_var() to do the following if
> Hush isn't available:
> 
> a) Skip the test if the value contains any spaces (or perhaps if the
> value contains any characters that aren't in a whitelist.
> 
> b) Not use quotes when not running on Hush.
> 
> I think re-writing it as follows would work:
> 
>>     bc = state_test_env.u_boot_console.config.buildconfig
>>     if bc.get('config_hush_parser', None):
>>         quote = '"'
>>     else:
>>         quote = ''
>>         if ' ' in value:
>>             pytest.skip('Space in variable value on non-Hush shell')
>>
>>     state_test_env.u_boot_console.run_command(
>>         'setenv %s %s%s%s' % (var, quote, value, quote))
>>     state_test_env.env[var] = value
> 


First of all sorry for delay. I had to fix some other issues.
This is fixing issues with all tests and I have sent v2.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP SoCs


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/fbb353be/attachment.sig>


More information about the U-Boot mailing list