From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id CC4B83857C75 for ; Thu, 3 Jun 2021 19:28:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CC4B83857C75 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x329.google.com with SMTP id n17-20020a7bc5d10000b0290169edfadac9so6557658wmk.1 for ; Thu, 03 Jun 2021 12:28:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=RAe3QX33Ou7XR3wxVDUy3kXd7oJNHGb/R7Lw5jwCwUc=; b=dXBzxn6z73rKDoZd5l9920BNj51kDdVxK3tU5QaT3lfCu8KxPgZImctGWtUAqlpihg Zqqosrl1s9JJ4QfJuumiTCw/qzhnUMx+IA9wfi9NYenPX+XXprV/l/SWLJb9D7mR9HCF dRhp4uxuHazbzAjZnTtvgUle4IdMjFKlnWVrViG916Whd9CqP4Z3S+gRkdCT3iV8bwxy SRCzUYLAvHQg0RVedFve92IVfhRpCSkbJv2c6OTJZ4KbHbVgXjSIQxmR5GgFQKLbr7tS F23mxKEtgvYQls0ekua+ZCHPgKgLtvd5qzesqGa82grExzxMKVEKp8MknsEmPX5igTMe NxEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=RAe3QX33Ou7XR3wxVDUy3kXd7oJNHGb/R7Lw5jwCwUc=; b=Ip3MlF0aTS5TievSkZyf0H88pz5QWPdOywLrpZUfGuEm/t3yKZ5ocbnROmAvNm6umz BQPwyqI9EOiimw+RPoj0rrTAvpkGnPROVGIXicWEJLCDB6b0/E7aX2PESROnBG0phUcA ludhdzart+aPrVsIsKI/65A/vW8k8V8Cs/KaCELafvixeD/FLUMbMVQB3EFrojbBCxpN cf8MTjl0706Y/OIFPPg7mHimD4VRwZxq8bRBzXO818vpaSUn2KhcNEtMq1X3hLzefx3c Edk/Y05PWq9sXe/jNmnF68JPZkaoH9aIYm2LVzJ5eynZug0G6kk6N0ZFzbYJxu5igDEP vrgQ== X-Gm-Message-State: AOAM533Gmsz9DKeLNVbvq9f/IILm2+0fqomcdnzsRS3HwCsN9lrPKd8f YCPd/ixUIoqea3Sh+xhMzWwYb1E7QGogtQ== X-Google-Smtp-Source: ABdhPJxIuRxoff6leYkHcbLci1dvlx5p6erGsw4xkRwh3bDVKs+HC6+eTBB37MBzghVOmCLYM6J1Gg== X-Received: by 2002:a1c:4d0d:: with SMTP id o13mr56017wmh.59.1622748514880; Thu, 03 Jun 2021 12:28:34 -0700 (PDT) Received: from localhost (host109-151-46-70.range109-151.btcentralplus.com. [109.151.46.70]) by smtp.gmail.com with ESMTPSA id k16sm3545747wmr.42.2021.06.03.12.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 12:28:34 -0700 (PDT) Date: Thu, 3 Jun 2021 20:28:33 +0100 From: Andrew Burgess To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 03/17] Fix silent gdb.base/annota1.exp test coverage regression Message-ID: <20210603192833.GP2672@embecosm.com> References: <20210603190243.2609886-1-pedro@palves.net> <20210603190243.2609886-4-pedro@palves.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20210603190243.2609886-4-pedro@palves.net> X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 20:27:49 up 15 days, 9:12, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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, 03 Jun 2021 19:28:38 -0000 * Pedro Alves [2021-06-03 20:02:29 +0100]: > This commit fixes a test coverage regression caused by: >=20 > commit b001de2320446ec803b4ee5e0b9710b025b84469 > Author: Andrew Burgess > AuthorDate: Mon Nov 26 17:56:39 2018 +0000 > Commit: Andrew Burgess > CommitDate: Wed Dec 12 17:33:52 2018 +0000 >=20 > gdb: Update test pattern to deal with native-extended-gdbserver >=20 > While looking at a regression caused by a local patch I was working > on, I noticed this: >=20 > =1A=1Apre-prompt > (gdb) > =1A=1Aprompt > PASS: gdb.base/annota1.exp: breakpoint info > PASS: gdb.base/annota1.exp: run until main breakpoint > run >=20 > =1A=1Apost-prompt > Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb.= base/annota1/annota1 > next >=20 > Note how above, we get the "run until main breakpoint" pass even > before "run" shows up in the log! The issue is that the test isn't > really testing anything, it always passes regardless of the gdb > output. >=20 > There are a few problems here, fixed by this commit: >=20 > - using {} to build the list for [join], when the strings we're > joining include variable names that must be expanded. Such list > need to be built with [list] instead. >=20 > - [join] joins strings with a space character by default. We need to > pass the empty string as second parameter so that it just concats > the strings. >=20 > - doing too much in a "-re" (calling procedures), which doesn't work > correctly. I've seen this before and never digged deeper into why. > Probably something to do with how gdb_test_multiple is implemented. > Regardless, easy and clear enough to build the pattern first into a > variable. >=20 > gdb/testsuite/ChangeLog: > yyyy-mm-dd Pedro Alves >=20 > * gdb.base/annota1.exp: Build list using [list] instead of {}. > Tell [join] to join with no character. Build expected pattern in > separate variable instead of in the -re expression directly. LGTM. Thanks, Andrew >=20 > Change-Id: Ib3c89290f0e9ae4a0a43422853fcd4a7a7e12b18 > --- > gdb/testsuite/gdb.base/annota1.exp | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) >=20 > diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/= annota1.exp > index e2a9423c68b..3689f49fa1b 100644 > --- a/gdb/testsuite/gdb.base/annota1.exp > +++ b/gdb/testsuite/gdb.base/annota1.exp > @@ -126,8 +126,8 @@ gdb_test_multiple "info break" "breakpoint info" { > # > #exp_internal 1 > set binexp [string_to_regexp $binfile] > -gdb_test_multiple "run" "run until main breakpoint" { > - -re [join { "\r\n\032\032post-prompt\r\nStarting program: $binexp " \ > + > +set run_re [join [list "\r\n\032\032post-prompt\r\nStarting program: $bi= nexp " \ > "\(\(\r\nReading \[^\r\n\]+\)|\(\r\nwarning: File transfers from r= emote targets can be slow\[^\r\n\]+\)\)*" \ > "\(\r\nwarning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\= ]+\r\nDo \"set use-deprecated-index-sections on\" before the file is read\r= \nto use the section anyway\\.\)?" \ > "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoint= s-invalid\)\)*\r\n\r\n" \ > @@ -146,7 +146,10 @@ gdb_test_multiple "run" "run until main breakpoint" { > "\032\032frame-source-end\r\n\r\n\r\n" \ > "\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n" \ > "\032\032frame-end\r\n\r\n" \ > - "\032\032stopped.*$gdb_prompt$" } ] { > + "\032\032stopped.*$gdb_prompt$" ] "" ] > + > +gdb_test_multiple "run" "run until main breakpoint" { > + -re $run_re { > pass $gdb_test_name > } > } > --=20 > 2.26.2 >=20