[PATCH 1/2] [gdb/testsuite] Disable inferior output in gdb.base/foll-vfork.exp

Tom de Vries tdevries@suse.de
Mon Nov 15 22:11:33 GMT 2021


On 11/15/21 5:39 PM, Simon Marchi wrote:
> On 2021-11-15 6:21 a.m., Tom de Vries via Gdb-patches wrote:
>> Test-case gdb.base/foll-vfork.exp has inferior output that is not needed, but
>> which makes the regexp matching more difficult (see commit 1f28b70def1
>> "[gdb/testsuite] Fix regexp in gdb.base/foll-vfork.exp").
>>
>> Disable the inferior output using '#if DEBUG'.
>>
>> Tested on x86_64-linux.
>> ---
>>  gdb/testsuite/gdb.base/foll-vfork-exit.c | 14 ++++++++++++--
>>  gdb/testsuite/gdb.base/foll-vfork.c      |  9 ++++++++-
>>  gdb/testsuite/gdb.base/foll-vfork.exp    | 17 +++++++++++------
>>  gdb/testsuite/gdb.base/vforked-prog.c    |  7 ++++++-
>>  4 files changed, 37 insertions(+), 10 deletions(-)
>>
>> diff --git a/gdb/testsuite/gdb.base/foll-vfork-exit.c b/gdb/testsuite/gdb.base/foll-vfork-exit.c
>> index 6c263cdc057..15e272afe82 100644
>> --- a/gdb/testsuite/gdb.base/foll-vfork-exit.c
>> +++ b/gdb/testsuite/gdb.base/foll-vfork-exit.c
>> @@ -29,12 +29,22 @@ main ()
>>    pid = vfork (); /* VFORK */
>>    if (pid == 0)
>>      {
>> -      printf ("I'm the child!\n");
>> +      const char *s = "I'm the child!";
>> +#if DEBUG
>> +      printf ("%s\n", s);
>> +#else
>> +    const char *volatile v = s;
>> +#endif
> 
> In my original comment, I meant that we could have simply deleted the
> printfs, instead of deleting the regexp $ anchor, as done in
> 1f28b70def1.  I don't think these printfs provide any value to debug the
> test case at all.
> 
> Since 1f28b70def1 is already merged, the printfs can just stay as-is
> (since the regexp accepts them).  Or we can remove them and put back the
> anchor.  I slightly prefer the latter, because it makes the test case
> check slightly more restrictive (if there is some spurious output after
> the prompt, the test will fail).  But it won't make a big difference in
> the grand scheme of things.

So, is this what you meant?

Thanks,
- Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gdb-testsuite-Remove-inferior-output-in-gdb.base-foll-vfork.exp.patch
Type: text/x-patch
Size: 4581 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/gdb-patches/attachments/20211115/fee25517/attachment.bin>


More information about the Gdb-patches mailing list