From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id AAPwDJUnuWBoIwAAWB0awg (envelope-from ) for ; Thu, 03 Jun 2021 15:03:49 -0400 Received: by simark.ca (Postfix, from userid 112) id 32D561F163; Thu, 3 Jun 2021 15:03:49 -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.6 required=5.0 tests=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 709E81E01F for ; Thu, 3 Jun 2021 15:03:47 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 03EFA399001C for ; Thu, 3 Jun 2021 19:03:47 +0000 (GMT) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by sourceware.org (Postfix) with ESMTPS id 6CA083883035 for ; Thu, 3 Jun 2021 19:02:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6CA083883035 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f42.google.com with SMTP id g204so4017292wmf.5 for ; Thu, 03 Jun 2021 12:02:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Dm1k8l1LwFCX6PkYa8nZCaB02iPt7uXlBAqkMYXSH5g=; b=Dfcm0NSbqA5MPr7HVVJwqfIfY3zZ2tJ5BSVRFlMBFG7CrjxydHsx3Atbjza1FmY7i4 j7maM6O1eo8kt+XCz2MxeMdQZ8kHf6HTZw/chRRs4bZ1keRDNBT8DlpLkUaRuKOeLy6x R3pc0V0hwHgXa8W413kqKz8n0MgVugHffdrLOCM0nsRcX9kTY9hkrmHTJUlRbLzn30jW l2aziDRSnpora7vZZl3ft0ajekfDdzIFeYzsPDyE+iQtfBAVsxD7Wvblv8FlhQLr80m8 8r6XEFl6EPckGL+xnQKCe/qc4EfekYcv0wqjwupElZFlTOKM9h8fUjElJPNNEIFRSLeA YDOQ== X-Gm-Message-State: AOAM532UcjWsTMUSvzfaglaW6+/P99HF39uNh4pAcweSgOaH1FKwGMrg CmXmC/sGUetzom3mrTcR/H38mZ3MYnMcPA== X-Google-Smtp-Source: ABdhPJyCXIByMrWiSDG7PW+CmAyy62ekxYlZYeGMNrllxED0/KvnSNzz/JTV8Jb6F0z1YZWoYTAI8g== X-Received: by 2002:a7b:cb9a:: with SMTP id m26mr588wmi.66.1622746972706; Thu, 03 Jun 2021 12:02:52 -0700 (PDT) Received: from localhost ([2001:8a0:f932:6a00:6b6e:c7b6:c5a7:aac3]) by smtp.gmail.com with ESMTPSA id t14sm4057463wra.60.2021.06.03.12.02.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Jun 2021 12:02:51 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 03/17] Fix silent gdb.base/annota1.exp test coverage regression Date: Thu, 3 Jun 2021 20:02:29 +0100 Message-Id: <20210603190243.2609886-4-pedro@palves.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210603190243.2609886-1-pedro@palves.net> References: <20210603190243.2609886-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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" This commit fixes a test coverage regression caused by: 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 gdb: Update test pattern to deal with native-extended-gdbserver While looking at a regression caused by a local patch I was working on, I noticed this: pre-prompt (gdb) prompt PASS: gdb.base/annota1.exp: breakpoint info PASS: gdb.base/annota1.exp: run until main breakpoint run post-prompt Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb.base/annota1/annota1 next 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. There are a few problems here, fixed by this commit: - 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. - [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. - 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. gdb/testsuite/ChangeLog: yyyy-mm-dd Pedro Alves * 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. Change-Id: Ib3c89290f0e9ae4a0a43422853fcd4a7a7e12b18 --- gdb/testsuite/gdb.base/annota1.exp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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: $binexp " \ "\(\(\r\nReading \[^\r\n\]+\)|\(\r\nwarning: File transfers from remote 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\032breakpoints-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 } } -- 2.26.2