gdb/testsuite: Introduce skip_ctf_tests guard function
authorAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 8 Oct 2019 09:09:31 +0000 (10:09 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 19 Nov 2019 00:37:20 +0000 (00:37 +0000)
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
gdb/testsuite/gdb.base/ctf-constvars.exp
gdb/testsuite/gdb.base/ctf-ptype.exp
gdb/testsuite/gdb.base/ctf-whatis.exp
gdb/testsuite/lib/gdb.exp

index de8712a7a1732fe579a7ab4999934fba58b04ded..f924966ae782a9edb309c997c55fcc2bfceacf85 100644 (file)
@@ -1,3 +1,11 @@
+2019-11-19  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * 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  <sergiodj@redhat.com>
 
        https://bugzilla.redhat.com/show_bug.cgi?id=1765117
index 4a81a94ddb403706f182d3350141c1e7943d173f..fd46d64454094051e0e8310a61e2806d89ed2d3e 100644 (file)
 #
 # 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
index 9f545824224a02776d9a45e0d1fdd565c7f7d7b5..68a9662c8971cb7ed098ebce5729e7ecc9de6f79 100644 (file)
 
 # 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
index 3f26fc326e391c8ea330db69093cff01c7fac767..626aecb87814fc7229b8594ed51931592a22a14d 100644 (file)
 
 # 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
index 2d395efb5656cad7225a093962d93c55c0115ae7..828c91dd9e919346385a0cb2e144757133216167 100644 (file)
@@ -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
This page took 0.034479 seconds and 4 git commands to generate.