From 30d0a63681c24106d4ea3239be4bbd72a0b67646 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Tue, 8 Oct 2019 10:09:31 +0100 Subject: [PATCH] gdb/testsuite: Introduce skip_ctf_tests guard function Most versions of GCC in the wild don't support CTF debug format right now, so, rather than attempting to compile the tests and failing each time, this patch introduces a guard function to check if the compiler supports CTF. If we don't have CTF support then the CTF tests are skipped. This patch only updates 3 of the 4 CTF tests, the fourth will be handled in the next patch. gdb/testsuite/ChangeLog: * gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in the compiler. Clean up header comment a little. * gdb.base/ctf-ptype.exp: Likewise. * gdb.base/ctf-whatis.exp: Likewise. * lib/gdb.exp (skip_ctf_tests): New proc. Change-Id: I505c11169a9bc9871a31fc0c61e119f92f32cc63 --- gdb/testsuite/ChangeLog | 8 ++++++++ gdb/testsuite/gdb.base/ctf-constvars.exp | 21 +++++++++++---------- gdb/testsuite/gdb.base/ctf-ptype.exp | 11 ++++++----- gdb/testsuite/gdb.base/ctf-whatis.exp | 11 ++++++----- gdb/testsuite/lib/gdb.exp | 11 +++++++++++ 5 files changed, 42 insertions(+), 20 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index de8712a7a17..f924966ae78 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-11-19 Andrew Burgess + + * gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in + the compiler. Clean up header comment a little. + * gdb.base/ctf-ptype.exp: Likewise. + * gdb.base/ctf-whatis.exp: Likewise. + * lib/gdb.exp (skip_ctf_tests): New proc. + 2019-11-18 Sergio Durigan Junior https://bugzilla.redhat.com/show_bug.cgi?id=1765117 diff --git a/gdb/testsuite/gdb.base/ctf-constvars.exp b/gdb/testsuite/gdb.base/ctf-constvars.exp index 4a81a94ddb4..fd46d644540 100644 --- a/gdb/testsuite/gdb.base/ctf-constvars.exp +++ b/gdb/testsuite/gdb.base/ctf-constvars.exp @@ -18,20 +18,21 @@ # # This file is part of the gdb testsuite # -# tests for const variables -# const pointers to vars -# pointers to const variables -# const pointers to const vars -# with mixed types +# Tests for: const variables, +# const pointers to vars +# pointers to const variables +# const pointers to const vars +# with mixed types. -# -# test running programs -# -# -gt generates full-fledged CTF. +if [skip_ctf_tests] { + unsupported "no ctf debug format support" + return 0 +} standard_testfile .c -set opts "additional_flags=-gt" +# Using `-gt` generates full-fledged CTF debug information. +set opts "additional_flags=-gt" if { [prepare_for_testing "failed to prepare" ${testfile} \ [list $srcfile] [list $opts nowarnings]] } { return 0 diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp index 9f545824224..68a9662c897 100644 --- a/gdb/testsuite/gdb.base/ctf-ptype.exp +++ b/gdb/testsuite/gdb.base/ctf-ptype.exp @@ -15,14 +15,15 @@ # This file is a subset of ptype.exp written by Rob Savoye. (rob@cygnus.com) -# -# test running programs -# -# -gt generates full-fledged CTF. +if [skip_ctf_tests] { + unsupported "no ctf debug format support" + return 0 +} standard_testfile .c -set opts "additional_flags=-gt" +# Using `-gt` generates full-fledged CTF debug information. +set opts "additional_flags=-gt" if { [prepare_for_testing "failed to prepare" ${testfile} \ [list $srcfile] [list $opts nowarnings]] } { return 0 diff --git a/gdb/testsuite/gdb.base/ctf-whatis.exp b/gdb/testsuite/gdb.base/ctf-whatis.exp index 3f26fc326e3..626aecb8781 100644 --- a/gdb/testsuite/gdb.base/ctf-whatis.exp +++ b/gdb/testsuite/gdb.base/ctf-whatis.exp @@ -15,14 +15,15 @@ # This file is a subset of whatis.exp written by Rob Savoye. (rob@cygnus.com) -# -# test running programs -# -# -gt generates full-fledged CTF. +if [skip_ctf_tests] { + unsupported "no ctf debug format support" + return 0 +} standard_testfile .c -set opts "additional_flags=-gt" +# Using `-gt` generates full-fledged CTF debug information. +set opts "additional_flags=-gt" if { [prepare_for_testing "failed to prepare" ${testfile} \ [list $srcfile] [list $opts nowarnings]] } { return 0 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 2d395efb565..828c91dd9e9 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6787,5 +6787,16 @@ proc cmp_file_string { file str msg } { } } +# Does the compiler support CTF debug output using '-gt' compiler +# flag? If not then we should skip these tests. + +gdb_caching_proc skip_ctf_tests { + return ![gdb_can_simple_compile ctfdebug { + int main () { + return 0; + } + } executable "additional_flags=-gt"] +} + # Always load compatibility stuff. load_lib future.exp -- 2.30.2