[gdb/testsuite] Check for sys/random.h in gdb.reverse/getrandom.exp

When running test-case gdb.reverse/getrandom.exp on a system with eglibc 2.19,
we run into:
...
 gdb compile failed, gdb.reverse/getrandom.c:18:24: fatal error: \
   sys/random.h: No such file or directory
  #include <sys/random.h>
                         ^
 compilation terminated.

                 === gdb Summary ===

 # of untested testcases        1
...
and:
...
UNTESTED: gdb.reverse/getrandom.exp: failed to prepare
...

Fix this by testing for the presence of the header, such that we have instead:
...
UNSUPPORTED: gdb.reverse/getrandom.exp: require failed: \
  have_system_header sys/random.h
...

Tested on x86_64-linux and i686-linux.
This commit is contained in:
Tom de Vries 2023-08-29 11:02:08 +02:00
parent c58d51c612
commit 130e33d861
2 changed files with 9 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#
require supports_reverse
require {have_system_header sys/random.h}
standard_testfile

View File

@ -9952,5 +9952,13 @@ proc have_host_locale { locale } {
return [expr $idx != -1]
}
# Return 1 if we can use '#include <$file>' in source file.
gdb_caching_proc have_system_header { file } {
set src "#include <$file>"
set name [string map { "/" "_sep_" } $file]
return [gdb_can_simple_compile have_system_header_$name $src object]
}
# Always load compatibility stuff.
load_lib future.exp