From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 9EA35385842B; Sun, 8 May 2022 16:32:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9EA35385842B Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Handle init errors in gdb.mi/user-selected-context-sync.exp X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: c7dad3e9f9620b1dd9b7c72523513590552993b2 X-Git-Newrev: 603df41b467152a226419a8dd5949f98a746a86e Message-Id: <20220508163208.9EA35385842B@sourceware.org> Date: Sun, 8 May 2022 16:32:08 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2022 16:32:08 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D603df41b4671= 52a226419a8dd5949f98a746a86e commit 603df41b467152a226419a8dd5949f98a746a86e Author: Tom de Vries Date: Sun May 8 18:32:05 2022 +0200 [gdb/testsuite] Handle init errors in gdb.mi/user-selected-context-sync= .exp =20 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) =3Dthread-group-added,id=3D"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=3Dnon-sto= p: \ test_cli_inferior: reset selection to thread 1.1 ... with many more UNRESOLVED following. =20 The ERROR is a common problem, filed as https://sourceware.org/bugzilla/show_bug.cgi?id=3D28561 . =20 But the many UNRESOLVEDs are due to not checking whether the setup as d= one in the test_setup function succeeds or not. =20 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. =20 Tested on x86_64-linux, by manually triggering the error in mi_gdb_start_separate_mi_tty. Diff: --- 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/test= suite/gdb.mi/user-selected-context-sync.exp index 9444ca5acf4..d78c96ddef1 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 } { } =20 if { [mi_gdb_start "separate-mi-tty"] !=3D 0 } { - return + return -1 } } =20 @@ -402,7 +402,7 @@ proc_with_prefix test_setup { mode } { mi_gdb_load $binfile =20 if { [mi_runto_main] < 0 } { - return + return -1 } =20 # When using mi_expect_stop, we don't expect a prompt after the *stopp= ed @@ -443,6 +443,8 @@ proc_with_prefix test_setup { mode } { # Prepare the second inferior for the test. test_continue_to_start $mode 2 } + + return 0 } =20 # Reset the selection to frame #0 of thread THREAD. @@ -1300,7 +1302,12 @@ proc_with_prefix test_cli_in_mi_frame { mode cli_in_= mi_mode } { } =20 foreach_with_prefix mode { "all-stop" "non-stop" } { - test_setup $mode + set test "setup done" + if { [test_setup $mode] =3D=3D -1 } { + fail $test + continue + } + pass $test =20 # Test selecting inferior, thread and frame from CLI