This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR gas/3918: make check RUNTESTFLAGS=i386.exp doesn't work
On Tue, Mar 06, 2007 at 11:35:38AM +1100, Ben Elliston wrote:
> On Mon, 2007-03-05 at 13:00 -0800, H. J. Lu wrote:
>
> > The problem is gas_finish. runtest.exp will call ${tool}_finish if it
> > exists. But gas_finish isn't intended to be called by runtest.exp
> > and should only be used with gas_start. When
> >
> > # make check RUNTESTFLAGS=i386.exp
> >
> > is used, gas_finish is called without gas_start and closes the wrong
> > fd. We can rename gas_finish. But it is used in 250 places. This patch
> > adds gas_started to make sure that it will be used when gas_start.
>
> This patch is okay, but please add a comment above "set gas_started 1"
> to explain why this variable is needed. Approved with this change.
>
This is the patch I checked in.
Thanks.
H.J.
---
2007-03-05 H.J. Lu <hongjiu.lu@intel.com>
PR gas/3918
* lib/gas-defs.exp (gas_started): New variable. Initialized to
0.
(gas_start): Set gas_started to 1.
(gas_finish): Skip if gas_started is 0. Reset gas_started to 0.
--- gas/testsuite/lib/gas-defs.exp.test 2005-07-04 07:55:52.000000000 -0700
+++ gas/testsuite/lib/gas-defs.exp 2007-03-05 18:05:52.000000000 -0800
@@ -53,12 +53,21 @@ proc all_ones { args } {
return 1
}
+# ${tool}_finish (gas_finish) will be called by runtest.exp. But
+# gas_finish should only be used with gas_start. We use gas_started
+# to tell gas_finish if gas_start has been called so that runtest.exp
+# can call gas_finish without closing the wrong fd.
+set gas_started 0
+
proc gas_start { prog as_opts } {
global AS
global ASFLAGS
global srcdir
global subdir
global spawn_id
+ global gas_started
+
+ set gas_started 1
verbose -log "Starting $AS $ASFLAGS $as_opts $prog" 2
catch {
@@ -71,9 +80,13 @@ proc gas_start { prog as_opts } {
proc gas_finish { } {
global spawn_id
+ global gas_started
- catch "close"
- catch "wait"
+ if { $gas_started == 1 } {
+ catch "close"
+ catch "wait"
+ set gas_started 0
+ }
}
proc want_no_output { testname } {