From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id IVvWF2JkOGlUFykAWB0awg (envelope-from ) for ; Tue, 09 Dec 2025 13:03:14 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=Gdkktn3j; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5E8791E08D; Tue, 09 Dec 2025 13:03:14 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A2DDC1E08D for ; Tue, 09 Dec 2025 13:03:13 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 343FD4BA2E22 for ; Tue, 9 Dec 2025 18:03:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 343FD4BA2E22 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=Gdkktn3j Received: from mail-oo1-f51.google.com (mail-oo1-f51.google.com [209.85.161.51]) by sourceware.org (Postfix) with ESMTPS id 866E64BA540C for ; Tue, 9 Dec 2025 18:02:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 866E64BA540C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 866E64BA540C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.161.51 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765303368; cv=none; b=DeGKSfVVvDcxmTbZOKqQzE01t9AWeDLUwiJACuBZzL0FYB1AvfREBeja8gpOMAy/3aMH84Q/BdNfTiA/eZORK4JjqoyPe1aHItBzc1fYLRpw1Zt8uxCSSsAB77sDZCcxCNg2P/+3GQgb8Spe5S73VRMGJ5dWvgu5F4s4GAgKPSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765303368; c=relaxed/simple; bh=frNjlhHv+ZBKMoPzGTrrfnRwgZIAjplrQUq00MD1OLY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=rIqVm4zXS6ou4YaGYUsn+LztgUNJDCUU7z3sKM8DrPdI+duMhej8dwB2bPjianxtKURpw1LHl92e7idhkJWtTFlxDnnHOCZnQ4xxB2zxpvJ+SRvTc3DI55zpAklAr5zrTm0PFKMVAZxFc66C2yCCA0W1kt5IRzup+cRDsFiU4oA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 866E64BA540C Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-6597b072cffso1942487eaf.1 for ; Tue, 09 Dec 2025 10:02:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1765303368; x=1765908168; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=H3qqQuvJFVNa2ZtbLu+dCVqQqsC4zIhvdfAshRYe1r8=; b=Gdkktn3jqDFUqEIbvE+XFBr/Mb4tGN/v/Y3C0Zximi7Mc0/Vr5gwVIcagyScKl/7gg DqI1swYN2P8SkU98Aa0eLFITIP60aPZjNJ+RFAHTXgNyVf/gAz2qQ4TCWRLbGPbwZO9l Vw9AH2gnjFKcGpS+yjXhnsnViAFCqomo3ddjRqRvEfXmhiGpgPJSLRunYuZBVyGuZSqR 3u8HLV/MQj4c4lDbC3exrVxhnxBV0BkKmOfpz+SL6USLhIBxn/zR+wKqJh9b4czZ/KyH sdNWf2kfkLRQ3SGVb943c+UAmq+v4S1v55oUntirfAMpPxKRmyPRJJTJx6fEq4Z/IX7l VW6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765303368; x=1765908168; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=H3qqQuvJFVNa2ZtbLu+dCVqQqsC4zIhvdfAshRYe1r8=; b=qqNgAbXPmsIEIhCOH3Af1tifFvOhBZMlpuZzY1btZw7gTO7awPct7Jm824mB655kNo gSnH8Gs0CbiLT65YTst08plsD1Cue5uFjO2mnc46VD6xcFcypS4y5mFiDLz2FQPnuaMp jUOEMxRgxa9StJANoKatcot6ApHTX7ciG1IJqD0zP2OQ4f9dayAVQIUaG7xabdyQ/6g0 WXoi2Z0/CzEjKITdKkFgT5QI+tnkI0RF9416iqmSlALqg8nsESbR5NMsfTq2fEsy2lrF dbaok+Dn7ePuzSR0oXrJBnqnWWiWUmn+cpg1j5w1AUOsibNH3Wd558nufm8Nd3wgVcAB n5Tg== X-Gm-Message-State: AOJu0Yxso7tCTdbjhqEDSgQsRD/OP6I+5c/xCUn7ilyf3Hep8ASMos0W Af1pRyrnixTGrk20+jRTWY1SJCctkF6qizN/WoFvt+iZ9X9yam6UWEzBBF14RhpBotJ0DcgvC9U HTuw= X-Gm-Gg: ASbGnct8xH9Yfh76G1eVn8uK4AK3L5QzUNB/pFeDxs8zgkWUiJwPlhZWhcQfWqUVMAm jejebQo/qWnsqmP7lJlXqveofQ2jVTbhbECuBevWzYbB61muRNLuVbQbFZR7pFjvlSpXTW/5vzd AzfjpWsqn5c+1uNV/jRyeZw4hy8QY+Nce+qlbba3uzlr8fUe2cvoEOhGxuzpYpb65FdLIxXhi9R f0NIElzQx99hgCltc4b+xGdJwwPbhxavjnzowx0f8SqhMPcTsmJQzkCoMpEHgN1GFK2cOCfsrqW ayWgHUFnSZschmQlZL6ruTisb6xdJDLVoRB1NU/D9Yrcfz2ot55Syfc2LSeOw+6BLPWs6E1vD3/ RKD7ZTsMMv2RxWxckREw9/PeAZl15tMerFC+AiyyRT0BCpfZ4rYPpUciGXvkL64WXgptpmFPRTu g4WNSKbhp+1Fmi3/CyA9gAnpB1uEQRbNRABw== X-Google-Smtp-Source: AGHT+IFy1HamhV3lCFszXXwoyiJmOjdkRpgsYUU9PIXCGqSaD1w4dDnC+Hz720n5MWYS0vUR3VGGCQ== X-Received: by 2002:a05:6820:829:b0:659:9a49:8dfc with SMTP id 006d021491bc7-6599a97b13amr4839594eaf.62.1765303367769; Tue, 09 Dec 2025 10:02:47 -0800 (PST) Received: from bapiya (97-122-120-205.hlrn.qwest.net. [97.122.120.205]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-3f50b510088sm11416935fac.11.2025.12.09.10.02.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Dec 2025 10:02:35 -0800 (PST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2] Rewrite the "show environment" test Date: Tue, 9 Dec 2025 11:02:30 -0700 Message-ID: <20251209180230.432182-1-tromey@adacore.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 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 In a review early in the year: https://inbox.sourceware.org/gdb-patches/874iz3f4ek.fsf@redhat.com/ Andrew pointed out that a new test I proposed failed with read1. This test was essentially a copy of gdb.base/environ.exp. I couldn't reproduce the read1 problem, but this patch rewrites the one test there that seems like it could possibly fail in this mode. Now it uses line-by-line mode and checks for a certain environment variable appearing in the output. --- gdb/testsuite/gdb.base/environ.exp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/gdb.base/environ.exp b/gdb/testsuite/gdb.base/environ.exp index 36cc5f48813..091010acfda 100644 --- a/gdb/testsuite/gdb.base/environ.exp +++ b/gdb/testsuite/gdb.base/environ.exp @@ -13,7 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . */ -gdb_start +# Make sure there is at least one environment variable. +save_vars { env(GDB_TEST_ENV_VAR) } { + setenv GDB_TEST_ENV_VAR abc + gdb_start +} proc test_set_show_env_var { name value test_name } { gdb_test_no_output "set environment $name $value" "$test_name" @@ -29,11 +33,20 @@ proc test_set_show_env_var_equal { name value test_name } { # Verify that we can show all currently-set environment variables. # It's hard to do this verification since we can't really compare each -# entry with the current environment. So we just check to see if -# there is anything that looks like an environment variable being -# printed. -gdb_test "show environment" "(\[A-Za-z_\]+=.*)+" \ - "show environment works" +# entry with the current environment. So we just check to see if the +# environment variable we set at startup is printed. +set saw_env 0 +gdb_test_multiple "show environment" "show environment works" -lbl { + -re "\r\nGDB_TEST_ENV_VAR=abc" { + incr saw_env 1 + exp_continue + } + + -re "\r\n$gdb_prompt $" { + } +} + +gdb_assert {$saw_env == 1} "show environment displayed variable" # Verify that we can unset a specific environment variable. gdb_test_no_output "unset environment EDITOR" "unset environment variable" base-commit: 8eeed95625ab7283032ed73e8866ace82daf30aa -- 2.52.0