From patchwork Fri May 27 19:05:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tremblay X-Patchwork-Id: 12578 Received: (qmail 128757 invoked by alias); 27 May 2016 19:05:29 -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 128746 invoked by uid 89); 27 May 2016 19:05:28 -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=1574 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; Fri, 27 May 2016 19:05:27 +0000 Received: from EUSAAHC002.ericsson.se (Unknown_Domain [147.117.188.78]) by usplmg20.ericsson.net (Symantec Mail Security) with SMTP id 10.AF.09012.4C198475; Fri, 27 May 2016 20:28:20 +0200 (CEST) Received: from elxa4wqvvz1.dyn.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.78) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 27 May 2016 15:05:24 -0400 From: Antoine Tremblay To: CC: Antoine Tremblay Subject: [PATCH 1/5] Add counter-cases for trace-condition.exp tests Date: Fri, 27 May 2016 15:05:12 -0400 Message-ID: <1464375916-16369-1-git-send-email-antoine.tremblay@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes 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. 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 }