From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id iWcfN7CgFGqyHxoAWB0awg (envelope-from ) for ; Mon, 25 May 2026 15:19:12 -0400 Received: by simark.ca (Postfix, from userid 112) id DBB2D1E0A3; Mon, 25 May 2026 15:19:12 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 416111E024 for ; Mon, 25 May 2026 15:19:12 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0E9034BAD16C for ; Mon, 25 May 2026 19:19:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0E9034BAD16C Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by sourceware.org (Postfix) with ESMTPS id 32AB24BA7980 for ; Mon, 25 May 2026 19:18:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 32AB24BA7980 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 32AB24BA7980 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779736725; cv=none; b=o7IB8dYqDOpKYpEeUnmvUMyjKl0mHFkIJ4CKh2VcuF0sFEhOTKCleXq7HF2GZAmJ5Fh8wZHmKANYUBH4vJx3Wwp6KT2t60EyZvltVFtM6vfD4J48Kw9+GL5PeiCCJNw8/UlX4jleB2J+mCx3pHak25pnZSlYFlDEQJVCV6u9FD8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1779736725; c=relaxed/simple; bh=FeDkQZPX8RoDs21ZDXBttD8PbrmdiXmCBsw+Z2ns12w=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=hqTk0xjjCf5BVLsfcd1ac2y/v9LwXtVO0Z6qrlY7kqXohbs0st6LO73r6gtrvO4KOXT0RSusTghIoDEJMw6Wutj6NMevOTJfc6wPB86bbh2IEHgQeS4isQjY8y9iIdJeXs3nZZpsGg2magsCnzTtNr6dyXI95+lOjCS7kErJUlI= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 32AB24BA7980 Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4891e86fabeso124845335e9.1 for ; Mon, 25 May 2026 12:18:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779736724; x=1780341524; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=/I5afAWHFckBkPdQEQo05RoV8uFpOBELkWl7LtUJhIc=; b=UoZE0OCvPI3tlkg2MLAYSBIge8AjkgOJh5A9nE8Wj9nRt3nfZYanOoVnbhF2Kfxsye dkRuhmvxUNTwvc4yag/IHeB1PZ441J94ylJHO19YgC9lLdnpXrnNl32xl5oFhzc1+cV7 6EGmF+fgHCBtX9OKP3/8fcUaBH9HV9Tmwy1iYI2rQLL+1QPNVVhQbT/D7bp7TY7INTrv KYNW+Ub4AnXkS/qku7uL3f36fC3/4nKlAdKBWulpweXcwWzL0Igd7GbMTop+M+4lXJlS MbEf1ZKX2XGHcvUd8gvEYnU35km3wzQXnZyNthHZOCdLzt3LALhRwRiIwc91nVqInzY5 Yn+g== X-Gm-Message-State: AOJu0YyT7xhVXv8p0nKaqlZJU4sjM9T5nLgR+GbGdYMpagHlkXMi5BYA 0TBUFeVfbAmehjVTWQYeiU/9xb0kpgNG3Xlb3b4gSwEWCiLHVTxBy42U3RPwsQ== X-Gm-Gg: Acq92OFqEbNH2hJ3XNI+kJIKYEGSke7f/3RQyXmIDvRZPY37xu6ctWWGczx4TrRqoxm P4EJOWhoLWinNtc4meTQlcGdhn91F82qJvUt8WswbOBYdbh9HCxXpoZFyJ0GN0FzfvX/vR1aTka 3aya8e2VJIo86Y3fjU9JMlP0KAhK+MrmKm1FyCyGsZ6JVHPPW982g87ZA/zqT3OhOgEi4zuAkP+ Wt7laO5eGoXs7ZVBJdyVJjT1mf0hzhwTpQCXcdgeYYGQrZgbbnR62qmKxV/Ua2ZcEV4I+3iHf6D x6j17nX+reFWKfLkEQ0H61lQTeLCvCF48z5fgSP9sJT9AzIDjmuX2R/puc2kpkF35XJJBYW07za rs5at7qgrzFV67si0nE2vp2r0ajWwU9j6ctsnROWl8VWzyWGm4kWifyawRrGOi8H262QjD/rytg MTovb0zK38UXIQwq8ekmnRW4LKVcv69nKL X-Received: by 2002:a05:600c:1553:b0:490:53b0:9e53 with SMTP id 5b1f17b1804b1-49053b0a086mr187203725e9.1.1779736723840; Mon, 25 May 2026 12:18:43 -0700 (PDT) Received: from localhost ([2001:8a0:fae3:2600:dc16:ec0f:632c:5ba7]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-49041787932sm122370415e9.1.2026.05.25.12.18.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 May 2026 12:18:43 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 04/11] gdb.base/exitsignal.exp: Exit with non-zero Date: Mon, 25 May 2026 20:18:22 +0100 Message-ID: <20260525191829.984105-5-pedro@palves.net> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260525191829.984105-1-pedro@palves.net> References: <20260525191829.984105-1-pedro@palves.net> 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 gdb.base/exitsignal.exp currently tests exiting with exit code 0. But, testing for 0 is typically more "dangerous" in the sense that it's easy for some bug in GDB or the target backend to fail to extract the exit code and return 0. Make it test exit code 1 instead. gdb.base/coredump-filter-build-id.exp currently reuses normal.c. It could still use it with this patch, but it seems better to me to remove the coupling. Simply add a new .c file for that testcase, which still returns 0. Change-Id: I49ccfdbbe4be4445172476e7dd4e06142c8a672e commit-id: d6b526ac --- .../gdb.base/coredump-filter-build-id.c | 22 +++++++++++++++++++ .../gdb.base/coredump-filter-build-id.exp | 2 +- gdb/testsuite/gdb.base/exitsignal.exp | 8 +++---- gdb/testsuite/gdb.base/normal.c | 7 ++++-- 4 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 gdb/testsuite/gdb.base/coredump-filter-build-id.c diff --git a/gdb/testsuite/gdb.base/coredump-filter-build-id.c b/gdb/testsuite/gdb.base/coredump-filter-build-id.c new file mode 100644 index 00000000000..d78df952cb5 --- /dev/null +++ b/gdb/testsuite/gdb.base/coredump-filter-build-id.c @@ -0,0 +1,22 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2013-2026 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +int +main () +{ + return 0; +} diff --git a/gdb/testsuite/gdb.base/coredump-filter-build-id.exp b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp index d267221e1bf..d8251e5c25f 100644 --- a/gdb/testsuite/gdb.base/coredump-filter-build-id.exp +++ b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp @@ -21,7 +21,7 @@ # external tool, eu-unstrip, to verify if the corefile contains # build-ids. -standard_testfile "normal.c" +standard_testfile # This test is Linux x86_64 only. if { ![istarget *-*-linux*] } { diff --git a/gdb/testsuite/gdb.base/exitsignal.exp b/gdb/testsuite/gdb.base/exitsignal.exp index 4f4c53e37cb..7ae6e19b093 100644 --- a/gdb/testsuite/gdb.base/exitsignal.exp +++ b/gdb/testsuite/gdb.base/exitsignal.exp @@ -128,11 +128,11 @@ proc test_normal {} { return } - gdb_continue_to_end + gdb_test "continue" " exited with code 01\\\].*" "continue to exit" - # Check $_exitcode. It should be 0. - gdb_test "print \$_exitcode" " = 0" \ - "\$_exitcode is zero after normal inferior is executed" + # Check $_exitcode. It should be 1. + gdb_test "print \$_exitcode" " = 1" \ + "\$_exitcode is one after normal inferior is executed" # Check $_exitsignal. It should still be void, since the inferior # has not received any signal. diff --git a/gdb/testsuite/gdb.base/normal.c b/gdb/testsuite/gdb.base/normal.c index dd371746235..ba04c861dad 100644 --- a/gdb/testsuite/gdb.base/normal.c +++ b/gdb/testsuite/gdb.base/normal.c @@ -15,10 +15,13 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* This test is just a normal return 0. */ +/* This test is just a normal return 1. */ int main (int argc, char *argv[]) { - return 0; + /* Non-zero specifically, as it would be otherwise easier for a + buggy GDB to report exit code 0 when it shouldn't and that + wouldn't be noticed. */ + return 1; } -- 2.53.0