Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Testcase problem in chng-syms.exp
@ 2007-03-10  0:22 Ulrich Weigand
  2007-03-16 15:33 ` [committed] " Ulrich Weigand
  0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Weigand @ 2007-03-10  0:22 UTC (permalink / raw)
  To: gdb-patches

Hello,

I'm seeing failures in chng-sym.exp which appear to be test case bugs.

The output of GDB near the end of the test run is:

Executing on host: spu-gcc /home/uweigand/fsf/gdb-head/gdb/testsuite/gdb.base/chng-syms.c  -DVARIABLE=var2 -g  -lm   -o /home/uweig
and/fsf/gdb-head-build/gdb/testsuite/gdb.base/chng-syms    (timeout = 300)
run ^M
`/home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/chng-syms' has changed; re-reading symbols.^M
Error in re-setting breakpoint 1:^M
No symbol "var1" in current context.^M
Starting program: /home/uweigand/fsf/gdb-head-build/gdb/testsuite/gdb.base/chng-syms ^M
^M
Program exited normally.^M
(gdb) FAIL: gdb.base/chng-syms.exp: running with invalidated bpt condition after executable changes

Now, the corresponding test case code reads:

    gdb_run_cmd
    gdb_expect {
        -re "Error in re-setting .*No symbol .var1..*Program exited normally.*$gdb_prompt $" {
            pass "running with invalidated bpt condition after executable changes"
        }
        -re "Error in re-setting .*No symbol .var1..*Breakpoint .*,( 0x.* in)? exit .*$gdb_prompt $" {
            pass "running with invalidated bpt condition after executable changes"
        }
        -re "$gdb_prompt $" {
            fail "running with invalidated bpt condition after executable changes"
        }
        timeout {
            fail "(timeout) running with invalidated bpt condition after executable changes"
        }
    }

So you'd expect that the output would match the first pattern, right?
However, it doesn't.  This appears to be caused by the implementation
of gdb_run_cmd, which ends in:

    send_gdb "run $args\n"
# This doesn't work quite right yet.
    gdb_expect 60 {
        -re "The program .* has been started already.*y or n. $" {
            send_gdb "y\n"
            exp_continue
        }
        -re "Starting program: \[^\r\n\]*" {}
    }

This means everything up to and including the line "Starting program: ..."
is swallowed up by this gdb_expect, and the second one in chng-syms.exp
does see the lines it is looking for any more.


Did I overlook anything here?  How can we best fix this?
I'd appreciate any suggestions ...

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

* [committed] Re: Testcase problem in chng-syms.exp
  2007-03-10  0:22 Testcase problem in chng-syms.exp Ulrich Weigand
@ 2007-03-16 15:33 ` Ulrich Weigand
  2007-03-16 15:39   ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Weigand @ 2007-03-16 15:33 UTC (permalink / raw)
  To: gdb-patches

Hello,

> So you'd expect that the output would match the first pattern, right?
> However, it doesn't.  This appears to be caused by the implementation
> of gdb_run_cmd, which ends in:
> 
>     send_gdb "run $args\n"
> # This doesn't work quite right yet.
>     gdb_expect 60 {
>         -re "The program .* has been started already.*y or n. $" {
>             send_gdb "y\n"
>             exp_continue
>         }
>         -re "Starting program: \[^\r\n\]*" {}
>     }
> 
> This means everything up to and including the line "Starting program: ..."
> is swallowed up by this gdb_expect, and the second one in chng-syms.exp
> does see the lines it is looking for any more.

I've now fixed this problem by adding -notransfer to the pattern.
Tested on s390-ibm-linux, s390x-ibm-linux, and spu-elf.  Fixes
the failure on spu-elf.  Committed to mainline.

Bye,
Ulrich

ChangeLog:

	* lib/gdb.exp (gdb_run_cmd): Use -notransfer to make start-up
	messages available to test cases (like chng-sym.exp).

Index: gdb/testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.78
diff -u -p -r1.78 gdb.exp
--- gdb/testsuite/lib/gdb.exp	23 Jan 2007 17:11:55 -0000	1.78
+++ gdb/testsuite/lib/gdb.exp	16 Mar 2007 14:33:17 -0000
@@ -283,7 +283,9 @@ proc gdb_run_cmd {args} {
 	    send_gdb "y\n"
 	    exp_continue
 	}
-	-re "Starting program: \[^\r\n\]*" {}
+	# Use -notransfer here so that test cases (like chng-sym.exp)
+	# may test for additional start-up messages.
+	-notransfer -re "Starting program: \[^\r\n\]*" {}
     }
 }
 

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

* Re: [committed] Re: Testcase problem in chng-syms.exp
  2007-03-16 15:33 ` [committed] " Ulrich Weigand
@ 2007-03-16 15:39   ` Daniel Jacobowitz
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-03-16 15:39 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches

On Fri, Mar 16, 2007 at 04:33:30PM +0100, Ulrich Weigand wrote:
> I've now fixed this problem by adding -notransfer to the pattern.
> Tested on s390-ibm-linux, s390x-ibm-linux, and spu-elf.  Fixes
> the failure on spu-elf.  Committed to mainline.

Ooh, that's clever.  Thanks for fixing this.

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2007-03-16 15:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-10  0:22 Testcase problem in chng-syms.exp Ulrich Weigand
2007-03-16 15:33 ` [committed] " Ulrich Weigand
2007-03-16 15:39   ` Daniel Jacobowitz

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