All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] test/py: Add dependency on HUSH parser
@ 2017-11-10 11:01 Michal Simek
  2017-11-10 21:34 ` Stephen Warren
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Simek @ 2017-11-10 11:01 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Not sure if this is the right dependency but would be great if someone
can test it too.

---
 test/py/tests/test_env.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
index b7f960c755fe..05e57c3f04c4 100644
--- a/test/py/tests/test_env.py
+++ b/test/py/tests/test_env.py
@@ -188,6 +188,7 @@ def test_env_unset_non_existent(state_test_env):
     unset_var(state_test_env, var)
     validate_empty(state_test_env, var)
 
+ at pytest.mark.buildconfigspec('hush_parser')
 def test_env_set_non_existent(state_test_env):
     """Test set a non-existant variable."""
 
@@ -196,6 +197,7 @@ def test_env_set_non_existent(state_test_env):
     set_var(state_test_env, var, value)
     validate_set(state_test_env, var, value)
 
+ at pytest.mark.buildconfigspec('hush_parser')
 def test_env_set_existing(state_test_env):
     """Test setting an existant variable."""
 
@@ -212,6 +214,7 @@ def test_env_unset_existing(state_test_env):
     unset_var(state_test_env, var)
     validate_empty(state_test_env, var)
 
+ at pytest.mark.buildconfigspec('hush_parser')
 def test_env_expansion_spaces(state_test_env):
     """Test expanding a variable that contains a space in its value."""
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] test/py: Add dependency on HUSH parser
  2017-11-10 11:01 [U-Boot] [PATCH] test/py: Add dependency on HUSH parser Michal Simek
@ 2017-11-10 21:34 ` Stephen Warren
  2017-11-15  9:34   ` Michal Simek
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Warren @ 2017-11-10 21:34 UTC (permalink / raw)
  To: u-boot

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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] test/py: Add dependency on HUSH parser
  2017-11-10 21:34 ` Stephen Warren
@ 2017-11-15  9:34   ` Michal Simek
  2017-11-15 18:31     ` Stephen Warren
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Simek @ 2017-11-15  9:34 UTC (permalink / raw)
  To: u-boot

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> Fs+u-boot-test-reset zynq_cse_qspi zc706

Zynq> Zynq> setenv test_env_1 " "
Zynq> setenv test_env_2 " 1${test_env_1}${test_env_1} 2 "
Zynq> printenv test_env_2
test_env_2=" 1" "" " 2 "
Zynq> setenv test_env_1
Zynq> setenv test_env_2
Zynq> F


Here is the branch with zynq_cse_qpsi configs which is minimum full
u-boot configuration running from on chip memory used for qspi programming.
http://git.denx.de/?p=u-boot/u-boot-microblaze.git;a=shortlog;h=refs/heads/for-stephen

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: multiplexed_log.css
Type: text/css
Size: 1316 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171115/f711b6e4/attachment.css>
-------------- 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/20171115/f711b6e4/attachment.sig>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] test/py: Add dependency on HUSH parser
  2017-11-15  9:34   ` Michal Simek
@ 2017-11-15 18:31     ` Stephen Warren
  2017-11-30 16:27       ` Michal Simek
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Warren @ 2017-11-15 18:31 UTC (permalink / raw)
  To: u-boot

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

s+u-boot-test-reset zynq_cse_qspi zc706
> 
> Zynq> Zynq> setenv test_env_1 " "
> Zynq> setenv test_env_2 " 1${test_env_1}${test_env_1} 2 "
> Zynq> printenv test_env_2
> test_env_2=" 1" "" " 2 "
> Zynq> setenv test_env_1
> Zynq> setenv test_env_2
> Zynq> F

This is essentially the same issue, but in a more complex setting. It's 
reasonable to make this test (test_env_expansion_spaces) depend on Hush 
since it tests a feature that non-Hush shells presumably deliberately 
don't implement.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] test/py: Add dependency on HUSH parser
  2017-11-15 18:31     ` Stephen Warren
@ 2017-11-30 16:27       ` Michal Simek
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2017-11-30 16:27 UTC (permalink / raw)
  To: u-boot

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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-30 16:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-10 11:01 [U-Boot] [PATCH] test/py: Add dependency on HUSH parser Michal Simek
2017-11-10 21:34 ` Stephen Warren
2017-11-15  9:34   ` Michal Simek
2017-11-15 18:31     ` Stephen Warren
2017-11-30 16:27       ` Michal Simek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.