* [PATCH 0/2] gdb.threads/attach-into-signal.exp: prepare for gdbserver
@ 2012-02-17 19:37 Pedro Alves
2012-02-17 19:38 ` [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup Pedro Alves
2012-02-17 19:52 ` [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output Pedro Alves
0 siblings, 2 replies; 28+ messages in thread
From: Pedro Alves @ 2012-02-17 19:37 UTC (permalink / raw)
To: gdb-patches; +Cc: jan.kratochvil
I'm working on making gdb.threads/attach-into-signal.exp pass against
GDBserver. These are two preparatory patches to the test itself.
The first does some cleaning up and modernizing of the test. The
second removes the dependency on the linux native target's debug
output, thus making it work against gdbserver too.
---
Pedro Alves (2):
gdb.threads/attach-into-signal.exp: cleanup
gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output
gdb/testsuite/gdb.threads/Makefile.in | 3 -
gdb/testsuite/gdb.threads/attach-into-signal.exp | 105 ++++++++++++++--------
2 files changed, 68 insertions(+), 40 deletions(-)
--
Pedro Alves
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup
2012-02-17 19:37 [PATCH 0/2] gdb.threads/attach-into-signal.exp: prepare for gdbserver Pedro Alves
@ 2012-02-17 19:38 ` Pedro Alves
2012-02-17 20:55 ` Tom Tromey
2012-02-20 8:57 ` Jan Kratochvil
2012-02-17 19:52 ` [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output Pedro Alves
1 sibling, 2 replies; 28+ messages in thread
From: Pedro Alves @ 2012-02-17 19:38 UTC (permalink / raw)
To: gdb-patches; +Cc: jan.kratochvil
This patch does a bit of general cleanup to
gdb.threads/attach-into-signal.exp file.
- build different executable files for the non-threaded and threaded
cases. This was my motivation. I wanted to test the non-threaded
case manually, but the threaded variant always clobbered the
non-threaded executable.
- unique-fy test messages (gdb.sum output)
- Use build_executable/clean_restart.
2012-02-17 Pedro Alves <palves@redhat.com>
General cleanup, make output test messages unique, and build
different executable files for the non-threaded and threaded
cases.
* gdb.threads/attach-into-signal.exp (binfile, escapedbinfile):
Delete.
(executable_nothr, executable_thr): New globals.
(top level): Adjust to delete both executables.
(corefunc): New parameter $executable. Set $pf_prefix instead of
hand writing a prefix in tests. Issue a clean_restart and enable
lin-lwp debug output here.
(top level): Adjust. Use build_executable. Don't start gdb here,
and don't enable lin-lwp debug output here.
* gdb.threads/Makefile.in (EXECUTABLES): Adjust.
---
gdb/testsuite/gdb.threads/Makefile.in | 3 +
gdb/testsuite/gdb.threads/attach-into-signal.exp | 50 +++++++++++-----------
2 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/gdb/testsuite/gdb.threads/Makefile.in b/gdb/testsuite/gdb.threads/Makefile.in
index 954d547..79e4c4c 100644
--- a/gdb/testsuite/gdb.threads/Makefile.in
+++ b/gdb/testsuite/gdb.threads/Makefile.in
@@ -1,7 +1,8 @@
VPATH = @srcdir@
srcdir = @srcdir@
-EXECUTABLES = attach-into-signal attach-stopped attachstop-mt \
+EXECUTABLES = attach-into-signal-nothr attach-into-signal-thr \
+ attach-stopped attachstop-mt \
bp_in_thread current-lwp-dead execl execl1 fork-child-threads \
fork-thread-pending gcore-pthreads hand-call-in-threads \
ia64-sigill interrupted-hand-call killed linux-dp \
diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsuite/gdb.threads/attach-into-signal.exp
index db88222..bf4b8a0 100644
--- a/gdb/testsuite/gdb.threads/attach-into-signal.exp
+++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp
@@ -24,23 +24,36 @@ if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub]
set testfile "attach-into-signal"
set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}]
+set executable_nothr ${testfile}-nothr
+set executable_thr ${testfile}-thr
-remote_exec build "rm -f ${binfile}"
+remote_exec build "rm -f ${objdir}/${subdir}/${executable_nothr}"
+remote_exec build "rm -f ${objdir}/${subdir}/${executable_thr}"
# For debugging this test
#
#log_user 1
-proc corefunc { threadtype } {
+proc corefunc { threadtype executable } {
global srcfile
global binfile
global escapedbinfile
global srcdir
+ global objdir
global subdir
global gdb_prompt
+ global pf_prefix
+
+ set save_pf_prefix $pf_prefix
+ lappend pf_prefix "$threadtype:"
+
+ clean_restart ${executable}
+ gdb_test_no_output "set debug lin-lwp 1" ""
+
+ set binfile ${objdir}/${subdir}/${executable}
+ set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${executable}]
if [get_compiler_info ${binfile}] {
+ set pf_prefix $save_pf_prefix
return -1
}
@@ -79,12 +92,12 @@ proc corefunc { threadtype } {
}
if { $stoppedtry >= 10 } {
verbose -log $line2
- set test "$threadtype: process is still running on the attempt # $attempt of $attempts"
+ set test "process is still running on the attempt # $attempt of $attempts"
break
}
# Main test:
- set test "$threadtype: attach (pass $passes), pending signal catch"
+ set test "attach (pass $passes), pending signal catch"
if {[gdb_test_multiple "attach $testpid" $test {
-re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*Received Alarm clock.*$gdb_prompt $" {
# nonthreaded:
@@ -136,35 +149,24 @@ proc corefunc { threadtype } {
remote_exec build "kill -s CONT ${testpid}"
remote_exec build "kill -9 ${testpid}"
-}
-# Start with clean gdb
-gdb_exit
+ set pf_prefix $save_pf_prefix
+}
# build the test case first without threads
#
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "attach-into-signal.exp (unthreaded)"
+if {[build_executable $testfile $executable_nothr $srcfile] == -1} {
+ untested "attach-into-signal.exp (nonthreaded)"
return -1
}
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-gdb_test_no_output "set debug lin-lwp 1" ""
-
-corefunc nonthreaded
+corefunc nonthreaded ${executable_nothr}
# build the test case also with threads
#
-if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DUSE_THREADS}] != "" } {
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${executable_thr}" executable {debug additional_flags=-DUSE_THREADS}] != "" } {
untested "attach-into-signal.exp (threaded)"
return -1
}
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-gdb_test_no_output "set debug lin-lwp 1" ""
-
-corefunc threaded
+corefunc threaded ${executable_thr}
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output
2012-02-17 19:37 [PATCH 0/2] gdb.threads/attach-into-signal.exp: prepare for gdbserver Pedro Alves
2012-02-17 19:38 ` [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup Pedro Alves
@ 2012-02-17 19:52 ` Pedro Alves
2012-02-20 9:41 ` Jan Kratochvil
2012-02-21 18:17 ` Edjunior Barbosa Machado
1 sibling, 2 replies; 28+ messages in thread
From: Pedro Alves @ 2012-02-17 19:52 UTC (permalink / raw)
To: gdb-patches; +Cc: jan.kratochvil
This test relies on Linux native target's debug output ("set debug
lin-lwp 1"), which obviously can't work when testing against GDBserver
(with the extended-remote board).
This patch makes the test more generic, using only regular GDB
functionality, avoiding relying on internal debug output.
The test runs twice, with two variants: once non-threaded, and once
threaded. SIGLARM defaults to noprint, but if we set it to print,
then for the non-threaded case, when we attach and find the main
thread stopping with SIGLARM, we'll see "Program received signal
SIGLARM". For the threaded case, the signal is seen on the non main
thread, so we won't see "Program received signal SIGLARM". Instead,
we check the second thread's siginfo.si_signo. We can't use this
method for the non-threaded case too, because the Linux native target
when attaching finds another signal other than SIGSTOP, puts that
other signal pending, and waits for the SIGSTOP, so siginfo.si_signo
will always show SIGSTOP.
With this, GDBserver fails the test, because it doesn't really support
what's being tested here. Namely, it doesn't deliver the SIGALRM back
to the inferior on detach (so the program ends up on the abort()
call). I have a fix for that, but it needs a bit more cleaning up.
Jan, is this okay with you?
2012-02-17 Pedro Alves <palves@redhat.com>
* gdb.threads/attach-into-signal.exp (corefunc): Don't enable
lin-lwp output. Set SIGALRM to stop. Adjust tests to not rely on
gdb's internal debug output. For the non-threaded case, look for
"Program received signal SIGLARM", for the threaded case, peek at
the thread's siginfo.
---
gdb/testsuite/gdb.threads/attach-into-signal.exp | 57 ++++++++++++++++------
1 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsuite/gdb.threads/attach-into-signal.exp
index bf4b8a0..c839339 100644
--- a/gdb/testsuite/gdb.threads/attach-into-signal.exp
+++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp
@@ -47,7 +47,6 @@ proc corefunc { threadtype executable } {
lappend pf_prefix "$threadtype:"
clean_restart ${executable}
- gdb_test_no_output "set debug lin-lwp 1" ""
set binfile ${objdir}/${subdir}/${executable}
set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${executable}]
@@ -57,6 +56,8 @@ proc corefunc { threadtype executable } {
return -1
}
+ gdb_test "handle SIGALRM stop print pass" "Yes.*Yes.*Yes.*"
+
# Start the program running and then wait for a bit, to be sure
# that it can be attached to.
# Statistically there is a better chance without giving process a nice.
@@ -99,27 +100,51 @@ proc corefunc { threadtype executable } {
# Main test:
set test "attach (pass $passes), pending signal catch"
if {[gdb_test_multiple "attach $testpid" $test {
- -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*Received Alarm clock.*$gdb_prompt $" {
+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*Program received signal SIGALRM.*$gdb_prompt $" {
# nonthreaded:
pass $test
verbose -log "$test succeeded on the attempt # $attempt of $attempts"
set passes [expr $passes + 1]
}
-re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
- # nonthreaded:
- # We just lack the luck, we should try it again.
- set attempt [expr $attempt + 1]
- }
- -re "Attaching to process $testpid.*Received Alarm clock.*$gdb_prompt $" {
- # threaded:
- pass $test
- verbose -log "$test succeeded on the attempt # $attempt of $attempts"
- set passes [expr $passes + 1]
- }
- -re "Attaching to process $testpid.*$gdb_prompt $" {
- # threaded:
- # We just lack the luck, we should try it again.
- set attempt [expr $attempt - 1]
+ set ok 0
+
+ if { $threadtype == "threaded" } {
+ # In the threaded case, the signal is left pending
+ # on the second thread. Check for that by peeking
+ # at the thread's siginfo. SIGALRM is 14, SIGSTOP
+ # is 19.
+
+ # With remote targets, we need to pull the thread
+ # list explicitly before GDB even knows about
+ # thread 2.
+ set test2 "pull thread list"
+ gdb_test_multiple "info threads" $test2 {
+ -re "\r\n$gdb_prompt $" {
+ }
+ }
+
+ set test2 "thread apply 2 print \$_siginfo.si_signo"
+ gdb_test_multiple $test2 $test2 {
+ -re " = 14\r\n$gdb_prompt $" {
+ set ok 1
+ }
+ -re " = 19\r\n$gdb_prompt $" {
+ }
+ }
+ } else {
+ # In the nonthreaded case, GDB should tell the
+ # user about having seen a signal.
+ }
+
+ if { $ok == 0} {
+ # We just lack the luck, we should try it again.
+ set attempt [expr $attempt + 1]
+ } else {
+ pass $test
+ verbose -log "$test succeeded on the attempt # $attempt of $attempts"
+ set passes [expr $passes + 1]
+ }
}
}] != 0 } {
break
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup
2012-02-17 19:38 ` [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup Pedro Alves
@ 2012-02-17 20:55 ` Tom Tromey
2012-02-17 21:00 ` Pedro Alves
` (2 more replies)
2012-02-20 8:57 ` Jan Kratochvil
1 sibling, 3 replies; 28+ messages in thread
From: Tom Tromey @ 2012-02-17 20:55 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, jan.kratochvil
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> - build different executable files for the non-threaded and threaded
Pedro> cases. This was my motivation. I wanted to test the non-threaded
Pedro> case manually, but the threaded variant always clobbered the
Pedro> non-threaded executable.
I think this ought to be a general rule. We need exceptions to it for
some executable-changed cases, but I think in general different tests
should build different executables, because this makes it easier to do
additional checking by hand.
Pedro> + set save_pf_prefix $pf_prefix
Pedro> + lappend pf_prefix "$threadtype:"
I think this should be append rather than lappend, as pf_prefix is just
a string, not a list.
Pedro> if [get_compiler_info ${binfile}] {
Pedro> + set pf_prefix $save_pf_prefix
Pedro> return -1
Pedro> }
I've occasionally wanted a wrapper like 'with_pf_prefix $whatever { body }'.
But not enough to write it :)
Tom
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup
2012-02-17 20:55 ` Tom Tromey
@ 2012-02-17 21:00 ` Pedro Alves
2012-02-17 22:04 ` Tom Tromey
2012-02-17 21:31 ` [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup Pedro Alves
2012-02-17 23:55 ` Joel Brobecker
2 siblings, 1 reply; 28+ messages in thread
From: Pedro Alves @ 2012-02-17 21:00 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches, jan.kratochvil
On 02/17/2012 08:24 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> - build different executable files for the non-threaded and threaded
> Pedro> cases. This was my motivation. I wanted to test the non-threaded
> Pedro> case manually, but the threaded variant always clobbered the
> Pedro> non-threaded executable.
>
> I think this ought to be a general rule. We need exceptions to it for
> some executable-changed cases, but I think in general different tests
> should build different executables, because this makes it easier to do
> additional checking by hand.
>
> Pedro> + set save_pf_prefix $pf_prefix
> Pedro> + lappend pf_prefix "$threadtype:"
>
> I think this should be append rather than lappend, as pf_prefix is just
> a string, not a list.
Hmm, the only thing dejagnu does with it is 'concat'.
/usr/share/dejagnu/framework.exp:681: global pf_prefix
/usr/share/dejagnu/framework.exp:688: if {[info exists pf_prefix]} {
/usr/share/dejagnu/framework.exp:689: set message [concat $pf_prefix " " $message]
Interesting data-point:
$ grep -rn pf_prefix *| grep append | grep lappend | wc -l
40
$ grep -rn pf_prefix *| grep append | grep append | grep -v lappend | wc -l
2
'concat' actually takes lists as arguments, so it could be said that lappend
is the correct thing to do. 'concat' also accepts strings all the same too,
and everything is a string in tcl anyway, so it could go both ways.
Hmm, having said that, with lists we can pop back one level without
saving the previous state of pf_prefix. That is, all the
"set save_pf_prefix $pf_prefix" are really unnecessary. So we could instead
write:
lappend pf_prefix "$threadtype:"
...
set pf_prefix [lreplace $pf_prefix end end]
or even better, hide that a bit in a couple of methods in lib/gdb.exp:
proc push_prefix { $new_prefix} {
lappend pf_prefix "$threadtype:"
}
proc pop_prefix {} {
set pf_prefix [lreplace $pf_prefix end end]
}
All without any extra variables.
>
> Pedro> if [get_compiler_info ${binfile}] {
> Pedro> + set pf_prefix $save_pf_prefix
> Pedro> return -1
> Pedro> }
>
> I've occasionally wanted a wrapper like 'with_pf_prefix $whatever { body }'.
> But not enough to write it :)
Oh, that's a good idea!
--
Pedro Alves
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup
2012-02-17 20:55 ` Tom Tromey
2012-02-17 21:00 ` Pedro Alves
@ 2012-02-17 21:31 ` Pedro Alves
2012-03-01 11:47 ` Pedro Alves
2012-02-17 23:55 ` Joel Brobecker
2 siblings, 1 reply; 28+ messages in thread
From: Pedro Alves @ 2012-02-17 21:31 UTC (permalink / raw)
To: Tom Tromey; +Cc: Pedro Alves, gdb-patches, jan.kratochvil
On 02/17/2012 08:24 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> - build different executable files for the non-threaded and threaded
> Pedro> cases. This was my motivation. I wanted to test the non-threaded
> Pedro> case manually, but the threaded variant always clobbered the
> Pedro> non-threaded executable.
>
> I think this ought to be a general rule. We need exceptions to it for
> some executable-changed cases, but I think in general different tests
> should build different executables, because this makes it easier to do
> additional checking by hand.
Yeah, agreed. Perhaps we should write it down somewhere.
I guess the wiki's test cookbook could be a good place.
--
Pedro Alves
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup
2012-02-17 21:00 ` Pedro Alves
@ 2012-02-17 22:04 ` Tom Tromey
2012-02-20 13:27 ` Pedro Alves
2012-02-21 16:05 ` testsuite: prefix handling Pedro Alves
0 siblings, 2 replies; 28+ messages in thread
From: Tom Tromey @ 2012-02-17 22:04 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, jan.kratochvil
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> Hmm, the only thing dejagnu does with it is 'concat'.
Pedro> /usr/share/dejagnu/framework.exp:681: global pf_prefix
Pedro> /usr/share/dejagnu/framework.exp:688: if {[info exists pf_prefix]} {
Pedro> /usr/share/dejagnu/framework.exp:689: set message [concat $pf_prefix " " $message]
Hm, I thought I had seen weird output in gdb.log caused by using lappend
here, which is why I used append elsewhere.
Pedro> $ grep -rn pf_prefix *| grep append | grep lappend | wc -l
Pedro> 40
Pedro> $ grep -rn pf_prefix *| grep append | grep append | grep -v lappend | wc -l
Pedro> 2
Also search for 'set pf_prefix', but filter out the restoring ones.
Maybe the bad one is the initial set in lib/gdb.exp:
set pf_prefix "[file tail [file dirname $file]]/[file tail $file]:";
... this should perhaps be wrapped in [list]
>> I've occasionally wanted a wrapper like 'with_pf_prefix $whatever { body }'.
>> But not enough to write it :)
Pedro> Oh, that's a good idea!
Try this. I didn't test it in dejagnu, so...
proc with_test_prefix {prefix body} {
global pf_prefix errorInfo errorCode
set saved $pf_prefix
lappend pf_prefix $prefix
set r [catch {uplevel 1 $body} message]
set pf_prefix $saved
if {$r == 0} {
return $message
} else {
return -code $r -errorinfo $errorInfo -errorcode $errorCode $message
}
}
I've often thought more of our tests could use this "macro" style.
Tom
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup
2012-02-17 20:55 ` Tom Tromey
2012-02-17 21:00 ` Pedro Alves
2012-02-17 21:31 ` [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup Pedro Alves
@ 2012-02-17 23:55 ` Joel Brobecker
2 siblings, 0 replies; 28+ messages in thread
From: Joel Brobecker @ 2012-02-17 23:55 UTC (permalink / raw)
To: Tom Tromey; +Cc: Pedro Alves, gdb-patches, jan.kratochvil
> I think this ought to be a general rule. We need exceptions to it for
> some executable-changed cases, but I think in general different tests
> should build different executables, because this makes it easier to do
> additional checking by hand.
Agreed! (FWIW)
--
Joel
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup
2012-02-17 19:38 ` [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup Pedro Alves
2012-02-17 20:55 ` Tom Tromey
@ 2012-02-20 8:57 ` Jan Kratochvil
1 sibling, 0 replies; 28+ messages in thread
From: Jan Kratochvil @ 2012-02-20 8:57 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On Fri, 17 Feb 2012 20:36:48 +0100, Pedro Alves wrote:
> This patch does a bit of general cleanup to
> gdb.threads/attach-into-signal.exp file.
>
> - build different executable files for the non-threaded and threaded
> cases. This was my motivation. I wanted to test the non-threaded
> case manually, but the threaded variant always clobbered the
> non-threaded executable.
>
> - unique-fy test messages (gdb.sum output)
>
> - Use build_executable/clean_restart.
I am fine with these changes.
Thanks,
Jan
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output
2012-02-17 19:52 ` [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output Pedro Alves
@ 2012-02-20 9:41 ` Jan Kratochvil
2012-02-20 12:32 ` Pedro Alves
2012-02-21 18:17 ` Edjunior Barbosa Machado
1 sibling, 1 reply; 28+ messages in thread
From: Jan Kratochvil @ 2012-02-20 9:41 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On Fri, 17 Feb 2012 20:37:50 +0100, Pedro Alves wrote:
> We can't use this method for the non-threaded case too, because the Linux
> native target when attaching finds another signal other than SIGSTOP, puts
> that other signal pending, and waits for the SIGSTOP, so siginfo.si_signo
> will always show SIGSTOP.
It works with this patch from Fedora but it is not yet upstreamed:
ping: [patch 3/4]#3 linux-nat: Do not respawn signals
http://sourceware.org/ml/gdb-patches/2011-05/msg00407.html
> Jan, is this okay with you?
Yes.
> + set test2 "pull thread list"
> + gdb_test_multiple "info threads" $test2 {
> + -re "\r\n$gdb_prompt $" {
> + }
> + }
This can be just:
gdb_test "info threads" ".*" "pull thread list"
Still this is a bug of extended gdbserver mode.
Thanks,
Jan
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output
2012-02-20 9:41 ` Jan Kratochvil
@ 2012-02-20 12:32 ` Pedro Alves
2012-02-20 12:34 ` Jan Kratochvil
0 siblings, 1 reply; 28+ messages in thread
From: Pedro Alves @ 2012-02-20 12:32 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
On 02/20/2012 08:57 AM, Jan Kratochvil wrote:
> On Fri, 17 Feb 2012 20:37:50 +0100, Pedro Alves wrote:
>> > We can't use this method for the non-threaded case too, because the Linux
>> > native target when attaching finds another signal other than SIGSTOP, puts
>> > that other signal pending, and waits for the SIGSTOP, so siginfo.si_signo
>> > will always show SIGSTOP.
> It works with this patch from Fedora but it is not yet upstreamed:
> ping: [patch 3/4]#3 linux-nat: Do not respawn signals
> http://sourceware.org/ml/gdb-patches/2011-05/msg00407.html
Yeah. We can revisit/simplify the test once that's in.
>> > Jan, is this okay with you?
> Yes.
Great.
>
>
>> > + set test2 "pull thread list"
>> > + gdb_test_multiple "info threads" $test2 {
>> > + -re "\r\n$gdb_prompt $" {
>> > + }
>> > + }
> This can be just:
> gdb_test "info threads" ".*" "pull thread list"
I avoided that on purpose, because that'd generate a PASS for every
attempt/iteration at trying to catch the signal.
> Still this is a bug of extended gdbserver mode.
Yeah, it could be considered a bug. Not only of extended gdbserver
tough. It happens with all remote targets, and we have similar things
in other tests. One thing at a time though, otherwise, I'll never be
done. :-)
Thanks!
--
Pedro Alves
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output
2012-02-20 12:32 ` Pedro Alves
@ 2012-02-20 12:34 ` Jan Kratochvil
2012-02-20 12:37 ` Pedro Alves
0 siblings, 1 reply; 28+ messages in thread
From: Jan Kratochvil @ 2012-02-20 12:34 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On Mon, 20 Feb 2012 13:25:32 +0100, Pedro Alves wrote:
> On 02/20/2012 08:57 AM, Jan Kratochvil wrote:
> > On Fri, 17 Feb 2012 20:37:50 +0100, Pedro Alves wrote:
> >> > + set test2 "pull thread list"
> >> > + gdb_test_multiple "info threads" $test2 {
> >> > + -re "\r\n$gdb_prompt $" {
> >> > + }
> >> > + }
> > This can be just:
> > gdb_test "info threads" ".*" "pull thread list"
>
> I avoided that on purpose, because that'd generate a PASS for every
> attempt/iteration at trying to catch the signal.
OK, I agree now.
> > Still this is a bug of extended gdbserver mode.
>
> Yeah, it could be considered a bug. Not only of extended gdbserver
> tough. It happens with all remote targets, and we have similar things
> in other tests. One thing at a time though, otherwise, I'll never be
> done. :-)
Yes; but it should be somehow marked/filed, unless you track this issue
already.
Thanks,
Jan
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output
2012-02-20 12:34 ` Jan Kratochvil
@ 2012-02-20 12:37 ` Pedro Alves
0 siblings, 0 replies; 28+ messages in thread
From: Pedro Alves @ 2012-02-20 12:37 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
On 02/20/2012 12:32 PM, Jan Kratochvil wrote:
> Yes; but it should be somehow marked/filed, unless you track this issue
> already.
I'm adding an entry to http://sourceware.org/gdb/wiki/LocalRemoteFeatureParity .
Thanks,
--
Pedro Alves
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup
2012-02-17 22:04 ` Tom Tromey
@ 2012-02-20 13:27 ` Pedro Alves
2012-02-21 16:05 ` testsuite: prefix handling Pedro Alves
1 sibling, 0 replies; 28+ messages in thread
From: Pedro Alves @ 2012-02-20 13:27 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches, jan.kratochvil
[On lappend vs append.]
Since this isn't an issue unique to this test, I'm going ahead and checking in
the patch as is. We can handle the normalizing of the whole testsuite's handling
of pf_prefix as a separate change.
--
Pedro Alves
^ permalink raw reply [flat|nested] 28+ messages in thread
* testsuite: prefix handling
2012-02-17 22:04 ` Tom Tromey
2012-02-20 13:27 ` Pedro Alves
@ 2012-02-21 16:05 ` Pedro Alves
2012-02-21 18:18 ` Jan Kratochvil
2012-02-21 19:17 ` Tom Tromey
1 sibling, 2 replies; 28+ messages in thread
From: Pedro Alves @ 2012-02-21 16:05 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches, jan.kratochvil
On 02/17/2012 09:31 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> Hmm, the only thing dejagnu does with it is 'concat'.
>
> Pedro> /usr/share/dejagnu/framework.exp:681: global pf_prefix
> Pedro> /usr/share/dejagnu/framework.exp:688: if {[info exists pf_prefix]} {
> Pedro> /usr/share/dejagnu/framework.exp:689: set message [concat $pf_prefix " " $message]
>
> Hm, I thought I had seen weird output in gdb.log caused by using lappend
> here, which is why I used append elsewhere.
Ah, I found out what it is.
expect1.1> set l "a b c"
a b c
expect1.2> lappend l "d e"
a b c {d e}
expect1.3> concat $l " " "foo"
a b c {d e} foo
{}'s is just tcl's list representation. So `lappend pf_prefix "something with spaces"'
will end up with {}'s in gdb.sum output. So I agree we should indeed treat
pf_prefix as a simple string.
> Try this. I didn't test it in dejagnu, so...
>
> proc with_test_prefix {prefix body} {
> global pf_prefix errorInfo errorCode
>
> set saved $pf_prefix
> lappend pf_prefix $prefix
> set r [catch {uplevel 1 $body} message]
> set pf_prefix $saved
>
> if {$r == 0} {
I think checking for $r == 1 (TCL_ERROR) explicitly is more correct.
I've gone through and converted most things to use this.
I've tested it against native and gdbserver x86_64 Fedora 16, and
diff'ed the gdb.sum outputs (before/after patch), making sure there
were no output changes.
I've also added a blurb explaining test prefixes, the need to keep
test output unique, and examples.
Only a few tests weren't converted to use with_test_prefix by this
patch. Those are ones that I found that:
- would require a large reindent
- or with_test_prefix wasn't a 1-1 replacement
The tests in question are:
gdb.base/break-interp.exp:416: append pf_prefix " symbol-less:"
gdb.base/break-interp.exp:531: append pf_prefix " $ldname:"
gdb.base/break-interp.exp:613: append pf_prefix " $binname:"
gdb.base/return-nodebug.exp:21: append pf_prefix " $typenospace:"
gdb.threads/watchpoint-fork.exp:33: append pf_prefix " singlethreaded:"
gdb.threads/watchpoint-fork.exp:96: append pf_prefix " multithreaded:"
gdb.trace/unavailable.exp:501: append pf_prefix " print object on:"
gdb.trace/unavailable.exp:525: append pf_prefix " print object off:"
I did convert those to use append rather than lappend though. When we
do that, we need to add an extra space to the appended string, as
lappend/concat did that. E.g.,
- lappend pf_prefix "symbol-less:"
+ append pf_prefix " symbol-less:"
WDYT?
--
Pedro Alves
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.
---
gdb/testsuite/gdb.arch/altivec-abi.exp | 27 +++---
gdb/testsuite/gdb.base/attach-pie-misread.exp | 8 --
gdb/testsuite/gdb.base/break-interp.exp | 36 ++------
gdb/testsuite/gdb.base/catch-load.exp | 12 +--
gdb/testsuite/gdb.base/disp-step-syscall.exp | 11 --
gdb/testsuite/gdb.base/jit-so.exp | 10 +-
gdb/testsuite/gdb.base/jit.exp | 12 +--
gdb/testsuite/gdb.base/return-nodebug.exp | 2
gdb/testsuite/gdb.base/sepdebug.exp | 9 --
gdb/testsuite/gdb.base/solib-display.exp | 9 --
gdb/testsuite/gdb.base/solib-overlap.exp | 9 --
gdb/testsuite/gdb.base/watch-cond-infcall.exp | 12 +--
gdb/testsuite/gdb.base/watchpoint.exp | 10 +-
gdb/testsuite/gdb.dwarf2/dw2-noloc.exp | 9 --
gdb/testsuite/gdb.mi/mi-watch.exp | 10 --
gdb/testsuite/gdb.mi/mi2-watch.exp | 10 --
gdb/testsuite/gdb.threads/non-ldr-exc-1.exp | 11 --
gdb/testsuite/gdb.threads/non-ldr-exc-2.exp | 11 --
gdb/testsuite/gdb.threads/non-ldr-exc-3.exp | 11 --
gdb/testsuite/gdb.threads/non-ldr-exc-4.exp | 11 --
gdb/testsuite/gdb.threads/watchpoint-fork.exp | 20 ++--
gdb/testsuite/gdb.threads/watchthreads-reorder.exp | 10 --
gdb/testsuite/gdb.trace/change-loc.exp | 23 +----
gdb/testsuite/gdb.trace/pending.exp | 89 +++++---------------
gdb/testsuite/gdb.trace/status-stop.exp | 35 ++------
gdb/testsuite/gdb.trace/strace.exp | 44 ++--------
gdb/testsuite/gdb.trace/trace-break.exp | 77 +++++------------
gdb/testsuite/gdb.trace/unavailable.exp | 51 +++--------
gdb/testsuite/lib/gdb.exp | 87 ++++++++++++++++++++
29 files changed, 242 insertions(+), 434 deletions(-)
diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp
index 9bbe33f..fd069b2 100644
--- a/gdb/testsuite/gdb.arch/altivec-abi.exp
+++ b/gdb/testsuite/gdb.arch/altivec-abi.exp
@@ -36,7 +36,7 @@ if [get_compiler_info $binfile] {
return -1
}
-proc altivec_abi_tests { extra_flags force_abi } {
+proc altivec_abi_tests { prefix extra_flags force_abi } { with_test_prefix $prefix {
global testfile binfile srcfile srcdir subdir
global gdb_prompt
@@ -144,13 +144,10 @@ proc altivec_abi_tests { extra_flags force_abi } {
gdb_test "p matrix\[1\]" ".*= .11, 12, 13, 14, 15, 16, 17, 18." "print second vector"
gdb_test "p matrix\[2\]" ".*= .21, 22, 23, 24, 25, 26, 27, 28." "print third vector"
gdb_test "p matrix\[3\]" ".*= .31, 32, 33, 34, 35, 36, 37, 38." "print fourth vector"
-}
+}}
if [test_compiler_info gcc*] {
- set saved_prefix $pf_prefix
-
- set pf_prefix "${saved_prefix} default ABI, auto:"
- altivec_abi_tests "additional_flags=-maltivec" "auto"
+ altivec_abi_tests " default ABI, auto:" "additional_flags=-maltivec" "auto"
# On GNU/Linux, we can mix -mabi=no-altivec and -mabi=altivec.
# So test some combinations.
@@ -159,24 +156,24 @@ if [test_compiler_info gcc*] {
# was broken, so skip those tests there.
if { ![is_lp64_target] || ![test_compiler_info "gcc-4-\[12\]-*"] } {
set binfile ${objdir}/${subdir}/${testfile}-ge-ge
- set pf_prefix "${saved_prefix} generic ABI, forced:"
- altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "generic"
+ altivec_abi_tests " generic ABI, forced:" \
+ "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "generic"
set binfile ${objdir}/${subdir}/${testfile}-ge-auto
- set pf_prefix "${saved_prefix} generic ABI, auto:"
- altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "auto"
+ altivec_abi_tests " generic ABI, auto:" \
+ "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "auto"
}
set binfile ${objdir}/${subdir}/${testfile}-av-av
- set pf_prefix "${saved_prefix} AltiVec ABI, forced:"
- altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "altivec"
+ altivec_abi_tests " AltiVec ABI, forced:" \
+ "additional_flags=-maltivec additional_flags=-mabi=altivec" "altivec"
set binfile ${objdir}/${subdir}/${testfile}-av-auto
- set pf_prefix "${saved_prefix} AltiVec ABI, auto:"
- altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto"
+ altivec_abi_tests " AltiVec ABI, auto:" \
+ "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto"
}
} elseif [test_compiler_info xlc*] {
- altivec_abi_tests "additional_flags=-qaltivec" "auto"
+ altivec_abi_tests "" "additional_flags=-qaltivec" "auto"
} else {
warning "unknown compiler"
return -1
diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.exp b/gdb/testsuite/gdb.base/attach-pie-misread.exp
index 65477a9..de1055e 100644
--- a/gdb/testsuite/gdb.base/attach-pie-misread.exp
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp
@@ -152,9 +152,7 @@ gdb_expect {
}
# Due to alignments it was reproducible with 1 on x86_64 but 2 on i686.
-foreach align_mult {1 2} {
- set old_ldprefix $pf_prefix
- lappend pf_prefix "shift-by-$align_mult:"
+foreach align_mult {1 2} { with_test_prefix " shift-by-$align_mult:" {
# FIXME: We believe there is enough room under FIRST_OFFSET.
set shifted_offset [format 0x%x [expr "$first_offset - $align_mult * $align_max"]]
@@ -198,8 +196,6 @@ foreach align_mult {1 2} {
}
gdb_test "detach" "Detaching from program: .*"
-
- set pf_prefix $old_ldprefix
-}
+}}
remote_exec host "kill -9 $pid"
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index 575e8f0..d6267ac 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -185,16 +185,12 @@ proc reach_1 {func command displacement} {
# displacement of 0 bytes to be present, "NONZERO" for displacement of non-0
# bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid.
proc reach {func command displacement} {
- global pf_prefix
- set old_ldprefix $pf_prefix
- lappend pf_prefix "reach-$func:"
-
- reach_1 $func $command $displacement
-
- set pf_prefix $old_ldprefix
+ with_test_prefix " reach-$func:" {
+ reach_1 $func $command $displacement
+ }
}
-proc test_core {file displacement} {
+proc test_core {file displacement} { with_test_prefix " core:" {
global srcdir subdir gdb_prompt expect_out
set corefile [core_find $file {} "segv"]
@@ -202,10 +198,6 @@ proc test_core {file displacement} {
return
}
- global pf_prefix
- set old_ldprefix $pf_prefix
- lappend pf_prefix "core:"
-
gdb_exit
gdb_start
# Clear it to never find any separate debug infos in $debug_root.
@@ -245,17 +237,11 @@ proc test_core {file displacement} {
}
gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "core main bt"
+}}
- set pf_prefix $old_ldprefix
-}
-
-proc test_attach_gdb {file pid displacement prefix} {
+proc test_attach_gdb {file pid displacement prefix} { with_test_prefix " $prefix:" {
global gdb_prompt expect_out
- global pf_prefix
- set old_ldprefix $pf_prefix
- lappend pf_prefix "$prefix:"
-
gdb_exit
gdb_start
@@ -300,9 +286,7 @@ proc test_attach_gdb {file pid displacement prefix} {
gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "attach main bt"
gdb_exit
-
- set pf_prefix $old_ldprefix
-}
+}}
proc test_attach {file displacement {relink_args ""}} {
global board_info
@@ -429,7 +413,7 @@ proc test_ld {file ifmain trynosym displacement} {
global pf_prefix
set old_ldprefix $pf_prefix
- lappend pf_prefix "symbol-less:"
+ append pf_prefix " symbol-less:"
# Test also `exec-file'-command loaded $FILE - therefore without symbols.
# SYMBOL_OBJFILE is not available and only EXEC_BFD must be used.
@@ -544,7 +528,7 @@ foreach ldprelink {NO YES} {
set interp_saved ${interp}-saved
set pf_prefix $old_ldprefix
- lappend pf_prefix "$ldname:"
+ append pf_prefix " $ldname:"
if {$ldsepdebug == "NO"} {
file_copy $interp_system $interp
@@ -626,7 +610,7 @@ foreach ldprelink {NO YES} {
set exec $binprefix-$binname
set pf_prefix $old_binprefix
- lappend pf_prefix "$binname:"
+ append pf_prefix " $binname:"
set opts "ldflags=-Wl,$binfile_lib,-rpath,[file dirname $binfile_lib]"
if {$binsepdebug != "NO"} {
diff --git a/gdb/testsuite/gdb.base/catch-load.exp b/gdb/testsuite/gdb.base/catch-load.exp
index af7114a..aa4c21b 100644
--- a/gdb/testsuite/gdb.base/catch-load.exp
+++ b/gdb/testsuite/gdb.base/catch-load.exp
@@ -46,20 +46,16 @@ if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug}] !
# names.
# KIND is passed to the "catch" command.
# MATCH is a boolean saying whether we expect the catchpoint to be hit.
-proc one_catch_load_test {scenario kind match sostop} {
+proc one_catch_load_test {scenario kind match sostop} { with_test_prefix "${scenario}:" {
global verbose testfile testfile2 binfile2_dlopen
- global pf_prefix srcfile
+ global srcfile
global decimal gdb_prompt
- set saved_prefix $pf_prefix
- append pf_prefix "${scenario}:"
-
clean_restart $testfile
gdb_load_shlibs $binfile2_dlopen
if {![runto_main]} {
fail "can't run to main"
- set pf_prefix $saved_prefix
return
}
@@ -98,9 +94,7 @@ proc one_catch_load_test {scenario kind match sostop} {
fail "continue"
}
}
-
- set pf_prefix $saved_prefix
-}
+}}
one_catch_load_test "plain load" "load" 1 0
one_catch_load_test "plain load with stop-on-solib-events" "load" 1 1
diff --git a/gdb/testsuite/gdb.base/disp-step-syscall.exp b/gdb/testsuite/gdb.base/disp-step-syscall.exp
index 1f23399..61de211 100644
--- a/gdb/testsuite/gdb.base/disp-step-syscall.exp
+++ b/gdb/testsuite/gdb.base/disp-step-syscall.exp
@@ -30,10 +30,9 @@ if { [istarget "i\[34567\]86-*-linux*"] || [istarget "x86_64-*-linux*"] } {
return -1
}
-proc disp_step_cross_syscall { syscall } {
+proc disp_step_cross_syscall { syscall } { with_test_prefix " $syscall:" {
global syscall_insn
global gdb_prompt
- global pf_prefix
set testfile "disp-step-$syscall"
@@ -47,9 +46,6 @@ proc disp_step_cross_syscall { syscall } {
return
}
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "$syscall:"
-
# Delete the breakpoint on main.
gdb_test_no_output "delete break 1"
@@ -94,7 +90,6 @@ proc disp_step_cross_syscall { syscall } {
if {$see_syscall_insn == 0} then {
fail "find syscall insn in $syscall"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -130,9 +125,7 @@ proc disp_step_cross_syscall { syscall } {
gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker \\(\\) at.*" \
"continue to marker ($syscall)"
-
- set pf_prefix $old_pf_prefix
-}
+}}
disp_step_cross_syscall "fork"
disp_step_cross_syscall "vfork"
diff --git a/gdb/testsuite/gdb.base/jit-so.exp b/gdb/testsuite/gdb.base/jit-so.exp
index b28f903..b595774 100644
--- a/gdb/testsuite/gdb.base/jit-so.exp
+++ b/gdb/testsuite/gdb.base/jit-so.exp
@@ -63,11 +63,8 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {}] != "" } {
set solib_binfile_target [gdb_download ${solib_binfile}]
-proc one_jit_test {count match_str} {
- global verbose testfile srcfile2 binfile2 binfile2_dlopen solib_binfile_target solib_binfile_test_msg pf_prefix
-
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "one_jit_test-$count:"
+proc one_jit_test {count match_str} { with_test_prefix " one_jit_test-$count:" {
+ global verbose testfile srcfile2 binfile2 binfile2_dlopen solib_binfile_target solib_binfile_test_msg
clean_restart $testfile
gdb_load_shlibs $binfile2
@@ -114,8 +111,7 @@ proc one_jit_test {count match_str} {
# All jit librares must have been unregistered
gdb_test "info function jit_function" \
"All functions matching regular expression \"jit_function\":"
- set pf_prefix $old_pf_prefix
-}
+}}
one_jit_test 1 "${hex} jit_function_0000"
one_jit_test 2 "${hex} jit_function_0000\[\r\n\]+${hex} jit_function_0001"
diff --git a/gdb/testsuite/gdb.base/jit.exp b/gdb/testsuite/gdb.base/jit.exp
index a1aa351..4b8059f 100644
--- a/gdb/testsuite/gdb.base/jit.exp
+++ b/gdb/testsuite/gdb.base/jit.exp
@@ -51,11 +51,8 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {-fPIC}] != "" } {
set solib_binfile_target [gdb_download ${solib_binfile}]
-proc one_jit_test {count match_str} {
- global verbose testfile solib_binfile_target solib_binfile_test_msg pf_prefix
-
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "one_jit_test-$count:"
+proc one_jit_test {count match_str} { with_test_prefix " one_jit_test-$count:" {
+ global verbose testfile solib_binfile_target solib_binfile_test_msg
clean_restart $testfile
@@ -93,9 +90,8 @@ proc one_jit_test {count match_str} {
gdb_continue_to_breakpoint "break here 2"
# All jit librares must have been unregistered
gdb_test "info function jit_function" \
- "All functions matching regular expression \"jit_function\":"
- set pf_prefix $old_pf_prefix
-}
+ "All functions matching regular expression \"jit_function\":"
+}}
one_jit_test 1 "${hex} jit_function_0000"
one_jit_test 2 "${hex} jit_function_0000\[\r\n\]+${hex} jit_function_0001"
diff --git a/gdb/testsuite/gdb.base/return-nodebug.exp b/gdb/testsuite/gdb.base/return-nodebug.exp
index 1058088..44b415b 100644
--- a/gdb/testsuite/gdb.base/return-nodebug.exp
+++ b/gdb/testsuite/gdb.base/return-nodebug.exp
@@ -18,7 +18,7 @@ proc do_test {type} {
global pf_prefix
set old_prefix $pf_prefix
- lappend pf_prefix "$typenospace:"
+ append pf_prefix " $typenospace:"
if {[runto "func"]} {
# Verify that we do not crash when using "return" from a function with
diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp
index 4010d33..cb1bd00 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -650,14 +650,10 @@ test_next_with_recursion
#********
-proc test_different_dir {type test_different_dir xfail} {
+proc test_different_dir {type test_different_dir xfail} { with_test_prefix " $type:" {
global srcdir subdir objdir binfile srcfile timeout gdb_prompt
- global pf_prefix
global bp_location6 decimal hex
- set old_pf_prefix $pf_prefix
- append pf_prefix " $type:"
-
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
@@ -747,9 +743,8 @@ proc test_different_dir {type test_different_dir xfail} {
gdb_test_no_output "set args main"
}
- set pf_prefix $old_pf_prefix
# proc test_different_dir
-}
+}}
# now move the .debug file to a different location so that we can test
diff --git a/gdb/testsuite/gdb.base/solib-display.exp b/gdb/testsuite/gdb.base/solib-display.exp
index c1a653d..6886e04 100644
--- a/gdb/testsuite/gdb.base/solib-display.exp
+++ b/gdb/testsuite/gdb.base/solib-display.exp
@@ -48,12 +48,8 @@ if [get_compiler_info ${binfile}] {
return -1
}
-set save_pf_prefix $pf_prefix
# SEP must be last for the possible `unsupported' error path.
-foreach libsepdebug {NO IN SEP} {
-
- set pf_prefix $save_pf_prefix
- lappend pf_prefix "$libsepdebug:"
+foreach libsepdebug {NO IN SEP} { with_test_prefix " $libsepdebug:" {
set sep_lib_flags $lib_flags
if {$libsepdebug != "NO"} {
@@ -135,5 +131,4 @@ foreach libsepdebug {NO IN SEP} {
gdb_test "break [gdb_get_line_number "break here" ${testfile}.c]" \
".*Breakpoint.* at .*"
gdb_test "continue" "6: a_static = 46\\r\\n5: a_local = 45\\r\\n4: main_global = 44\\r\\n.*"
-}
-set pf_prefix $save_pf_prefix
+}}
diff --git a/gdb/testsuite/gdb.base/solib-overlap.exp b/gdb/testsuite/gdb.base/solib-overlap.exp
index b83a99c..048e6cf 100644
--- a/gdb/testsuite/gdb.base/solib-overlap.exp
+++ b/gdb/testsuite/gdb.base/solib-overlap.exp
@@ -52,12 +52,9 @@ set srcfile ${srcdir}/${subdir}/${testfile}.c
# false PASS.
# Prelink first lib1 at 0x40000000 and lib2 at 0x41000000.
# During second pass try lib1 at 0x50000000 and lib2 at 0x51000000.
-foreach prelink_lib1 {0x40000000 0x50000000} {
+foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix " $prelink_lib1:" {
set prelink_lib2 [format "0x%x" [expr $prelink_lib1 + 0x01000000]]
- set old_prefix $pf_prefix
- lappend pf_prefix "$prelink_lib1:"
-
# Library file.
set binfile_lib1 ${objdir}/${subdir}/${libname}1-${prelink_lib1}.so
set binfile_lib1_test_msg OBJDIR/${subdir}/${libname}1-${prelink_lib1}.so
@@ -137,6 +134,4 @@ foreach prelink_lib1 {0x40000000 0x50000000} {
sleep 5
remote_exec build "kill -9 ${testpid}"
-
- set pf_prefix $old_prefix
-}
+}}
diff --git a/gdb/testsuite/gdb.base/watch-cond-infcall.exp b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
index 8b81453..383ce89 100644
--- a/gdb/testsuite/gdb.base/watch-cond-infcall.exp
+++ b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
@@ -25,12 +25,8 @@ if { [build_executable ${testfile}.exp ${testfile} ${testfile}.c {debug}] } {
return -1
}
-proc test_watchpoint { hw teststr } {
+proc test_watchpoint { hw } {
global testfile
- global pf_prefix
-
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "$teststr:"
clean_restart ${testfile}
@@ -50,12 +46,10 @@ proc test_watchpoint { hw teststr } {
gdb_test "continue" \
"atchpoint \[0-9\]+: var\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*watchpoint-stop.*" \
"continue"
-
- set pf_prefix $old_pf_prefix
}
if { ![target_info exists gdb,no_hardware_watchpoints] } {
- test_watchpoint 1 "hw"
+ with_test_prefix " hw:" { test_watchpoint 1 }
}
-test_watchpoint 0 "sw"
+with_test_prefix " sw:" { test_watchpoint 0 }
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index 381c26e..7a252bb 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -894,12 +894,10 @@ proc do_tests {} {
do_tests
if ![target_info exists gdb,no_hardware_watchpoints] {
- set save_pf_prefix $pf_prefix
- lappend pf_prefix "no-hw:"
-
- set no_hw 1
- do_tests
- set pf_prefix $save_pf_prefix
+ with_test_prefix " no-hw:" {
+ set no_hw 1
+ do_tests
+ }
}
# Restore old timeout
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp b/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
index 9b29b14..ecb99ef 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
@@ -33,10 +33,7 @@ if { [prepare_for_testing dw2-noloc.exp "dw2-noloc" {dw2-noloc-main.c dw2-noloc.
# unresolvable: .symtab entry does not exist for this symbol name.
# DW_AT_declaration is not present in any of these DIEs.
-proc file_symbols {type} {
- global pf_prefix
- set old_prefix $pf_prefix
- lappend pf_prefix "$type:"
+proc file_symbols {type} { with_test_prefix " $type:" {
global gdb_prompt
@@ -78,9 +75,7 @@ proc file_symbols {type} {
# As DW_AT_declaration is not present in this DIE
# it should print <optimized out>. As usefulness of such DIE is not
# clear its resolution is not being tested.
-
- set pf_prefix $old_prefix
-}
+}}
file_symbols no-run
diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp
index bce4e88..972fdb2 100644
--- a/gdb/testsuite/gdb.mi/mi-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi-watch.exp
@@ -147,15 +147,11 @@ proc test_watchpoint_triggering {type} {
clear_xfail *-*-*
}
-proc test_watchpoint_all {type} {
- global pf_prefix
+proc test_watchpoint_all {type} { with_test_prefix " $type:" {
upvar srcdir srcdir
upvar subdir subdir
upvar binfile binfile
- set old_prefix $pf_prefix
- lappend pf_prefix "$type:"
-
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
@@ -165,9 +161,7 @@ proc test_watchpoint_all {type} {
#test_rwatch_creation_and_listing $type
#test_awatch_creation_and_listing $type
test_watchpoint_triggering $type
-
- set pf_prefix $old_prefix
-}
+}}
# Run the tests twice, once using software watchpoints...
mi_gdb_test "567-gdb-set can-use-hw-watchpoints 0" \
diff --git a/gdb/testsuite/gdb.mi/mi2-watch.exp b/gdb/testsuite/gdb.mi/mi2-watch.exp
index 3324ba8..37a919f 100644
--- a/gdb/testsuite/gdb.mi/mi2-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi2-watch.exp
@@ -146,15 +146,11 @@ proc test_watchpoint_triggering {type} {
clear_xfail *-*-*
}
-proc test_watchpoint_all {type} {
- global pf_prefix
+proc test_watchpoint_all {type} { with_test_prefix " $type:" {
upvar srcdir srcdir
upvar subdir subdir
upvar binfile binfile
- set old_prefix $pf_prefix
- lappend pf_prefix "$type:"
-
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
@@ -164,9 +160,7 @@ proc test_watchpoint_all {type} {
#test_rwatch_creation_and_listing $type
#test_awatch_creation_and_listing $type
test_watchpoint_triggering $type
-
- set pf_prefix $old_prefix
-}
+}}
# Run the tests twice, once using software watchpoints...
mi_gdb_test "567-gdb-set can-use-hw-watchpoints 0" \
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
index 8a14129..c6ced8e 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
@@ -30,17 +30,12 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-proc do_test { lock_sched } {
- global pf_prefix
+proc do_test { lock_sched } { with_test_prefix " lock-sched$lock_sched:" {
global executable
- set save_pf_prefix $pf_prefix
- lappend pf_prefix "lock-sched$lock_sched:"
-
clean_restart ${executable}
if ![runto_main] {
- set pf_prefix $save_pf_prefix
return -1
}
@@ -57,9 +52,7 @@ proc do_test { lock_sched } {
gdb_test "continue" \
".*is executing new program.*Breakpoint 1, main.* at .*" \
"continue over exec"
-
- set pf_prefix $save_pf_prefix
-}
+}}
do_test 0
do_test 1
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
index 5404ef4..66f090a 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
@@ -31,17 +31,12 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-proc do_test { lock_sched } {
- global pf_prefix
+proc do_test { lock_sched } { with_test_prefix " lock-sched$lock_sched:" {
global executable
- set save_pf_prefix $pf_prefix
- lappend pf_prefix "lock-sched$lock_sched:"
-
clean_restart ${executable}
if ![runto_main] {
- set pf_prefix $save_pf_prefix
return -1
}
@@ -62,9 +57,7 @@ proc do_test { lock_sched } {
gdb_test "continue" \
".*is executing new program.*Breakpoint 1, main.* at .*" \
"continue over exec"
-
- set pf_prefix $save_pf_prefix
-}
+}}
do_test 0
do_test 1
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
index 9c82c2a..83d243f 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
@@ -33,17 +33,12 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-proc do_test { lock_sched } {
- global pf_prefix
+proc do_test { lock_sched } { with_test_prefix " lock-sched$lock_sched:" {
global executable
- set save_pf_prefix $pf_prefix
- lappend pf_prefix "lock-sched$lock_sched:"
-
clean_restart ${executable}
if ![runto_main] {
- set pf_prefix $save_pf_prefix
return -1
}
@@ -60,9 +55,7 @@ proc do_test { lock_sched } {
gdb_test "continue" \
".*is executing new program.*Breakpoint 1, main.* at .*" \
"continue over exec"
-
- set pf_prefix $save_pf_prefix
-}
+}}
do_test 0
do_test 1
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
index 943b077..7fce0ef 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
@@ -32,17 +32,12 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-proc do_test { lock_sched } {
- global pf_prefix
+proc do_test { lock_sched } { with_test_prefix " lock-sched$lock_sched:" {
global executable
- set save_pf_prefix $pf_prefix
- lappend pf_prefix "lock-sched$lock_sched:"
-
clean_restart ${executable}
if ![runto_main] {
- set pf_prefix $save_pf_prefix
return -1
}
@@ -59,9 +54,7 @@ proc do_test { lock_sched } {
gdb_test "continue" \
".*is executing new program.*Breakpoint 1, main.* at .*" \
"continue over exec"
-
- set pf_prefix $save_pf_prefix
-}
+}}
do_test 0
do_test 1
diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.exp b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
index 814fb02..db05e1f 100644
--- a/gdb/testsuite/gdb.threads/watchpoint-fork.exp
+++ b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
@@ -22,21 +22,15 @@ if [is_remote target] {
return
}
-proc test {type symbol} {
- global testfile objdir subdir srcdir gdb_prompt
-
- global pf_prefix
- set prefix_test $pf_prefix
- lappend pf_prefix "$type:"
- set prefix_mt $pf_prefix
+proc test {type symbol} { with_test_prefix " $type:" {
+ global testfile objdir subdir srcdir gdb_prompt pf_prefix
set srcfile_type ${srcdir}/${subdir}/${testfile}-${type}.c
-
# no threads
- set pf_prefix $prefix_mt
- lappend pf_prefix "singlethreaded:"
+ set prefix_test $pf_prefix
+ append pf_prefix " singlethreaded:"
set executable ${testfile}-${type}-st
set srcfile_main ${srcdir}/${subdir}/${testfile}-st.c
@@ -98,8 +92,8 @@ proc test {type symbol} {
return
}
- set pf_prefix $prefix_mt
- lappend pf_prefix "multithreaded:"
+ set pf_prefix $prefix_test
+ append pf_prefix " multithreaded:"
set executable ${testfile}-${type}-mt
set srcfile_main ${srcdir}/${subdir}/${testfile}-mt.c
@@ -151,7 +145,7 @@ proc test {type symbol} {
# cleanup
set pf_prefix $prefix_test
-}
+}}
test parent FOLLOW_PARENT
diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
index f620c07..ab4cd5f 100644
--- a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
@@ -38,11 +38,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable
return -1
}
-foreach reorder {0 1} {
-
- global pf_prefix
- set prefix_test $pf_prefix
- lappend pf_prefix "reorder$reorder:"
+foreach reorder {0 1} { with_test_prefix " reorder$reorder:" {
clean_restart $testfile
@@ -97,6 +93,4 @@ foreach reorder {0 1} {
gdb_test "set debug infrun 1"
gdb_continue_to_breakpoint "break-at-exit" ".*break-at-exit.*"
-
- set pf_prefix $prefix_test
-}
+}}
diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp
index 451a0e1..91cdb11 100644
--- a/gdb/testsuite/gdb.trace/change-loc.exp
+++ b/gdb/testsuite/gdb.trace/change-loc.exp
@@ -71,20 +71,15 @@ if [is_amd64_regs_target] {
# Set tracepoint during tracing experiment.
-proc tracepoint_change_loc_1 { trace_type } {
+proc tracepoint_change_loc_1 { trace_type } { with_test_prefix " 1 $trace_type:" {
global testfile
global srcfile
global pcreg
global gdb_prompt
- global pf_prefix
-
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix 1 $trace_type:"
clean_restart ${testfile}
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
gdb_test_no_output "delete break 1"
@@ -120,7 +115,6 @@ proc tracepoint_change_loc_1 { trace_type } {
}
-re ".*$gdb_prompt $" {
kfail "gdb/13392" "continue to marker 2"
- set pf_prefix $old_pf_prefix
return
}
}
@@ -143,23 +137,17 @@ proc tracepoint_change_loc_1 { trace_type } {
gdb_test "tfind" "Found trace frame 0, tracepoint 4.*" "tfind frame 0"
gdb_test "tfind" "Target failed to find requested trace frame\\..*"
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Set pending tracepoint.
-proc tracepoint_change_loc_2 { trace_type } {
+proc tracepoint_change_loc_2 { trace_type } { with_test_prefix " 2 $trace_type:" {
global srcdir
global srcfile
global subdir
global pcreg
global binfile
global gdb_prompt
- global pf_prefix
-
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix 2 $trace_type:"
gdb_exit
gdb_start
@@ -218,7 +206,6 @@ proc tracepoint_change_loc_2 { trace_type } {
}
-re ".*$gdb_prompt $" {
kfail "gdb/13392" "continue to marker 1"
- set pf_prefix $old_pf_prefix
return
}
}
@@ -247,9 +234,7 @@ proc tracepoint_change_loc_2 { trace_type } {
gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" "tfind frame 1"
gdb_test "tfind" "Found trace frame 2, tracepoint 1.*" "tfind frame 2"
gdb_test "tfind" "Target failed to find requested trace frame\\..*"
-
- set pf_prefix $old_pf_prefix
-}
+}}
tracepoint_change_loc_1 "trace"
tracepoint_change_loc_2 "trace"
diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp
index 9dc8706..7a9d01d 100644
--- a/gdb/testsuite/gdb.trace/pending.exp
+++ b/gdb/testsuite/gdb.trace/pending.exp
@@ -60,16 +60,12 @@ if ![gdb_target_supports_trace] {
# Verify pending tracepoint is resolved to running to main.
-proc pending_tracepoint_resolved { trace_type } {
+proc pending_tracepoint_resolved { trace_type } { with_test_prefix " $trace_type resolved:" {
global srcdir
global subdir
global binfile
global srcfile
global lib_sl1
- global pf_prefix
-
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "$trace_type" "resolved:"
# Start with a fresh gdb.
gdb_exit
@@ -101,22 +97,16 @@ proc pending_tracepoint_resolved { trace_type } {
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*pendfunc.*" \
"single tracepoint info"
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Verify pending tracepoint is resolved and works as expected.
-proc pending_tracepoint_works { trace_type } {
+proc pending_tracepoint_works { trace_type } { with_test_prefix " $trace_type works:" {
global executable
global srcfile
global lib_sl1
- global pf_prefix
global gdb_prompt
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "$trace_type" "works:"
-
# Restart with a fresh gdb.
clean_restart $executable
@@ -150,7 +140,6 @@ proc pending_tracepoint_works { trace_type } {
}
-re ".*$gdb_prompt $" {
kfail "gdb/13392" "continue to marker"
- set pf_prefix $old_pf_prefix
return
}
}
@@ -161,27 +150,22 @@ proc pending_tracepoint_works { trace_type } {
gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" "tfind test frame 1"
gdb_test "tfind" "Found trace frame 2, tracepoint 1.*" "tfind test frame 2"
gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind test frame"
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Verify pending tracepoint is resolved during trace.
-proc pending_tracepoint_resolved_during_trace { trace_type } {
+proc pending_tracepoint_resolved_during_trace { trace_type } \
+{ with_test_prefix " $trace_type resolved_in_trace:" \
+{
global executable
global srcfile
global gdb_prompt
global lib_sl1
- global pf_prefix
-
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "$trace_type" "resolved_in_trace:"
# Start with a fresh gdb.
clean_restart $executable
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -211,7 +195,6 @@ proc pending_tracepoint_resolved_during_trace { trace_type } {
}
-re ".*$gdb_prompt $" {
kfail "gdb/13392" "continue to marker 2"
- set pf_prefix $old_pf_prefix
return
}
}
@@ -226,28 +209,23 @@ proc pending_tracepoint_resolved_during_trace { trace_type } {
gdb_test "tfind start" "#0 .*" "tfind test frame 0"
gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind test frame"
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Verify pending tracepoint is resolved and installed during trace.
-proc pending_tracepoint_installed_during_trace { trace_type } {
+proc pending_tracepoint_installed_during_trace { trace_type } \
+{ with_test_prefix " $trace_type installed_in_trace:" \
+{
global executable
global srcfile
global lib_sl1
global gdb_prompt
- global pf_prefix
global hex
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "$trace_type" "installed_in_trace:"
-
# Start with a fresh gdb.
clean_restart $executable
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -281,7 +259,6 @@ proc pending_tracepoint_installed_during_trace { trace_type } {
}
-re ".*$gdb_prompt $" {
kfail "gdb/13392" "continue to marker 2"
- set pf_prefix $old_pf_prefix
return
}
}
@@ -296,28 +273,23 @@ proc pending_tracepoint_installed_during_trace { trace_type } {
gdb_test "tfind start" "#0 $hex in pendfunc2 .*" "tfind test frame 0"
gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind test frame"
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Verify pending tracepoint will no longer work if we disconnect during tracing.
-proc pending_tracepoint_disconnect_during_trace { trace_type } {
+proc pending_tracepoint_disconnect_during_trace { trace_type } \
+{ with_test_prefix " $trace_type disconn:" \
+{
global executable
global srcfile
global lib_sl1
- global pf_prefix
global gdb_prompt
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "$trace_type" "disconn:"
-
# Start with a fresh gdb.
clean_restart $executable
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -349,28 +321,23 @@ proc pending_tracepoint_disconnect_during_trace { trace_type } {
}
}
}
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Verify disconnect after pending tracepoint has been resolved.
-proc pending_tracepoint_disconnect_after_resolved { trace_type } {
+proc pending_tracepoint_disconnect_after_resolved { trace_type } \
+{ with_test_prefix " $trace_type disconn_resolved:" \
+{
global executable
global srcfile
global lib_sl1
global gdb_prompt
- global pf_prefix
-
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "$trace_type" "disconn_resolved:"
# Start with a fresh gdb.
clean_restart $executable
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -407,27 +374,22 @@ proc pending_tracepoint_disconnect_after_resolved { trace_type } {
pass "$test"
}
}
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Verify action works properly in resolved tracepoint.
-proc pending_tracepoint_with_action_resolved { trace_type } {
+proc pending_tracepoint_with_action_resolved { trace_type } \
+{ with_test_prefix " $trace_type action_resolved:" \
+{
global executable
global srcfile
global lib_sl1
global gdb_prompt
- global pf_prefix
-
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "$trace_type" "action_resolved:"
# Start with a fresh gdb.
clean_restart $executable
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -467,7 +429,6 @@ proc pending_tracepoint_with_action_resolved { trace_type } {
}
-re ".*$gdb_prompt $" {
kfail "gdb/13392" "continue to marker 2"
- set pf_prefix $old_pf_prefix
return
}
}
@@ -483,9 +444,7 @@ proc pending_tracepoint_with_action_resolved { trace_type } {
gdb_test "tfind start" "#0 .*" "tfind test frame 0"
gdb_test "tdump" "Data collected at tracepoint .*, trace frame \[0-9\]:.*\\$${pcreg} = .*"
gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind test frame"
-
- set pf_prefix $old_pf_prefix
-}
+}}
pending_tracepoint_resolved "trace"
diff --git a/gdb/testsuite/gdb.trace/status-stop.exp b/gdb/testsuite/gdb.trace/status-stop.exp
index 9c7e915..859e9cc 100644
--- a/gdb/testsuite/gdb.trace/status-stop.exp
+++ b/gdb/testsuite/gdb.trace/status-stop.exp
@@ -39,19 +39,14 @@ if ![gdb_target_supports_trace] {
# Verify that the sequence of commands "tstart tstop tstart" works well.
-proc test_tstart_tstop_tstart { } {
+proc test_tstart_tstop_tstart { } { with_test_prefix " tstart_tstop_tstart:" {
global executable
- global pf_prefix
global hex
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix tstart_tstop_tstart:"
-
# Start with a fresh gdb.
clean_restart ${executable}
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -64,25 +59,18 @@ proc test_tstart_tstop_tstart { } {
gdb_test_no_output "tstop"
gdb_test_no_output "tstart"
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Verify the sequence of commands "tstart tstart" works well.
-proc test_tstart_tstart { } {
+proc test_tstart_tstart { } { with_test_prefix " tstart_tstart:" {
global executable
- global pf_prefix
global hex
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix tstart_tstart:"
-
# Start with a fresh gdb.
clean_restart ${executable}
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -90,25 +78,18 @@ proc test_tstart_tstart { } {
gdb_test_no_output "tstart"
gdb_test "tstart" "" "tstart again" "A trace is running already. Start a new run\\? \\(y or n\\) " "y"
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Verify that trace stops clearly when trace buffer is full.
-proc test_buffer_full_tstart { } {
+proc test_buffer_full_tstart { } { with_test_prefix " buffer_full_tstart:" {
global executable
- global pf_prefix
global hex
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix buffer_full_tstart:"
-
# Start with a fresh gdb.
clean_restart ${executable}
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -123,12 +104,10 @@ proc test_buffer_full_tstart { } {
gdb_test "tstatus" ".*buffer was full.*"
gdb_test_no_output "tstart"
-
- set old_pf_prefix $pf_prefix
-}
+}}
test_tstart_tstop_tstart
test_tstart_tstart
-test_buffer_full_tstart
\ No newline at end of file
+test_buffer_full_tstart
diff --git a/gdb/testsuite/gdb.trace/strace.exp b/gdb/testsuite/gdb.trace/strace.exp
index 4d6ea10..1d955b9 100644
--- a/gdb/testsuite/gdb.trace/strace.exp
+++ b/gdb/testsuite/gdb.trace/strace.exp
@@ -52,43 +52,31 @@ if { ![gdb_target_supports_trace] } then {
gdb_load_shlibs $libipa
-proc strace_info_marker { } {
+proc strace_info_marker { } { with_test_prefix " info_marker" {
global executable
- global pf_prefix
-
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "info_marker"
# Restart with a fresh gdb.
clean_restart $executable
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
# List the markers in program. They should be disabled.
gdb_test "info static-tracepoint-markers" \
".*ust/bar\[\t \]+n\[\t \]+.*ust/bar2\[\t \]+n\[\t \]+.*"
+}}
- set pf_prefix $old_pf_prefix
-}
-
-proc strace_probe_marker { } {
+proc strace_probe_marker { } { with_test_prefix " probe_marker" {
global executable
- global pf_prefix
global expect_out
global gdb_prompt
global hex
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "probe_marker"
-
# Restart with a fresh gdb.
clean_restart $executable
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -106,25 +94,18 @@ proc strace_probe_marker { } {
gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0"
gdb_test "tfind" "Found trace frame 1, tracepoint .*" "tfind frame 1"
gdb_test "tfind" "Target failed to find requested trace frame\\..*"
+}}
- set pf_prefix $old_pf_prefix
-}
-
-proc strace_trace_on_same_addr { type } {
+proc strace_trace_on_same_addr { type } { with_test_prefix " trace_same_addr $type" {
global executable
- global pf_prefix
global expect_out
global gdb_prompt
global hex
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "trace_same_addr" "$type"
-
# Restart with a fresh gdb.
clean_restart $executable
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -203,24 +184,19 @@ proc strace_trace_on_same_addr { type } {
gdb_test "tfind" "Found trace frame 3, tracepoint .*" "tfind frame 3"
gdb_test "tfind" "Target failed to find requested trace frame\\..*"
}
- set pf_prefix $old_pf_prefix
-}
+}}
+
+proc strace_trace_on_diff_addr { } { with_test_prefix " trace_diff_addr" {
-proc strace_trace_on_diff_addr { } {
global executable
- global pf_prefix
global expect_out
global gdb_prompt
global hex
- set old_pf_prefix $pf_prefix
- lappend pf_prefix "trace_diff_addr"
-
# Restart with a fresh gdb.
clean_restart $executable
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -261,9 +237,7 @@ proc strace_trace_on_diff_addr { } {
gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0"
gdb_test "tfind" "Found trace frame 1, tracepoint .*" "tfind frame 1"
gdb_test "tfind" "Target failed to find requested trace frame\\..*"
-
- set pf_prefix $old_pf_prefix
-}
+}}
strace_info_marker
strace_probe_marker
diff --git a/gdb/testsuite/gdb.trace/trace-break.exp b/gdb/testsuite/gdb.trace/trace-break.exp
index 1c372d4..5fcc1ac 100644
--- a/gdb/testsuite/gdb.trace/trace-break.exp
+++ b/gdb/testsuite/gdb.trace/trace-break.exp
@@ -55,19 +55,16 @@ if [is_amd64_regs_target] {
# Set breakpoint and tracepoint at the same address.
-proc break_trace_same_addr_1 { trace_type option } {
+proc break_trace_same_addr_1 { trace_type option } \
+{ with_test_prefix " 1 $trace_type $option:" \
+{
global executable
- global pf_prefix
global hex
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix 1 $trace_type $option:"
-
# Start with a fresh gdb.
clean_restart ${executable}
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -87,25 +84,20 @@ proc break_trace_same_addr_1 { trace_type option } {
gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0"
gdb_test "tfind" "Target failed to find requested trace frame\\..*"
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Set multiple tracepoints at the same address.
-proc break_trace_same_addr_2 { trace_type1 trace_type2 option } {
+proc break_trace_same_addr_2 { trace_type1 trace_type2 option } \
+{ with_test_prefix " 2 $trace_type1 $trace_type2 $option:" \
+{
global executable
- global pf_prefix
global hex
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix 2 $trace_type1 $trace_type2 $option:"
-
# Start with a fresh gdb.
clean_restart ${executable}
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -129,26 +121,21 @@ proc break_trace_same_addr_2 { trace_type1 trace_type2 option } {
gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0"
gdb_test "tfind" "Found trace frame 1, tracepoint .*" "tfind frame 1"
gdb_test "tfind" "Target failed to find requested trace frame\\..*"
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Set breakpoint and tracepoint at the same address. Delete breakpoint, and verify
# that tracepoint still works.
-proc break_trace_same_addr_3 { trace_type option } {
+proc break_trace_same_addr_3 { trace_type option } \
+{ with_test_prefix " 3 $trace_type $option:" \
+{
global executable
- global pf_prefix
global hex
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix 3 $trace_type $option:"
-
# Start with a fresh gdb.
clean_restart ${executable}
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -169,26 +156,22 @@ proc break_trace_same_addr_3 { trace_type option } {
gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0"
gdb_test "tfind" "Target failed to find requested trace frame\\..*"
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Set breakpoint and tracepoint at the same address. Delete tracepoint, and verify
# that breakpoint still works.
-proc break_trace_same_addr_4 { trace_type option } {
+proc break_trace_same_addr_4 { trace_type option } \
+{ with_test_prefix " 4 $trace_type $option:" \
+{
global executable
- global pf_prefix
global hex
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix 4 $trace_type $option:"
# Start with a fresh gdb.
clean_restart ${executable}
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -210,31 +193,26 @@ proc break_trace_same_addr_4 { trace_type option } {
gdb_test "tstop" "Trace is not running.*"
gdb_test "tfind" "Target failed to find requested trace frame\\..*"
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Set two tracepoints TRACE1 and TRACE2 at two locations, and start tracing.
# Then, set tracepoint TRACE3 at either of these two locations.
# TRACE3_AT_FIRST_LOC is a boolean variable to decide insert TRACE3 at which
# of two locations. Verify these tracepoints work as expected.
-proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } {
+proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } \
+{ with_test_prefix " 5 $trace1 $trace2 ${trace3}@${trace3_at_first_loc}:" \
+{
global executable
- global pf_prefix
global hex
global fpreg
global spreg
global pcreg
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix 5 $trace1 $trace2 ${trace3}@${trace3_at_first_loc}:"
-
# Start with a fresh gdb.
clean_restart ${executable}
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -289,29 +267,24 @@ proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } {
gdb_test "tdump" \
"Data collected at tracepoint .*, trace frame \[0-9\]:.*\\$${fpreg} = .*" \
"tdump 3"
-
- set pf_prefix $old_pf_prefix
-}
+}}
# Set two tracepoints at the same address, and enable/disable them. Verify
# tracepoints work as expect.
-proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } {
+proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } \
+{ with_test_prefix " 6 $trace1 $enable1 $trace2 $enable2:" \
+{
global executable
- global pf_prefix
global hex
global gdb_prompt
global spreg
global pcreg
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix 6 $trace1 $enable1 $trace2 $enable2:"
-
# Start with a fresh gdb.
clean_restart ${executable}
if ![runto_main] {
fail "Can't run to main"
- set pf_prefix $old_pf_prefix
return -1
}
@@ -362,9 +335,7 @@ proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } {
gdb_test "tfind tracepoint 5" "Target failed to find requested trace frame.*" \
"tfind test frame of tracepoint 5"
}
-
- set pf_prefix $old_pf_prefix
-}
+}}
foreach break_always_inserted { "on" "off" } {
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 87af860..199e219 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -136,13 +136,9 @@ proc test_maybe_regvar_display { var } {
# Test procs
#
-proc gdb_collect_args_test {} {
+proc gdb_collect_args_test {} { with_test_prefix " unavailable arguments:" {
global cr
global gdb_prompt
- global pf_prefix
-
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix unavailable arguments:"
prepare_for_trace_test
@@ -205,17 +201,11 @@ proc gdb_collect_args_test {} {
gdb_test "tfind none" \
"#0 end .*" \
"cease trace debugging"
+}}
- set pf_prefix $old_pf_prefix
-}
-
-proc gdb_collect_locals_test { func msg } {
+proc gdb_collect_locals_test { func msg } { with_test_prefix " unavailable locals: $msg:" {
global cr
global gdb_prompt
- global pf_prefix
-
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix unavailable locals: $msg:"
prepare_for_trace_test
@@ -262,18 +252,12 @@ proc gdb_collect_locals_test { func msg } {
gdb_test "tfind none" \
"#0 end .*" \
"cease trace debugging"
+}}
- set pf_prefix $old_pf_prefix
-}
-
-proc gdb_unavailable_registers_test { } {
+proc gdb_unavailable_registers_test { } { with_test_prefix " unavailable registers:" {
global gdb_prompt
global spreg
global pcreg
- global pf_prefix
-
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix unavailable registers:"
prepare_for_trace_test
@@ -319,19 +303,13 @@ proc gdb_unavailable_registers_test { } {
"info registers \$$spreg reports not available"
gdb_test "tfind none" "#0 end .*" "cease trace debugging"
+}}
- set pf_prefix $old_pf_prefix
-}
-
-proc gdb_collect_globals_test { } {
+proc gdb_collect_globals_test { } { with_test_prefix " collect globals:" {
global ws
global cr
global gdb_prompt
global hex
- global pf_prefix
-
- set old_pf_prefix $pf_prefix
- set pf_prefix "$pf_prefix collect globals:"
prepare_for_trace_test
@@ -518,8 +496,9 @@ proc gdb_collect_globals_test { } {
gdb_test_no_output "set print object on"
- set old_pf_prefix_2 $pf_prefix
- set pf_prefix "$pf_prefix print object on:"
+ global pf_prefix
+ set old_pf_prefix $pf_prefix
+ append pf_prefix " print object on:"
# With print object on, printing a pointer may need to fetch the
# pointed-to object, to check its run-time type. Make sure that
@@ -539,11 +518,11 @@ proc gdb_collect_globals_test { } {
gdb_test "print derived_whole" \
" = \\(Derived\\) {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex, z = 4}"
- set pf_prefix $old_pf_prefix_2
+ set pf_prefix $old_pf_prefix
gdb_test_no_output "set print object off"
- set pf_prefix "$pf_prefix print object off:"
+ append pf_prefix " print object off:"
gdb_test "print virtualp" " = \\(Virtual \\*\\) <unavailable>"
@@ -559,7 +538,7 @@ proc gdb_collect_globals_test { } {
gdb_test "print derived_whole" \
" = {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex, z = 4}"
- set pf_prefix $old_pf_prefix_2
+ set pf_prefix $old_pf_prefix
# An instance of a virtual class where we collected everything but
# the vptr.
@@ -569,9 +548,7 @@ proc gdb_collect_globals_test { } {
gdb_test "tfind none" \
"#0 end .*" \
"cease trace debugging"
-
- set pf_prefix $old_pf_prefix
-}
+}}
proc gdb_trace_collection_test {} {
gdb_collect_globals_test
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 00fe71c..59497dc 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1481,6 +1481,93 @@ 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
+# }
+#
+# ...do setup for variation 2...
+# 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 $message
+ } else {
+ return -code $code $result
+ }
+}
+
# Return 1 if _Complex types are supported, otherwise, return 0.
proc support_complex_tests {} {
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output
2012-02-17 19:52 ` [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output Pedro Alves
2012-02-20 9:41 ` Jan Kratochvil
@ 2012-02-21 18:17 ` Edjunior Barbosa Machado
2012-02-21 19:11 ` Pedro Alves
1 sibling, 1 reply; 28+ messages in thread
From: Edjunior Barbosa Machado @ 2012-02-21 18:17 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, jan.kratochvil
On 02/17/2012 05:37 PM, Pedro Alves wrote:
> The test runs twice, with two variants: once non-threaded, and once
> threaded. SIGLARM defaults to noprint, but if we set it to print,
> then for the non-threaded case, when we attach and find the main
> thread stopping with SIGLARM, we'll see "Program received signal
> SIGLARM". For the threaded case, the signal is seen on the non main
> thread, so we won't see "Program received signal SIGLARM". Instead,
> we check the second thread's siginfo.si_signo. We can't use this
> method for the non-threaded case too, because the Linux native target
> when attaching finds another signal other than SIGSTOP, puts that
> other signal pending, and waits for the SIGSTOP, so siginfo.si_signo
> will always show SIGSTOP.
It looks like the $_siginfo inspection used in the threaded case is not supported on some architectures (like ppc32 and ppc64, where the testcase returns about 100 failures). From what I noticed in another testcase, gdb.base/siginfo-obj.exp, signal information is currently available only on arm, x86 and x86_64.
Thanks,
--
Edjunior
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: testsuite: prefix handling
2012-02-21 16:05 ` testsuite: prefix handling Pedro Alves
@ 2012-02-21 18:18 ` Jan Kratochvil
2012-02-21 19:28 ` Pedro Alves
2012-02-21 19:17 ` Tom Tromey
1 sibling, 1 reply; 28+ messages in thread
From: Jan Kratochvil @ 2012-02-21 18:18 UTC (permalink / raw)
To: Pedro Alves; +Cc: Tom Tromey, gdb-patches
On Tue, 21 Feb 2012 16:22:13 +0100, Pedro Alves wrote:
> {}'s is just tcl's list representation. So `lappend pf_prefix "something with spaces"'
> will end up with {}'s in gdb.sum output. So I agree we should indeed treat
> pf_prefix as a simple string.
I followed rather a rule that the pf_prefix component must never contain
a space. This way the resulting pf_prefix is a list and one can iterate it by
each appended component / remove it etc. But I have never used it that way.
Also maybe the non-spaced output is better to read, one easily sees the nested
component; but maybe the opposite is true and one can just check ':'s, YMMV.
with-libs: without-PIE: some test
vs.
with libs: without PIE: some test
> Only a few tests weren't converted to use with_test_prefix by this
> patch. Those are ones that I found that:
As new testcase are in many cases created by copying existing ones the wrong
still will be spreading in the future. Sure there are many cases of such
leftover old styles in the GDB codebase.
> WDYT?
I would also prefer reindentation.
Thanks,
Jan
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output
2012-02-21 18:17 ` Edjunior Barbosa Machado
@ 2012-02-21 19:11 ` Pedro Alves
0 siblings, 0 replies; 28+ messages in thread
From: Pedro Alves @ 2012-02-21 19:11 UTC (permalink / raw)
To: Edjunior Barbosa Machado; +Cc: gdb-patches, jan.kratochvil
On 02/21/2012 06:16 PM, Edjunior Barbosa Machado wrote:
> It looks like the $_siginfo inspection used in the threaded case is not supported on some
> architectures (like ppc32 and ppc64, where the testcase returns about 100 failures). From what I noticed in
> another testcase, gdb.base/siginfo-obj.exp, signal information is currently available only on arm, x86 and x86_64.
The only reason signal inspection doesn't work on any other GNU/Linux architecture is that
nobody has yet implemented the gdbarch_get_siginfo_type hook for them. Could this be
enough motivation? Otherwise we'll have to skip the tests...
--
Pedro Alves
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: testsuite: prefix handling
2012-02-21 16:05 ` testsuite: prefix handling Pedro Alves
2012-02-21 18:18 ` Jan Kratochvil
@ 2012-02-21 19:17 ` Tom Tromey
2012-02-21 20:08 ` Pedro Alves
1 sibling, 1 reply; 28+ messages in thread
From: Tom Tromey @ 2012-02-21 19:17 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, jan.kratochvil
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>> if {$r == 0} {
Pedro> I think checking for $r == 1 (TCL_ERROR) explicitly is more correct.
I agree. My Tcl is rusty :)
Pedro> Only a few tests weren't converted to use with_test_prefix by this
Pedro> patch. Those are ones that I found that:
Pedro> - would require a large reindent
Pedro> - or with_test_prefix wasn't a 1-1 replacement
I don't mind large reindents in a situation like this.
I think the resulting code would be better.
It is up to you, though; I also don't mind the status quo.
Pedro> WDYT?
Pedro> -proc altivec_abi_tests { extra_flags force_abi } {
Pedro> +proc altivec_abi_tests { prefix extra_flags force_abi } { with_test_prefix $prefix {
[...]
Pedro> +}}
I think newlines and reindentation would result in prettier code.
The size of the diff is secondary to me; just because we'll have to read
and edit the result, not the patch.
Pedro> - altivec_abi_tests "additional_flags=-maltivec" "auto"
Pedro> + altivec_abi_tests " default ABI, auto:" "additional_flags=-maltivec" "auto"
It would be both prettier and better encapsulation if with_test_prefix
supplied the space.
Pedro> +# Test files shall make sure all the test result lines in gdb.sum are
Pedro> +# unique in a test run, so that comparing the gdb.sum files of two
Pedro> +# test runs gives correct results. Test files that exercise
Pedro> +# variations of the same tests more than once, shall prefix the
Pedro> +# different test invocations with different identifying strings in
Pedro> +# order to make them unique.
[...]
I love the comment.
Tom
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: testsuite: prefix handling
2012-02-21 18:18 ` Jan Kratochvil
@ 2012-02-21 19:28 ` Pedro Alves
2012-02-21 19:54 ` Tom Tromey
0 siblings, 1 reply; 28+ messages in thread
From: Pedro Alves @ 2012-02-21 19:28 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Tom Tromey, gdb-patches
On 02/21/2012 06:17 PM, Jan Kratochvil wrote:
> As new testcase are in many cases created by copying existing ones the wrong
> still will be spreading in the future. Sure there are many cases of such
> leftover old styles in the GDB codebase.
Well, help appreciated.
--
Pedro Alves
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: testsuite: prefix handling
2012-02-21 19:28 ` Pedro Alves
@ 2012-02-21 19:54 ` Tom Tromey
0 siblings, 0 replies; 28+ messages in thread
From: Tom Tromey @ 2012-02-21 19:54 UTC (permalink / raw)
To: Pedro Alves; +Cc: Jan Kratochvil, gdb-patches
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> On 02/21/2012 06:17 PM, Jan Kratochvil wrote:
>> As new testcase are in many cases created by copying existing ones the wrong
>> still will be spreading in the future. Sure there are many cases of such
>> leftover old styles in the GDB codebase.
Pedro> Well, help appreciated.
I don't mind tweaking your patch provided you agree with my various
comments.
Tom
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: testsuite: prefix handling
2012-02-21 19:17 ` Tom Tromey
@ 2012-02-21 20:08 ` Pedro Alves
2012-02-21 20:59 ` Pedro Alves
2012-02-21 21:00 ` Tom Tromey
0 siblings, 2 replies; 28+ messages in thread
From: Pedro Alves @ 2012-02-21 20:08 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches, jan.kratochvil
On 02/21/2012 06:05 PM, Tom Tromey wrote:
>
> Pedro> Only a few tests weren't converted to use with_test_prefix by this
> Pedro> patch. Those are ones that I found that:
>
> Pedro> - would require a large reindent
> Pedro> - or with_test_prefix wasn't a 1-1 replacement
>
> I don't mind large reindents in a situation like this.
> I think the resulting code would be better.
> It is up to you, though; I also don't mind the status quo.
I really dislike mixing in a lot of formatting changes with
code changes, so I was really avoiding it. It's a harder patch to
read/prove right, and a harder patch to maintain as well. If someone
sent me over this change mixed in with a lots of reindents, and hadn't
at least sent me a -W diff, I'd groan. :-) We can always do
a "reindent" patch as follow up, perhaps even as multiple patches.
>
> Pedro> WDYT?
>
> Pedro> -proc altivec_abi_tests { extra_flags force_abi } {
> Pedro> +proc altivec_abi_tests { prefix extra_flags force_abi } { with_test_prefix $prefix {
> [...]
> Pedro> +}}
>
> I think newlines and reindentation would result in prettier code.
Honestly, I kind of liked the current formatting -- I was kind of reading it
as a function attribute. But I don't mind seeing this re-indented either.
But that's a lower priority to me.
> Pedro> - altivec_abi_tests "additional_flags=-maltivec" "auto"
> Pedro> + altivec_abi_tests " default ABI, auto:" "additional_flags=-maltivec" "auto"
>
> It would be both prettier and better encapsulation if with_test_prefix
> supplied the space.
Thing is I stumbled on tests that don't currently output a space. So I'm not
sure we should always require spaces. Changing those would make this patch
not an identity patch -- it'd produce different gdb.sum output compared to
the current mainline. I can try making with_test_prefix always add the space
instead as follow up, and see which tests are those, and if we'd get something
non-sensical. Probably not.
>
> Pedro> +# Test files shall make sure all the test result lines in gdb.sum are
> Pedro> +# unique in a test run, so that comparing the gdb.sum files of two
> Pedro> +# test runs gives correct results. Test files that exercise
> Pedro> +# variations of the same tests more than once, shall prefix the
> Pedro> +# different test invocations with different identifying strings in
> Pedro> +# order to make them unique.
> [...]
>
> I love the comment.
:-)
--
Pedro Alves
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: testsuite: prefix handling
2012-02-21 20:08 ` Pedro Alves
@ 2012-02-21 20:59 ` Pedro Alves
2012-02-21 21:02 ` Tom Tromey
2012-02-21 21:00 ` Tom Tromey
1 sibling, 1 reply; 28+ messages in thread
From: Pedro Alves @ 2012-02-21 20:59 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches, jan.kratochvil
On 02/21/2012 06:37 PM, Pedro Alves wrote:
>> > Pedro> - altivec_abi_tests "additional_flags=-maltivec" "auto"
>> > Pedro> + altivec_abi_tests " default ABI, auto:" "additional_flags=-maltivec" "auto"
>> >
>> > It would be both prettier and better encapsulation if with_test_prefix
>> > supplied the space.
> Thing is I stumbled on tests that don't currently output a space. So I'm not
> sure we should always require spaces. Changing those would make this patch
> not an identity patch -- it'd produce different gdb.sum output compared to
> the current mainline. I can try making with_test_prefix always add the space
> instead as follow up, and see which tests are those, and if we'd get something
> non-sensical. Probably not.
Eh, I did this, and the only test that changed output in either
a native or gdbserver run was catch-load.exp. :-)
I'm also wondering if with_test_prefix should supply the `:'. gdb.trace/strace.exp
seems to be the only test that doesn't append `:', but looking at it, it
probably should. We could add a with_raw_test_prefix or something like
that that doesn't add neither the space nor the `:' if necessary.
--
Pedro Alves
gdb/testsuite/gdb.arch/altivec-abi.exp | 30 ++++++++++++--------
gdb/testsuite/gdb.base/attach-pie-misread.exp | 2 +
gdb/testsuite/gdb.base/break-interp.exp | 6 ++--
gdb/testsuite/gdb.base/disp-step-syscall.exp | 2 +
gdb/testsuite/gdb.base/jit-so.exp | 2 +
gdb/testsuite/gdb.base/jit.exp | 2 +
gdb/testsuite/gdb.base/sepdebug.exp | 2 +
gdb/testsuite/gdb.base/solib-display.exp | 2 +
gdb/testsuite/gdb.base/solib-overlap.exp | 2 +
gdb/testsuite/gdb.base/watch-cond-infcall.exp | 4 +--
gdb/testsuite/gdb.base/watchpoint.exp | 2 +
gdb/testsuite/gdb.dwarf2/dw2-noloc.exp | 2 +
gdb/testsuite/gdb.mi/mi-watch.exp | 2 +
gdb/testsuite/gdb.mi/mi2-watch.exp | 2 +
gdb/testsuite/gdb.threads/non-ldr-exc-1.exp | 2 +
gdb/testsuite/gdb.threads/non-ldr-exc-2.exp | 2 +
gdb/testsuite/gdb.threads/non-ldr-exc-3.exp | 2 +
gdb/testsuite/gdb.threads/non-ldr-exc-4.exp | 2 +
gdb/testsuite/gdb.threads/watchpoint-fork.exp | 2 +
gdb/testsuite/gdb.threads/watchthreads-reorder.exp | 2 +
gdb/testsuite/gdb.trace/change-loc.exp | 4 +--
gdb/testsuite/gdb.trace/pending.exp | 14 +++++----
gdb/testsuite/gdb.trace/status-stop.exp | 6 ++--
gdb/testsuite/gdb.trace/strace.exp | 8 +++--
gdb/testsuite/gdb.trace/trace-break.exp | 12 ++++----
gdb/testsuite/gdb.trace/unavailable.exp | 8 +++--
gdb/testsuite/lib/gdb.exp | 13 +++++----
27 files changed, 73 insertions(+), 66 deletions(-)
diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp
index fd069b2..fa102fb 100644
--- a/gdb/testsuite/gdb.arch/altivec-abi.exp
+++ b/gdb/testsuite/gdb.arch/altivec-abi.exp
@@ -36,7 +36,7 @@ if [get_compiler_info $binfile] {
return -1
}
-proc altivec_abi_tests { prefix extra_flags force_abi } { with_test_prefix $prefix {
+proc altivec_abi_tests { prefix extra_flags force_abi } {
global testfile binfile srcfile srcdir subdir
global gdb_prompt
@@ -144,10 +144,12 @@ proc altivec_abi_tests { prefix extra_flags force_abi } { with_test_prefix $pref
gdb_test "p matrix\[1\]" ".*= .11, 12, 13, 14, 15, 16, 17, 18." "print second vector"
gdb_test "p matrix\[2\]" ".*= .21, 22, 23, 24, 25, 26, 27, 28." "print third vector"
gdb_test "p matrix\[3\]" ".*= .31, 32, 33, 34, 35, 36, 37, 38." "print fourth vector"
-}}
+}
if [test_compiler_info gcc*] {
- altivec_abi_tests " default ABI, auto:" "additional_flags=-maltivec" "auto"
+ with_test_prefix "default ABI, auto:" {
+ altivec_abi_tests "additional_flags=-maltivec" "auto"
+ }
# On GNU/Linux, we can mix -mabi=no-altivec and -mabi=altivec.
# So test some combinations.
@@ -156,24 +158,28 @@ if [test_compiler_info gcc*] {
# was broken, so skip those tests there.
if { ![is_lp64_target] || ![test_compiler_info "gcc-4-\[12\]-*"] } {
set binfile ${objdir}/${subdir}/${testfile}-ge-ge
- altivec_abi_tests " generic ABI, forced:" \
- "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "generic"
+ with_test_prefix "generic ABI, forced:" {
+ altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "generic"
+ }
set binfile ${objdir}/${subdir}/${testfile}-ge-auto
- altivec_abi_tests " generic ABI, auto:" \
- "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "auto"
+ with_test_prefix "generic ABI, auto:" {
+ altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "auto"
+ }
}
set binfile ${objdir}/${subdir}/${testfile}-av-av
- altivec_abi_tests " AltiVec ABI, forced:" \
- "additional_flags=-maltivec additional_flags=-mabi=altivec" "altivec"
+ with_test_prefix "AltiVec ABI, forced:" {
+ altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "altivec"
+ }
set binfile ${objdir}/${subdir}/${testfile}-av-auto
- altivec_abi_tests " AltiVec ABI, auto:" \
- "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto"
+ with_test_prefix "AltiVec ABI, auto:" {
+ altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto"
+ }
}
} elseif [test_compiler_info xlc*] {
- altivec_abi_tests "" "additional_flags=-qaltivec" "auto"
+ altivec_abi_tests "additional_flags=-qaltivec" "auto"
} else {
warning "unknown compiler"
return -1
diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.exp b/gdb/testsuite/gdb.base/attach-pie-misread.exp
index de1055e..fbfb726 100644
--- a/gdb/testsuite/gdb.base/attach-pie-misread.exp
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp
@@ -152,7 +152,7 @@ gdb_expect {
}
# Due to alignments it was reproducible with 1 on x86_64 but 2 on i686.
-foreach align_mult {1 2} { with_test_prefix " shift-by-$align_mult:" {
+foreach align_mult {1 2} { with_test_prefix "shift-by-$align_mult:" {
# FIXME: We believe there is enough room under FIRST_OFFSET.
set shifted_offset [format 0x%x [expr "$first_offset - $align_mult * $align_max"]]
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index d6267ac..844916a 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -185,12 +185,12 @@ proc reach_1 {func command displacement} {
# displacement of 0 bytes to be present, "NONZERO" for displacement of non-0
# bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid.
proc reach {func command displacement} {
- with_test_prefix " reach-$func:" {
+ with_test_prefix "reach-$func:" {
reach_1 $func $command $displacement
}
}
-proc test_core {file displacement} { with_test_prefix " core:" {
+proc test_core {file displacement} { with_test_prefix "core:" {
global srcdir subdir gdb_prompt expect_out
set corefile [core_find $file {} "segv"]
@@ -239,7 +239,7 @@ proc test_core {file displacement} { with_test_prefix " core:" {
gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "core main bt"
}}
-proc test_attach_gdb {file pid displacement prefix} { with_test_prefix " $prefix:" {
+proc test_attach_gdb {file pid displacement prefix} { with_test_prefix "$prefix:" {
global gdb_prompt expect_out
gdb_exit
diff --git a/gdb/testsuite/gdb.base/disp-step-syscall.exp b/gdb/testsuite/gdb.base/disp-step-syscall.exp
index 61de211..06df05d 100644
--- a/gdb/testsuite/gdb.base/disp-step-syscall.exp
+++ b/gdb/testsuite/gdb.base/disp-step-syscall.exp
@@ -30,7 +30,7 @@ if { [istarget "i\[34567\]86-*-linux*"] || [istarget "x86_64-*-linux*"] } {
return -1
}
-proc disp_step_cross_syscall { syscall } { with_test_prefix " $syscall:" {
+proc disp_step_cross_syscall { syscall } { with_test_prefix "$syscall:" {
global syscall_insn
global gdb_prompt
diff --git a/gdb/testsuite/gdb.base/jit-so.exp b/gdb/testsuite/gdb.base/jit-so.exp
index b595774..77006ee 100644
--- a/gdb/testsuite/gdb.base/jit-so.exp
+++ b/gdb/testsuite/gdb.base/jit-so.exp
@@ -63,7 +63,7 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {}] != "" } {
set solib_binfile_target [gdb_download ${solib_binfile}]
-proc one_jit_test {count match_str} { with_test_prefix " one_jit_test-$count:" {
+proc one_jit_test {count match_str} { with_test_prefix "one_jit_test-$count:" {
global verbose testfile srcfile2 binfile2 binfile2_dlopen solib_binfile_target solib_binfile_test_msg
clean_restart $testfile
diff --git a/gdb/testsuite/gdb.base/jit.exp b/gdb/testsuite/gdb.base/jit.exp
index 4b8059f..fa100ca 100644
--- a/gdb/testsuite/gdb.base/jit.exp
+++ b/gdb/testsuite/gdb.base/jit.exp
@@ -51,7 +51,7 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {-fPIC}] != "" } {
set solib_binfile_target [gdb_download ${solib_binfile}]
-proc one_jit_test {count match_str} { with_test_prefix " one_jit_test-$count:" {
+proc one_jit_test {count match_str} { with_test_prefix "one_jit_test-$count:" {
global verbose testfile solib_binfile_target solib_binfile_test_msg
clean_restart $testfile
diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp
index cb1bd00..937edc1 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -650,7 +650,7 @@ test_next_with_recursion
#********
-proc test_different_dir {type test_different_dir xfail} { with_test_prefix " $type:" {
+proc test_different_dir {type test_different_dir xfail} { with_test_prefix "$type:" {
global srcdir subdir objdir binfile srcfile timeout gdb_prompt
global bp_location6 decimal hex
diff --git a/gdb/testsuite/gdb.base/solib-display.exp b/gdb/testsuite/gdb.base/solib-display.exp
index 6886e04..d6cbc23 100644
--- a/gdb/testsuite/gdb.base/solib-display.exp
+++ b/gdb/testsuite/gdb.base/solib-display.exp
@@ -49,7 +49,7 @@ if [get_compiler_info ${binfile}] {
}
# SEP must be last for the possible `unsupported' error path.
-foreach libsepdebug {NO IN SEP} { with_test_prefix " $libsepdebug:" {
+foreach libsepdebug {NO IN SEP} { with_test_prefix "$libsepdebug:" {
set sep_lib_flags $lib_flags
if {$libsepdebug != "NO"} {
diff --git a/gdb/testsuite/gdb.base/solib-overlap.exp b/gdb/testsuite/gdb.base/solib-overlap.exp
index 048e6cf..cce9d77 100644
--- a/gdb/testsuite/gdb.base/solib-overlap.exp
+++ b/gdb/testsuite/gdb.base/solib-overlap.exp
@@ -52,7 +52,7 @@ set srcfile ${srcdir}/${subdir}/${testfile}.c
# false PASS.
# Prelink first lib1 at 0x40000000 and lib2 at 0x41000000.
# During second pass try lib1 at 0x50000000 and lib2 at 0x51000000.
-foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix " $prelink_lib1:" {
+foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1:" {
set prelink_lib2 [format "0x%x" [expr $prelink_lib1 + 0x01000000]]
# Library file.
diff --git a/gdb/testsuite/gdb.base/watch-cond-infcall.exp b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
index 383ce89..30f93bf 100644
--- a/gdb/testsuite/gdb.base/watch-cond-infcall.exp
+++ b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
@@ -49,7 +49,7 @@ proc test_watchpoint { hw } {
}
if { ![target_info exists gdb,no_hardware_watchpoints] } {
- with_test_prefix " hw:" { test_watchpoint 1 }
+ with_test_prefix "hw:" { test_watchpoint 1 }
}
-with_test_prefix " sw:" { test_watchpoint 0 }
+with_test_prefix "sw:" { test_watchpoint 0 }
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index 7a252bb..66ccdf6 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -894,7 +894,7 @@ proc do_tests {} {
do_tests
if ![target_info exists gdb,no_hardware_watchpoints] {
- with_test_prefix " no-hw:" {
+ with_test_prefix "no-hw:" {
set no_hw 1
do_tests
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp b/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
index ecb99ef..dd14948 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
@@ -33,7 +33,7 @@ if { [prepare_for_testing dw2-noloc.exp "dw2-noloc" {dw2-noloc-main.c dw2-noloc.
# unresolvable: .symtab entry does not exist for this symbol name.
# DW_AT_declaration is not present in any of these DIEs.
-proc file_symbols {type} { with_test_prefix " $type:" {
+proc file_symbols {type} { with_test_prefix "$type:" {
global gdb_prompt
diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp
index 972fdb2..87113a3 100644
--- a/gdb/testsuite/gdb.mi/mi-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi-watch.exp
@@ -147,7 +147,7 @@ proc test_watchpoint_triggering {type} {
clear_xfail *-*-*
}
-proc test_watchpoint_all {type} { with_test_prefix " $type:" {
+proc test_watchpoint_all {type} { with_test_prefix "$type:" {
upvar srcdir srcdir
upvar subdir subdir
upvar binfile binfile
diff --git a/gdb/testsuite/gdb.mi/mi2-watch.exp b/gdb/testsuite/gdb.mi/mi2-watch.exp
index 37a919f..64228dc 100644
--- a/gdb/testsuite/gdb.mi/mi2-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi2-watch.exp
@@ -146,7 +146,7 @@ proc test_watchpoint_triggering {type} {
clear_xfail *-*-*
}
-proc test_watchpoint_all {type} { with_test_prefix " $type:" {
+proc test_watchpoint_all {type} { with_test_prefix "$type:" {
upvar srcdir srcdir
upvar subdir subdir
upvar binfile binfile
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
index c6ced8e..c913ab2 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
@@ -30,7 +30,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-proc do_test { lock_sched } { with_test_prefix " lock-sched$lock_sched:" {
+proc do_test { lock_sched } { with_test_prefix "lock-sched$lock_sched:" {
global executable
clean_restart ${executable}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
index 66f090a..e524072 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
@@ -31,7 +31,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-proc do_test { lock_sched } { with_test_prefix " lock-sched$lock_sched:" {
+proc do_test { lock_sched } { with_test_prefix "lock-sched$lock_sched:" {
global executable
clean_restart ${executable}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
index 83d243f..c0e79bd 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
@@ -33,7 +33,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-proc do_test { lock_sched } { with_test_prefix " lock-sched$lock_sched:" {
+proc do_test { lock_sched } { with_test_prefix "lock-sched$lock_sched:" {
global executable
clean_restart ${executable}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
index 7fce0ef..0aa47f9 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
@@ -32,7 +32,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-proc do_test { lock_sched } { with_test_prefix " lock-sched$lock_sched:" {
+proc do_test { lock_sched } { with_test_prefix "lock-sched$lock_sched:" {
global executable
clean_restart ${executable}
diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.exp b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
index db05e1f..f0dbfcc 100644
--- a/gdb/testsuite/gdb.threads/watchpoint-fork.exp
+++ b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
@@ -22,7 +22,7 @@ if [is_remote target] {
return
}
-proc test {type symbol} { with_test_prefix " $type:" {
+proc test {type symbol} { with_test_prefix "$type:" {
global testfile objdir subdir srcdir gdb_prompt pf_prefix
set srcfile_type ${srcdir}/${subdir}/${testfile}-${type}.c
diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
index ab4cd5f..e00383f 100644
--- a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
@@ -38,7 +38,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable
return -1
}
-foreach reorder {0 1} { with_test_prefix " reorder$reorder:" {
+foreach reorder {0 1} { with_test_prefix "reorder$reorder:" {
clean_restart $testfile
diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp
index 91cdb11..a97402a 100644
--- a/gdb/testsuite/gdb.trace/change-loc.exp
+++ b/gdb/testsuite/gdb.trace/change-loc.exp
@@ -71,7 +71,7 @@ if [is_amd64_regs_target] {
# Set tracepoint during tracing experiment.
-proc tracepoint_change_loc_1 { trace_type } { with_test_prefix " 1 $trace_type:" {
+proc tracepoint_change_loc_1 { trace_type } { with_test_prefix "1 $trace_type:" {
global testfile
global srcfile
global pcreg
@@ -141,7 +141,7 @@ proc tracepoint_change_loc_1 { trace_type } { with_test_prefix " 1 $trace_type:"
# Set pending tracepoint.
-proc tracepoint_change_loc_2 { trace_type } { with_test_prefix " 2 $trace_type:" {
+proc tracepoint_change_loc_2 { trace_type } { with_test_prefix "2 $trace_type:" {
global srcdir
global srcfile
global subdir
diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp
index 7a9d01d..7bfc9e1 100644
--- a/gdb/testsuite/gdb.trace/pending.exp
+++ b/gdb/testsuite/gdb.trace/pending.exp
@@ -60,7 +60,7 @@ if ![gdb_target_supports_trace] {
# Verify pending tracepoint is resolved to running to main.
-proc pending_tracepoint_resolved { trace_type } { with_test_prefix " $trace_type resolved:" {
+proc pending_tracepoint_resolved { trace_type } { with_test_prefix "$trace_type resolved:" {
global srcdir
global subdir
global binfile
@@ -101,7 +101,7 @@ proc pending_tracepoint_resolved { trace_type } { with_test_prefix " $trace_type
# Verify pending tracepoint is resolved and works as expected.
-proc pending_tracepoint_works { trace_type } { with_test_prefix " $trace_type works:" {
+proc pending_tracepoint_works { trace_type } { with_test_prefix "$trace_type works:" {
global executable
global srcfile
global lib_sl1
@@ -155,7 +155,7 @@ proc pending_tracepoint_works { trace_type } { with_test_prefix " $trace_type wo
# Verify pending tracepoint is resolved during trace.
proc pending_tracepoint_resolved_during_trace { trace_type } \
-{ with_test_prefix " $trace_type resolved_in_trace:" \
+{ with_test_prefix "$trace_type resolved_in_trace:" \
{
global executable
global srcfile
@@ -214,7 +214,7 @@ proc pending_tracepoint_resolved_during_trace { trace_type } \
# Verify pending tracepoint is resolved and installed during trace.
proc pending_tracepoint_installed_during_trace { trace_type } \
-{ with_test_prefix " $trace_type installed_in_trace:" \
+{ with_test_prefix "$trace_type installed_in_trace:" \
{
global executable
global srcfile
@@ -279,7 +279,7 @@ proc pending_tracepoint_installed_during_trace { trace_type } \
# Verify pending tracepoint will no longer work if we disconnect during tracing.
proc pending_tracepoint_disconnect_during_trace { trace_type } \
-{ with_test_prefix " $trace_type disconn:" \
+{ with_test_prefix "$trace_type disconn:" \
{
global executable
global srcfile
@@ -327,7 +327,7 @@ proc pending_tracepoint_disconnect_during_trace { trace_type } \
# Verify disconnect after pending tracepoint has been resolved.
proc pending_tracepoint_disconnect_after_resolved { trace_type } \
-{ with_test_prefix " $trace_type disconn_resolved:" \
+{ with_test_prefix "$trace_type disconn_resolved:" \
{
global executable
global srcfile
@@ -379,7 +379,7 @@ proc pending_tracepoint_disconnect_after_resolved { trace_type } \
# Verify action works properly in resolved tracepoint.
proc pending_tracepoint_with_action_resolved { trace_type } \
-{ with_test_prefix " $trace_type action_resolved:" \
+{ with_test_prefix "$trace_type action_resolved:" \
{
global executable
global srcfile
diff --git a/gdb/testsuite/gdb.trace/status-stop.exp b/gdb/testsuite/gdb.trace/status-stop.exp
index 859e9cc..7d1c219 100644
--- a/gdb/testsuite/gdb.trace/status-stop.exp
+++ b/gdb/testsuite/gdb.trace/status-stop.exp
@@ -39,7 +39,7 @@ if ![gdb_target_supports_trace] {
# Verify that the sequence of commands "tstart tstop tstart" works well.
-proc test_tstart_tstop_tstart { } { with_test_prefix " tstart_tstop_tstart:" {
+proc test_tstart_tstop_tstart { } { with_test_prefix "tstart_tstop_tstart:" {
global executable
global hex
@@ -63,7 +63,7 @@ proc test_tstart_tstop_tstart { } { with_test_prefix " tstart_tstop_tstart:" {
# Verify the sequence of commands "tstart tstart" works well.
-proc test_tstart_tstart { } { with_test_prefix " tstart_tstart:" {
+proc test_tstart_tstart { } { with_test_prefix "tstart_tstart:" {
global executable
global hex
@@ -82,7 +82,7 @@ proc test_tstart_tstart { } { with_test_prefix " tstart_tstart:" {
# Verify that trace stops clearly when trace buffer is full.
-proc test_buffer_full_tstart { } { with_test_prefix " buffer_full_tstart:" {
+proc test_buffer_full_tstart { } { with_test_prefix "buffer_full_tstart:" {
global executable
global hex
diff --git a/gdb/testsuite/gdb.trace/strace.exp b/gdb/testsuite/gdb.trace/strace.exp
index 1d955b9..9ceabfb 100644
--- a/gdb/testsuite/gdb.trace/strace.exp
+++ b/gdb/testsuite/gdb.trace/strace.exp
@@ -52,7 +52,7 @@ if { ![gdb_target_supports_trace] } then {
gdb_load_shlibs $libipa
-proc strace_info_marker { } { with_test_prefix " info_marker" {
+proc strace_info_marker { } { with_test_prefix "info_marker" {
global executable
# Restart with a fresh gdb.
@@ -67,7 +67,7 @@ proc strace_info_marker { } { with_test_prefix " info_marker" {
".*ust/bar\[\t \]+n\[\t \]+.*ust/bar2\[\t \]+n\[\t \]+.*"
}}
-proc strace_probe_marker { } { with_test_prefix " probe_marker" {
+proc strace_probe_marker { } { with_test_prefix "probe_marker" {
global executable
global expect_out
global gdb_prompt
@@ -96,7 +96,7 @@ proc strace_probe_marker { } { with_test_prefix " probe_marker" {
gdb_test "tfind" "Target failed to find requested trace frame\\..*"
}}
-proc strace_trace_on_same_addr { type } { with_test_prefix " trace_same_addr $type" {
+proc strace_trace_on_same_addr { type } { with_test_prefix "trace_same_addr $type" {
global executable
global expect_out
global gdb_prompt
@@ -186,7 +186,7 @@ proc strace_trace_on_same_addr { type } { with_test_prefix " trace_same_addr $ty
}
}}
-proc strace_trace_on_diff_addr { } { with_test_prefix " trace_diff_addr" {
+proc strace_trace_on_diff_addr { } { with_test_prefix "trace_diff_addr" {
global executable
global expect_out
diff --git a/gdb/testsuite/gdb.trace/trace-break.exp b/gdb/testsuite/gdb.trace/trace-break.exp
index 5fcc1ac..986d113 100644
--- a/gdb/testsuite/gdb.trace/trace-break.exp
+++ b/gdb/testsuite/gdb.trace/trace-break.exp
@@ -56,7 +56,7 @@ if [is_amd64_regs_target] {
# Set breakpoint and tracepoint at the same address.
proc break_trace_same_addr_1 { trace_type option } \
-{ with_test_prefix " 1 $trace_type $option:" \
+{ with_test_prefix "1 $trace_type $option:" \
{
global executable
global hex
@@ -89,7 +89,7 @@ proc break_trace_same_addr_1 { trace_type option } \
# Set multiple tracepoints at the same address.
proc break_trace_same_addr_2 { trace_type1 trace_type2 option } \
-{ with_test_prefix " 2 $trace_type1 $trace_type2 $option:" \
+{ with_test_prefix "2 $trace_type1 $trace_type2 $option:" \
{
global executable
global hex
@@ -127,7 +127,7 @@ proc break_trace_same_addr_2 { trace_type1 trace_type2 option } \
# that tracepoint still works.
proc break_trace_same_addr_3 { trace_type option } \
-{ with_test_prefix " 3 $trace_type $option:" \
+{ with_test_prefix "3 $trace_type $option:" \
{
global executable
global hex
@@ -162,7 +162,7 @@ proc break_trace_same_addr_3 { trace_type option } \
# that breakpoint still works.
proc break_trace_same_addr_4 { trace_type option } \
-{ with_test_prefix " 4 $trace_type $option:" \
+{ with_test_prefix "4 $trace_type $option:" \
{
global executable
global hex
@@ -201,7 +201,7 @@ proc break_trace_same_addr_4 { trace_type option } \
# of two locations. Verify these tracepoints work as expected.
proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } \
-{ with_test_prefix " 5 $trace1 $trace2 ${trace3}@${trace3_at_first_loc}:" \
+{ with_test_prefix "5 $trace1 $trace2 ${trace3}@${trace3_at_first_loc}:" \
{
global executable
global hex
@@ -273,7 +273,7 @@ proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } \
# tracepoints work as expect.
proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } \
-{ with_test_prefix " 6 $trace1 $enable1 $trace2 $enable2:" \
+{ with_test_prefix "6 $trace1 $enable1 $trace2 $enable2:" \
{
global executable
global hex
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 199e219..9309437 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -136,7 +136,7 @@ proc test_maybe_regvar_display { var } {
# Test procs
#
-proc gdb_collect_args_test {} { with_test_prefix " unavailable arguments:" {
+proc gdb_collect_args_test {} { with_test_prefix "unavailable arguments:" {
global cr
global gdb_prompt
@@ -203,7 +203,7 @@ proc gdb_collect_args_test {} { with_test_prefix " unavailable arguments:" {
"cease trace debugging"
}}
-proc gdb_collect_locals_test { func msg } { with_test_prefix " unavailable locals: $msg:" {
+proc gdb_collect_locals_test { func msg } { with_test_prefix "unavailable locals: $msg:" {
global cr
global gdb_prompt
@@ -254,7 +254,7 @@ proc gdb_collect_locals_test { func msg } { with_test_prefix " unavailable local
"cease trace debugging"
}}
-proc gdb_unavailable_registers_test { } { with_test_prefix " unavailable registers:" {
+proc gdb_unavailable_registers_test { } { with_test_prefix "unavailable registers:" {
global gdb_prompt
global spreg
global pcreg
@@ -305,7 +305,7 @@ proc gdb_unavailable_registers_test { } { with_test_prefix " unavailable registe
gdb_test "tfind none" "#0 end .*" "cease trace debugging"
}}
-proc gdb_collect_globals_test { } { with_test_prefix " collect globals:" {
+proc gdb_collect_globals_test { } { with_test_prefix "collect globals:" {
global ws
global cr
global gdb_prompt
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 3a43f95..ce04b5f 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1507,21 +1507,21 @@ proc skip_shlib_tests {} {
# gdb_test ... ... "test foo"
# gdb_test ... ... "test bar"
#
-# with_test_prefix " subvariation a:" {
+# with_test_prefix "subvariation a:" {
# gdb_test ... ... "test x"
# }
#
-# with_test_prefix " subvariation b:" {
+# with_test_prefix "subvariation b:" {
# gdb_test ... ... "test x"
# }
# }
#
-# with_test_prefix " variation1:" {
+# with_test_prefix "variation1:" {
# ...do setup for variation 1...
# do_tests
# }
#
-# with_test_prefix " variation2:" {
+# with_test_prefix "variation2:" {
# ...do setup for variation 2...
# do_tests
# }
@@ -1549,13 +1549,14 @@ proc skip_shlib_tests {} {
#
# Run BODY in the context of the caller, with the current test prefix
-# (pf_prefix) appended with PREFIX. Returns the result of BODY.
+# (pf_prefix) appended with one space and then PREFIX. Returns the
+# result of BODY.
#
proc with_test_prefix { prefix body } {
global pf_prefix
set saved $pf_prefix
- append pf_prefix $prefix
+ append pf_prefix " " $prefix
set code [catch {uplevel 1 $body} result]
set pf_prefix $saved
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: testsuite: prefix handling
2012-02-21 20:08 ` Pedro Alves
2012-02-21 20:59 ` Pedro Alves
@ 2012-02-21 21:00 ` Tom Tromey
2012-02-21 22:03 ` Pedro Alves
1 sibling, 1 reply; 28+ messages in thread
From: Tom Tromey @ 2012-02-21 21:00 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, jan.kratochvil
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> I really dislike mixing in a lot of formatting changes with
Pedro> code changes, so I was really avoiding it.
Yeah, I totally blanked out about that.
I completely agree.
Pedro> Honestly, I kind of liked the current formatting -- I was kind of
Pedro> reading it as a function attribute. But I don't mind seeing this
Pedro> re-indented either. But that's a lower priority to me.
If you don't object I will do it.
There's also the defining style (untested):
proc prefix_proc {name arglist substitution body} {
set delayed "\[[list subst $substitution]\]"
proc $name $arglist [list with_test_prefix $delayed $body]
}
prefix_proc test_something {name} {hi: $name} {
blah blah
}
Ok, I wouldn't really want to use it anyway...
Tom
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: testsuite: prefix handling
2012-02-21 20:59 ` Pedro Alves
@ 2012-02-21 21:02 ` Tom Tromey
2012-02-21 22:08 ` Pedro Alves
0 siblings, 1 reply; 28+ messages in thread
From: Tom Tromey @ 2012-02-21 21:02 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, jan.kratochvil
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> I'm also wondering if with_test_prefix should supply the `:'.
Pedro> gdb.trace/strace.exp
Pedro> seems to be the only test that doesn't append `:', but looking at it, it
Pedro> probably should. We could add a with_raw_test_prefix or something like
Pedro> that that doesn't add neither the space nor the `:' if necessary.
It would be fine by me to add it.
Tom
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: testsuite: prefix handling
2012-02-21 21:00 ` Tom Tromey
@ 2012-02-21 22:03 ` Pedro Alves
0 siblings, 0 replies; 28+ messages in thread
From: Pedro Alves @ 2012-02-21 22:03 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches, jan.kratochvil
On 02/21/2012 08:59 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> I really dislike mixing in a lot of formatting changes with
> Pedro> code changes, so I was really avoiding it.
>
> Yeah, I totally blanked out about that.
> I completely agree.
>
> Pedro> Honestly, I kind of liked the current formatting -- I was kind of
> Pedro> reading it as a function attribute. But I don't mind seeing this
> Pedro> re-indented either. But that's a lower priority to me.
>
> If you don't object I will do it.
I don't.
--
Pedro Alves
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: testsuite: prefix handling
2012-02-21 21:02 ` Tom Tromey
@ 2012-02-21 22:08 ` Pedro Alves
0 siblings, 0 replies; 28+ messages in thread
From: Pedro Alves @ 2012-02-21 22:08 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches, jan.kratochvil
On 02/21/2012 09:00 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> I'm also wondering if with_test_prefix should supply the `:'.
> Pedro> gdb.trace/strace.exp
> Pedro> seems to be the only test that doesn't append `:', but looking at it, it
> Pedro> probably should. We could add a with_raw_test_prefix or something like
> Pedro> that that doesn't add neither the space nor the `:' if necessary.
>
> It would be fine by me to add it.
Okay, I've tested it as well, and only the strace.exp test changes.
Therefore I've now committed the original patch, and then this one as
follow up.
--
Pedro Alves
2012-02-21 Pedro Alves <palves@redhat.com>
* gdb.arch/altivec-abi.exp (altivec_abi_tests): Don't do
with_test_prefix here.
(top level): Do it here instead. Remove `:' from the
with_test_prefix string.
* gdb.base/attach-pie-misread.exp: Remove the leading space the
the suffix `:' from the with_test_prefix prefix string.
* gdb.base/break-interp.exp: Ditto.
* gdb.base/catch-load.exp: Ditto.
* gdb.base/disp-step-syscall.exp: Ditto.
* gdb.base/jit-so.exp: Ditto.
* gdb.base/jit.exp: Ditto.
* gdb.base/sepdebug.exp: Ditto.
* gdb.base/solib-display.exp: Ditto.
* gdb.base/solib-overlap.exp: Ditto.
* gdb.base/watch-cond-infcall.exp: Ditto.
* gdb.base/watchpoint.exp: Ditto.
* gdb.dwarf2/dw2-noloc.exp: Ditto.
* gdb.mi/mi-watch.exp: Ditto.
* gdb.mi/mi2-watch.exp: Ditto.
* gdb.threads/non-ldr-exc-1.exp: Ditto.
* gdb.threads/non-ldr-exc-2.exp: Ditto.
* gdb.threads/non-ldr-exc-3.exp: Ditto.
* gdb.threads/non-ldr-exc-4.exp: Ditto.
* gdb.threads/watchpoint-fork.exp: Ditto.
* gdb.threads/watchthreads-reorder.exp: Ditto.
* gdb.trace/change-loc.exp: Ditto.
* gdb.trace/pending.exp: Ditto.
* gdb.trace/status-stop.exp: Ditto.
* gdb.trace/strace.exp: Ditto.
* gdb.trace/trace-break.exp: Ditto.
* gdb.trace/unavailable.exp: Ditto.
* lib/gdb.exp (with_test_prefix): Always prefix with space and
suffix with colon. Adjust leading comments.
---
gdb/testsuite/gdb.arch/altivec-abi.exp | 30 ++++++++++++--------
gdb/testsuite/gdb.base/attach-pie-misread.exp | 2 +
gdb/testsuite/gdb.base/break-interp.exp | 6 ++--
gdb/testsuite/gdb.base/catch-load.exp | 2 +
gdb/testsuite/gdb.base/disp-step-syscall.exp | 2 +
gdb/testsuite/gdb.base/jit-so.exp | 2 +
gdb/testsuite/gdb.base/jit.exp | 2 +
gdb/testsuite/gdb.base/sepdebug.exp | 2 +
gdb/testsuite/gdb.base/solib-display.exp | 2 +
gdb/testsuite/gdb.base/solib-overlap.exp | 2 +
gdb/testsuite/gdb.base/watch-cond-infcall.exp | 4 +--
gdb/testsuite/gdb.base/watchpoint.exp | 2 +
gdb/testsuite/gdb.dwarf2/dw2-noloc.exp | 2 +
gdb/testsuite/gdb.mi/mi-watch.exp | 2 +
gdb/testsuite/gdb.mi/mi2-watch.exp | 2 +
gdb/testsuite/gdb.threads/non-ldr-exc-1.exp | 2 +
gdb/testsuite/gdb.threads/non-ldr-exc-2.exp | 2 +
gdb/testsuite/gdb.threads/non-ldr-exc-3.exp | 2 +
gdb/testsuite/gdb.threads/non-ldr-exc-4.exp | 2 +
gdb/testsuite/gdb.threads/watchpoint-fork.exp | 2 +
gdb/testsuite/gdb.threads/watchthreads-reorder.exp | 2 +
gdb/testsuite/gdb.trace/change-loc.exp | 4 +--
gdb/testsuite/gdb.trace/pending.exp | 14 +++++----
gdb/testsuite/gdb.trace/status-stop.exp | 6 ++--
gdb/testsuite/gdb.trace/strace.exp | 8 +++--
gdb/testsuite/gdb.trace/trace-break.exp | 12 ++++----
gdb/testsuite/gdb.trace/unavailable.exp | 8 +++--
gdb/testsuite/lib/gdb.exp | 15 +++++-----
28 files changed, 75 insertions(+), 68 deletions(-)
diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp
index fd069b2..718018d 100644
--- a/gdb/testsuite/gdb.arch/altivec-abi.exp
+++ b/gdb/testsuite/gdb.arch/altivec-abi.exp
@@ -36,7 +36,7 @@ if [get_compiler_info $binfile] {
return -1
}
-proc altivec_abi_tests { prefix extra_flags force_abi } { with_test_prefix $prefix {
+proc altivec_abi_tests { prefix extra_flags force_abi } {
global testfile binfile srcfile srcdir subdir
global gdb_prompt
@@ -144,10 +144,12 @@ proc altivec_abi_tests { prefix extra_flags force_abi } { with_test_prefix $pref
gdb_test "p matrix\[1\]" ".*= .11, 12, 13, 14, 15, 16, 17, 18." "print second vector"
gdb_test "p matrix\[2\]" ".*= .21, 22, 23, 24, 25, 26, 27, 28." "print third vector"
gdb_test "p matrix\[3\]" ".*= .31, 32, 33, 34, 35, 36, 37, 38." "print fourth vector"
-}}
+}
if [test_compiler_info gcc*] {
- altivec_abi_tests " default ABI, auto:" "additional_flags=-maltivec" "auto"
+ with_test_prefix "default ABI, auto" {
+ altivec_abi_tests "additional_flags=-maltivec" "auto"
+ }
# On GNU/Linux, we can mix -mabi=no-altivec and -mabi=altivec.
# So test some combinations.
@@ -156,24 +158,28 @@ if [test_compiler_info gcc*] {
# was broken, so skip those tests there.
if { ![is_lp64_target] || ![test_compiler_info "gcc-4-\[12\]-*"] } {
set binfile ${objdir}/${subdir}/${testfile}-ge-ge
- altivec_abi_tests " generic ABI, forced:" \
- "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "generic"
+ with_test_prefix "generic ABI, forced" {
+ altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "generic"
+ }
set binfile ${objdir}/${subdir}/${testfile}-ge-auto
- altivec_abi_tests " generic ABI, auto:" \
- "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "auto"
+ with_test_prefix "generic ABI, auto" {
+ altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "auto"
+ }
}
set binfile ${objdir}/${subdir}/${testfile}-av-av
- altivec_abi_tests " AltiVec ABI, forced:" \
- "additional_flags=-maltivec additional_flags=-mabi=altivec" "altivec"
+ with_test_prefix "AltiVec ABI, forced" {
+ altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "altivec"
+ }
set binfile ${objdir}/${subdir}/${testfile}-av-auto
- altivec_abi_tests " AltiVec ABI, auto:" \
- "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto"
+ with_test_prefix "AltiVec ABI, auto" {
+ altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto"
+ }
}
} elseif [test_compiler_info xlc*] {
- altivec_abi_tests "" "additional_flags=-qaltivec" "auto"
+ altivec_abi_tests "additional_flags=-qaltivec" "auto"
} else {
warning "unknown compiler"
return -1
diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.exp b/gdb/testsuite/gdb.base/attach-pie-misread.exp
index de1055e..e7ff231 100644
--- a/gdb/testsuite/gdb.base/attach-pie-misread.exp
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp
@@ -152,7 +152,7 @@ gdb_expect {
}
# Due to alignments it was reproducible with 1 on x86_64 but 2 on i686.
-foreach align_mult {1 2} { with_test_prefix " shift-by-$align_mult:" {
+foreach align_mult {1 2} { with_test_prefix "shift-by-$align_mult" {
# FIXME: We believe there is enough room under FIRST_OFFSET.
set shifted_offset [format 0x%x [expr "$first_offset - $align_mult * $align_max"]]
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index d6267ac..59e5753 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -185,12 +185,12 @@ proc reach_1 {func command displacement} {
# displacement of 0 bytes to be present, "NONZERO" for displacement of non-0
# bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid.
proc reach {func command displacement} {
- with_test_prefix " reach-$func:" {
+ with_test_prefix "reach-$func" {
reach_1 $func $command $displacement
}
}
-proc test_core {file displacement} { with_test_prefix " core:" {
+proc test_core {file displacement} { with_test_prefix "core" {
global srcdir subdir gdb_prompt expect_out
set corefile [core_find $file {} "segv"]
@@ -239,7 +239,7 @@ proc test_core {file displacement} { with_test_prefix " core:" {
gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "core main bt"
}}
-proc test_attach_gdb {file pid displacement prefix} { with_test_prefix " $prefix:" {
+proc test_attach_gdb {file pid displacement prefix} { with_test_prefix "$prefix" {
global gdb_prompt expect_out
gdb_exit
diff --git a/gdb/testsuite/gdb.base/catch-load.exp b/gdb/testsuite/gdb.base/catch-load.exp
index e17a563..21b8505 100644
--- a/gdb/testsuite/gdb.base/catch-load.exp
+++ b/gdb/testsuite/gdb.base/catch-load.exp
@@ -46,7 +46,7 @@ if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug}] !
# names.
# KIND is passed to the "catch" command.
# MATCH is a boolean saying whether we expect the catchpoint to be hit.
-proc one_catch_load_test {scenario kind match sostop} { with_test_prefix "${scenario}:" {
+proc one_catch_load_test {scenario kind match sostop} { with_test_prefix "${scenario}" {
global verbose testfile testfile2 binfile2_dlopen
global srcfile
global decimal gdb_prompt
diff --git a/gdb/testsuite/gdb.base/disp-step-syscall.exp b/gdb/testsuite/gdb.base/disp-step-syscall.exp
index 61de211..c62938c 100644
--- a/gdb/testsuite/gdb.base/disp-step-syscall.exp
+++ b/gdb/testsuite/gdb.base/disp-step-syscall.exp
@@ -30,7 +30,7 @@ if { [istarget "i\[34567\]86-*-linux*"] || [istarget "x86_64-*-linux*"] } {
return -1
}
-proc disp_step_cross_syscall { syscall } { with_test_prefix " $syscall:" {
+proc disp_step_cross_syscall { syscall } { with_test_prefix "$syscall" {
global syscall_insn
global gdb_prompt
diff --git a/gdb/testsuite/gdb.base/jit-so.exp b/gdb/testsuite/gdb.base/jit-so.exp
index b595774..7df2011 100644
--- a/gdb/testsuite/gdb.base/jit-so.exp
+++ b/gdb/testsuite/gdb.base/jit-so.exp
@@ -63,7 +63,7 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {}] != "" } {
set solib_binfile_target [gdb_download ${solib_binfile}]
-proc one_jit_test {count match_str} { with_test_prefix " one_jit_test-$count:" {
+proc one_jit_test {count match_str} { with_test_prefix "one_jit_test-$count" {
global verbose testfile srcfile2 binfile2 binfile2_dlopen solib_binfile_target solib_binfile_test_msg
clean_restart $testfile
diff --git a/gdb/testsuite/gdb.base/jit.exp b/gdb/testsuite/gdb.base/jit.exp
index 4b8059f..70b33a7 100644
--- a/gdb/testsuite/gdb.base/jit.exp
+++ b/gdb/testsuite/gdb.base/jit.exp
@@ -51,7 +51,7 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {-fPIC}] != "" } {
set solib_binfile_target [gdb_download ${solib_binfile}]
-proc one_jit_test {count match_str} { with_test_prefix " one_jit_test-$count:" {
+proc one_jit_test {count match_str} { with_test_prefix "one_jit_test-$count" {
global verbose testfile solib_binfile_target solib_binfile_test_msg
clean_restart $testfile
diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp
index cb1bd00..30ed7af 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -650,7 +650,7 @@ test_next_with_recursion
#********
-proc test_different_dir {type test_different_dir xfail} { with_test_prefix " $type:" {
+proc test_different_dir {type test_different_dir xfail} { with_test_prefix "$type" {
global srcdir subdir objdir binfile srcfile timeout gdb_prompt
global bp_location6 decimal hex
diff --git a/gdb/testsuite/gdb.base/solib-display.exp b/gdb/testsuite/gdb.base/solib-display.exp
index 6886e04..1491459 100644
--- a/gdb/testsuite/gdb.base/solib-display.exp
+++ b/gdb/testsuite/gdb.base/solib-display.exp
@@ -49,7 +49,7 @@ if [get_compiler_info ${binfile}] {
}
# SEP must be last for the possible `unsupported' error path.
-foreach libsepdebug {NO IN SEP} { with_test_prefix " $libsepdebug:" {
+foreach libsepdebug {NO IN SEP} { with_test_prefix "$libsepdebug" {
set sep_lib_flags $lib_flags
if {$libsepdebug != "NO"} {
diff --git a/gdb/testsuite/gdb.base/solib-overlap.exp b/gdb/testsuite/gdb.base/solib-overlap.exp
index 048e6cf..49e67be 100644
--- a/gdb/testsuite/gdb.base/solib-overlap.exp
+++ b/gdb/testsuite/gdb.base/solib-overlap.exp
@@ -52,7 +52,7 @@ set srcfile ${srcdir}/${subdir}/${testfile}.c
# false PASS.
# Prelink first lib1 at 0x40000000 and lib2 at 0x41000000.
# During second pass try lib1 at 0x50000000 and lib2 at 0x51000000.
-foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix " $prelink_lib1:" {
+foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1" {
set prelink_lib2 [format "0x%x" [expr $prelink_lib1 + 0x01000000]]
# Library file.
diff --git a/gdb/testsuite/gdb.base/watch-cond-infcall.exp b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
index 383ce89..1c83da5 100644
--- a/gdb/testsuite/gdb.base/watch-cond-infcall.exp
+++ b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
@@ -49,7 +49,7 @@ proc test_watchpoint { hw } {
}
if { ![target_info exists gdb,no_hardware_watchpoints] } {
- with_test_prefix " hw:" { test_watchpoint 1 }
+ with_test_prefix "hw" { test_watchpoint 1 }
}
-with_test_prefix " sw:" { test_watchpoint 0 }
+with_test_prefix "sw" { test_watchpoint 0 }
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index 7a252bb..7200f71 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -894,7 +894,7 @@ proc do_tests {} {
do_tests
if ![target_info exists gdb,no_hardware_watchpoints] {
- with_test_prefix " no-hw:" {
+ with_test_prefix "no-hw" {
set no_hw 1
do_tests
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp b/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
index ecb99ef..9a6cb2a 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
@@ -33,7 +33,7 @@ if { [prepare_for_testing dw2-noloc.exp "dw2-noloc" {dw2-noloc-main.c dw2-noloc.
# unresolvable: .symtab entry does not exist for this symbol name.
# DW_AT_declaration is not present in any of these DIEs.
-proc file_symbols {type} { with_test_prefix " $type:" {
+proc file_symbols {type} { with_test_prefix "$type" {
global gdb_prompt
diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp
index 972fdb2..fde99dc 100644
--- a/gdb/testsuite/gdb.mi/mi-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi-watch.exp
@@ -147,7 +147,7 @@ proc test_watchpoint_triggering {type} {
clear_xfail *-*-*
}
-proc test_watchpoint_all {type} { with_test_prefix " $type:" {
+proc test_watchpoint_all {type} { with_test_prefix "$type" {
upvar srcdir srcdir
upvar subdir subdir
upvar binfile binfile
diff --git a/gdb/testsuite/gdb.mi/mi2-watch.exp b/gdb/testsuite/gdb.mi/mi2-watch.exp
index 37a919f..8aa0d94 100644
--- a/gdb/testsuite/gdb.mi/mi2-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi2-watch.exp
@@ -146,7 +146,7 @@ proc test_watchpoint_triggering {type} {
clear_xfail *-*-*
}
-proc test_watchpoint_all {type} { with_test_prefix " $type:" {
+proc test_watchpoint_all {type} { with_test_prefix "$type" {
upvar srcdir srcdir
upvar subdir subdir
upvar binfile binfile
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
index c6ced8e..8dc9bf4 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
@@ -30,7 +30,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-proc do_test { lock_sched } { with_test_prefix " lock-sched$lock_sched:" {
+proc do_test { lock_sched } { with_test_prefix "lock-sched$lock_sched" {
global executable
clean_restart ${executable}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
index 66f090a..2d49773 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
@@ -31,7 +31,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-proc do_test { lock_sched } { with_test_prefix " lock-sched$lock_sched:" {
+proc do_test { lock_sched } { with_test_prefix "lock-sched$lock_sched" {
global executable
clean_restart ${executable}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
index 83d243f..7d6841d 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
@@ -33,7 +33,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-proc do_test { lock_sched } { with_test_prefix " lock-sched$lock_sched:" {
+proc do_test { lock_sched } { with_test_prefix "lock-sched$lock_sched" {
global executable
clean_restart ${executable}
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
index 7fce0ef..aecf107 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
@@ -32,7 +32,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-proc do_test { lock_sched } { with_test_prefix " lock-sched$lock_sched:" {
+proc do_test { lock_sched } { with_test_prefix "lock-sched$lock_sched" {
global executable
clean_restart ${executable}
diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.exp b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
index db05e1f..086c9bd 100644
--- a/gdb/testsuite/gdb.threads/watchpoint-fork.exp
+++ b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
@@ -22,7 +22,7 @@ if [is_remote target] {
return
}
-proc test {type symbol} { with_test_prefix " $type:" {
+proc test {type symbol} { with_test_prefix "$type" {
global testfile objdir subdir srcdir gdb_prompt pf_prefix
set srcfile_type ${srcdir}/${subdir}/${testfile}-${type}.c
diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
index ab4cd5f..5197983 100644
--- a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
@@ -38,7 +38,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable
return -1
}
-foreach reorder {0 1} { with_test_prefix " reorder$reorder:" {
+foreach reorder {0 1} { with_test_prefix "reorder$reorder" {
clean_restart $testfile
diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp
index 91cdb11..d6062fc 100644
--- a/gdb/testsuite/gdb.trace/change-loc.exp
+++ b/gdb/testsuite/gdb.trace/change-loc.exp
@@ -71,7 +71,7 @@ if [is_amd64_regs_target] {
# Set tracepoint during tracing experiment.
-proc tracepoint_change_loc_1 { trace_type } { with_test_prefix " 1 $trace_type:" {
+proc tracepoint_change_loc_1 { trace_type } { with_test_prefix "1 $trace_type" {
global testfile
global srcfile
global pcreg
@@ -141,7 +141,7 @@ proc tracepoint_change_loc_1 { trace_type } { with_test_prefix " 1 $trace_type:"
# Set pending tracepoint.
-proc tracepoint_change_loc_2 { trace_type } { with_test_prefix " 2 $trace_type:" {
+proc tracepoint_change_loc_2 { trace_type } { with_test_prefix "2 $trace_type" {
global srcdir
global srcfile
global subdir
diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp
index 7a9d01d..017aea9 100644
--- a/gdb/testsuite/gdb.trace/pending.exp
+++ b/gdb/testsuite/gdb.trace/pending.exp
@@ -60,7 +60,7 @@ if ![gdb_target_supports_trace] {
# Verify pending tracepoint is resolved to running to main.
-proc pending_tracepoint_resolved { trace_type } { with_test_prefix " $trace_type resolved:" {
+proc pending_tracepoint_resolved { trace_type } { with_test_prefix "$trace_type resolved" {
global srcdir
global subdir
global binfile
@@ -101,7 +101,7 @@ proc pending_tracepoint_resolved { trace_type } { with_test_prefix " $trace_type
# Verify pending tracepoint is resolved and works as expected.
-proc pending_tracepoint_works { trace_type } { with_test_prefix " $trace_type works:" {
+proc pending_tracepoint_works { trace_type } { with_test_prefix "$trace_type works" {
global executable
global srcfile
global lib_sl1
@@ -155,7 +155,7 @@ proc pending_tracepoint_works { trace_type } { with_test_prefix " $trace_type wo
# Verify pending tracepoint is resolved during trace.
proc pending_tracepoint_resolved_during_trace { trace_type } \
-{ with_test_prefix " $trace_type resolved_in_trace:" \
+{ with_test_prefix "$trace_type resolved_in_trace" \
{
global executable
global srcfile
@@ -214,7 +214,7 @@ proc pending_tracepoint_resolved_during_trace { trace_type } \
# Verify pending tracepoint is resolved and installed during trace.
proc pending_tracepoint_installed_during_trace { trace_type } \
-{ with_test_prefix " $trace_type installed_in_trace:" \
+{ with_test_prefix "$trace_type installed_in_trace" \
{
global executable
global srcfile
@@ -279,7 +279,7 @@ proc pending_tracepoint_installed_during_trace { trace_type } \
# Verify pending tracepoint will no longer work if we disconnect during tracing.
proc pending_tracepoint_disconnect_during_trace { trace_type } \
-{ with_test_prefix " $trace_type disconn:" \
+{ with_test_prefix "$trace_type disconn" \
{
global executable
global srcfile
@@ -327,7 +327,7 @@ proc pending_tracepoint_disconnect_during_trace { trace_type } \
# Verify disconnect after pending tracepoint has been resolved.
proc pending_tracepoint_disconnect_after_resolved { trace_type } \
-{ with_test_prefix " $trace_type disconn_resolved:" \
+{ with_test_prefix "$trace_type disconn_resolved" \
{
global executable
global srcfile
@@ -379,7 +379,7 @@ proc pending_tracepoint_disconnect_after_resolved { trace_type } \
# Verify action works properly in resolved tracepoint.
proc pending_tracepoint_with_action_resolved { trace_type } \
-{ with_test_prefix " $trace_type action_resolved:" \
+{ with_test_prefix "$trace_type action_resolved" \
{
global executable
global srcfile
diff --git a/gdb/testsuite/gdb.trace/status-stop.exp b/gdb/testsuite/gdb.trace/status-stop.exp
index 859e9cc..9c2320e 100644
--- a/gdb/testsuite/gdb.trace/status-stop.exp
+++ b/gdb/testsuite/gdb.trace/status-stop.exp
@@ -39,7 +39,7 @@ if ![gdb_target_supports_trace] {
# Verify that the sequence of commands "tstart tstop tstart" works well.
-proc test_tstart_tstop_tstart { } { with_test_prefix " tstart_tstop_tstart:" {
+proc test_tstart_tstop_tstart { } { with_test_prefix "tstart_tstop_tstart" {
global executable
global hex
@@ -63,7 +63,7 @@ proc test_tstart_tstop_tstart { } { with_test_prefix " tstart_tstop_tstart:" {
# Verify the sequence of commands "tstart tstart" works well.
-proc test_tstart_tstart { } { with_test_prefix " tstart_tstart:" {
+proc test_tstart_tstart { } { with_test_prefix "tstart_tstart" {
global executable
global hex
@@ -82,7 +82,7 @@ proc test_tstart_tstart { } { with_test_prefix " tstart_tstart:" {
# Verify that trace stops clearly when trace buffer is full.
-proc test_buffer_full_tstart { } { with_test_prefix " buffer_full_tstart:" {
+proc test_buffer_full_tstart { } { with_test_prefix "buffer_full_tstart" {
global executable
global hex
diff --git a/gdb/testsuite/gdb.trace/strace.exp b/gdb/testsuite/gdb.trace/strace.exp
index 54f96a3..7f4551e 100644
--- a/gdb/testsuite/gdb.trace/strace.exp
+++ b/gdb/testsuite/gdb.trace/strace.exp
@@ -52,7 +52,7 @@ if { ![gdb_target_supports_trace] } then {
gdb_load_shlibs $libipa
-proc strace_info_marker { } { with_test_prefix " info_marker" {
+proc strace_info_marker { } { with_test_prefix "info_marker" {
global executable
global gdb_prompt
@@ -76,7 +76,7 @@ proc strace_info_marker { } { with_test_prefix " info_marker" {
}
}}
-proc strace_probe_marker { } { with_test_prefix " probe_marker" {
+proc strace_probe_marker { } { with_test_prefix "probe_marker" {
global executable
global expect_out
global gdb_prompt
@@ -105,7 +105,7 @@ proc strace_probe_marker { } { with_test_prefix " probe_marker" {
gdb_test "tfind" "Target failed to find requested trace frame\\..*"
}}
-proc strace_trace_on_same_addr { type } { with_test_prefix " trace_same_addr $type" {
+proc strace_trace_on_same_addr { type } { with_test_prefix "trace_same_addr $type" {
global executable
global expect_out
global gdb_prompt
@@ -195,7 +195,7 @@ proc strace_trace_on_same_addr { type } { with_test_prefix " trace_same_addr $ty
}
}}
-proc strace_trace_on_diff_addr { } { with_test_prefix " trace_diff_addr" {
+proc strace_trace_on_diff_addr { } { with_test_prefix "trace_diff_addr" {
global executable
global expect_out
diff --git a/gdb/testsuite/gdb.trace/trace-break.exp b/gdb/testsuite/gdb.trace/trace-break.exp
index 5fcc1ac..6c5e43a 100644
--- a/gdb/testsuite/gdb.trace/trace-break.exp
+++ b/gdb/testsuite/gdb.trace/trace-break.exp
@@ -56,7 +56,7 @@ if [is_amd64_regs_target] {
# Set breakpoint and tracepoint at the same address.
proc break_trace_same_addr_1 { trace_type option } \
-{ with_test_prefix " 1 $trace_type $option:" \
+{ with_test_prefix "1 $trace_type $option" \
{
global executable
global hex
@@ -89,7 +89,7 @@ proc break_trace_same_addr_1 { trace_type option } \
# Set multiple tracepoints at the same address.
proc break_trace_same_addr_2 { trace_type1 trace_type2 option } \
-{ with_test_prefix " 2 $trace_type1 $trace_type2 $option:" \
+{ with_test_prefix "2 $trace_type1 $trace_type2 $option" \
{
global executable
global hex
@@ -127,7 +127,7 @@ proc break_trace_same_addr_2 { trace_type1 trace_type2 option } \
# that tracepoint still works.
proc break_trace_same_addr_3 { trace_type option } \
-{ with_test_prefix " 3 $trace_type $option:" \
+{ with_test_prefix "3 $trace_type $option" \
{
global executable
global hex
@@ -162,7 +162,7 @@ proc break_trace_same_addr_3 { trace_type option } \
# that breakpoint still works.
proc break_trace_same_addr_4 { trace_type option } \
-{ with_test_prefix " 4 $trace_type $option:" \
+{ with_test_prefix "4 $trace_type $option" \
{
global executable
global hex
@@ -201,7 +201,7 @@ proc break_trace_same_addr_4 { trace_type option } \
# of two locations. Verify these tracepoints work as expected.
proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } \
-{ with_test_prefix " 5 $trace1 $trace2 ${trace3}@${trace3_at_first_loc}:" \
+{ with_test_prefix "5 $trace1 $trace2 ${trace3}@${trace3_at_first_loc}" \
{
global executable
global hex
@@ -273,7 +273,7 @@ proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } \
# tracepoints work as expect.
proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } \
-{ with_test_prefix " 6 $trace1 $enable1 $trace2 $enable2:" \
+{ with_test_prefix "6 $trace1 $enable1 $trace2 $enable2" \
{
global executable
global hex
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 199e219..9130b4b 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -136,7 +136,7 @@ proc test_maybe_regvar_display { var } {
# Test procs
#
-proc gdb_collect_args_test {} { with_test_prefix " unavailable arguments:" {
+proc gdb_collect_args_test {} { with_test_prefix "unavailable arguments" {
global cr
global gdb_prompt
@@ -203,7 +203,7 @@ proc gdb_collect_args_test {} { with_test_prefix " unavailable arguments:" {
"cease trace debugging"
}}
-proc gdb_collect_locals_test { func msg } { with_test_prefix " unavailable locals: $msg:" {
+proc gdb_collect_locals_test { func msg } { with_test_prefix "unavailable locals: $msg" {
global cr
global gdb_prompt
@@ -254,7 +254,7 @@ proc gdb_collect_locals_test { func msg } { with_test_prefix " unavailable local
"cease trace debugging"
}}
-proc gdb_unavailable_registers_test { } { with_test_prefix " unavailable registers:" {
+proc gdb_unavailable_registers_test { } { with_test_prefix "unavailable registers" {
global gdb_prompt
global spreg
global pcreg
@@ -305,7 +305,7 @@ proc gdb_unavailable_registers_test { } { with_test_prefix " unavailable registe
gdb_test "tfind none" "#0 end .*" "cease trace debugging"
}}
-proc gdb_collect_globals_test { } { with_test_prefix " collect globals:" {
+proc gdb_collect_globals_test { } { with_test_prefix "collect globals" {
global ws
global cr
global gdb_prompt
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 3a43f95..7a6d7e7 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1507,21 +1507,21 @@ proc skip_shlib_tests {} {
# gdb_test ... ... "test foo"
# gdb_test ... ... "test bar"
#
-# with_test_prefix " subvariation a:" {
+# with_test_prefix "subvariation a" {
# gdb_test ... ... "test x"
# }
#
-# with_test_prefix " subvariation b:" {
+# with_test_prefix "subvariation b" {
# gdb_test ... ... "test x"
# }
# }
#
-# with_test_prefix " variation1:" {
+# with_test_prefix "variation1" {
# ...do setup for variation 1...
# do_tests
# }
#
-# with_test_prefix " variation2:" {
+# with_test_prefix "variation2" {
# ...do setup for variation 2...
# do_tests
# }
@@ -1543,19 +1543,20 @@ proc skip_shlib_tests {} {
#
# global pf_prefix
# set saved_pf_prefix
-# append pf_prefix "${foo} bar"
+# 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.
+# (pf_prefix) appended with one space, then PREFIX, and then a colon.
+# Returns the result of BODY.
#
proc with_test_prefix { prefix body } {
global pf_prefix
set saved $pf_prefix
- append pf_prefix $prefix
+ append pf_prefix " " $prefix ":"
set code [catch {uplevel 1 $body} result]
set pf_prefix $saved
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup
2012-02-17 21:31 ` [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup Pedro Alves
@ 2012-03-01 11:47 ` Pedro Alves
0 siblings, 0 replies; 28+ messages in thread
From: Pedro Alves @ 2012-03-01 11:47 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey, jan.kratochvil
On 02/17/2012 09:00 PM, Pedro Alves wrote:
> On 02/17/2012 08:24 PM, Tom Tromey wrote:
>>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>>
>> Pedro> - build different executable files for the non-threaded and threaded
>> Pedro> cases. This was my motivation. I wanted to test the non-threaded
>> Pedro> case manually, but the threaded variant always clobbered the
>> Pedro> non-threaded executable.
>>
>> I think this ought to be a general rule. We need exceptions to it for
>> some executable-changed cases, but I think in general different tests
>> should build different executables, because this makes it easier to do
>> additional checking by hand.
>
> Yeah, agreed. Perhaps we should write it down somewhere.
> I guess the wiki's test cookbook could be a good place.
Now mentioned over at <http://sourceware.org/gdb/wiki/GDBTestcaseCookbook>.
--
Pedro Alves
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2012-03-01 11:47 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-17 19:37 [PATCH 0/2] gdb.threads/attach-into-signal.exp: prepare for gdbserver Pedro Alves
2012-02-17 19:38 ` [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup Pedro Alves
2012-02-17 20:55 ` Tom Tromey
2012-02-17 21:00 ` Pedro Alves
2012-02-17 22:04 ` Tom Tromey
2012-02-20 13:27 ` Pedro Alves
2012-02-21 16:05 ` testsuite: prefix handling Pedro Alves
2012-02-21 18:18 ` Jan Kratochvil
2012-02-21 19:28 ` Pedro Alves
2012-02-21 19:54 ` Tom Tromey
2012-02-21 19:17 ` Tom Tromey
2012-02-21 20:08 ` Pedro Alves
2012-02-21 20:59 ` Pedro Alves
2012-02-21 21:02 ` Tom Tromey
2012-02-21 22:08 ` Pedro Alves
2012-02-21 21:00 ` Tom Tromey
2012-02-21 22:03 ` Pedro Alves
2012-02-17 21:31 ` [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup Pedro Alves
2012-03-01 11:47 ` Pedro Alves
2012-02-17 23:55 ` Joel Brobecker
2012-02-20 8:57 ` Jan Kratochvil
2012-02-17 19:52 ` [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output Pedro Alves
2012-02-20 9:41 ` Jan Kratochvil
2012-02-20 12:32 ` Pedro Alves
2012-02-20 12:34 ` Jan Kratochvil
2012-02-20 12:37 ` Pedro Alves
2012-02-21 18:17 ` Edjunior Barbosa Machado
2012-02-21 19:11 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox