On 10/6/21 9:40 AM, Tom de Vries wrote: > [ 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. > I ended up using require to transform: ... if { [ensure_gdb_index $binfile] == -1 } { return -1 } ... into: ... require {ensure_gdb_index $binfile} != -1 ... and consequently had to change proc require a bit. Committed as attached. Thanks, - Tom