From patchwork Fri Mar 31 15:15:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 67158 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 89FDE3858298 for ; Fri, 31 Mar 2023 15:16:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 89FDE3858298 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680275796; bh=xhdoMSTRM7x/L40nEiLVTWGNbFAwp2Y8ZDruKCpW4mA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=FwspEdgymzfwD9lYTha3GcHmKAos+lZ6gNvSjAHLXqxzW5IFLpAzIwwiN3eJurHaA K7A8FmTQDq7ujo/gmFxI5FqZgoCjT3fEUBWpcMPBejXPWe2Rfbx/11hxhA9quHm1pT byiKWBiR8DE3X0tAPsFDy/2IPhE0V9fuwq9LklHU= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 529C03858D28 for ; Fri, 31 Mar 2023 15:16:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 529C03858D28 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-out1.suse.de (Postfix) with ESMTPS id 6A29F21A96 for ; Fri, 31 Mar 2023 15:16:08 +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 55749133B6 for ; Fri, 31 Mar 2023 15:16:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1HycEzj5JmTEAwAAMHmgww (envelope-from ) for ; Fri, 31 Mar 2023 15:16:08 +0000 To: gdb-patches@sourceware.org Subject: [pushed 1/2] [gdb/testsuite] Fix gdb.threads/threadapply.exp with editing off Date: Fri, 31 Mar 2023 17:15:52 +0200 Message-Id: <20230331151553.7938-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" With test-case gdb.threads/threadapply.exp and editing set to on, we have: ... (gdb) define remove^M Type commands for definition of "remove".^M End with a line saying just "end".^M >remove-inferiors 3^M >end^M (gdb) ... but with editing set to off, we run into: ... (gdb) define remove^M Type commands for definition of "remove".^M End with a line saying just "end".^M >remove-inferiors 3^M end^M >(gdb) FAIL: gdb.threads/threadapply.exp: thread_set=all: try remove: \ define remove (timeout) ... The commands are issued by this test: ... gdb_define_cmd "remove" { "remove-inferiors 3" } ... which does: - gdb_test_multiple "define remove", followed by - gdb_test_multiple "remove-inferiors 3\nend". Proc gdb_test_multiple has special handling for multi-line commands, which splits it up into subcommands, and for each subcommand issues it and then waits for the resulting prompt (the secondary prompt ">" for all but the last subcommand). However, that doesn't work as expected in this case because the initial gdb_test_multiple "define remove" fails to match all resulting output, and consequently the secondary prompt resulting from "define remove" is counted as if it was the one resulting from "remove-inferiors 3". Fix this by matching the entire output of "define remove", including the secondary prompt. Tested on x86_64-linux. PR testsuite/30288 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30288 --- gdb/testsuite/lib/gdb.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 54bca63b5c3714e1032bf32754dbadaff424221a diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 8b85618abcd..bb4bd656471 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -8490,7 +8490,7 @@ proc gdb_define_cmd {command command_list} { set test "define $command" gdb_test_multiple "define $command" $test { - -re "End with" { + -re "End with \[^\r\n\]*\r\n *>$" { gdb_test_multiple $input $test { -re "\r\n$gdb_prompt " { } From patchwork Fri Mar 31 15:15:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 67157 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 49C98385B513 for ; Fri, 31 Mar 2023 15:16:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49C98385B513 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680275795; bh=mevBx0koHh8vu2+2mCuFOdAhCxfQg4CfKMgdLkzi8Gk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=OQOjlREqd9jBdQrHPEluznfGMzmX8XOlN4QfFmMEKZnvKX0faXvLZmvV1HczpnvK3 FmWtqMzw9gWEVMinS2VK3UBcovInckwxVLRsSXvhTJKkInkZsMcmP6kdxnIiKs+llM ucXKngzS+Ii5v+GplfS2cW3tLaFfMMwPB3iwPXq4= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 529E33858D32 for ; Fri, 31 Mar 2023 15:16:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 529E33858D32 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-out1.suse.de (Postfix) with ESMTPS id 83EF421A97 for ; Fri, 31 Mar 2023 15:16:08 +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 6FC7C133B6 for ; Fri, 31 Mar 2023 15:16:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +KQgGjj5JmTEAwAAMHmgww (envelope-from ) for ; Fri, 31 Mar 2023 15:16:08 +0000 To: gdb-patches@sourceware.org Subject: [pushed 2/2] [gdb/testsuite] Fix gdb.base/trace-commands.exp with editing off Date: Fri, 31 Mar 2023 17:15:53 +0200 Message-Id: <20230331151553.7938-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230331151553.7938-1-tdevries@suse.de> References: <20230331151553.7938-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" With test-case gdb.base/trace-commands.exp and editing off, I run into fails because multi-line commands are issued using gdb_test_sequence, which doesn't handle them correctly. Fix this by using gdb_test instead. Tested on x86_64-linux. PR testsuite/30288 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30288 --- gdb/testsuite/gdb.base/trace-commands.exp | 67 ++++++++++++++--------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/gdb/testsuite/gdb.base/trace-commands.exp b/gdb/testsuite/gdb.base/trace-commands.exp index c37b6d99d08..c936d228097 100644 --- a/gdb/testsuite/gdb.base/trace-commands.exp +++ b/gdb/testsuite/gdb.base/trace-commands.exp @@ -69,27 +69,33 @@ gdb_test "show trace-commands" \ gdb_test "echo hi\\n" {\+echo hi\\n[\r\n]+hi} "simple trace-commands test" # Nested test -gdb_test_sequence "if 1\nset \$i = 0\nwhile \$i < 5\nfunc \$i\nset \$i += 1\nend\nend" \ - "nested trace-commands test" { - {[\r\n]\+if 1} - {[\r\n]\+\+set \$i = 0} - {[\r\n]\+\+while \$i < 5} - {[\r\n]\+\+\+func \$i} - {[\r\n]\+\+\+\+echo in func \$i\\n} - {[\r\n]\+\+\+set \$i \+= 1} - {[\r\n]\+\+\+func \$i} - {[\r\n]\+\+\+\+echo in func \$i\\n} - {[\r\n]\+\+\+set \$i \+= 1} - {[\r\n]\+\+\+func \$i} - {[\r\n]\+\+\+\+echo in func \$i\\n} - {[\r\n]\+\+\+set \$i \+= 1} - {[\r\n]\+\+\+func \$i} - {[\r\n]\+\+\+\+echo in func \$i\\n} - {[\r\n]\+\+\+set \$i \+= 1} - {[\r\n]\+\+\+func \$i} - {[\r\n]\+\+\+\+echo in func \$i\\n} - {[\r\n]\+\+\+set \$i \+= 1} +set strings { + {+if 1} + {++set $i = 0} + {++while $i < 5} + {+++func $i} + {++++echo in func $i\n} + {+++set $i += 1} + {+++func $i} + {++++echo in func $i\n} + {+++set $i += 1} + {+++func $i} + {++++echo in func $i\n} + {+++set $i += 1} + {+++func $i} + {++++echo in func $i\n} + {+++set $i += 1} + {+++func $i} + {++++echo in func $i\n} + {+++set $i += 1} +} +set re {} +foreach string $strings { + lappend re [string_to_regexp $string] } +set re [join $re "\r\n(.*\r\n)?"] +set cmd "if 1\nset \$i = 0\nwhile \$i < 5\nfunc \$i\nset \$i += 1\nend\nend" +gdb_test $cmd $re "nested trace-commands test" # Function with source works gdb_test_sequence "define topfunc\nsource $tracecommandsscript\nend" \ @@ -111,13 +117,20 @@ gdb_test_sequence "topfunc" "nested trace-commands test with source" { } # Test nest depth resets properly on error -gdb_test_sequence "if 1\nif 2\nload\necho should not get here\\n\nend\nend" \ - "depth resets on error part 1" { - {[\r\n]\+if 1} - {[\r\n]\+\+if 2} - {[\r\n]\+\+\+load} - {[\r\n]No executable file specified\.} - {[\r\n]Use the "file" or "exec-file" command\.} +set cmd "if 1\nif 2\nload\necho should not get here\\n\nend\nend" +set strings { + {+if 1} + {++if 2} + {+++load} + {No executable file specified.} + {Use the "file" or "exec-file" command.} +} +set re {} +foreach string $strings { + lappend re [string_to_regexp $string] } +set re [join $re "\r\n(.*\r\n)?"] +gdb_test $cmd $re "depth resets on error part 1" + gdb_test "echo hi\\n" {[\r\n]\+echo hi\\n[\r\n]+hi} \ "depth resets on error part 2"