This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Avoid expect timeouts in "maint print statistics" test
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 8 Sep 2010 19:23:24 +0200 (CEST)
- Subject: [commit] Avoid expect timeouts in "maint print statistics" test
Hello,
I've been seeing timeouts in maint.exp on ARM when debug info for glibc
was available. The problem was that in this case the output of
"maint print statistics" can be very long, and matching this long
output against an expect string containing generic wildcards (.*)
seems to cause extremely long run times for the expect command
to complete.
Looking at the maint.exp, it seems that other checks have already shown
similar problems elsewhere, and the fix of choice is to use expect
templates without generic wildcards, which may require to split a
single expect invocation into multiple ones.
The patch below implements this approach for the "maint print statistics"
test as well, eliminating the timeouts.
Tested on armv7l-linux-gnueabi and i686-linux.
Committed to mainline.
Bye,
Ulrich
ChangeLog:
* gdb.base/maint.exp: Avoid wildcards against potentially very long
"maint print statistics" output to prevent expect timeouts.
Index: gdb/testsuite/gdb.base/maint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/maint.exp,v
retrieving revision 1.47
diff -u -p -r1.47 maint.exp
--- gdb/testsuite/gdb.base/maint.exp 10 Jun 2010 19:48:19 -0000 1.47
+++ gdb/testsuite/gdb.base/maint.exp 8 Sep 2010 14:47:24 -0000
@@ -149,14 +149,18 @@ if [istarget "*-*-cygwin*"] {
set timeout [expr $timeout + 500]
}
-gdb_test_multiple "maint print statistics" "maint print statistics" {
- -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*Total memory used for psymbol obstack.*Total memory used for psymbol cache.*Total memory used for symbol obstack.*Total memory used for type obstack.*$gdb_prompt $" {
- # Old output for gdb 6.0 and earlier
- pass "maint print statistics"
- }
- -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*Total memory used for objfile obstack.*Total memory used for psymbol cache.*Total memory used for macro cache.*$gdb_prompt $" {
- pass "maint print statistics"
+send_gdb "maint print statistics\n"
+gdb_expect {
+ -re "Statistics for\[^\n\r\]*break\[^\n\r\]*:\r\n Number of \"minimal\" symbols read: $decimal\r\n Number of \"partial\" symbols read: $decimal\r\n Number of \"full\" symbols read: $decimal\r\n Number of \"types\" defined: $decimal\r\n Number of psym tables \\(not yet expanded\\): $decimal\r\n Number of symbol tables: $decimal\r\n Number of symbol tables with line tables: $decimal\r\n Number of symbol tables with blockvectors: $decimal\r\n Total memory used for objfile obstack: $decimal\r\n Total memory used for psymbol cache: $decimal\r\n Total memory used for macro cache: $decimal\r\n Total memory used for file name cache: $decimal\r\n" {
+ gdb_expect {
+ -re "$gdb_prompt $" {
+ pass "maint print statistics"
+ }
+ timeout { fail "(timeout) maint print statistics" }
+ }
}
+ -re ".*$gdb_prompt $" { fail "maint print statistics" }
+ timeout { fail "(timeout) maint print statistics" }
}
# There aren't any ...
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com