82 lines
2.3 KiB
Diff
82 lines
2.3 KiB
Diff
|
[gdb/testsuite] Handle init errors in gdb.mi/user-selected-context-sync.exp
|
||
|
|
||
|
In OBS, on aarch64-linux, with a gdb 11.1 based package, I run into:
|
||
|
...
|
||
|
(gdb) builtin_spawn -pty^M
|
||
|
new-ui mi /dev/pts/5^M
|
||
|
New UI allocated^M
|
||
|
(gdb) =thread-group-added,id="i1"^M
|
||
|
(gdb) ERROR: MI channel failed
|
||
|
warning: Error detected on fd 11^M
|
||
|
thread 1.1^M
|
||
|
Unknown thread 1.1.^M
|
||
|
(gdb) UNRESOLVED: gdb.mi/user-selected-context-sync.exp: mode=non-stop: \
|
||
|
test_cli_inferior: reset selection to thread 1.1
|
||
|
...
|
||
|
with many more UNRESOLVED following.
|
||
|
|
||
|
The ERROR is a common problem, filed as
|
||
|
https://sourceware.org/bugzilla/show_bug.cgi?id=28561 .
|
||
|
|
||
|
But the many UNRESOLVEDs are due to not checking whether the setup as done in
|
||
|
the test_setup function succeeds or not.
|
||
|
|
||
|
Fix this by:
|
||
|
- making test_setup return an error upon failure
|
||
|
- handling test_setup error at the call site
|
||
|
- adding a "setup done" pass/fail to be turned into an unresolved
|
||
|
in case of error during setup.
|
||
|
|
||
|
Tested on x86_64-linux, by manually triggering the error in
|
||
|
mi_gdb_start_separate_mi_tty.
|
||
|
|
||
|
---
|
||
|
gdb/testsuite/gdb.mi/user-selected-context-sync.exp | 13 ++++++++++---
|
||
|
1 file changed, 10 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
|
||
|
index 2f1a4884a21..d4e72190d2a 100644
|
||
|
--- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
|
||
|
+++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
|
||
|
@@ -393,7 +393,7 @@ proc_with_prefix test_setup { mode } {
|
||
|
}
|
||
|
|
||
|
if { [mi_gdb_start "separate-mi-tty"] != 0 } {
|
||
|
- return
|
||
|
+ return -1
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@@ -403,7 +403,7 @@ proc_with_prefix test_setup { mode } {
|
||
|
|
||
|
if { [mi_runto_main] < 0 } {
|
||
|
fail "can't run to main"
|
||
|
- return
|
||
|
+ return -1
|
||
|
}
|
||
|
|
||
|
# When using mi_expect_stop, we don't expect a prompt after the *stopped
|
||
|
@@ -444,6 +444,8 @@ proc_with_prefix test_setup { mode } {
|
||
|
# Prepare the second inferior for the test.
|
||
|
test_continue_to_start $mode 2
|
||
|
}
|
||
|
+
|
||
|
+ return 0
|
||
|
}
|
||
|
|
||
|
# Reset the selection to frame #0 of thread THREAD.
|
||
|
@@ -1253,7 +1255,12 @@ proc_with_prefix test_cli_in_mi_frame { mode cli_in_mi_mode } {
|
||
|
}
|
||
|
|
||
|
foreach_with_prefix mode { "all-stop" "non-stop" } {
|
||
|
- test_setup $mode
|
||
|
+ set test "setup done"
|
||
|
+ if { [test_setup $mode] == -1 } {
|
||
|
+ fail $test
|
||
|
+ continue
|
||
|
+ }
|
||
|
+ pass $test
|
||
|
|
||
|
# Test selecting inferior, thread and frame from CLI
|
||
|
|