From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10860 invoked by alias); 6 May 2011 02:15:44 -0000 Received: (qmail 10447 invoked by uid 22791); 6 May 2011 02:15:42 -0000 X-SWARE-Spam-Status: No, hits=-5.6 required=5.0 tests=AWL,BAYES_00,FAKE_REPLY_C,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 May 2011 02:15:16 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p462FFNF027558 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 5 May 2011 22:15:16 -0400 Received: from host1.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p462FDHn004706 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 5 May 2011 22:15:15 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p462FDg1023864; Fri, 6 May 2011 04:15:13 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p462FCVj023788; Fri, 6 May 2011 04:15:12 +0200 Date: Fri, 06 May 2011 02:15:00 -0000 From: Jan Kratochvil To: Marek Polacek Cc: "gdb-patches@sourceware.org" Subject: Re: [RFC] gdb.cp/static-print-quit.exp: fix racy tests (PR testsuite/12649) Message-ID: <20110506021511.GA30222@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DC2E877.6080808@redhat.com> <4DC2E674.1060608@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00171.txt.bz2 On Thu, 05 May 2011 20:03:32 +0200, Marek Polacek wrote: [...] > We can prevent this if we, in our gdb_test_multiple, create a "" > case with `exp_continue'. Nonetheless, except this, we must also in this > case: > > -re " to quit---$" { > fail $test > return -1 > } Found comments for the testcase were: [patch] Fix memory corruption on aborted object print http://sourceware.org/ml/gdb-patches/2010-06/msg00632.html 47c8c764a9be6d023eca450336e6d9de16970fc0 The " to quit---$" case was there probably for the gdb-7.1 case which is missing the "static field" output, put there untested now. I understand this is a change of the testcase. > differentiate between success and failure, since after processing the "" > part we now have in the buffer " to quit---". Thus, it is possible to do > something like this, using a new variable `seen_return', although I must say, I don't > like it at all. exp_continue/variables make it complicated, I would prefer splitting it to multiple consecutive test cases. > set test "print c" > set seen_return 0 > gdb_test_multiple $test $test { > "" { > incr seen_return > exp_continue > } BTW you do not need to match exactly "" as is in lib/gdb.exp - it is enough to match any string ending with "". On Thu, 05 May 2011 20:12:07 +0200, Marek Polacek wrote: > I should have add a diff as well, here it is: [...] > - -re " = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n---Type to continue, or q to quit---$" { > - pass $test > + "" { > + incr seen_return FYI the diff could not be applied as it has s converted to spaces. Any comments? I will check it in otherwise. Tested on x86_64-fedora15-linux-gnu. Thanks, Jan gdb/testsuite/ 2011-05-06 Jan Kratochvil Fix a race. * gdb.cp/static-print-quit.exp (print c): Split to ... (print c - , print c - q , print c - to quit): ... these. Make the testfile untested on gdb-7.1. --- a/gdb/testsuite/gdb.cp/static-print-quit.exp +++ b/gdb/testsuite/gdb.cp/static-print-quit.exp @@ -30,14 +30,29 @@ clean_restart $executable gdb_test_no_output "set width 80" gdb_test_no_output "set height 2" -set test "print c" -gdb_test_multiple $test $test { - -re " = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n---Type to continue, or q to quit---$" { +set test "print c - " +gdb_test_multiple "print c" $test { + -re "\\$\[0-9\]+ = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n---Type " { pass $test } + -re "\r\n---Type " { + # gdb-7.1 did not crash with this testcase but it had the same bug. + untested ${testfile}.exp + return 0 + } +} + +set test "print c - q " +gdb_test_multiple "" $test { + -re " to continue, or q " { + pass $test + } +} + +set test "print c - to quit" +gdb_test_multiple "" $test { -re " to quit---$" { - fail $test - return -1 + pass $test } }