[committed,gdb/testsuite] Fix DUPLICATE in gdb.base/skip-solib.exp

Message ID 20210910164307.GA15698@delia.home
State New
Headers show
Series
  • [committed,gdb/testsuite] Fix DUPLICATE in gdb.base/skip-solib.exp
Related show

Commit Message

Tom de Vries via Gdb-patches Sept. 10, 2021, 4:43 p.m.
Hi,

Fix DUPLICATE in gdb.base/skip-solib.exp by using with_test_prefix.

Also fix indentation style and long lines, remove outdated question/answer
bits, and use multi_line.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix DUPLICATE in gdb.base/skip-solib.exp

---
 gdb/testsuite/gdb.base/skip-solib.exp | 104 ++++++++++++++++------------------
 1 file changed, 49 insertions(+), 55 deletions(-)

Patch

diff --git a/gdb/testsuite/gdb.base/skip-solib.exp b/gdb/testsuite/gdb.base/skip-solib.exp
index 22c8ee06850..a66272aeffb 100644
--- a/gdb/testsuite/gdb.base/skip-solib.exp
+++ b/gdb/testsuite/gdb.base/skip-solib.exp
@@ -20,7 +20,8 @@ 
 #
 
 # This only works on GNU/Linux.
-if { ![isnative] || [is_remote host] || ![istarget *-linux*] || [skip_shlib_tests]} {
+if { ![isnative] || [is_remote host] || ![istarget *-linux*]
+     || [skip_shlib_tests]} {
     continue
 }
 
@@ -39,82 +40,75 @@  set binfile_lib [standard_output_file ${libname}.so]
 # the main program.
 #
 
-if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug -Wl,-soname,${libname}.so]] != ""} {
+if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} \
+	 [list debug -Wl,-soname,${libname}.so]] != ""} {
     return -1
 }
 
-if {[gdb_compile "${srcdir}/${subdir}/${srcfile_main}" "${binfile_main}.o" object debug] != ""} {
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile_main}" "${binfile_main}.o" \
+	 object debug] != ""} {
     return -1
 }
 
 set testobjdir [standard_output_file {}]
 if {[gdb_compile "${binfile_main}.o" "${binfile_main}" executable \
-                 [list debug "additional_flags=-L$testobjdir -l${test} \
-                                               -Wl,-rpath=$testobjdir"]] != ""} {
+	 [list debug "additional_flags=-L$testobjdir" \
+	      "additional_flags=-l${test}" \
+	      "additional_flags=-Wl,-rpath=$testobjdir"]] != ""} {
     return -1
 }
 
-clean_restart ${executable_main}
-
 #
-# At this point, if we try to skip the file ${srcfile_lib} or the function
-# multiply(), we should get a prompt asking us if we want to enable the
-# skip entry pending a shared library load.
+# Test ignoring of a file inside a solib.
 #
+with_test_prefix "ignoring solib file" {
 
-gdb_test "skip file ${srcfile_lib}" \
-  "File ${srcfile_lib} will be skipped when stepping." \
-  "ignoring file in solib" \
-  "No source file named ${srcfile_lib}.*
-Ignore file pending future shared library load.*" \
-  "y"
+    clean_restart ${executable_main}
 
-#
-# Checkinfo skip list.
-#
-gdb_test "info skip" \
-  "Num\\s+Enb\\s+Glob\\s+File\\s+RE\\s+Function\\s*
-1\\s+y\\s+n\\s+${srcfile_lib}\\s+n\\s+<none>\\s*" \
-  "info skip with pending file"
+    gdb_test "skip file ${srcfile_lib}" \
+	"File ${srcfile_lib} will be skipped when stepping." \
+	"skip file"
 
-if ![runto_main] { fail "skip tests suppressed" }
+    gdb_test "info skip" \
+	[multi_line \
+	     "Num\\s+Enb\\s+Glob\\s+File\\s+RE\\s+Function\\s*" \
+	     "1\\s+y\\s+n\\s+${srcfile_lib}\\s+n\\s+<none>\\s*"]
 
-#
-# We shouldn't step into square(), since we skipped skip-solib-lib.c.
-#
-gdb_test "step" ""
-gdb_test "bt" "#0\\s+main.*" "step after ignoring solib file."
+    if ![runto_main] { fail "skip tests suppressed" }
+
+    #
+    # We shouldn't step into square(), since we skipped skip-solib-lib.c.
+    #
+    gdb_test "step" ""
+    gdb_test "bt" "#0\\s+main.*"
+}
 
 #
-# Now restart gdb and testing ignoring of a function inside a solib.
+# Now test ignoring of a function inside a solib.
 #
-clean_restart ${executable_main}
+with_test_prefix "ignoring solib function" {
+    clean_restart ${executable_main}
 
-gdb_test "skip function multiply" \
-  "Function multiply will be skipped when stepping\\." \
-  "ignoring function in solib" \
-"No function found named multiply..*
-Ignore function pending future shared library load.*" \
-  "y"
+    gdb_test "skip function multiply" \
+	"Function multiply will be skipped when stepping\\." \
+	"skip function"
 
-if ![runto_main] { fail "skip tests suppressed" }
+    if ![runto_main] { fail "skip tests suppressed" }
 
-#
-# Our first step should take us into square.
-#
-gdb_test "step" "square.*"
+    #
+    # Our first step should take us into square.
+    #
+    gdb_test "step" "square.*" "step into other function"
 
-#
-# Now our entry should no longer be pending.
-#
-gdb_test "info skip" \
-  "Num\\s+Enb\\s+Glob\\s+File\\s+RE\\s+Function\\s*
-1\\s+y\\s+n\\s+<none>\\s+n\\s+multiply\\s*" \
-  "info skip for function multiply"
+    gdb_test "info skip" \
+	[multi_line \
+	     "Num\\s+Enb\\s+Glob\\s+File\\s+RE\\s+Function\\s*" \
+	     "1\\s+y\\s+n\\s+<none>\\s+n\\s+multiply\\s*"]
 
-#
-# This step shouldn't go into multiply -- we should skip it and go on to the
-# last line of square.
-#
-gdb_test "step" ""
-gdb_test "bt" "#0\\s+square.*"
+    #
+    # This step shouldn't go into multiply -- we should skip it and go on to
+    # the last line of square.
+    #
+    gdb_test "step" ""
+    gdb_test "bt" "#0\\s+square.*"
+}