From patchwork Tue Oct 17 17:26:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 23647 Received: (qmail 98858 invoked by alias); 17 Oct 2017 17:26:22 -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 98425 invoked by uid 89); 17 Oct 2017 17:26:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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 ESMTP; Tue, 17 Oct 2017 17:26:20 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3DC06C04B92C for ; Tue, 17 Oct 2017 17:26:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3DC06C04B92C Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCC305D9C9 for ; Tue, 17 Oct 2017 17:26:18 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH] Fix 'gdb.base/quit.exp hangs forever' if the test fails Date: Tue, 17 Oct 2017 18:26:17 +0100 Message-Id: <1508261177-9407-1-git-send-email-palves@redhat.com> The [wait -i $gdb_spawn_id] in the test is dangerous in the sense that it won't be subject to timeout logic. So if GDB fails quiting, this testcase hangs forever, hanging the test run with it. See: https://sourceware.org/ml/gdb-patches/2016-10/msg00728.html Instead of 'wait'ing directly, use gdb_test_multiple and expect 'eof'. Tested that the testcase no longer hangs by hacking the test to send "info threads" instead of "quit". Tested with --target_board={unix, native-gdbserver,native-extended-gdbserver} and tested with --host_board=local-remote-host as well. gdb/testsuite/ChangeLog: yyyy-mm-dd Pedro Alves * gdb.base/quit.exp: Use gdb_test_multiple and expect 'eof' before 'wait -i'. Use gdb_assert and remote_close. --- gdb/testsuite/gdb.base/quit.exp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/gdb/testsuite/gdb.base/quit.exp b/gdb/testsuite/gdb.base/quit.exp index c81040e..b2ecc22 100644 --- a/gdb/testsuite/gdb.base/quit.exp +++ b/gdb/testsuite/gdb.base/quit.exp @@ -23,13 +23,15 @@ gdb_test "quit()" "A syntax error in expression, near .*" \ "quit with syntax error" # Test that an expression can be used to set the error code. -send_gdb "quit 22+1\n" -set result [wait -i $gdb_spawn_id] -verbose $result -if {[lindex $result 2] == 0 && [lindex $result 3] == 23} { - pass "quit with expression" -} else { - fail "quit with expression" + +set test "quit with expression" +gdb_test_multiple "quit 22+1" $test { + eof { + set result [wait -i $gdb_spawn_id] + verbose $result + gdb_assert {[lindex $result 2] == 0 && [lindex $result 3] == 23} $test + + remote_close host + clear_gdb_spawn_id + } } -close $gdb_spawn_id -clear_gdb_spawn_id