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

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)
+@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)
+@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)
+@pytest.mark.buildconfigspec('hush_parser') def test_env_expansion_spaces(state_test_env): """Test expanding a variable that contains a space in its value."""

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?

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/f...
Thanks, Michal

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.

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
participants (3)
-
Michal Simek
-
Michal Simek
-
Stephen Warren