Skip to contentSkip to conversation

tests/acceptance: Print expected message on wait_for_console_pattern

PATCH In review Wainer dos Santos Moschetta 4 participants 4 messages Mar 9, 2021 – Mar 17, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/acceptance: Print expected message on wait_for_console_pattern

For the sake of improve debuggability of tests which use the wait_for_console_pattern(), this changed the _console_interaction() so that the expected message is printed if the test fail.

---
While I was testing "[PATCH v2 2/2] tests/acceptance: Test ast2600 machine" I could not clearly determine which of the called wait_for_console_pattern() was failing. So this patch improves debuggability in such as situations.

 tests/acceptance/avocado_qemu/__init__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/acceptance/avocado_qemu/__init__.py +2 -1
index df167b142c..ed338caaba 100644
@@ -97,7 +97,8 @@ def _console_interaction(test, success_message, failure_message,
             break
         if failure_message and failure_message in msg:
             console.close()
-            fail = 'Failure message found in console: %s' % failure_message
+            fail = 'Failure message found in console: "%s". Expected: "%s"' % \
+                    (failure_message, success_message)
             test.fail(fail)
 
 def interrupt_interactive_console_until_pattern(test, success_message,
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Wainer dos Santos Moschetta

For the sake of improve debuggability of tests which use the wait_for_console_pattern(), this changed the _console_interaction() so that the expected message is printed if the test fail.

---
While I was testing "[PATCH v2 2/2] tests/acceptance: Test ast2600 machine" I could not clearly determine which of the called wait_for_console_pattern() was failing. So this patch improves debuggability in such as situations.

Nice!

Quoted 22 lines
 tests/acceptance/avocado_qemu/__init__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/acceptance/avocado_qemu/__init__.py +2 -2
index df167b142c..ed338caaba 100644
@@ -97,7 +97,8 @@ def _console_interaction(test, success_message, failure_message,
             break
         if failure_message and failure_message in msg:
             console.close()
-            fail = 'Failure message found in console: %s' % failure_message
+            fail = 'Failure message found in console: "%s". Expected: "%s"' % \
+                    (failure_message, success_message)
             test.fail(fail)
 
 def interrupt_interactive_console_until_pattern(test, success_message,
--

2.29.2

Reviewed-by on v1 1/1
#2 lore raw
In reply to Wainer dos Santos Moschetta
Quoted 5 lines · Wainer dos Santos Moschetta

For the sake of improve debuggability of tests which use the wait_for_console_pattern(), this changed the _console_interaction() so that the expected message is printed if the test fail.

Quoted 9 lines

---
While I was testing "[PATCH v2 2/2] tests/acceptance: Test ast2600 machine" I could not clearly determine which of the called wait_for_console_pattern() was failing. So this patch improves debuggability in such as situations.

 tests/acceptance/avocado_qemu/__init__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 17 lines
tests/acceptance/avocado_qemu/__init__.py +2 -2
index df167b142c..ed338caaba 100644
@@ -97,7 +97,8 @@ def _console_interaction(test, success_message, failure_message,
             break
         if failure_message and failure_message in msg:
             console.close()
-            fail = 'Failure message found in console: %s' % failure_message
+            fail = 'Failure message found in console: "%s". Expected: "%s"' % \
+                    (failure_message, success_message)
             test.fail(fail)
 
 def interrupt_interactive_console_until_pattern(test, success_message,
--

2.29.2

Reviewed-by Tested-by on v1 1/1
#3 lore raw
In reply to Wainer dos Santos Moschetta
Quoted 4 lines · Wainer dos Santos Moschetta

For the sake of improve debuggability of tests which use the wait_for_console_pattern(), this changed the _console_interaction() so that the expected message is printed if the test fail.

Quoted 9 lines

---
While I was testing "[PATCH v2 2/2] tests/acceptance: Test ast2600 machine" I could not clearly determine which of the called wait_for_console_pattern() was failing. So this patch improves debuggability in such as situations.

 tests/acceptance/avocado_qemu/__init__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)