gdb/testsuite: allow "require" callbacks to provide a reason
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 28 Mar 2023 12:23:05 +0000 (08:23 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 28 Mar 2023 15:53:40 +0000 (11:53 -0400)
commit7cd38c3c566502906ba3a6c214cc30cc5aadbda4
tree59fc3b5f7e5bbb15a6028b2f5745509d28caceac
parent4516ff910bb256b629c72cc5cf3535607296e42d
gdb/testsuite: allow "require" callbacks to provide a reason

When an allow_* proc returns false, it can be a bit difficult what check
failed exactly, if the procedure does multiple checks.  To make
investigation easier, I propose to allow the "require" callbacks to be
able to return a list of two elements: the zero/non-zero value, and a
reason string.

Use the new feature in allow_hipcc_tests to demonstrate it (it's also
where I hit actually hit this inconvenience).  On my computer (where GDB
is built with amd-dbgapi support but where I don't have a suitable GPU
target), I get:

    UNSUPPORTED: gdb.rocm/simple.exp: require failed: allow_hipcc_tests (no suitable amdgpu targets found)

vs before:

    UNSUPPORTED: gdb.rocm/simple.exp: require failed: allow_hipcc_tests

Change-Id: Id1966535b87acfcbe9eac99f49dc1196398c6578
Approved-By: Tom de Vries <tdevries@suse.de>
gdb/testsuite/lib/gdb.exp
gdb/testsuite/lib/rocm.exp