From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id mBRoAZ3+pGC4OAAAWB0awg (envelope-from ) for ; Wed, 19 May 2021 08:03:41 -0400 Received: by simark.ca (Postfix, from userid 112) id E50F31F11C; Wed, 19 May 2021 08:03:40 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.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 B75D61E54D for ; Wed, 19 May 2021 08:03:39 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 50E9E3939C17; Wed, 19 May 2021 12:03:39 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id A20D93939C04 for ; Wed, 19 May 2021 12:03:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A20D93939C04 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id BC7D7AFEC for ; Wed, 19 May 2021 12:03:35 +0000 (UTC) Subject: [committed][gdb/testsuite] Fix read1 timeout in gdb.base/info-types-c++.exp From: Tom de Vries To: gdb-patches@sourceware.org References: <20210512063959.GA20913@delia.home> Message-ID: <1c11c589-dcac-273e-136c-13a37685a57d@suse.de> Date: Wed, 19 May 2021 14:03:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210512063959.GA20913@delia.home> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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@sourceware.org Sender: "Gdb-patches" On 5/12/21 8:40 AM, Tom de Vries wrote: > Hi, > > When running test-case gdb.base/info-types-c++.exp with check-read1 I run > into: > ... > 425: typedef const void * std::allocator_traits _Sp_counted_ptr_inplace recursive_directory_iterator::_Dir_stack, std::allocator __cxx11::recursive_directory_iterator::_Dir_stack>, \ > FAIL: gdb.base/info-types-c++.exp: info types (timeout) > ... > > The corresponding gdb_test_multiple does contain an exp_continue which > resets the timeout counter every time info for another file is printed, but > this doesn't help for this timeout because it times out during printing info > for a single file. > > Fix this by processing line-by-line. > > Tested on x86_64-linux, both with gcc-7.5.0 and gcc-4.8.5 (the latter is > different because the "unsigned int" type is missing). > > Any comments? > Committed. Thanks, - Tom > [gdb/testsuite] Fix read1 timeout in gdb.base/info-types-c++.exp > > gdb/testsuite/ChangeLog: > > 2021-05-12 Tom de Vries > > * gdb.base/info-types.exp.tcl: Scan info types output line-by-line. > > --- > gdb/testsuite/gdb.base/info-types.exp.tcl | 97 +++++++++++++++++++++++++------ > 1 file changed, 80 insertions(+), 17 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/info-types.exp.tcl b/gdb/testsuite/gdb.base/info-types.exp.tcl > index ffdc3fa9088..2989751eef9 100644 > --- a/gdb/testsuite/gdb.base/info-types.exp.tcl > +++ b/gdb/testsuite/gdb.base/info-types.exp.tcl > @@ -16,6 +16,57 @@ > # Check that 'info types' produces the expected output for an inferior > # containing a number of different types. > > +# Match LINE against regexp OUTPUT_LINES[IDX]. > +proc match_line { line output_lines idx_name } { > + upvar $idx_name idx > + > + while { 1 } { > + if { $idx == [llength $output_lines] } { > + # Ran out of regexps, bail out. > + return -1 > + } > + > + set re [lindex $output_lines $idx] > + if { $re == "--optional" } { > + # Optional, get actual regexp. > + set opt 1 > + incr idx > + set re [lindex $output_lines $idx] > + } else { > + # Not optional. > + set opt 0 > + } > + > + if { [regexp $re $line] } { > + # Match. > + incr idx > + if { $idx == [llength $output_lines] } { > + # Last match, we're done. > + return 1 > + } > + # Match found, keep looking for next match. > + return 0 > + } else { > + # No match. > + if { $idx == 0 } { > + # First match not found, just keep looking for first match. > + return 0 > + } elseif { $opt } { > + # Try next regexp on same line. > + incr idx > + continue > + } else { > + # Mismatch, bail out. > + return -1 > + } > + } > + break > + } > + > + # Keep going. > + return 0 > +} > + > # Run 'info types' test, compiling the test file for language LANG, > # which should be either 'c' or 'c++'. > proc run_test { lang } { > @@ -39,8 +90,8 @@ proc run_test { lang } { > } > > if { $lang == "c++" } { > - set output_re \ > - [multi_line \ > + set output_lines \ > + [list \ > "98:\[\t \]+CL;" \ > "42:\[\t \]+anon_struct_t;" \ > "65:\[\t \]+anon_union_t;" \ > @@ -69,11 +120,12 @@ proc run_test { lang } { > "39:\[\t \]+typedef enum_t nested_enum_t;" \ > "19:\[\t \]+typedef float nested_float_t;" \ > "18:\[\t \]+typedef int nested_int_t;" \ > - "62:\[\t \]+typedef union_t nested_union_t;(" \ > - "\[\t \]+unsigned int)?"] > + "62:\[\t \]+typedef union_t nested_union_t;" \ > + "--optional" "\[\t \]+unsigned int" \ > + ""] > } else { > - set output_re \ > - [multi_line \ > + set output_lines \ > + [list \ > "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \ > "45:\[\t \]+typedef struct {\\.\\.\\.} anon_struct_t;" \ > "68:\[\t \]+typedef union {\\.\\.\\.} anon_union_t;" \ > @@ -96,33 +148,44 @@ proc run_test { lang } { > "19:\[\t \]+typedef float nested_float_t;" \ > "18:\[\t \]+typedef int nested_int_t;" \ > "62:\[\t \]+typedef union union_t nested_union_t;" \ > - "56:\[\t \]+union union_t;(" \ > - "\[\t \]+unsigned int)?"] > + "56:\[\t \]+union union_t;" \ > + "--optional" "\[\t \]+unsigned int" \ > + ""] > } > > set state 0 > + set idx 0 > gdb_test_multiple "info types" "" { > -re "\r\nAll defined types:" { > - if { $state == 0 } { set state 1 } > + if { $state == 0 } { set state 1 } else { set state -1 } > exp_continue > } > - -re "\r\n\r\nFile .*[string_to_regexp $srcfile]:" { > - if { $state == 1 } { set state 2 } > + -re "^\r\nFile .*[string_to_regexp $srcfile]:" { > + if { $state == 1 } { set state 2 } else { set state -2 } > exp_continue > } > - -re $output_re { > - if { $state == 2 } { set state 3 } > - exp_continue > - } > - -re "\r\n\r\nFile \[^\r\n\]*:" { > + -re "^\r\nFile \[^\r\n\]*:" { > + if { $state == 2 } { set state -4 } > exp_continue > } > -re -wrap "" { > if { $state == 3} { > pass $gdb_test_name > } else { > - fail $gdb_test_name > + fail "$gdb_test_name (state == $state)" > + } > + } > + -re "^\r\n(\[^\r\n\]*)(?=\r\n)" { > + if { $state == 2 } { > + set line $expect_out(1,string) > + set res [match_line $line $output_lines idx] > + if { $res == 1 } { > + set state 3 > + } elseif { $res == -1 } { > + set state -3 > + } > } > + exp_continue > } > } > } >