Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: [patch] testsuite: Fix inferior-died.exp racy FAILs  [Re: RFC: fix crash when inferior exits during "continue"]
Date: Mon, 20 Feb 2012 02:41:00 -0000	[thread overview]
Message-ID: <20120219184555.GA18014@host2.jankratochvil.net> (raw)
In-Reply-To: <87d39fn9cq.fsf@fleche.redhat.com>

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"


  parent reply	other threads:[~2012-02-19 18:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07 19:14 RFC: fix crash when inferior exits during "continue" Tom Tromey
2012-02-10 14:41 ` Jan Kratochvil
2012-02-10 20:05   ` Tom Tromey
2012-02-14 13:44     ` Gary Benson
2012-02-14 14:19       ` Pedro Alves
2012-02-15 22:24         ` Tom Tromey
2012-02-16 12:45           ` Pedro Alves
2012-02-16 14:42             ` Tom Tromey
2012-02-16 15:24               ` Tom Tromey
2012-02-20  2:41           ` Jan Kratochvil [this message]
2012-02-20 21:05             ` [commit] [patch] testsuite: Fix inferior-died.exp racy FAILs [Re: RFC: fix crash when inferior exits during "continue"] Jan Kratochvil
2012-02-20 21:24             ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120219184555.GA18014@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox