[PATCH] gdb/testsuite: make runto always emit a FAIL on internal error

Simon Marchi simon.marchi@polymtl.ca
Fri Aug 21 19:52:42 GMT 2020


On 2020-08-21 1:53 p.m., Pedro Alves wrote:
> It seems to me that the whole rationale given here is also applicable to
> any other failure in runto_main.  In that scenario, the testcase
> will equally silently be skipped, which also seems bad.
> 
> I'd be more inclined to think that instead we consider removing
> no-message from runto_main.  That would also let us remove
> the many "cannot run to main" fails sprinkled all over the
> place.  I think that all the times I've seen a runto_main call
> that forgets to call "fail" (or even check return and bail),
> it's been a bug.  And we have many of those.  So must making
> runto_main FAIL itself would just fix that for good (except
> the bailing out part).
> 
> If some caller wants to pass no-message _and_ distinguish internal
> errors from other errors, then I'm thinking we should make runto
> return a different number for internal errors, like:
>    1=success, 0=error, -1=internal-error.
> 
> Though I'm not thinking of why a caller would want it -- normally
> if you can't run to main for any reason, you'll want to stop the
> test.

I agree that the normal/typical case is that failing to run to main is an
unexpected failure, and should noisily fail.  If a test is special and has
legitimate reasons why failing to run to main would be ok, and the test
wants to handle it differently, then it should pass an additional argument
(like no-message) to say so (it shouldn't be the default).

Although I still don't see why an internal error would ever be ok, so I'd
still single out this FAIL from the others, and make it unconditional
(be shown even if no-message is passed).  If a test passes "no-message" to
runto and we hit an internal error, I think we should show the FAIL.  The
point of the internal errors is that they should be impossible to trigger,
a test will never expect an internal error.

So even if we do the change you propose (make runto_main not use no-message),
I'd still want the change proposed in this patch.

Simon


More information about the Gdb-patches mailing list