[PATCH] test: log: Actually test enable/disable output

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] test: log: Actually test enable/disable output

Sean Anderson
Strings are truth-y in python, so ``assert 'anything'`` will always
evaluate to True. Fix the test so that it actually checks the output.

Fixes: 3d03ab6361 ("log: Add a way to enable/disable a log device")
Signed-off-by: Sean Anderson <[hidden email]>
---

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

diff --git a/test/py/tests/test_log.py b/test/py/tests/test_log.py
index 275f9382d2..e8b2b17145 100644
--- a/test/py/tests/test_log.py
+++ b/test/py/tests/test_log.py
@@ -95,9 +95,9 @@ def test_log(u_boot_console):
     def test11():
         """Test use of log_device_set_enable()"""
         lines = run_test(11)
-        assert 'log_test() default'
+        assert 'log_test() default' == next(lines)
         # disabled should not be displayed
-        assert 'log_test() enabled'
+        assert 'log_test() enabled' == next(lines)
 
     # TODO([hidden email]): Consider structuring this as separate tests
     cons = u_boot_console
--
2.28.0

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] test: log: Actually test enable/disable output

Simon Glass-3
On Sat, 17 Oct 2020 at 07:20, Sean Anderson <[hidden email]> wrote:

>
> Strings are truth-y in python, so ``assert 'anything'`` will always
> evaluate to True. Fix the test so that it actually checks the output.
>
> Fixes: 3d03ab6361 ("log: Add a way to enable/disable a log device")
> Signed-off-by: Sean Anderson <[hidden email]>
> ---
>
>  test/py/tests/test_log.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <[hidden email]>