From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54200 invoked by alias); 14 Jan 2016 17:13:11 -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 54188 invoked by uid 89); 14 Jan 2016 17:13: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=160114, hundreds X-HELO: usplmg21.ericsson.net Received: from usplmg21.ericsson.net (HELO usplmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 14 Jan 2016 17:13:08 +0000 Received: from EUSAAHC008.ericsson.se (Unknown_Domain [147.117.188.96]) by usplmg21.ericsson.net (Symantec Mail Security) with SMTP id 3A.89.32102.317D7965; Thu, 14 Jan 2016 18:12:51 +0100 (CET) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.98) with Microsoft SMTP Server id 14.3.248.2; Thu, 14 Jan 2016 12:13:05 -0500 Subject: Re: How to abort a test? To: Pedro Alves , , gdb-patches References: <56958359.8070708@ericsson.com> <5697CC09.8010306@redhat.com> From: Simon Marchi Message-ID: <5697D721.1000305@ericsson.com> Date: Thu, 14 Jan 2016 17:13:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <5697CC09.8010306@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00311.txt.bz2 On 16-01-14 11:25 AM, Pedro Alves wrote: >> 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. > > IIUC, you wouldn't want pass/fail to even be reached, so I don't understand > what test would you want to fail. I think unresolved would be appropriate in that case, since it's not the program under test failed, but the test, or its setup/environment. According to the Dejagnu doc, unresolved: "... usually means the test did not execute as expected, and a human being must go over results to determine if it passed or failed (and to improve the test case). ". I think that applies here. So when there is an uncaught exception coming from the test, Dejagnu could issue a: unresolved "Uncaught error from test " # needs a better message The important part is that the runtest command returns a failure return code, so that automated builds or scripts consider the run as failed. To me, a test that ends with an exception is not a test that ran successfully. >> >> 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. > > Test usually return early if running to main fails (if ![runto_main]), so maybe it > won't be that many places. Maybe some judiciously placed "return -code return" > hacks saves you a good chunk. I don't have any other idea. Many tests use gdb_run_cmd directly without checking the result: gdb/testsuite $ grep -rin '^gdb_run_cmd$' gdb.* | wc -l 73 So they would need to be changed: -gdb_run_cmd +if ![gdb_run_cmd] { + fail "Failed to run" +} > For the particular case of gdbserver not being present in the target, > probably the easiest would be to check that earlier, likely before > runtest, even. Not ideal, since the testsuite can mix native and gdbserver > tests, for instance, but... And it's a bit hard to check in the case of a remote target, given that it's runtest that knows how to "compute" the remote hostname, username, expected gdbserver path, etc, from the --target_board. Simon