Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFC: consolidate checks for _Unwind_DebugHook in test suite
@ 2012-08-14 16:20 Tom Tromey
  2012-08-15  0:53 ` Yao Qi
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: Tom Tromey @ 2012-08-14 16:20 UTC (permalink / raw)
  To: gdb-patches

I happened to notice that nextoverthrow.exp checks for the sdt.h probe
points, but jnpe.exp does not.

This patch consolidates the checking code into a new function in
gdb.exp.

Tom

    	* lib/gdb.exp (skip_unwinder_tests): New proc.
    	* gdb.cp/nextoverthrow.exp: Use skip_unwinder_tests.
    	* gdb.java/jnpe.exp: Use skip_unwinder_tests.

diff --git a/gdb/testsuite/gdb.cp/nextoverthrow.exp b/gdb/testsuite/gdb.cp/nextoverthrow.exp
index 53f59d7..488ae87 100644
--- a/gdb/testsuite/gdb.cp/nextoverthrow.exp
+++ b/gdb/testsuite/gdb.cp/nextoverthrow.exp
@@ -34,35 +34,7 @@ if ![runto_main] then {
     continue
 } 
 
-# See whether we have the needed unwinder hooks.
-set ok 1
-gdb_test_multiple "print _Unwind_DebugHook" "check for unwinder hook" {
-    -re "= .*no debug info.*_Unwind_DebugHook.*\r\n$gdb_prompt $" {
-	# Pass the test so we don't get bogus fails in the results.
-	pass "check for unwinder hook"
-	set ok 0
-    }
-    -re "= .*_Unwind_DebugHook.*\r\n$gdb_prompt $" {
-	pass "check for unwinder hook"
-    }
-    -re "No symbol .* in current context.\r\n$gdb_prompt $" {
-	# Pass the test so we don't get bogus fails in the results.
-	pass "check for unwinder hook"
-	set ok 0
-    }
-}
-if {!$ok} {
-    gdb_test_multiple "info probe" "check for stap probe in unwinder" {
-	-re ".*libgcc.*unwind.*\r\n$gdb_prompt $" {
-	    pass "check for stap probe in unwinder"
-	    set ok 1
-	}
-	-re "\r\n$gdb_prompt $" {
-	}
-    }
-}
-
-if {!$ok} {
+if {![skip_unwinder_tests]} {
     unsupported "nextoverthrow.exp could not find _Unwind_DebugHook"
     return -1
 }
diff --git a/gdb/testsuite/gdb.java/jnpe.exp b/gdb/testsuite/gdb.java/jnpe.exp
index f7225d8..b15ee32 100644
--- a/gdb/testsuite/gdb.java/jnpe.exp
+++ b/gdb/testsuite/gdb.java/jnpe.exp
@@ -31,20 +31,7 @@ if ![runto "$testfile.java:$line"] then {
     continue
 } 
 
-# See whether we have the needed unwinder hooks.
-set ok 1
-gdb_test_multiple "print _Unwind_DebugHook" "check for unwinder hook in java" {
-    -re "= .*_Unwind_DebugHook.*\r\n$gdb_prompt $" {
-	pass "check for unwinder hook in java"
-    }
-    -re "No symbol .* in current context.?\r\n$gdb_prompt $" {
-	# Pass the test so we don't get bogus fails in the results.
-	setup_xfail *-*-*
-	fail "check for unwinder hook in java"
-	set ok 0
-    }
-}
-if {!$ok} {
+if {![skip_unwinder_tests]} {
     unsupported "jnpe.exp could not find _Unwind_DebugHook"
     return -1
 }
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 17e2117..daa50f5 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2093,6 +2093,43 @@ proc skip_hw_watchpoint_access_tests {} {
     return 0
 }
 
+# Return 1 if we should skip tests that require the runtime unwinder
+# hook.  This must be invoked while gdb is running, after shared
+# libraries have been loaded.  This is needed because otherwise a
+# shared libgcc won't be visible.
+
+proc skip_unwinder_tests {} {
+    global gdb_prompt
+
+    set ok 1
+    gdb_test_multiple "print _Unwind_DebugHook" "check for unwinder hook" {
+	-re "= .*no debug info.*_Unwind_DebugHook.*\r\n$gdb_prompt $" {
+	    # Pass the test so we don't get bogus fails in the results.
+	    pass "check for unwinder hook"
+	    set ok 0
+	}
+	-re "= .*_Unwind_DebugHook.*\r\n$gdb_prompt $" {
+	    pass "check for unwinder hook"
+	}
+	-re "No symbol .* in current context.\r\n$gdb_prompt $" {
+	    # Pass the test so we don't get bogus fails in the results.
+	    pass "check for unwinder hook"
+	    set ok 0
+	}
+    }
+    if {!$ok} {
+	gdb_test_multiple "info probe" "check for stap probe in unwinder" {
+	    -re ".*libgcc.*unwind.*\r\n$gdb_prompt $" {
+		pass "check for stap probe in unwinder"
+		set ok 1
+	    }
+	    -re "\r\n$gdb_prompt $" {
+	    }
+	}
+    }
+    return $ok
+}
+
 set compiler_info		"unknown"
 set gcc_compiled		0
 set hp_cc_compiler		0


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2012-08-27 15:57 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-14 16:20 RFC: consolidate checks for _Unwind_DebugHook in test suite Tom Tromey
2012-08-15  0:53 ` Yao Qi
2012-08-15 13:58   ` Tom Tromey
2012-08-22 14:26 ` Tom Tromey
2012-08-23  9:50 ` [PATCH 1/2] Append "." in error message Yao Qi
2012-08-23  9:50   ` [PATCH 2/2] Remove pass in skip_unwinder_tests Yao Qi
2012-08-23 10:52     ` Pedro Alves
2012-08-23 12:29       ` Yao Qi
2012-08-23 18:03         ` Pedro Alves
2012-08-24 13:38     ` Jan Kratochvil
2012-08-24 15:41       ` Pedro Alves
2012-08-24 16:19         ` Jan Kratochvil
2012-08-24 16:53           ` Pedro Alves
2012-08-24 16:57             ` Pedro Alves
2012-08-24 17:12             ` Jan Kratochvil
2012-08-27 10:33           ` Yao Qi
2012-08-27 13:07             ` Jan Kratochvil
2012-08-27 15:15               ` Yao Qi
2012-08-27 15:57                 ` Jan Kratochvil
2012-08-24 13:34   ` [PATCH 1/2] Append "." in error message Jan Kratochvil
2012-08-24 13:40 ` RFC: consolidate checks for _Unwind_DebugHook in test suite Jan Kratochvil
2012-08-24 13:54   ` Tom Tromey
2012-08-24 14:08     ` Jan Kratochvil
2012-08-24 15:26       ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox