From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128241 invoked by alias); 12 Jan 2016 22:51:09 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 128228 invoked by uid 89); 12 Jan 2016 22:51:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=hundreds, bonus X-HELO: usplmg20.ericsson.net Received: from usplmg20.ericsson.net (HELO usplmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 12 Jan 2016 22:51:08 +0000 Received: from EUSAAHC005.ericsson.se (Unknown_Domain [147.117.188.87]) by usplmg20.ericsson.net (Symantec Mail Security) with SMTP id 7C.23.06940.E3185965; Tue, 12 Jan 2016 23:42:06 +0100 (CET) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.89) with Microsoft SMTP Server id 14.3.248.2; Tue, 12 Jan 2016 17:51:05 -0500 To: , gdb-patches From: Simon Marchi Subject: How to abort a test? Message-ID: <56958359.8070708@ericsson.com> Date: Tue, 12 Jan 2016 22:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00243.txt.bz2 Hi! (x-posting to gdb-patches@ and/or dejagnu@, depending on the point of view) I am trying to make some improvements in the gdb testsuite, especially when testing with gdbserver on a remote target board. I'd like to add a check so that if the gdbserver specified by the user does not exist on the remote board, the test will error out and abort. There is no point in testing anything else after that, we know it will fail (and take a long of time before doing so, because gdb needs to timeout first). When raising an exception, such as: error "The specified gdbserver path does not exist." I can make it propagate up to where runtest catches it: runtest.exp:1474: if { [catch "uplevel #0 source $test_file_name"] == 1 } { The test will be aborted, runtest will output a detailed error, but the test will still pass. Intuitively, I would think that a test that throws an error should automatically be failed or unresolved, since something unexpected happened. The only option I see right now would be to fix the whole return chain and add proper error handling everywhere, to exit early when an error happens. However, that means changing tens (hundreds?) of callsites through the testsuite, which is why I'm looking for alternative solutions first. My situation is actually very similar to this unanswered stackoverflow question, so bonus points for us if we can answer it at the same time :) http://stackoverflow.com/questions/16131622/abort-a-test-in-a-dejagnu-testsuite It's the first hit when you Google "dejagnu abort test", so I'm sure it would help more people. Thanks for your help, Simon