From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 601973839C5F; Sat, 4 Jun 2022 09:16:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 601973839C5F 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] Fix gdb.threads/manythreads.exp with check-read1 X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 98c17098021554b3394ba052e94d9f1243ae37c2 X-Git-Newrev: de15377594391aa201fba1ce7d8924274e10abbf Message-Id: <20220604091626.601973839C5F@sourceware.org> Date: Sat, 4 Jun 2022 09:16:26 +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: Sat, 04 Jun 2022 09:16:26 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dde1537759439= 1aa201fba1ce7d8924274e10abbf commit de15377594391aa201fba1ce7d8924274e10abbf Author: Tom de Vries Date: Sat Jun 4 11:16:22 2022 +0200 [gdb/testsuite] Fix gdb.threads/manythreads.exp with check-read1 =20 When running test-case gdb.threads/manythreads.exp with check-read1, I = ran into this hard-to-reproduce FAIL: ... [New Thread 0x7ffff7318700 (LWP 31125)]^M [Thread 0x7ffff7321700 (LWP 31124) exited]^M [New T^C^M ^M Thread 769 "manythreads" received signal SIGINT, Interrupt.^M [Switching to Thread 0x7ffff6d66700 (LWP 31287)]^M 0x00007ffff7586a81 in clone () from /lib64/libc.so.6^M (gdb) FAIL: gdb.threads/manythreads.exp: stop threads 1 ... =20 The matching in the failing gdb_test_multiple is done in an intricate w= ay, trying to pass on some order and fail on another order. =20 Fix this by rewriting the regexps to match one line at most, and detect= ing invalid order by setting and checking state variables. =20 Tested on x86_64-linux. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29177 Diff: --- gdb/testsuite/gdb.threads/manythreads.exp | 34 +++++++++++++++++----------= ---- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/gdb/testsuite/gdb.threads/manythreads.exp b/gdb/testsuite/gdb.= threads/manythreads.exp index f2b8bb791c6..8e0df3ef95c 100644 --- a/gdb/testsuite/gdb.threads/manythreads.exp +++ b/gdb/testsuite/gdb.threads/manythreads.exp @@ -63,21 +63,12 @@ proc interrupt_and_wait { message } { =20 send_gdb "\003" =20 + set saw_signal 0 + set order_ok 1 gdb_test_multiple "" $message { - -re "\\\[New \[^\]\]*\\\]\r\n" { - exp_continue - } - -re "\\\[\[^\]\]* exited\\\]\r\n" { - exp_continue - } - -re " received signal SIGINT.*$gdb_prompt $" { - pass "$message" - } - -re "$gdb_prompt $" { - # Note that with this regex order, if GDB emits [New - # Thread ...] output between "Thread NNN received signal" - # and the prompt, the "received signal" regex won't match. - # That's good, as if we see that happening, it's a + -re "\r\n\\\[New \[^\r\n\]*(?=3D\r\n)" { + # Note if GDB emits [New Thread ...] output between + # "Thread NNN received signal" and the prompt, it's a # regression. # # GDB makes sure to notify about signal stops, end of @@ -100,7 +91,20 @@ proc interrupt_and_wait { message } { # foo () at foo.c:31 # 31 bar (); # - fail $message + if { $saw_signal } { + set order_ok 0 + } + exp_continue + } + -re "\r\n\\\[\[^\r\n]* exited\\\](?=3D\r\n)" { + exp_continue + } + -re "\r\n\[^\r\n]* received signal SIGINT\[^\r\n\]*(?=3D\r\n)" { + set saw_signal 1 + exp_continue + } + -re -wrap "" { + gdb_assert {$saw_signal && $order_ok} $gdb_test_name } } }