[PATCH][gdb/testsuite] Add proc require in lib/gdb.exp

Tom de Vries tdevries@suse.de
Wed Oct 6 07:40:24 GMT 2021


[ was: Re: [committed][gdb/testsuite] Disable vgdb tests if xml not
supported ]

On 10/5/21 8:15 PM, Tom Tromey wrote:
> Tom> Or perhaps you mean more generically (which wouldn't require us to write
> Tom> a proc for each type of require):
> Tom> ...
> Tom> proc require { fn val } {
> Tom>     if { [$fn] != $val } {
> Tom>         untested "$fn != $val"
> Tom>         return -code return 0
> Tom>     }
> Tom> }
> Tom> ...
> Tom> and:
> Tom> ...
> Tom> require gdb_skip_xml_test 0
> Tom> ...
> Tom> ?
> 
> Either seems fine but this one does read nicely to me.
> Or maybe even just requiring 'fn' to return 0 would be good enough.

I've also thought about that, but decided against it:
- it does not take into account a proc support_foo that returns 1, which
  in the current form can be required using "require support_foo 1"
- it does not support the cases where we require no support for a
  feature, say "require gdb_skip_xml_test 1"

Also, I considered making the test freeform, as in gdb_assert, but
decided against it because:
- it does not enforce uniform usage
- makes it harder to do the fn+value to message matching I've added in
  this version.

Any comment?

Thanks,
- Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gdb-testsuite-Add-proc-require-in-lib-gdb.exp.patch
Type: text/x-patch
Size: 3925 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/gdb-patches/attachments/20211006/2b5f5b3c/attachment-0001.bin>


More information about the Gdb-patches mailing list