From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116489 invoked by alias); 30 May 2016 10:50:43 -0000 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 Received: (qmail 116448 invoked by uid 89); 30 May 2016 10:50:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,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 (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 30 May 2016 10:50:41 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1DCD8486B4; Mon, 30 May 2016 10:50:40 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4UAocNC015015; Mon, 30 May 2016 06:50:39 -0400 Subject: Re: [PATCH 1/5] Add counter-cases for trace-condition.exp tests To: Antoine Tremblay , gdb-patches@sourceware.org References: <1464375916-16369-1-git-send-email-antoine.tremblay@ericsson.com> From: Pedro Alves Message-ID: <023899bf-b568-f522-be51-734f3ee2d022@redhat.com> Date: Mon, 30 May 2016 10:50:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <1464375916-16369-1-git-send-email-antoine.tremblay@ericsson.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-05/txt/msg00536.txt.bz2 On 05/27/2016 08:05 PM, Antoine Tremblay wrote: > In trace-condition.exp, tests are done by doing a conditional tracepoint > and validating that the trace contains all the frames that could be > collected if that condition is true. > > E.g. test_tracepoints $trace_command "21 + 21 == 42" 10 > > This will always return true and collect the 10 frames possible to collect > with the test program. > > However, if the condition evaluation is broken such that the condition is > unconditional we will not notice this problem. > > This patch adds counter-cases to such conditions like so: > > $trace_command "21 + 11 == 42" 0 > > This way such a problem would be noticed. Thanks for doing this. > > gdb/testsuite/ChangeLog: > > * gdb.trace/trace-condition.exp: Add counter-case tests. > --- > gdb/testsuite/gdb.trace/trace-condition.exp | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp > index b7427ca..f9eaf31 100644 > --- a/gdb/testsuite/gdb.trace/trace-condition.exp > +++ b/gdb/testsuite/gdb.trace/trace-condition.exp > @@ -157,4 +157,25 @@ foreach trace_command { "trace" "ftrace" } { > test_tracepoints $trace_command "(42 >= 42 ? 0 : 1) == 0" 10 > test_tracepoints $trace_command "(42 > 21 ? 0 : 1) == 0" 10 18955_i386_failure > test_tracepoints $trace_command "\$trace_timestamp >= 0" 10 > + > + # Counter-cases tests. > + test_tracepoints $trace_command "21 + 21 == 11" 0 > + test_tracepoints $trace_command "42 - 21 == 11" 0 > + test_tracepoints $trace_command "21 * 2 == 11" 0 > + test_tracepoints $trace_command "21 << 1 == 11" 0 > + test_tracepoints $trace_command "42 >> 1 == 11" 0 > + test_tracepoints $trace_command "-(21 << 1) == -11" 0 > + test_tracepoints $trace_command "-42 >> 1 == -11" 0 > + test_tracepoints $trace_command "(0xabababab & 0x0000ffff) == 0xffff" 0 > + test_tracepoints $trace_command "(0xabababab | 0x0000ffff) == 0xeeeedddd" 0 > + test_tracepoints $trace_command "(0xaaaaaaaa ^ 0x55555555) == 0xaaaaaaaa" 0 > + test_tracepoints $trace_command "~0xaaaaaaaa == 0x11111111" 0 > + test_tracepoints $trace_command "61 < 42" 0 > + test_tracepoints $trace_command "42 <= 11" 0 > + test_tracepoints $trace_command "11 >= 42" 0 > + test_tracepoints $trace_command "11 > 21" 0 > + test_tracepoints $trace_command "(66 < 42 ? 0 : 1) == 0" 0 18955_i386_failure > + test_tracepoints $trace_command "(66 <= 42 ? 0 : 1) == 0" 0 > + test_tracepoints $trace_command "(11 >= 42 ? 0 : 1) == 0" 0 > + test_tracepoints $trace_command "(11 > 21 ? 0 : 1) == 0" 0 18955_i386_failure I'm surprised to see these split into their own section though. I'd think it'd be better to keep each along side the corresponding test, to make it easier to keep them in sync: test_tracepoints $trace_command "21 + 21 == 42" 10 + test_tracepoints $trace_command "21 + 21 == 11" 0 test_tracepoints $trace_command "42 - 21 == 21" 10 + test_tracepoints $trace_command "42 - 21 == 11" 0 etc. Could you do that? > } > Thanks, Pedro Alves