This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] testsuite: fix gdb_test_list_exact for older cygwin/mingw expect


On Cygwin and mingw32 systems, I do get a failure on 
"show convenience" test inside gdb.base/default.exp
This test uses gdb_test_list_exact proc.

After some debugging, I managed to understand that the reason was the use of
regular expression patterns containing \r\n but enclose in curly braces.

The first regular expression used to delimit a line is
{[\r\n]+[\r\n]+}
  These \r\n are never converted into carriage return and newline,
and thus the pattern
$_thread = 0
$_siginfo = NULL
is cut a 'r' or 'n' letters
giving {$_thr} and {ead = 0
$sigin}
which of course fail the test.

If I use
"\[\r\n\]+\[\r\n\]+"
instead, the test succeeds on cygwin and mingw32.

I checked on a compile farm machine x86_64-unknown-linux-gnu,
and as gdb.base/default.exp is the only
test source using that new function, I just checked
that this also worked with a double quote pattern.

Is this OK?

Pierre Muller

2011-05-05  Pierre Muller  <muller@ics.u-strasbg.fr>

	* lib/gdb.exp (gdb_test_list_exact): Suggest use of double
	quote pattern to avoid problems with Cygwin/mingw expect versions.
	* gdb.base/default.exp (sohw convenience): Use double
	quote pattern for regular expressions.

Index: src/gdb/testsuite/gdb.base/default.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/default.exp,v
retrieving revision 1.48
diff -u -p -r1.48 default.exp
--- src/gdb/testsuite/gdb.base/default.exp	15 Feb 2011 21:17:52 -0000
1.48
+++ src/gdb/testsuite/gdb.base/default.exp	4 May 2011 22:38:10 -0000
@@ -601,8 +601,8 @@ gdb_test "show confirm" "Whether to conf
 # This is tricker as there are multiple internal convenience vars and we
 # can't assume any particular order.
 gdb_test_list_exact "show convenience" "show convenience" \
-    {[^\r\n]+[\r\n]+} \
-    {[^\r\n]+} \
+    "\[^\r\n\]+\[\r\n\]+" \
+    "\[^\r\n\]+" \
     { \
 	{$_sdata = void} \
 	{$_siginfo = void} \
Index: src/gdb/testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.172
diff -u -p -r1.172 gdb.exp
--- src/gdb/testsuite/lib/gdb.exp	27 Apr 2011 19:44:42 -0000
1.172
+++ src/gdb/testsuite/lib/gdb.exp	4 May 2011 22:38:11 -0000
@@ -1099,8 +1099,8 @@ proc gdb_test_exact { args } {
 # of text per element and then strip trailing \r\n's.
 # Example:
 # gdb_test_list_exact "foo" "bar" \
-#     {[^\r\n]+[\r\n]+} \
-#     {[^\r\n]+} \
+#    "\[^\r\n\]+\[\r\n\]+" \
+#    "\[^\r\n\]+" \
 #     { \
 #	{expected result 1} \
 #	{expected result 2} \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]