Quantcast

[PATCH v2 1/2] test: py: Use global pytestmark for hush tests

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v2 1/2] test: py: Use global pytestmark for hush tests

Michal Simek-3
All tests in test_hush_if_test depends on hush parser to be
present. This patch simplify test dependencies by using global
pytestmark.

Reported-by: Stephen Warren <[hidden email]>
Signed-off-by: Michal Simek <[hidden email]>
---

Changes in v2:
- Fix line-wrapping in comming message

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

diff --git a/test/py/tests/test_hush_if_test.py b/test/py/tests/test_hush_if_test.py
index b572538528e1..056a2880303e 100644
--- a/test/py/tests/test_hush_if_test.py
+++ b/test/py/tests/test_hush_if_test.py
@@ -8,6 +8,8 @@ import os
 import os.path
 import pytest
 
+pytestmark = pytest.mark.buildconfigspec('hush_parser')
+
 # The list of "if test" conditions to test.
 subtests = (
     # Base if functionality.
@@ -109,27 +111,23 @@ def exec_hush_if(u_boot_console, expr, result):
     response = u_boot_console.run_command(cmd)
     assert response.strip() == str(result).lower()
 
-@pytest.mark.buildconfigspec('hush_parser')
 def test_hush_if_test_setup(u_boot_console):
     """Set up environment variables used during the "if" tests."""
 
     u_boot_console.run_command('setenv ut_var_nonexistent')
     u_boot_console.run_command('setenv ut_var_exists 1')
 
-@pytest.mark.buildconfigspec('hush_parser')
 @pytest.mark.parametrize('expr,result', subtests)
 def test_hush_if_test(u_boot_console, expr, result):
     """Test a single "if test" condition."""
 
     exec_hush_if(u_boot_console, expr, result)
 
-@pytest.mark.buildconfigspec('hush_parser')
 def test_hush_if_test_teardown(u_boot_console):
     """Clean up environment variables used during the "if" tests."""
 
     u_boot_console.run_command('setenv ut_var_exists')
 
-@pytest.mark.buildconfigspec('hush_parser')
 # We might test this on real filesystems via UMS, DFU, 'save', etc.
 # Of those, only UMS currently allows file removal though.
 @pytest.mark.boardspec('sandbox')
--
1.9.1

_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v2 2/2] test: py: hush: Add echo dependency

Michal Simek-3
Some tests depends on echo command to be present.

Reported-by: Stephen Warren <[hidden email]>
Signed-off-by: Michal Simek <[hidden email]>
---

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

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

_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH v2 1/2] test: py: Use global pytestmark for hush tests

Stephen Warren-2
In reply to this post by Michal Simek-3
On 05/18/2017 01:23 AM, Michal Simek wrote:
> All tests in test_hush_if_test depends on hush parser to be
> present. This patch simplify test dependencies by using global
> pytestmark.

Acked-by: Stephen Warren <[hidden email]>
_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH v2 2/2] test: py: hush: Add echo dependency

Stephen Warren-2
In reply to this post by Michal Simek-3
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.
_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH v2 2/2] test: py: hush: Add echo dependency

Michal Simek-3
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
_______________________________________________
U-Boot mailing list
[hidden email]
https://lists.denx.de/listinfo/u-boot
Loading...