* [PATCH] Add "needs_status_wrapper" feature to gdb testsuite.
@ 2002-05-06 17:48 Michael Snyder
2002-05-10 12:51 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2002-05-06 17:48 UTC (permalink / raw)
To: gdb-patches; +Cc: fnasser
This is a feature that has been being used in the GCC testsuite,
but I was completely unaware of it before now.
This enables tests that look for an exit status to succeed even
on targets that don't implement the exit status. I think it's
pretty cool!
I've modified two tests from gdb/testsuite to take advantage of it.
I'm not sure which other tests may also need modification, but
now there are a couple of examples to look at.
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.15
diff -p -r1.15 gdb.exp
*** lib/gdb.exp 3 Apr 2002 16:17:11 -0000 1.15
--- lib/gdb.exp 7 May 2002 00:10:06 -0000
*************** proc gdb_preprocess {source dest args} {
*** 1092,1099 ****
--- 1092,1125 ----
return $result;
}
+ set gdb_wrapper_initialized 0
+
+ proc gdb_wrapper_init { args } {
+ global gdb_wrapper_initialized;
+ global gdb_wrapper_file;
+ global gdb_wrapper_flags;
+
+ if { $gdb_wrapper_initialized == 1 } { return; }
+
+ if {[target_info exists needs_status_wrapper] && \
+ [target_info needs_status_wrapper] != "0" && \
+ ![info exists gdb_wrapper_file]} {
+ set result [build_wrapper "testglue.o"];
+ if { $result != "" } {
+ set gdb_wrapper_file [lindex $result 0];
+ set gdb_wrapper_flags [lindex $result 1];
+ } else {
+ warning "Status wrapper failed to build."
+ }
+ }
+ set gdb_wrapper_initialized 1
+ }
+
proc gdb_compile {source dest type options} {
global GDB_TESTCASE_OPTIONS;
+ global gdb_wrapper_file;
+ global gdb_wrapper_flags;
+ global gdb_wrapper_initialized;
if [target_info exists gdb_stub] {
set options2 { "additional_flags=-Dusestubs" }
*************** proc gdb_compile {source dest type optio
*** 1110,1115 ****
--- 1136,1150 ----
}
verbose "options are $options"
verbose "source is $source $dest $type $options"
+
+ if { $gdb_wrapper_initialized == 0 } { gdb_wrapper_init }
+
+ if {[target_info exists needs_status_wrapper] && \
+ [target_info needs_status_wrapper] != "0" && \
+ [info exists gdb_wrapper_file]} {
+ lappend options "libs=${gdb_wrapper_file}"
+ lappend options "ldflags=${gdb_wrapper_flags}"
+ }
set result [target_compile $source $dest $type $options];
regsub "\[\r\n\]*$" "$result" "" result;
Index: gdb.base/a2-run.exp
2002-05-06 Michael Snyder <msnyder@redhat.com>
Enable the "needs_status_wrapper" testsuite feature.
* lib/gdb.exp (gdb_wrapper_init): New procedure.
(gdb_compile): Conditionally call gdb_wrapper_init.
* gdb.base/a2-run.exp: Recognize output from status wrapper.
* gdb.c++/method.exp: Recognize output from status wrapper.
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/a2-run.exp,v
retrieving revision 1.4
diff -p -r1.4 a2-run.exp
*** gdb.base/a2-run.exp 14 Feb 2002 06:25:18 -0000 1.4
--- gdb.base/a2-run.exp 7 May 2002 00:10:06 -0000
*************** if [istarget "*-*-vxworks*"] then {
*** 80,85 ****
--- 80,88 ----
-re ".*usage: factorial <number>.*Program exited with code 01.*$gdb_prompt $" {
pass "run \"$testfile\" with no args"
}
+ -re ".*usage: factorial <number>.* EXIT code 1.*Program exited normally.*$gdb_prompt $" {
+ pass "run \"$testfile\" with no args (exit wrapper)"
+ }
-re ".*$gdb_prompt $" {
fail "run \"$testfile\" with no args"
verbose "expect_out is $expect_out(buffer)" 2
Index: gdb.c++/method.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/method.exp,v
retrieving revision 1.7
diff -p -r1.7 method.exp
*** gdb.c++/method.exp 8 Apr 2002 22:41:46 -0000 1.7
--- gdb.c++/method.exp 7 May 2002 00:10:06 -0000
*************** gdb_expect {
*** 180,185 ****
timeout { fail "(timeout) ptype A" }
}
! gdb_test "cont" \
! "Continuing.\r\n\r\nProgram exited normally." \
! "finish program"
--- 180,194 ----
timeout { fail "(timeout) ptype A" }
}
! send_gdb "cont\n"
! gdb_expect {
! -re "Continuing\r\n\r\nProgram exited normally.*$gdb_prompt $" {
! pass "finish program"
! }
! -re "Continuing.* EXIT code 0.*Program exited normally.*$gdb_prompt $" {
! pass "finish program (exit wrapper)"
! }
! -re ".*$gdb_prompt $" { fail "finish program" }
! default:{ fail "finish program (timeout)" }
! }
!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add "needs_status_wrapper" feature to gdb testsuite.
2002-05-06 17:48 [PATCH] Add "needs_status_wrapper" feature to gdb testsuite Michael Snyder
@ 2002-05-10 12:51 ` Andrew Cagney
2002-05-23 10:07 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-05-10 12:51 UTC (permalink / raw)
To: Michael Snyder, fnasser, Michael Elizabeth Chastain; +Cc: gdb-patches
Hmm,
This doesn't work with existing multi-lib configurations. The second
and further test runs get linked with the wrong wrapper (because it
wasn't re-compiled) :-(
Can this please be pulled or disabled until the problem is fixed?
Andrew
> This is a feature that has been being used in the GCC testsuite,
> but I was completely unaware of it before now.
>
> This enables tests that look for an exit status to succeed even
> on targets that don't implement the exit status. I think it's
> pretty cool!
>
> I've modified two tests from gdb/testsuite to take advantage of it.
> I'm not sure which other tests may also need modification, but
> now there are a couple of examples to look at.
>
> Index: lib/gdb.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
> retrieving revision 1.15
> diff -p -r1.15 gdb.exp
> *** lib/gdb.exp 3 Apr 2002 16:17:11 -0000 1.15
> --- lib/gdb.exp 7 May 2002 00:10:06 -0000
> *************** proc gdb_preprocess {source dest args} {
> *** 1092,1099 ****
> --- 1092,1125 ----
> return $result;
> }
>
> + set gdb_wrapper_initialized 0
> +
> + proc gdb_wrapper_init { args } {
> + global gdb_wrapper_initialized;
> + global gdb_wrapper_file;
> + global gdb_wrapper_flags;
return;
> + if { $gdb_wrapper_initialized == 1 } { return; }
> +
> + if {[target_info exists needs_status_wrapper] && \
> + [target_info needs_status_wrapper] != "0" && \
> + ![info exists gdb_wrapper_file]} {
> + set result [build_wrapper "testglue.o"];
> + if { $result != "" } {
> + set gdb_wrapper_file [lindex $result 0];
> + set gdb_wrapper_flags [lindex $result 1];
> + } else {
> + warning "Status wrapper failed to build."
> + }
> + }
> + set gdb_wrapper_initialized 1
> + }
> +
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add "needs_status_wrapper" feature to gdb testsuite.
2002-05-10 12:51 ` Andrew Cagney
@ 2002-05-23 10:07 ` Andrew Cagney
2002-05-23 10:21 ` Michael Snyder
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-05-23 10:07 UTC (permalink / raw)
To: Andrew Cagney
Cc: Michael Snyder, fnasser, Michael Elizabeth Chastain, gdb-patches
> This is a feature that has been being used in the GCC testsuite, but I was completely unaware of it before now.
Michael, this is _still_ broken.
Andrew
> This enables tests that look for an exit status to succeed even
> on targets that don't implement the exit status. I think it's
> pretty cool!
>
> I've modified two tests from gdb/testsuite to take advantage of it.
> I'm not sure which other tests may also need modification, but
> now there are a couple of examples to look at.
>
> Index: lib/gdb.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
> retrieving revision 1.15
> diff -p -r1.15 gdb.exp
> *** lib/gdb.exp 3 Apr 2002 16:17:11 -0000 1.15
> --- lib/gdb.exp 7 May 2002 00:10:06 -0000
> *************** proc gdb_preprocess {source dest args} {
> *** 1092,1099 ****
> --- 1092,1125 ----
> return $result;
> }
> + set gdb_wrapper_initialized 0
> + + proc gdb_wrapper_init { args } {
> + global gdb_wrapper_initialized;
> + global gdb_wrapper_file;
> + global gdb_wrapper_flags;
>
> return;
>
> + if { $gdb_wrapper_initialized == 1 } { return; }
> + + if {[target_info exists needs_status_wrapper] && \
> + [target_info needs_status_wrapper] != "0" && \
> + ![info exists gdb_wrapper_file]} {
> + set result [build_wrapper "testglue.o"];
> + if { $result != "" } {
> + set gdb_wrapper_file [lindex $result 0];
> + set gdb_wrapper_flags [lindex $result 1];
> + } else {
> + warning "Status wrapper failed to build."
> + }
> + }
> + set gdb_wrapper_initialized 1
> + }
> +
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add "needs_status_wrapper" feature to gdb testsuite.
2002-05-23 10:07 ` Andrew Cagney
@ 2002-05-23 10:21 ` Michael Snyder
2002-05-23 10:25 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2002-05-23 10:21 UTC (permalink / raw)
To: Andrew Cagney
Cc: Michael Snyder, fnasser, Michael Elizabeth Chastain, gdb-patches
Andrew Cagney wrote:
>
> > This is a feature that has been being used in the GCC testsuite, but I was completely unaware of it before now.
>
> Michael, this is _still_ broken.
Sorry -- I think there's a fix in-house: I've just been
too busy to push it out to sources. I'll do it today.
>
> > This enables tests that look for an exit status to succeed even
> > on targets that don't implement the exit status. I think it's
> > pretty cool!
> >
> > I've modified two tests from gdb/testsuite to take advantage of it.
> > I'm not sure which other tests may also need modification, but
> > now there are a couple of examples to look at.
> >
> > Index: lib/gdb.exp
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
> > retrieving revision 1.15
> > diff -p -r1.15 gdb.exp
> > *** lib/gdb.exp 3 Apr 2002 16:17:11 -0000 1.15
> > --- lib/gdb.exp 7 May 2002 00:10:06 -0000
> > *************** proc gdb_preprocess {source dest args} {
> > *** 1092,1099 ****
> > --- 1092,1125 ----
> > return $result;
> > }
> > + set gdb_wrapper_initialized 0
> > + + proc gdb_wrapper_init { args } {
> > + global gdb_wrapper_initialized;
> > + global gdb_wrapper_file;
> > + global gdb_wrapper_flags;
> >
> > return;
> >
> > + if { $gdb_wrapper_initialized == 1 } { return; }
> > + + if {[target_info exists needs_status_wrapper] && \
> > + [target_info needs_status_wrapper] != "0" && \
> > + ![info exists gdb_wrapper_file]} {
> > + set result [build_wrapper "testglue.o"];
> > + if { $result != "" } {
> > + set gdb_wrapper_file [lindex $result 0];
> > + set gdb_wrapper_flags [lindex $result 1];
> > + } else {
> > + warning "Status wrapper failed to build."
> > + }
> > + }
> > + set gdb_wrapper_initialized 1
> > + }
> > +
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add "needs_status_wrapper" feature to gdb testsuite.
2002-05-23 10:21 ` Michael Snyder
@ 2002-05-23 10:25 ` Andrew Cagney
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-05-23 10:25 UTC (permalink / raw)
To: Michael Snyder
Cc: Michael Snyder, fnasser, Michael Elizabeth Chastain, gdb-patches
Thanks!
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-05-23 17:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-06 17:48 [PATCH] Add "needs_status_wrapper" feature to gdb testsuite Michael Snyder
2002-05-10 12:51 ` Andrew Cagney
2002-05-23 10:07 ` Andrew Cagney
2002-05-23 10:21 ` Michael Snyder
2002-05-23 10:25 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox