From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 047B7385841F for ; Thu, 24 Feb 2022 18:13:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 047B7385841F Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-452-gxGIUAMmOWa-NpHOS1Towg-1; Thu, 24 Feb 2022 13:13:44 -0500 X-MC-Unique: gxGIUAMmOWa-NpHOS1Towg-1 Received: by mail-wm1-f71.google.com with SMTP id c5-20020a1c3505000000b0034a0dfc86aaso202314wma.6 for ; Thu, 24 Feb 2022 10:13:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=w5MuPVPoDV3ZcOPEH8jU8dLv1llnilvH2Tmi5sWE/8k=; b=TcyvQ14hTywA61o7Wt36tPJJolqL22kIC4WFdnPELgcxL1qU15xTZtu8j0VRbUz+Se 1V/SUwYMkrbsT6abZyDXRla7aLlEcoRNtmjVQejTauYfNHH6+/r46Rv4XY0atlgUjnmb 9lUbWjSHL2yy9SvQOIE+fe07BDrY8WfoghfPaLYWk4lvxnGE/VcCIQ3Ha2/5HAV+TJW0 oxHhecRhh96LhCcvkf9HP6Yv862FevgNegn1Gd/B0TNV+KMNwqE2ZCP3F4yHWPOhuSQm Ysbs2SL82sPVmbmO0BQBrjUjqca6LhX0G2FmrVsCXQBX44uTxR74eDful76Hry6YvyBC Ilqw== X-Gm-Message-State: AOAM532inS54efBpIPm6pArm853AbMcPUHSiKrbhvzIErCdZOuMnR8jW Yh2VMPg6K2ijF2PCbRGEfNw7oNpYgbOjuUlo58WE/8hzJEwaK515zmlSo9RayBFEYbyPXtwY/Nf G04K12fIE53x5frQXIgpIkg== X-Received: by 2002:adf:de0b:0:b0:1ed:c0ae:cf76 with SMTP id b11-20020adfde0b000000b001edc0aecf76mr3201676wrm.501.1645726423179; Thu, 24 Feb 2022 10:13:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwSJuQI5pS4h+EQBJPkgezF2mBd7xhcEf/6gPRm9r9GSsUjfVUV5gaUxl4aR30LbpZNQBz2Ag== X-Received: by 2002:adf:de0b:0:b0:1ed:c0ae:cf76 with SMTP id b11-20020adfde0b000000b001edc0aecf76mr3201659wrm.501.1645726422833; Thu, 24 Feb 2022 10:13:42 -0800 (PST) Received: from localhost (92.40.169.52.threembb.co.uk. [92.40.169.52]) by smtp.gmail.com with ESMTPSA id a3-20020a7bc1c3000000b00380e493660esm3268000wmj.42.2022.02.24.10.13.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 10:13:42 -0800 (PST) Date: Thu, 24 Feb 2022 18:13:40 +0000 From: Andrew Burgess To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix list.exp test cases Message-ID: <20220224181340.GU2571@redhat.com> References: <20220224154029.940785-1-tromey@adacore.com> MIME-Version: 1.0 In-Reply-To: <20220224154029.940785-1-tromey@adacore.com> X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 18:12:00 up 13 days, 7:51, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_ABUSEAT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Thu, 24 Feb 2022 18:13:50 -0000 * Tom Tromey via Gdb-patches [2022-02-24 08:40:29 -0700]: > PR testsuite/7142 -- old enough to have been converted from Gnats -- > points out that test_list_filename_and_function in gdb.base/list.exp > has "fails" that are unmatched with passes. This patch cleans this up > a little. If we're going to clean this up, maybe we could switch to use gdb_test_multiple, which would allow the use of $gdb_test_name, and remove the need for send_gdb calls. Something like the patch below? Thanks, Andrew --- commit 2db58395c641adedc8d198786aa0dbb6424cc766 Author: Tom Tromey Date: Thu Feb 24 08:40:29 2022 -0700 gdb/testsuite: fix list.exp test cases PR testsuite/7142 -- old enough to have been converted from Gnats -- points out that test_list_filename_and_function in gdb.base/list.exp has "fails" that are unmatched with passes. This patch cleans this up a little. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7142 diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index d035d9b1613..d11d35e6697 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -251,36 +251,28 @@ proc test_list_filename_and_function {} { global gdb_prompt global last_line_re - set testcnt 0 - # gcc appears to generate incorrect debugging information for code # in include files, which breaks this test. # SunPRO cc is the second case below, it's also correct. - send_gdb "list list0.c:main\n" - gdb_expect { - -re "1\[ \t\]+#include .*10\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { - incr testcnt + gdb_test_multiple "list list0.c:main" "" { + -re -wrap "1\[ \t\]+#include .*10\[ \t\]+foo \[(\]+.*\[)\]+;" { + pass $gdb_test_name } - -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { - pass "list function in source file 1" + -re -wrap "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;" { + pass $gdb_test_name } - -re ".*$gdb_prompt $" { fail "list list0.c:main" } - timeout { fail "list list0.c:main (timeout)" } } # Not sure what the point of having this function be unused is. # AIX is legitimately removing it. setup_xfail "rs6000-*-aix*" - send_gdb "list list0.c:unused\n" - gdb_expect { - -re "40\[ \t\]+unused.*${last_line_re}\r\n$gdb_prompt $" { - incr testcnt + gdb_test_multiple "list list0.c:unused" "" { + -re -wrap "40\[ \t\]+unused.*${last_line_re}" { + pass $gdb_test_name } - -re "37.*42\[ \t\]+\}\r\n$gdb_prompt $" { - incr testcnt + -re -wrap "37.*42\[ \t\]+\}" { + pass $gdb_test_name } - -re ".*$gdb_prompt $" { fail "list list0.c:unused" } - timeout { fail "list list0.c:unused (timeout)" } } clear_xfail "rs6000-*-aix*" @@ -290,58 +282,47 @@ proc test_list_filename_and_function {} { # SunPRO cc is the third case. setup_xfail "rs6000-*-*" 1804 setup_xfail_format "COFF" - send_gdb "list list0.h:foo\n" - gdb_expect { - -re "2\[ \t\]+including file. This.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { - incr testcnt + gdb_test_multiple "list list0.h:foo" "" { + -re -wrap "2\[ \t\]+including file. This.*11\[ \t\]+bar \[(\]+.*\[)\]+;" { + pass $gdb_test_name } - -re "1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { - incr testcnt + -re -wrap "1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;" { + pass $gdb_test_name } - -re "3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { - incr testcnt + -re -wrap "3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;" { + pass $gdb_test_name } - -re "No source file named list0.h.\r\n$gdb_prompt $" { - fail "list list0.h:foo" + -re -wrap "No source file named list0.h." { + fail $gdb_test_name } - -re ".*$gdb_prompt $" { fail "list list0.h:foo" } - timeout { fail "list list0.h:foo (timeout)" } } # Ultrix gdb is the second case. - send_gdb "list list1.c:bar\n" - gdb_expect { - -re "4\[ \t\]+void.*13\[ \t\]+\}\r\n$gdb_prompt $" { - incr testcnt + gdb_test_multiple "list list1.c:bar" "" { + -re -wrap "4\[ \t\]+void.*13\[ \t\]+\}" { + pass $gdb_test_name } - -re "4\[ \t\]+void.*12\[ \t\]*long_line ..;\r\n$gdb_prompt $" { - incr testcnt + -re -wrap "4\[ \t\]+void.*12\[ \t\]*long_line ..;" { + pass $gdb_test_name } - -re "4\[ \t\]+void.*11\[ \t\]*\r\n$gdb_prompt $" { - incr testcnt + -re -wrap "4\[ \t\]+void.*11\[ \t\]*" { + pass $gdb_test_name } - -re ".*$gdb_prompt $" { fail "list list1.c:bar" } - timeout { fail "list list1.c:bar (timeout)" } } # Not sure what the point of having this function be unused is. # AIX is legitimately removing it. setup_xfail "rs6000-*-aix*" - send_gdb "list list1.c:unused\n" - gdb_expect { - -re "12\[ \t\]+long_line \[(\]\[)\];.*13\[ \t\]+\}\r\n.*$gdb_prompt $" { - incr testcnt + gdb_test_multiple "list list1.c:unused" "" { + -re -wrap "12\[ \t\]+long_line \[(\]\[)\];.*13\[ \t\]+\}.*" { + pass $gdb_test_name } - -re "14.*19\[ \t\]+\}\r\n.*$gdb_prompt $" { - incr testcnt + -re -wrap "14.*19\[ \t\]+\}.*" { + pass $gdb_test_name } - -re ".*$gdb_prompt $" { fail "list list1.c:unused" } - timeout { fail "list list1.c:unused (timeout)" } } clear_xfail "rs6000-*-aix*" - pass "list filename:function ($testcnt tests)" - # Test with quoting. gdb_test "list 'list0.c:main'" "int main.*"