[1/4] Fix error check in gdb_py_test_silent_cmd

Message ID 20241120-noop-string-printer-v1-1-40c44526fb4a@adacore.com
State New
Headers
Series Fix string display in DAP |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tom Tromey Nov. 20, 2024, 4:31 p.m. UTC
  I added a new test using gdb_py_test_silent_cmd, and then was
surprised to find out that the new test passed -- it caused a Python
exception and I had expected it to fail.  This patch fixes this proc
to detect this situation and fail.
---
 gdb/testsuite/lib/gdb-python.exp | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/gdb/testsuite/lib/gdb-python.exp b/gdb/testsuite/lib/gdb-python.exp
index e27d5c1776931990d29bf1660f214f0c60be510d..a820c870fd6028c0e73d11770d95f09045aa8582 100644
--- a/gdb/testsuite/lib/gdb-python.exp
+++ b/gdb/testsuite/lib/gdb-python.exp
@@ -22,6 +22,7 @@  proc gdb_py_test_silent_cmd { cmd name report_pass } {
     global gdb_prompt
 
     gdb_test_multiple $cmd $name {
+	-re "Error occurred in Python:.*$gdb_prompt $" { fail $name }
 	-re "Traceback.*$gdb_prompt $" { fail $name }
 	-re "$gdb_prompt $"            { if $report_pass { pass $name } }
     }