public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: <dejagnu@gnu.org>, gdb-patches <gdb-patches@sourceware.org>
Subject: How to abort a test?
Date: Tue, 12 Jan 2016 22:51:00 -0000	[thread overview]
Message-ID: <56958359.8070708@ericsson.com> (raw)

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

             reply	other threads:[~2016-01-12 22:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12 22:51 Simon Marchi [this message]
2016-01-14 16:25 ` Pedro Alves
2016-01-14 17:13   ` Simon Marchi
2016-01-14 17:28     ` Pedro Alves
2016-01-14 19:43       ` Simon Marchi
2016-01-14 19:48         ` Pedro Alves
2016-01-15 16:35           ` Simon Marchi
2016-01-15 20:22             ` Ben Elliston
2016-01-17  8:27             ` Joel Brobecker
2016-01-18 16:43               ` Simon Marchi
2016-01-21 10:42                 ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56958359.8070708@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=dejagnu@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).