From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id M9jyIDm/OmSqmCwAWB0awg (envelope-from ) for ; Sat, 15 Apr 2023 11:14:01 -0400 Received: by simark.ca (Postfix, from userid 112) id 7B8E71E0D5; Sat, 15 Apr 2023 11:14:01 -0400 (EDT) Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=JxgZ+8XC; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.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 BE99F1E0D5 for ; Sat, 15 Apr 2023 11:13:59 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DFC53385AC29 for ; Sat, 15 Apr 2023 15:13:58 +0000 (GMT) Received: from outbound-ss-761.bluehost.com (outbound-ss-761.bluehost.com [74.220.211.250]) by sourceware.org (Postfix) with ESMTPS id F0CF2385842E for ; Sat, 15 Apr 2023 15:13:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F0CF2385842E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw10.mail.unifiedlayer.com (unknown [10.0.90.125]) by progateway8.mail.pro1.eigbox.com (Postfix) with ESMTP id 1467D10043B5D for ; Sat, 15 Apr 2023 15:13:44 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id nhaxp2OYoP6cJnhaxpz1KM; Sat, 15 Apr 2023 15:13:44 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=V8u4bcri c=1 sm=1 tr=0 ts=643abf28 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=dKHAf1wccvYA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=3Qhz7xS8dOisEvQthyUA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=avmNi53Umt6uDJdykK7uJPPYj400Q4zRbRV0pVdVDdQ=; b=JxgZ+8XCaiphbLqKLe4i8teUx7 ZgvfoUgpd0mZAHnCQToYBrFNZ6JkfDzhCSUH2BbG/Iy/kDbIYYPuvt5WK6RbNvVq1t33cFFiLaRhW 3iM7HTi7XDzV+1KR7zVuDQR7M; Received: from 71-211-191-82.hlrn.qwest.net ([71.211.191.82]:43720 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pnhax-0021Ms-OG; Sat, 15 Apr 2023 09:13:43 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFC 2/5] Introduce the "critical" testsuite command Date: Sat, 15 Apr 2023 09:13:33 -0600 Message-Id: <20230415151336.4104455-3-tom@tromey.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230415151336.4104455-1-tom@tromey.com> References: <20230415151336.4104455-1-tom@tromey.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 71.211.191.82 X-Source-L: No X-Exim-ID: 1pnhax-0021Ms-OG X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-191-82.hlrn.qwest.net (localhost.localdomain) [71.211.191.82]:43720 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes 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 patch introduces a new "critical" command for the test suite. Unlike require, "critical" can handle multiple arguments and a variety of return value conventions. It is implemented as a Tcl namespace ensemble for this reason. This version of the patch provides a few such subcommands. Currently these are all implemented via a helper proc, but there's no requirement that this always be true. --- gdb/testsuite/lib/gdb.exp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index a1808c699e9..0ae40bceba2 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -9287,6 +9287,34 @@ proc require { args } { } } +# +# The "critical" command is used to invoke some code that must +# succeed. If the code in question fails, "unsupported" is logged and +# the command's caller will return. +# +# This is implemented as an ensemble namespace so that individual +# sub-commands can handle varying return values correctly. +# +namespace eval critical { + proc _make_wrapper {name bad_result} { + proc $name {args} [format { + set result [uplevel [list %s {*}$args]] + if {$result == %s} { + unsupported "error adding gdb index" + return -code return 0 + } + } $name $bad_result] + namespace export $name + } + + _make_wrapper ensure_gdb_index -1 + _make_wrapper prepare_for_testing_full -1 + _make_wrapper prepare_for_testing -1 + _make_wrapper runto 0 + + namespace ensemble create +} + # Wait up to ::TIMEOUT seconds for file PATH to exist on the target system. # Return 1 if it does exist, 0 otherwise. -- 2.39.2