aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2012-02-21 21:55:39 +0000
committerPedro Alves <palves@redhat.com>2012-02-21 21:55:39 +0000
commit6a5870cea1620f9309c730a1dd97afac8ca2f8ed (patch)
treeeb0cba7d00a91ce406316ab4e6b22c711d3888b0 /gdb/testsuite/lib
parentb54a8fd70210fd1fc7b4f41c4679737066951033 (diff)
downloadgdb-6a5870cea1620f9309c730a1dd97afac8ca2f8ed.zip
gdb-6a5870cea1620f9309c730a1dd97afac8ca2f8ed.tar.gz
gdb-6a5870cea1620f9309c730a1dd97afac8ca2f8ed.tar.bz2
2012-02-21 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com> * lib/gdb.exp: Add description of test prefixes. (with_test_prefix): New procedure. * gdb.arch/altivec-abi.exp: Use with_test_prefix. * gdb.base/attach-pie-misread.exp: Use with_test_prefix. * gdb.base/break-interp.exp: Use with_test_prefix. Use append instead of lappend to append to pf_prefix. * gdb.base/catch-load.exp: Use with_test_prefix. * gdb.base/disp-step-syscall.exp: Use with_test_prefix. * gdb.base/jit-so.exp: Use with_test_prefix. * gdb.base/jit.exp: Use with_test_prefix. * gdb.base/return-nodebug.exp (do_test): Use append instead of lappend to append to pf_prefix. * gdb.base/sepdebug.exp: Use with_test_prefix. * gdb.base/solib-display.exp: Use with_test_prefix. * gdb.base/solib-overlap.exp: Use with_test_prefix. * gdb.base/watch-cond-infcall.exp: Use with_test_prefix. * gdb.base/watchpoint.exp: Use with_test_prefix. * gdb.dwarf2/dw2-noloc.exp: Use with_test_prefix. * gdb.mi/mi-watch.exp: Use with_test_prefix. * gdb.mi/mi2-watch.exp: Use with_test_prefix. * gdb.threads/non-ldr-exc-1.exp: Use with_test_prefix. * gdb.threads/non-ldr-exc-2.exp: Use with_test_prefix. * gdb.threads/non-ldr-exc-3.exp: Use with_test_prefix. * gdb.threads/non-ldr-exc-4.exp: Use with_test_prefix. * gdb.threads/watchpoint-fork.exp: Use with_test_prefix. Use append instead of lappend to append to pf_prefix. * gdb.threads/watchthreads-reorder.exp: Use with_test_prefix. * gdb.trace/change-loc.exp: Use with_test_prefix. * gdb.trace/pending.exp: Use with_test_prefix. * gdb.trace/status-stop.exp: Use with_test_prefix. * gdb.trace/strace.exp: Use with_test_prefix. * gdb.trace/trace-break.exp: Use with_test_prefix. * gdb.trace/unavailable.exp: Use with_test_prefix. Use append instead of lappend to append to pf_prefix.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/gdb.exp86
1 files changed, 86 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 00fe71c..3a43f95 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1481,6 +1481,92 @@ proc skip_shlib_tests {} {
return 1
}
+# Test files shall make sure all the test result lines in gdb.sum are
+# unique in a test run, so that comparing the gdb.sum files of two
+# test runs gives correct results. Test files that exercise
+# variations of the same tests more than once, shall prefix the
+# different test invocations with different identifying strings in
+# order to make them unique.
+#
+# About test prefixes:
+#
+# $pf_prefix is the string that dejagnu prints after the result (FAIL,
+# PASS, etc.), and before the test message/name in gdb.sum. E.g., the
+# underlined substring in
+#
+# PASS: gdb.base/mytest.exp: some test
+# ^^^^^^^^^^^^^^^^^^^^
+#
+# is $pf_prefix.
+#
+# The easiest way to adjust the test prefix is to append a test
+# variation prefix to the $pf_prefix, using the with_test_prefix
+# procedure. E.g.,
+#
+# proc do_tests {} {
+# gdb_test ... ... "test foo"
+# gdb_test ... ... "test bar"
+#
+# with_test_prefix " subvariation a:" {
+# gdb_test ... ... "test x"
+# }
+#
+# with_test_prefix " subvariation b:" {
+# gdb_test ... ... "test x"
+# }
+# }
+#
+# with_test_prefix " variation1:" {
+# ...do setup for variation 1...
+# do_tests
+# }
+#
+# with_test_prefix " variation2:" {
+# ...do setup for variation 2...
+# do_tests
+# }
+#
+# Results in:
+#
+# PASS: gdb.base/mytest.exp: variation1: test foo
+# PASS: gdb.base/mytest.exp: variation1: test bar
+# PASS: gdb.base/mytest.exp: variation1: subvariation a: test x
+# PASS: gdb.base/mytest.exp: variation1: subvariation b: test x
+# PASS: gdb.base/mytest.exp: variation2: test foo
+# PASS: gdb.base/mytest.exp: variation2: test bar
+# PASS: gdb.base/mytest.exp: variation2: subvariation a: test x
+# PASS: gdb.base/mytest.exp: variation2: subvariation b: test x
+#
+# If for some reason more flexibility is necessary, one can also
+# manipulate the pf_prefix global directly, treating it as a string.
+# E.g.,
+#
+# global pf_prefix
+# set saved_pf_prefix
+# append pf_prefix "${foo} bar"
+# ... actual tests ...
+# set pf_prefix $saved_pf_prefix
+#
+
+# Run BODY in the context of the caller, with the current test prefix
+# (pf_prefix) appended with PREFIX. Returns the result of BODY.
+#
+proc with_test_prefix { prefix body } {
+ global pf_prefix
+
+ set saved $pf_prefix
+ append pf_prefix $prefix
+ set code [catch {uplevel 1 $body} result]
+ set pf_prefix $saved
+
+ if {$code == 1} {
+ global errorInfo errorCode
+ return -code $code -errorinfo $errorInfo -errorcode $errorCode $result
+ } else {
+ return -code $code $result
+ }
+}
+
# Return 1 if _Complex types are supported, otherwise, return 0.
proc support_complex_tests {} {