Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Antoine Tremblay <antoine.tremblay@ericsson.com>
To: <gdb-patches@sourceware.org>
Cc: Antoine Tremblay <antoine.tremblay@ericsson.com>
Subject: [PATCH 2/5 v2] Move trace conditions tests from ftrace.exp to trace-condition.exp
Date: Fri, 27 May 2016 19:05:00 -0000	[thread overview]
Message-ID: <1464375916-16369-2-git-send-email-antoine.tremblay@ericsson.com> (raw)
In-Reply-To: <1464375916-16369-1-git-send-email-antoine.tremblay@ericsson.com>

This patch moves conditional tests that were done in ftrace.exp to
trace-condition.exp.

Note that emit_ref is now tested by the anarg local variable there is no
need to test the register directly.

All emit calls have been tested using asserts before / after the move, so
that the tests cover the same functions.

Note that these function were not covered before and are still not:
emit_gt_goto, emit_lt_goto, emit_pop, emit_unsigned_less.

gdb/testsuite/ChangeLog:

	* gdb.trace/ftrace.exp (test_ftrace_condition): Remove.
	Move condition tests...
	* gdb.trace/trace-condition.exp: Here.
---
 gdb/testsuite/gdb.trace/ftrace.exp          | 74 -----------------------------
 gdb/testsuite/gdb.trace/trace-condition.exp |  4 ++
 2 files changed, 4 insertions(+), 74 deletions(-)

diff --git a/gdb/testsuite/gdb.trace/ftrace.exp b/gdb/testsuite/gdb.trace/ftrace.exp
index f770bf7..e90485c 100644
--- a/gdb/testsuite/gdb.trace/ftrace.exp
+++ b/gdb/testsuite/gdb.trace/ftrace.exp
@@ -174,43 +174,6 @@ proc test_fast_tracepoints {} {
     }
 }
 
-# Test compiled-condition
-# CONDEXP is the condition expression to be compiled.
-# VAR is the variable to be collected for testing.
-# LIST is a list of expected values of VAR should be collected
-# based on the CONDEXP.
-proc test_ftrace_condition { condexp var list } \
-{ with_test_prefix "cond $condexp" \
-{
-    global executable
-    global hex
-
-    clean_restart ${executable}
-    if ![runto_main] {
-	fail "Can't run to main to check for trace support"
-	return -1
-    }
-
-    gdb_test "break end" ".*" ""
-    gdb_test "tvariable \$tsv = 0"
-    gdb_test "ftrace set_point if $condexp" "Fast tracepoint .*"
-    gdb_trace_setactions "set action for tracepoint .*" "" \
-	"collect $var" "^$"
-
-    gdb_test_no_output "tstart" ""
-    gdb_test "continue" \
-	"Continuing\\.\[ \r\n\]+(Thread .* hit )?Breakpoint.*" ""
-    gdb_test_no_output "tstop" ""
-
-    set i 0
-    foreach expval $list {
-	gdb_test "tfind" "Found trace frame $i, tracepoint .*" "tfind frame $i"
-	gdb_test "print $var" "\\$\[0-9\]+ = $expval\[\r\n\]" "expect $expval"
-	set i [expr $i + 1]
-    }
-    gdb_test "tfind" "Target failed to find requested trace frame\."
-}}
-
 gdb_reinitialize_dir $srcdir/$subdir
 
 if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 } {
@@ -219,40 +182,3 @@ if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 }
 }
 
 test_fast_tracepoints
-
-# Test conditional goto and simple expression.
-test_ftrace_condition "globvar > 7" "globvar" { 8 9 10 }
-test_ftrace_condition "globvar < 4" "globvar" { 1 2 3 }
-test_ftrace_condition "globvar >= 7" "globvar" { 7 8 9 10 }
-test_ftrace_condition "globvar <= 4" "globvar" { 1 2 3 4 }
-test_ftrace_condition "globvar == 5" "globvar" { 5 }
-test_ftrace_condition "globvar != 5" "globvar" { 1 2 3 4 6 7 8 9 10 }
-test_ftrace_condition "globvar > 3 && globvar < 7" "globvar" { 4 5 6 }
-test_ftrace_condition "globvar < 3 || globvar > 7" "globvar" { 1 2 8 9 10 }
-test_ftrace_condition "(globvar << 2) + 1 == 29" "globvar" { 7 }
-test_ftrace_condition "(globvar >> 2) == 2" "globvar" { 8 9 10 }
-
-# Test emit_call by accessing trace state variables.
-test_ftrace_condition "(\$tsv = \$tsv + 2) > 10" "globvar" { 6 7 8 9 10 }
-
-# This expression is used for testing emit_reg.
-if [is_amd64_regs_target] {
-    set arg0exp "\$rdi"
-} elseif [is_x86_like_target] {
-    set arg0exp "*(int *) (\$ebp + 8)"
-} elseif { [istarget "aarch64*-*-*"] } {
-    set arg0exp "\$x0"
-} elseif [istarget "powerpc*-*-*"] {
-    set arg0exp "\$r3"
-} elseif { [istarget "s390x-*-*"] } {
-    set arg0exp "\$r2"
-} elseif { [istarget "s390-*-*"] } {
-    # On targets with 64-bit GPRs, avoid the high part.
-    set arg0exp "(\$r2 & 0xffffffff)"
-} else {
-    set arg0exp ""
-}
-
-if { "$arg0exp" != "" } {
-    test_ftrace_condition "($arg0exp > 500)" "globvar" { 6 7 8 9 10 }
-}
diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp
index f9eaf31..c4dc5fe 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.exp
+++ b/gdb/testsuite/gdb.trace/trace-condition.exp
@@ -137,6 +137,8 @@ foreach trace_command { "trace" "ftrace" } {
     test_tracepoints $trace_command "anarg == 100 && globvar == 1" 1 18955_x86_64_failure
 
     # Test various operations to cover as many opcodes as possible.
+    test_tracepoints $trace_command "21 == 21" 10
+    test_tracepoints $trace_command "21 != 42" 10
     test_tracepoints $trace_command "21 + 21 == 42" 10
     test_tracepoints $trace_command "42 - 21 == 21" 10
     test_tracepoints $trace_command "21 * 2 == 42" 10
@@ -159,6 +161,8 @@ foreach trace_command { "trace" "ftrace" } {
     test_tracepoints $trace_command "\$trace_timestamp >= 0" 10
 
     # Counter-cases tests.
+    test_tracepoints $trace_command "11 == 21" 0
+    test_tracepoints $trace_command "42 != 42" 0
     test_tracepoints $trace_command "21 + 21 == 11" 0
     test_tracepoints $trace_command "42 - 21 == 11" 0
     test_tracepoints $trace_command "21 * 2 == 11" 0
-- 
2.8.1


  parent reply	other threads:[~2016-05-27 19:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-27 19:05 [PATCH 1/5] Add counter-cases for trace-condition.exp tests Antoine Tremblay
2016-05-27 19:05 ` [PATCH 3/5 v2] Add emit_less_unsigned test in trace-condition.exp Antoine Tremblay
2016-05-30 11:02   ` Pedro Alves
2016-05-27 19:05 ` [PATCH 4/5 v2] Add variable length tests for emit_ref " Antoine Tremblay
2016-05-30 11:02   ` Pedro Alves
2016-05-27 19:05 ` Antoine Tremblay [this message]
2016-05-30 11:02   ` [PATCH 2/5 v2] Move trace conditions tests from ftrace.exp to trace-condition.exp Pedro Alves
2016-05-27 19:05 ` [PATCH 5/5 v2] Add tests for 64bit values in trace-condition.exp Antoine Tremblay
2016-05-30 11:02   ` Pedro Alves
2016-05-30 14:50     ` [PATCH 5/5 v3] " Antoine Tremblay
2016-05-30 15:06       ` Pedro Alves
2016-05-30 16:55         ` Antoine Tremblay
2016-05-30 10:50 ` [PATCH 1/5] Add counter-cases for trace-condition.exp tests Pedro Alves
2016-05-30 14:20   ` Antoine Tremblay
2016-05-30 14:48   ` [PATCH 1/5 v3] " Antoine Tremblay
2016-05-30 15:06     ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464375916-16369-2-git-send-email-antoine.tremblay@ericsson.com \
    --to=antoine.tremblay@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox