From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id e/XhEG8ijmL8SwgAWB0awg (envelope-from ) for ; Wed, 25 May 2022 08:34:55 -0400 Received: by simark.ca (Postfix, from userid 112) id 3819D1E220; Wed, 25 May 2022 08:34:55 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=qu9gOPlU; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BBEDB1E01D for ; Wed, 25 May 2022 08:34:54 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 01E813858413 for ; Wed, 25 May 2022 12:34:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01E813858413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1653482094; bh=qAkCKc6+4N0db+FsLA0msfuF5PdHu13Ix9caXREe0Cg=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=qu9gOPlU81AYhliox0kYT50VLdkpOvEZszTdEx961mc5EHroY+VE8ayhVfSpLxkyU ZKSiJci47m9u8ovAJe0BMmbS3f2fKBOy02kbF7c3z1Hwm6ku1AGZz4Q0tOqSJBNk7w sS49HvC4oy1cY9URMiwooBDdu94QfBuvfcKmzGg8= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id BD4523858413 for ; Wed, 25 May 2022 12:34:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BD4523858413 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 01C9E1F88B; Wed, 25 May 2022 12:34:33 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DC14613ADF; Wed, 25 May 2022 12:34:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1pzBNFkijmI7MwAAMHmgww (envelope-from ); Wed, 25 May 2022 12:34:33 +0000 Date: Wed, 25 May 2022 14:34:32 +0200 To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Fix gdb.threads/manythreads.exp with check-read1 Message-ID: <20220525123430.GA22147@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Cc: Pedro Alves Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, 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 ... The matching in the failing gdb_test_multiple is done in an intricate way, trying to pass on some order and fail on another order. Fix this by rewriting the regexps to match one line at most, and detecting invalid order by setting and checking state variables. Tested on x86_64-linux. Any comments? Thanks, - Tom [gdb/testsuite] Fix gdb.threads/manythreads.exp with check-read1 --- 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 } { send_gdb "\003" + 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\]*(?=\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\\\](?=\r\n)" { + exp_continue + } + -re "\r\n\[^\r\n]* received signal SIGINT\[^\r\n\]*(?=\r\n)" { + set saw_signal 1 + exp_continue + } + -re -wrap "" { + gdb_assert {$saw_signal && $order_ok} $gdb_test_name } } }