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] testsuite: Fix inferior-died.exp racy FAILs [Re: RFC: fix crash when inferior exits during "continue"]


On Wed, 15 Feb 2012 21:13:25 +0100, Tom Tromey wrote:
> 2012-02-15  Tom Tromey  <tromey@redhat.com>
> 
> 	* gdb.base/inferior-died.c: New file.
> 	* gdb.base/inferior-died.exp: New file.

It has racy FAILs:

 continue
 Continuing.
-[Inferior 2 (process 17329) exited normally]
-(gdb) PASS: gdb.base/inferior-died.exp: continue
-testcase ./gdb.base/inferior-died.exp completed in 2 seconds
+[Inferior 2 (process 17248) exited normally]
+(gdb) [Inferior 1 (process 17243) exited with code 0140]
+FAIL: gdb.base/inferior-died.exp: continue (timeout)
+testcase ./gdb.base/inferior-died.exp completed in 11 seconds

I will check in this fix in some days.


Thanks,
Jan


gdb/testsuite/
2012-02-19  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix racy FAILs.
	* gdb.base/inferior-died.c (main): Add return of 0.
	* gdb.base/inferior-died.exp (continue): Fix expectation of
	asynchronous events.
	(p 1): New test.

--- a/gdb/testsuite/gdb.base/inferior-died.c
+++ b/gdb/testsuite/gdb.base/inferior-died.c
@@ -33,4 +33,5 @@ int main()
     function ();
   else
     waitpid (child, NULL, 0);
+  return 0;
 }
--- a/gdb/testsuite/gdb.base/inferior-died.exp
+++ b/gdb/testsuite/gdb.base/inferior-died.exp
@@ -53,4 +53,19 @@ gdb_breakpoint $srcfile:$line
 gdb_continue_to_breakpoint "breakpoint"
 
 gdb_test "inferior 2" "Switching to inferior 2.*"
-gdb_test "continue" "exited normally.*"
+
+# The inferior 1 exit may come unexpectedly in any moment.
+set test "continue"
+set seen 0
+gdb_test_multiple $test $test {
+    -re "($gdb_prompt |\\\[Inferior \[^\r\n\]* exited normally\\\])" {
+	incr seen
+	if {$seen < 3} {
+	    exp_continue
+	}
+	pass $test
+    }
+}
+
+# Internal error may show up after all the messages above.
+gdb_test "p 1" " = 1"


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