From patchwork Tue Apr 21 18:08:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 6370 Received: (qmail 68225 invoked by alias); 21 Apr 2015 18:18:12 -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 68210 invoked by uid 89); 21 Apr 2015 18:18:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_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; Tue, 21 Apr 2015 18:18:10 +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 (Postfix) with ESMTPS id 64F01A10B7 for ; Tue, 21 Apr 2015 18:08:52 +0000 (UTC) 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 t3LI8WL7028722 for ; Tue, 21 Apr 2015 14:08:51 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 18/24] Make gdb.gdb/complaints.exp use '-i $inferior_spawn_id' and gdb_test_stdio Date: Tue, 21 Apr 2015 19:08:25 +0100 Message-Id: <1429639711-16459-19-git-send-email-palves@redhat.com> In-Reply-To: <1429639711-16459-1-git-send-email-palves@redhat.com> References: <1429639711-16459-1-git-send-email-palves@redhat.com> gdb/testsuite/ChangeLog: 2015-04-21 Pedro Alves * gdb.gdb/complaints.exp (test_initial_complaints, test_serial_complaints) (test_short_complaints): Use gdb_test_stdio. (test_empty_complaint): Handle $inferior_spawn_id != $gdb_spawn_id. --- gdb/testsuite/gdb.gdb/complaints.exp | 110 ++++++++++++++++++++--------------- 1 file changed, 64 insertions(+), 46 deletions(-) diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp index 707b2a5..24843c0 100644 --- a/gdb/testsuite/gdb.gdb/complaints.exp +++ b/gdb/testsuite/gdb.gdb/complaints.exp @@ -24,15 +24,41 @@ if [target_info exists gdb,noinferiorio] { return } -proc test_initial_complaints { } { +# Similar to gdb_test_stdio, except no \r\n is expected before +# $gdb_prompt in the $gdb_spawn_id. +proc test_complaint {test inferior_io_re msg} { + global inferior_spawn_id gdb_spawn_id global gdb_prompt + set inferior_matched 0 + set gdb_matched 0 + + gdb_test_multiple $test $msg { + -i $inferior_spawn_id -re "$inferior_io_re" { + set inferior_matched 1 + if {!$gdb_matched} { + exp_continue + } + } + -i $gdb_spawn_id -re "$gdb_prompt $" { + set gdb_matched 1 + if {!$inferior_matched} { + exp_continue + } + } + } + + verbose -log "inferior_matched=$inferior_matched, gdb_matched=$gdb_matched" + gdb_assert {$inferior_matched && $gdb_matched} $msg +} + +proc test_initial_complaints { } { # Unsupress complaints gdb_test "set stop_whining = 2" # Prime the system - gdb_test "call complaint (&symfile_complaints, \"Register a complaint\")" \ + gdb_test_stdio "call complaint (&symfile_complaints, \"Register a complaint\")" \ "During symbol reading, Register a complaint." # Check that the complaint was inserted and where @@ -40,7 +66,7 @@ proc test_initial_complaints { } { ".\[0-9\]+ =.*\"Register a complaint\"" # Re-issue the first message #1 - gdb_test "call complaint (&symfile_complaints, symfile_complaints->root->fmt)" \ + gdb_test_stdio "call complaint (&symfile_complaints, symfile_complaints->root->fmt)" \ "During symbol reading, Register a complaint." # Check that there is only one thing in the list. How the boolean @@ -50,37 +76,29 @@ proc test_initial_complaints { } { ".\[0-9\]+ = \(1|true\)" "list has one entry" # Add a second complaint, expect it - gdb_test "call complaint (&symfile_complaints, \"Testing! Testing! Testing!\")" \ + gdb_test_stdio "call complaint (&symfile_complaints, \"Testing! Testing! Testing!\")" \ "During symbol reading, Testing. Testing. Testing.." return 0 } proc test_serial_complaints { } { - - global gdb_prompt - gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 0)" "" "serial start" # Prime the system - gdb_test_multiple "call complaint (&symfile_complaints, \"serial line 1\")" "serial line 1" { - -re "During symbol reading...serial line 1...$gdb_prompt $" { - pass "serial line 1" - } - } + test_complaint "call complaint (&symfile_complaints, \"serial line 1\")" \ + "During symbol reading...serial line 1..." \ + "serial line 1" # Add a second complaint, expect it - gdb_test_multiple "call complaint (&symfile_complaints, \"serial line 2\")" "serial line 2" { - -re "serial line 2...$gdb_prompt " { - pass "serial line 2" - } - } + test_complaint "call complaint (&symfile_complaints, \"serial line 2\")" \ + "serial line 2..." \ + "serial line 2" - gdb_test_multiple "call clear_complaints (&symfile_complaints, 1, 0)" "serial end" { - -re "\r\n\r\n$gdb_prompt " { - pass "serial end" - } - } + gdb_test_stdio "call clear_complaints (&symfile_complaints, 1, 0)" \ + "\r\n" \ + "" \ + "serial end" return 0 } @@ -88,30 +106,22 @@ proc test_serial_complaints { } { # For short complaints, all are the same proc test_short_complaints { } { - - global gdb_prompt - gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 1)" "" "short start" # Prime the system - gdb_test_multiple "call complaint (&symfile_complaints, \"short line 1\")" "short line 1" { - -re "short line 1...$gdb_prompt " { - pass "short line 1" - } - } + test_complaint "call complaint (&symfile_complaints, \"short line 1\")" \ + "short line 1..." \ + "short line 1" # Add a second complaint, expect it - gdb_test_multiple "call complaint (&symfile_complaints, \"short line 2\")" "short line 2" { - -re "short line 2...$gdb_prompt " { - pass "short line 2" - } - } + test_complaint "call complaint (&symfile_complaints, \"short line 2\")" \ + "short line 2..." \ + "short line 2" - gdb_test_multiple "call clear_complaints (&symfile_complaints, 1, 0)" "short end" { - -re "\r\n\r\n$gdb_prompt " { - pass "short end" - } - } + gdb_test_stdio "call clear_complaints (&symfile_complaints, 1, 0)" \ + "\r\n" \ + "" \ + "short end" return 0 } @@ -122,12 +132,20 @@ proc test_short_complaints { } { proc test_empty_complaint { cmd msg } { global gdb_prompt - gdb_test_multiple $cmd $msg { - -re "\r\n\r\n$gdb_prompt $" { - fail $msg - } - "\r\n$gdb_prompt $" { - pass $msg + global inferior_spawn_id gdb_spawn_id + + if {$gdb_spawn_id == $inferior_spawn_id} { + gdb_test_no_output $cmd $msg + } else { + set seen_output 0 + gdb_test_multiple $cmd $msg { + -i $inferior_spawn_id -re "." { + set seen_output 1 + exp_continue + } + -i $gdb_spawn_id "$gdb_prompt $" { + gdb_assert !$seen_output $msg + } } } }