Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/testsuite] Don't abort testrun for invalid command in test-case
Date: Thu, 11 Jun 2020 17:56:08 +0100	[thread overview]
Message-ID: <dea158ce-9ed2-fb01-9fdc-9b3171a77683@redhat.com> (raw)
In-Reply-To: <18e36963-4f04-f871-33fb-89a5d1683bbd@suse.de>

On 6/11/20 5:25 PM, Tom de Vries wrote:
> On 11-06-2020 17:31, Pedro Alves wrote:

>> I'd think it would be cleaner to override unknown in gdb_init,
>> and restore in gdb_finish.  No need for filename matching that way.
>> Like below.  Any reason you didn't go for this instead?
>>
> I don't think it's cleaner, because we run default_gdb_init, as well the
> bit of proc runtest between ${tool}_init a ${tool}_finish with the
> altered ::unknown.

Well, that is code that is exercised by all testscases, it's part of the
framework.  It's not going to ever contain calls to procedures that
don't exist that go unnoticed for long.  The whole testsuite would
collapse.  We can move the overriding until after default_gdb_init
is called, even, so that even less code runs under gdb's "unknown":

    set res [default_gdb_init $test_file_name]

    # Skip dejagnu_unknown while running a testcase to prevent it from
    # exiting and aborting the entire test run.  Save the unknown proc
    # defined by DejaGnu, and override the unknown proc with a
    # gdb-local version.
    rename ::unknown ::dejagnu_unknown
    proc unknown { args } {
	return [uplevel 1 ::tcl_unknown $args]
    }

    return $res
  }

> Alternatively, we could override source to detect the precise point that
> runtest hands control to the test-case, as attached.  But there's still
> filename matching.  [ Note btw, that this approach changes the scope of
> the fix slightly. ]

Overriding standard procs and filename matching strikes me as uglier than
using the hooks that dejagnu provides (init/finish), but I can also see your
point of only overriding unknown for the exact duration of the sourced file
being cleaner.  Thus, I'm not objecting and leave it up to you.  I agree
that it's nice that we don't abort the whole testsuite.

BTW, isn't "tcl_unknown" an internal DejaGnu name?  We should document
that in a comment, since this could break if DejaGnu changes the renamed
proc's name.  Another reason to ask DejaGnu to handle this for us cleanly.

Thanks,
Pedro Alves



  reply	other threads:[~2020-06-11 16:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 14:35 Tom de Vries
2020-06-11 15:31 ` Pedro Alves
2020-06-11 16:25   ` Tom de Vries
2020-06-11 16:56     ` Pedro Alves [this message]
2020-06-11 22:55       ` Tom de Vries
2020-06-16 12:47         ` Pedro Alves
2020-06-17 14:14           ` Tom de Vries
2020-06-17 14:19             ` Pedro Alves
2020-06-18 10:16               ` [PATCH][gdb/testsuite] Move code from gdb_init to default_gdb_init Tom de Vries
2020-06-18 10:56                 ` Pedro Alves
2020-06-12  7:47       ` [PATCH][gdb/testsuite] Don't abort testrun for invalid command in test-case Tom de Vries
2020-06-12  8:37       ` Tom de Vries

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=dea158ce-9ed2-fb01-9fdc-9b3171a77683@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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