[U-Boot] [PATCH] test: py: Add cmd_echo dependency

Michal Simek michal.simek at xilinx.com
Mon May 15 12:21:09 UTC 2017


On 12.5.2017 18:20, Stephen Warren wrote:
> On 05/12/2017 01:31 AM, Michal Simek wrote:
>> There is missing dependency on echo command. Mark tests which requires
>> echo.
> 
>>  test/py/tests/test_env.py          | 8 ++++++++
>>  test/py/tests/test_shell_basics.py | 4 ++++
>>  2 files changed, 12 insertions(+)
> 
> test_hush_if_test.py also needs fixing for this. Perhaps you didn't
> notice this because those tests are already dependant on
> CONFIG_HUSH_PARSER which I assume you don't have enabled.

yep - in my configuration hush is disabled that's why I didn't find it out.
For hush only these two tests pass when echo is disable.

test_hush_if_test_setup
test_hush_if_test_teardown

Also when you disable HUSH more tests failed.

> 
>> diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
> 
>> + at pytest.mark.buildconfigspec('cmd_echo')
>>  def test_env_echo_exists(state_test_env):
>>      """Test echoing a variable that exists."""
> 
> I don't believe this one actually depends on CONFIG_CMD_ECHO; it uses
> printenv rather than the echo command.

removed

> 
>> + at pytest.mark.buildconfigspec('cmd_echo')
>>  def test_env_printenv_non_existent(state_test_env):
> 
> Same here.

removed

> 
>> + at pytest.mark.buildconfigspec('cmd_echo')
>>  def test_env_set_non_existent(state_test_env):
> 
> Same here.

removed

> 
>> + at pytest.mark.buildconfigspec('cmd_echo')
>>  def test_env_set_existing(state_test_env):
> 
> Same here.

removed

> 
>> + at pytest.mark.buildconfigspec('cmd_echo')
>>  def test_env_expansion_spaces(state_test_env):
> 
> Same here.

You are right with that above. It was failing for me that's why I have
added this but the reason for failure is different.

printenv is in cmd/nvedit.c
which is enabled all the time
obj-y += nvedit.o

That's why I will remove this completely.

Just a note there is


> 
> However, the other functions in the patch do need this mark.
> 
>> diff --git a/test/py/tests/test_shell_basics.py
>> b/test/py/tests/test_shell_basics.py
> 
>>  # Test basic shell functionality, such as commands separate by
>> semi-colons.
>> +import pytest
> 
> Nit: There's a blank line between the file comment and import statements
> in other files.

fixed.

> 
>> + at pytest.mark.buildconfigspec('cmd_echo')
>>  def test_shell_execute(u_boot_console):
>>      """Test any shell command."""
> 
> Rather than marking each individual test in this file (and
> test_hush_if_test.py), perhaps apply the mark on a file/module level?
> 
> https://docs.pytest.org/en/latest/example/markers.html says to do this
> in global scope:
> 
> pytestmark = pytest.mark.buildconfigspec('cmd_echo')

yep that works too but I was checking setup_buildconfigspec
and we don't have an option to mark whole file depends on cmd_echo but
some tests in that file don't need to require it.

This is the same for env and dependency on hush. Where based on my tests
only test_env_echo_exists and test_env_printenv_non_existent don't
require hush.


Thanks,
Michal



More information about the U-Boot mailing list