From patchwork Mon Feb 23 13:54:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 5236 Received: (qmail 4044 invoked by alias); 23 Feb 2015 13:54:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 3944 invoked by uid 89); 23 Feb 2015 13:54:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 23 Feb 2015 13:54:25 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1NDsMqx018498 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 23 Feb 2015 08:54:23 -0500 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1NDsKZf000641 for ; Mon, 23 Feb 2015 08:54:22 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 1/6] gdb.base/interrupt.exp: Fix race Date: Mon, 23 Feb 2015 13:54:15 +0000 Message-Id: <1424699660-11727-2-git-send-email-palves@redhat.com> In-Reply-To: <1424699660-11727-1-git-send-email-palves@redhat.com> References: <1424699660-11727-1-git-send-email-palves@redhat.com> Working on splitting gdb and inferior output handling in this test, I noticed a race that happens to be masked out today. The test sends "a\n" to the inferior, and then inferior echoes back "a\n". If expect manages to read only the first "a\r\n" into its buffer, then this matches: -re "^a\r\n(|a\r\n)$" { and leaves the second "a\r\n" in output. Then the next test that processes inferior I/O sends "data\n", and expects: -re "^(\r\n|)data\r\n(|data\r\n)$" which fails given the anchor and given "a\r\n" is still in the buffer. This is masked today because the test relies on inferior I/O being done on GDB's terminal, and there are tested GDB commands in between, which consume the "a\r\n" that was left in the output. We don't support SunOS4 anymore, so just remove the workaround. gdb/testsuite/ChangeLog 2015-02-23 Pedro Alves * gdb.base/interrupt.exp: Don't handle the case of the inferior output appearing once only. --- gdb/testsuite/gdb.base/interrupt.exp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp index 4c0fc77..82137e6 100644 --- a/gdb/testsuite/gdb.base/interrupt.exp +++ b/gdb/testsuite/gdb.base/interrupt.exp @@ -58,12 +58,10 @@ if ![file exists $binfile] then { eof { fail "run (eof)" } } # This should appear twice, once for the echo and once for the - # program's output. Under dejagnu (but not interactively) for - # SunOS4, it only appears once. Don't worry about it, I imagine - # dejagnu has just done something to the tty modes. + # program's output. send_gdb "a\n" gdb_expect { - -re "^a\r\n(|a\r\n)$" { + -re "^a\r\na\r\n$" { pass "child process ate our char" } timeout { fail "echo a (timeout)" } @@ -155,7 +153,7 @@ if ![file exists $binfile] then { # but the success is spurious. Need to provide the right reg.expr. # here. gdb_expect { - -re "^(\r\n|)data\r\n(|data\r\n)$" { pass "echo data" } + -re "^(\r\n|)data\r\ndata\r\n$" { pass "echo data" } -re "Undefined command.*$gdb_prompt " { fail "echo data" } timeout { fail "echo data (timeout)" } eof { fail "echo data (eof)" } @@ -184,7 +182,7 @@ if ![file exists $binfile] then { # We should be back in the loop. send_gdb "more data\n" gdb_expect { - -re "^(\r\n|)more data\r\n(|more data\r\n)$" { pass "echo more data" } + -re "^(\r\n|)more data\r\nmore data\r\n$" { pass "echo more data" } timeout { fail "echo more data (timeout)" } eof { fail "echo more data (eof)" } }