From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id XP1bHSmm1GDkHQAAWB0awg (envelope-from ) for ; Thu, 24 Jun 2021 11:35:05 -0400 Received: by simark.ca (Postfix, from userid 112) id 701101F1F2; Thu, 24 Jun 2021 11:35:05 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 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 3257E1E54D for ; Thu, 24 Jun 2021 11:35:04 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F33D339A901D for ; Thu, 24 Jun 2021 15:35:03 +0000 (GMT) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 030BA39A5C06 for ; Thu, 24 Jun 2021 15:34:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 030BA39A5C06 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F18991FD97 for ; Thu, 24 Jun 2021 15:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1624548891; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=2sH2eT5xlmOA4e2Wfu8WVghu7wwp/yYWftErxtFNUME=; b=HR8JKAFuTGCzYjWvQEF+h9uXhXJbaapI1OxNnkyrUZoiGBJkzn3yQ9IFjlCeKhedkSkC8o b8EVFz4HbZduhaR9DmHbt9AC8IAB3kGi+seDqK3qAqhci67RyH2CI3Y1BG7O/SYBxEwOhD xqKyS9Yls+sEaGsBUathmVIiauRl2DY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1624548891; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=2sH2eT5xlmOA4e2Wfu8WVghu7wwp/yYWftErxtFNUME=; b=7h74LGdUKzKwpJXLgmsMtrE8czKW93v4jQv1zL1WK4JAX7qoxOov1kkhrFBrdTaD2GwlfT 5S4Qu068sTiNrwCQ== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id D419B11A97 for ; Thu, 24 Jun 2021 15:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1624548891; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=2sH2eT5xlmOA4e2Wfu8WVghu7wwp/yYWftErxtFNUME=; b=HR8JKAFuTGCzYjWvQEF+h9uXhXJbaapI1OxNnkyrUZoiGBJkzn3yQ9IFjlCeKhedkSkC8o b8EVFz4HbZduhaR9DmHbt9AC8IAB3kGi+seDqK3qAqhci67RyH2CI3Y1BG7O/SYBxEwOhD xqKyS9Yls+sEaGsBUathmVIiauRl2DY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1624548891; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=2sH2eT5xlmOA4e2Wfu8WVghu7wwp/yYWftErxtFNUME=; b=7h74LGdUKzKwpJXLgmsMtrE8czKW93v4jQv1zL1WK4JAX7qoxOov1kkhrFBrdTaD2GwlfT 5S4Qu068sTiNrwCQ== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id tlKzMhum1GDSJQAALh3uQQ (envelope-from ) for ; Thu, 24 Jun 2021 15:34:51 +0000 Date: Thu, 24 Jun 2021 17:34:50 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [RFC][gdb/testsuite] Remove read1 timeout factor from gdb.base/info-macros.exp Message-ID: <20210624153449.GA30047@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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, At the moment some check-read1 timeouts are handled like this in gdb.base/info-macros.exp: ... gdb_test_multiple_with_read1_timeout_factor 10 "$test" $testname { -re "$r1$r2$r3" { pass $testname } -re ".*#define TWO.*\r\n$gdb_prompt" { fail $testname } -re ".*#define THREE.*\r\n$gdb_prompt" { fail $testname } -re ".*#define FOUR.*\r\n$gdb_prompt" { fail $testname } } ... which is not ideal. We could use gdb_test_lines, but it currently doesn't support verifying the absence of regexps, which is currently implemented using the clauses above calling fail. Fix this by using gdb_test_lines and adding a -re-not syntax to gdb_test_lines, such that we can do: ... gdb_test_lines $test $testname $r1.*$r2 \ -re-not "#define TWO" \ -re-not "#define THREE" \ -re-not "#define FOUR" ... Only removing one use of gdb_test_multiple_with_read1_timeout_factor in the test-case for now. Tested on x86_64-linux, which make targets check and check-read1. Any comments? Thanks, - Tom [gdb/testsuite] Remove read1 timeout factor from gdb.base/info-macros.exp gdb/testsuite/ChangeLog: 2021-06-24 Tom de Vries * gdb.base/info-macros.exp: Replace gdb_test_multiple_with_read1_timeout_factor with gdb_test_lines. * lib/gdb.exp (gdb_test_lines): Add handling or -re-not . --- gdb/testsuite/gdb.base/info-macros.exp | 24 +++++++----------------- gdb/testsuite/lib/gdb.exp | 31 ++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/gdb/testsuite/gdb.base/info-macros.exp b/gdb/testsuite/gdb.base/info-macros.exp index 19f16814374..6af34ff77cb 100644 --- a/gdb/testsuite/gdb.base/info-macros.exp +++ b/gdb/testsuite/gdb.base/info-macros.exp @@ -125,24 +125,14 @@ proc gdb_test_multiple_with_read1_timeout_factor { factor command message \ } set test "info macros" -set r1 ".*#define FOO \"hello\"" -set r2 ".*#define ONE" -set r3 ".*\r\n$gdb_prompt" +set r1 "#define FOO \"hello\"" +set r2 "#define ONE" set testname "$test 2" -gdb_test_multiple_with_read1_timeout_factor 10 "$test" $testname { - -re "$r1$r2$r3" { - pass $testname - } - -re ".*#define TWO.*\r\n$gdb_prompt" { - fail $testname - } - -re ".*#define THREE.*\r\n$gdb_prompt" { - fail $testname - } - -re ".*#define FOUR.*\r\n$gdb_prompt" { - fail $testname - } -} +gdb_test_lines $test $testname $r1.*$r2 \ + -re-not "#define TWO" \ + -re-not "#define THREE" \ + -re-not "#define FOUR" + gdb_test "next" ".*" "" set r1 ".*#define FOO \" \"" diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 02b65617ea4..543a7dc6b06 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1443,13 +1443,34 @@ proc gdb_test_sequence { args } { # '^M # ^M # ' +# +# Optionally, additional -re-not arguments can be specified, to +# ensure that a regexp is not match by the COMMAND output. +# Such an additional argument generates an additional PASS/FAIL of the form: +# PASS: test-case.exp: $message: pattern not matched: + +proc gdb_test_lines { command message re args } { + set re_not [list] + + for {set i 0} {$i < [llength $args]} {incr i} { + set arg [lindex $args $i] + if { $arg == "-re-not" } { + incr i + if { [llength $args] == $i } { + error "Missing argument for -re-not" + break + } + set arg [lindex $args $i] + lappend re_not $arg + } else { + error "Unhandled argument: $arg" + } + } -proc gdb_test_lines { command message re } { - set found 0 - set idx 0 if { $message == ""} { set message $command } + set lines "" gdb_test_multiple $command $message { -re "\r\n(\[^\r\n\]*)(?=\r\n)" { @@ -1467,6 +1488,10 @@ proc gdb_test_lines { command message re } { } gdb_assert { [regexp $re $lines] } $message + + foreach re $re_not { + gdb_assert { ![regexp $re $lines] } "$message: pattern not matched: $re" + } } # Test that a command gives an error. For pass or fail, return