[gdb/testsuite] Fix gdb.dap/type_check.exp with older python
authorTom de Vries <tdevries@suse.de>
Tue, 13 Jun 2023 10:21:45 +0000 (12:21 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 13 Jun 2023 10:21:45 +0000 (12:21 +0200)
commit40bea10383b36fbe451d91ed0513792c399de1a6
tree56828bd4d8adee1498c32d92bfe4b103fc51352c
parentbdde90c4cea27aacb0b98b4b1fa7289cb1a96168
[gdb/testsuite] Fix gdb.dap/type_check.exp with older python

On openSUSE Leap 15.4 with system python 3.6, I run into:
...
(gdb) python check_everything()^M
(gdb) FAIL: gdb.dap/type_check.exp: type checker
...

In check_everything, the hasattr test fails silently:
...
def check_everything():
    # Older versions of Python can't really implement this.
    if hasattr(typing, "get_origin"):
...
and that makes the gdb_test in the test-case fail.

Fix this by emitting UNSUPPORTED instead in check_everything, and detecting
this in the test-case.

Tested on x86_64-linux.
gdb/testsuite/gdb.dap/type_check.exp
gdb/testsuite/gdb.dap/type_check.py