From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71186 invoked by alias); 14 Jan 2016 19:43:46 -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 71172 invoked by uid 89); 14 Jan 2016 19:43:45 -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, sourcing, op, boards 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; Thu, 14 Jan 2016 19:43:44 +0000 Received: from EUSAAHC007.ericsson.se (Unknown_Domain [147.117.188.93]) by usplmg20.ericsson.net (Symantec Mail Security) with SMTP id AC.18.06940.B38F7965; Thu, 14 Jan 2016 20:34:19 +0100 (CET) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.95) with Microsoft SMTP Server id 14.3.248.2; Thu, 14 Jan 2016 14:43:40 -0500 Subject: Re: How to abort a test? To: Pedro Alves , , gdb-patches References: <56958359.8070708@ericsson.com> <5697CC09.8010306@redhat.com> <5697D721.1000305@ericsson.com> <5697DABA.8010008@redhat.com> From: Simon Marchi Message-ID: <5697FA6C.7060703@ericsson.com> Date: Thu, 14 Jan 2016 19:43: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: <5697DABA.8010008@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00316.txt.bz2 On 16-01-14 12:28 PM, Pedro Alves wrote: >> So they would need to be changed: >> >> -gdb_run_cmd >> +if ![gdb_run_cmd] { >> + fail "Failed to run" >> +} >> > > That's where the "return -code return" hack would come in. You'd > do that inside gdb_run_cmd so that would return directly to gdb_run_cmd's > caller. But it's an ugly hack. Now that's some tcl dark magic. >>> 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. > > I meant, before runtest, the dejagnu procedure, not before invoking the > runtest binary. E.g., straight from the target board file, say. > > E.g., with: > > --- c/gdb/testsuite/boards/gdbserver-base.exp > +++ w/gdb/testsuite/boards/gdbserver-base.exp > @@ -33,6 +33,8 @@ set_board_info gdb,predefined_tsv "\\\$trace_timestamp" > > set GDBFLAGS "${GDBFLAGS} -ex \"set auto-connect-native-target off\"" > > +error "gdbserver not present on target!" > + > proc ${board}_file { dest op args } { > if { $op == "delete" } { > return 0 > > then I get: > > $ time make check RUNTESTFLAGS="--target_board=native-gdbserver" > make[1]: Entering directory `/home/pedro/gdb/mygit/build/gdb/testsuite' > Nothing to be done for all... > make check-single > make[2]: Entering directory `/home/pedro/gdb/mygit/build/gdb/testsuite' > rootme=`pwd`; export rootme; srcdir=/home/pedro/gdb/mygit/src/gdb/testsuite ; export srcdir ; EXPECT=`if [ "${READ1}" != "" ] ; then echo ${rootme}/expect-read1; elif [ -f ${rootme}/../../expect/expect ] ; then echo ${rootme}/../../expect/expect ; else echo expect ; fi` ; export EXPECT ; EXEEXT= ; export EXEEXT ; LD_LIBRARY_PATH=$rootme/../../expect:$rootme/../../libstdc++:$rootme/../../tk/unix:$rootme/../../tcl/unix:$rootme/../../bfd:$rootme/../../opcodes:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; if [ -f ${rootme}/../../expect/expect ] ; then TCL_LIBRARY=${srcdir}/../../tcl/library ; export TCL_LIBRARY ; fi ; runtest --target_board=native-gdbserver > Test Run By pedro on Thu Jan 14 17:24:37 2016 > Native configuration is x86_64-pc-linux-gnu > > === gdb tests === > > Schedule of variations: > native-gdbserver > > Running target native-gdbserver > Using /home/pedro/gdb/mygit/src/gdb/testsuite/boards/../boards/native-gdbserver.exp as board description file for target. > Using /home/pedro/gdb/mygit/src/gdb/testsuite/boards/../boards/gdbserver-base.exp as board description file for target. > ERROR: tcl error sourcing board description file for target /home/pedro/gdb/mygit/src/gdb/testsuite/boards/../boards/gdbserver-base.exp. > gdbserver not present on target! > gdbserver not present on target! > while executing > "error "gdbserver not present on target!"" > (file "/home/pedro/gdb/mygit/src/gdb/testsuite/boards/../boards/gdbserver-base.exp" line 36) > invoked from within > "source /home/pedro/gdb/mygit/src/gdb/testsuite/boards/../boards/gdbserver-base.exp" > ("uplevel" body line 1) > invoked from within > "uplevel #0 source /home/pedro/gdb/mygit/src/gdb/testsuite/boards/../boards/gdbserver-base.exp" > invoked from within > "catch "uplevel #0 source ${dir}/${initfile}" error" > make[2]: *** [check-single] Error 1 > make[2]: Leaving directory `/home/pedro/gdb/mygit/build/gdb/testsuite' > make[1]: *** [check] Error 2 > make[1]: Leaving directory `/home/pedro/gdb/mygit/build/gdb/testsuite' > make: *** [check] Error 2 > > real 0m0.404s > user 0m0.336s > sys 0m0.060s > > Obviously not ideal; I'm just pointing out the likely easiest. Hmm if I try to put a call to [remote_file target exists "/home/simark/nonexistent"] It always returns true somehow. When I dig, I find this error: {rsh to target failed for test -f /home/simark/nonexistent, rsh: Could not resolve hostname target: Name or service not known} At this point I think the target board is not set (we are currently parsing it), so we probably can't do operations on it. Anyway, the point is not to fix it for my particular case, but to make the general testsuite more robust. I think I'll send a patch for Dejagnu for the "unresolved" solution, and see what the maintainers think. Thanks for you help Pedro. Simon