[gdb/testsuite] Fix imported-unit.exp FAIL without psymtabs
authorTom de Vries <tdevries@suse.de>
Wed, 8 Apr 2020 10:05:34 +0000 (12:05 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 8 Apr 2020 10:05:34 +0000 (12:05 +0200)
The test-case gdb.dwarf2/imported-unit.exp contains a test testing partial
symbols, so when we run the test-case using either target board readnow,
cc-with-gdb-index or cc-with-debug-names, we run into:
...
FAIL: gdb.dwarf2/imported-unit.exp: no static partial symbols in importing unit
...

Fix this by marking the test unsupported if there are no partial symbols.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-04-08  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (psymtabs_p): New proc.
* gdb.dwarf2/imported-unit.exp: Mark "no static partial symbols in
importing unit" unsupported if there are no partial symbols.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/imported-unit.exp
gdb/testsuite/lib/gdb.exp

index 066a41ec5bb9b4401f631c82d42aa9bf06bad9d0..16b982bfc9c4d1507d5d9314516d98be66ea97c9 100644 (file)
@@ -1,3 +1,9 @@
+2020-04-08  Tom de Vries  <tdevries@suse.de>
+
+       * lib/gdb.exp (psymtabs_p): New proc.
+       * gdb.dwarf2/imported-unit.exp: Mark "no static partial symbols in
+       importing unit" unsupported if there are no partial symbols.
+
 2020-04-08  Tom de Vries  <tdevries@suse.de>
 
        PR testsuite/25760
index 80d66283572342e2eec5717f11dc3a043931d786..41a7505459466e53c64ad5dbe1770490ce33d870 100644 (file)
@@ -149,19 +149,25 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
 
 gdb_test_no_output "set language c++"
 
+set psymtabs_p [psymtabs_p]
+
 # Verify that the partial symtab for the unit importing the partial unit does
 # not contain the static partial symbol int, which is defined in the partial
 # unit.  Test-case for PR25646.
-gdb_test "main print psymbols" \
-    [multi_line \
-        "  Depends on 1 other partial symtabs\." \
-        "\[^\r\n\]*" \
-        "  Global partial symbols:" \
-        "    `main', function, $hex" \
-        "" \
-        ".*"] \
-    "no static partial symbols in importing unit"
-
+set test "no static partial symbols in importing unit"
+if { $psymtabs_p } {
+    gdb_test "main print psymbols" \
+       [multi_line \
+            "  Depends on 1 other partial symtabs\." \
+            "\[^\r\n\]*" \
+            "  Global partial symbols:" \
+            "    `main', function, $hex" \
+            "" \
+            ".*"] \
+       $test
+} else {
+    unsupported $test
+}
 # Sanity check
 gdb_test "ptype main" "= int \\(void\\)"
 
index 3bd08816b6d7f9ea5ea05dc3b1067913437db8ec..52687ad89ae716a15b40f34f81a41fd42ac4b546 100644 (file)
@@ -6998,6 +6998,24 @@ proc readnow { } {
     return 0
 }
 
+# Return 1 if partial symbols are available.  Otherwise, return 0.
+
+proc psymtabs_p {  } {
+    global gdb_prompt
+
+    set cmd "maint info psymtab"
+    gdb_test_multiple $cmd "" {
+       -re "$cmd\r\n$gdb_prompt $" {
+           return 0
+       }
+       -re -wrap "" {
+           return 1
+       }
+    }
+
+    return 0
+}
+
 # Verify that partial symtab expansion for $filename has state $readin.
 
 proc verify_psymtab_expanded { filename readin } {