From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 20BF23840C03 for ; Thu, 11 Jun 2020 14:35:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 20BF23840C03 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DD517AD6A for ; Thu, 11 Jun 2020 14:35:28 +0000 (UTC) Date: Thu, 11 Jun 2020 16:35:23 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Don't abort testrun for invalid command in test-case Message-ID: <20200611143522.GA19667@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-16.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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, 11 Jun 2020 14:35:27 -0000 Hi, Say we add a call to foobar at the end of a test-case, and run the test-suite. We'll run into a dejagnu error: ... ERROR: (DejaGnu) proc "foobar" does not exist. ... and the test-suite run is aborted. It's reasonable that the test-case is aborted, but it's not reasonable that the testsuite run is aborted. Problems in one test-case should not leak into other test-cases, and they generally don't. The exception is the "invalid command name" problem due to an override of ::unknown in dejagnu's framework.exp. Fix this by limiting the scope of dejagnu's ::unknown override. Tested on x86_64-linux. Any comments? Thanks, - Tom [gdb/testsuite] Don't abort testrun for invalid command in test-case gdb/testsuite/ChangeLog: 2020-06-11 Tom de Vries PR testsuite/26110 * lib/gdb.exp (::dejagnu_unknown): Rename from ::unknown. (unknown): New proc. --- gdb/testsuite/lib/gdb.exp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 51f8a05464..e25f2e74f7 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -7243,5 +7243,32 @@ proc with_override { name override body } { return $result } +# Save the unknown proc defined by dejagnu. +rename ::unknown ::dejagnu_unknown + +# Override the unknown proc with a gdb-local version. +proc unknown { args } { + set script [info script] + + set script [file dirname $script] + set subdir3 [file tail $script] + + set script [file dirname $script] + set subdir2 [file tail $script] + + set script [file dirname $script] + set subdir1 [file tail $script] + + if { $subdir1 == "gdb" + && $subdir2 == "testsuite" + && [regexp {^gdb[.]} $subdir3] } { + # If we're executing a gdb test-case, skip dejagnu_unknown to prevent + # it from exiting and aborting the entire test run. + return [uplevel 1 ::tcl_unknown $args] + } + + return [uplevel 1 ::dejagnu_unknown $args] +} + # Always load compatibility stuff. load_lib future.exp