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]

[PATCH] gdb.python/python.exp: fix up race (PR testsuite/12649)


With read1 (see reproducer in PR12649), this test failed:

Running ./gdb.python/python.exp ...
ERROR: Window too small.
ERROR: Window too small.
FAIL: gdb.python/python.exp: gdb.execute does not page
ERROR: Process no longer exists

The problem is that when parsing the "---Type <return> to continue, or q <return> to
quit---$" line, when we get past "<return>", it matches with this case in lib/gdb.exp:

	 "<return>" {
	    send_gdb "\n"
	    perror "Window too small."
            fail "$message"
	    set result -1
	}

so we immediately bail out.  I've fixed this by splitting the line into three chunks
and using `exp_continue'.  Tested with both read{1,}.  Ok to apply?

2011-09-27  Marek Polacek  <mpolacek@redhat.com>

	* gdb.python/python.exp: Fix race by splitting the line.

--- gdb/gdb/testsuite/gdb.python/python.exp.mp	2011-09-27 10:24:56.712668284 +0200
+++ gdb/gdb/testsuite/gdb.python/python.exp	2011-09-27 16:26:10.973544539 +0200
@@ -106,7 +106,13 @@ gdb_test_no_output "set height $lines"
 
 set test "verify pagination beforehand"
 gdb_test_multiple "python print \"\\n\" * $lines" $test {
-    -re "---Type <return> to continue, or q <return> to quit---$  " {
+    -re "---Type <return>" {
+	exp_continue
+    }
+    -re " to continue, or q <return>" {
+	exp_continue
+    }
+    -re " to quit---" {
 	pass $test
     }
 }
@@ -116,7 +122,13 @@ gdb_test "python if gdb.execute('python 
 
 set test "verify pagination afterwards"
 gdb_test_multiple "python print \"\\n\" * $lines" $test {
-    -re "---Type <return> to continue, or q <return> to quit---$" {
+    -re "---Type <return>" {
+	exp_continue
+    }
+    -re " to continue, or q <return>" {
+	exp_continue
+    }
+    -re " to quit---" {
 	pass $test
     }
 
	Marek


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