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

Stephen Warren swarren at wwwdotorg.org
Fri May 12 16:20:15 UTC 2017


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.

> 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.

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

Same here.

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

Same here.

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

Same here.

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

Same here.

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.

> + 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')


More information about the U-Boot mailing list