From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 96051 invoked by alias); 30 May 2016 14:20:58 -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 96040 invoked by uid 89); 30 May 2016 14:20:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:0400, H*RU:Unknown_Domain, H*r:Symantec, Hx-spam-relays-external:Unknown_Domain X-HELO: usplmg20.ericsson.net Received: from usplmg20.ericsson.net (HELO usplmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 30 May 2016 14:20:55 +0000 Received: from EUSAAHC001.ericsson.se (Unknown_Domain [147.117.188.75]) by usplmg20.ericsson.net (Symantec Mail Security) with SMTP id 76.83.09012.1734C475; Mon, 30 May 2016 15:43:14 +0200 (CEST) Received: from elxa4wqvvz1 (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.75) with Microsoft SMTP Server (TLS) id 14.3.294.0; Mon, 30 May 2016 10:20:52 -0400 References: <1464375916-16369-1-git-send-email-antoine.tremblay@ericsson.com> <023899bf-b568-f522-be51-734f3ee2d022@redhat.com> User-agent: mu4e 0.9.17; emacs 24.4.1 From: Antoine Tremblay To: Pedro Alves CC: Antoine Tremblay , Subject: Re: [PATCH 1/5] Add counter-cases for trace-condition.exp tests In-Reply-To: <023899bf-b568-f522-be51-734f3ee2d022@redhat.com> Date: Mon, 30 May 2016 14:20:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2016-05/txt/msg00544.txt.bz2 Pedro Alves writes: > 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? > Yes actually I did that at first, but found it very confusing with so many similar lines together so I continued using another block. But like you sugested in patch 5 review I can add a line between each test case/counter. I'll do that and repost. Thanks, Antoine