diff mbox

[U-Boot,v2,2/2] test: py: hush: Add echo dependency

Message ID 1420854ffb34cf34af4c6c88a6dda02151358450.1495092193.git.michal.simek@xilinx.com
State Accepted
Commit 5bdb31706509c0dbf44228fc69538e90cc7d510e
Delegated to: Tom Rini
Headers show

Commit Message

Michal Simek May 18, 2017, 7:23 a.m. UTC
Some tests depends on echo command to be present.

Reported-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v2:
- New patch in this series
- Tested on sandbox

 test/py/tests/test_hush_if_test.py | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stephen Warren May 18, 2017, 4:27 p.m. UTC | #1
On 05/18/2017 01:23 AM, Michal Simek wrote:
> Some tests depends on echo command to be present.

> diff --git a/test/py/tests/test_hush_if_test.py b/test/py/tests/test_hush_if_test.py

> +@pytest.mark.buildconfigspec('cmd_echo')
>   @pytest.mark.parametrize('expr,result', subtests)
>   def test_hush_if_test(u_boot_console, expr, result):
>       """Test a single "if test" condition."""

This change is technically correct I admit.

However, there's not much point allowing test_hush_if_test_setup() and 
test_hush_if_test_teardown() to run if test_hush_if_test() doesn't run, 
so I'd be inclined to make this a file-level mark rather than a 
function-/test-level mark, just like the other mark for the dependency 
on CONFIG_HUSH_PARSER.

Still, either way is OK I guess.
Michal Simek May 19, 2017, 9:23 a.m. UTC | #2
On 18.5.2017 18:27, Stephen Warren wrote:
> On 05/18/2017 01:23 AM, Michal Simek wrote:
>> Some tests depends on echo command to be present.
> 
>> diff --git a/test/py/tests/test_hush_if_test.py
>> b/test/py/tests/test_hush_if_test.py
> 
>> +@pytest.mark.buildconfigspec('cmd_echo')
>>   @pytest.mark.parametrize('expr,result', subtests)
>>   def test_hush_if_test(u_boot_console, expr, result):
>>       """Test a single "if test" condition."""
> 
> This change is technically correct I admit.
> 
> However, there's not much point allowing test_hush_if_test_setup() and
> test_hush_if_test_teardown() to run if test_hush_if_test() doesn't run,
> so I'd be inclined to make this a file-level mark rather than a
> function-/test-level mark, just like the other mark for the dependency
> on CONFIG_HUSH_PARSER.
> 
> Still, either way is OK I guess.

I choose this way because in future someone can add more tests for hush
which won't use echo. And still that two tests which runs are doing
something what can failed that's why not run them.

Anyway not a problem to mark the whole file too if syntax enables it.

Thanks,
Michal
Tom Rini June 6, 2017, 12:21 a.m. UTC | #3
On Thu, May 18, 2017 at 09:23:15AM +0200, Michal Simek wrote:

> Some tests depends on echo command to be present.
> 
> Reported-by: Stephen Warren <swarren@nvidia.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/test/py/tests/test_hush_if_test.py b/test/py/tests/test_hush_if_test.py
index 056a2880303e..c8f4208d3105 100644
--- a/test/py/tests/test_hush_if_test.py
+++ b/test/py/tests/test_hush_if_test.py
@@ -117,6 +117,7 @@  def test_hush_if_test_setup(u_boot_console):
     u_boot_console.run_command('setenv ut_var_nonexistent')
     u_boot_console.run_command('setenv ut_var_exists 1')
 
+@pytest.mark.buildconfigspec('cmd_echo')
 @pytest.mark.parametrize('expr,result', subtests)
 def test_hush_if_test(u_boot_console, expr, result):
     """Test a single "if test" condition."""
@@ -130,6 +131,7 @@  def test_hush_if_test_teardown(u_boot_console):
 
 # We might test this on real filesystems via UMS, DFU, 'save', etc.
 # Of those, only UMS currently allows file removal though.
+@pytest.mark.buildconfigspec('cmd_echo')
 @pytest.mark.boardspec('sandbox')
 def test_hush_if_test_host_file_exists(u_boot_console):
     """Test the "if test -e" shell command."""