aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAntoine Tremblay <antoine.tremblay@ericsson.com>2016-05-30 11:24:44 -0400
committerAntoine Tremblay <antoine.tremblay@ericsson.com>2016-05-30 12:51:13 -0400
commit7faeb45ae36426b827c49457cf7186d73756cccc (patch)
treee7612509bd64fd44fcdf90183ba256f25918b6d3 /gdb
parente385593eef98ac92be57159e141f4b805dadbbb3 (diff)
downloadgdb-7faeb45ae36426b827c49457cf7186d73756cccc.zip
gdb-7faeb45ae36426b827c49457cf7186d73756cccc.tar.gz
gdb-7faeb45ae36426b827c49457cf7186d73756cccc.tar.bz2
Add counter-cases for trace-condition.exp tests
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.trace/trace-condition.exp38
2 files changed, 42 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8397f67..45c3ff0 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2016-05-30 Antoine Tremblay <antoine.tremblay@ericsson.com>
+
+ * gdb.trace/trace-condition.exp: Add counter-case tests.
+
2016-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
PR c++/15231
diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp
index b7427ca..ca3232f 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.exp
+++ b/gdb/testsuite/gdb.trace/trace-condition.exp
@@ -138,23 +138,61 @@ foreach trace_command { "trace" "ftrace" } {
# Test various operations to cover as many opcodes as possible.
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
+
test_tracepoints $trace_command "21 * 2 == 42" 10
+ test_tracepoints $trace_command "21 * 2 == 11" 0
+
test_tracepoints $trace_command "21 << 1 == 42" 10
+ test_tracepoints $trace_command "21 << 1 == 11" 0
+
test_tracepoints $trace_command "42 >> 1 == 21" 10
+ test_tracepoints $trace_command "42 >> 1 == 11" 0
+
test_tracepoints $trace_command "-(21 << 1) == -42" 10
+ test_tracepoints $trace_command "-(21 << 1) == -11" 0
+
test_tracepoints $trace_command "-42 >> 1 == -21" 10
+ test_tracepoints $trace_command "-42 >> 1 == -11" 0
+
test_tracepoints $trace_command "(0xabababab & 0x0000ffff) == 0xabab" 10
+ test_tracepoints $trace_command "(0xabababab & 0x0000ffff) == 0xffff" 0
+
test_tracepoints $trace_command "(0xabababab | 0x0000ffff) == 0xababffff" 10
+ test_tracepoints $trace_command "(0xabababab | 0x0000ffff) == 0xeeeedddd" 0
+
test_tracepoints $trace_command "(0xaaaaaaaa ^ 0x55555555) == 0xffffffff" 10
+ test_tracepoints $trace_command "(0xaaaaaaaa ^ 0x55555555) == 0xaaaaaaaa" 0
+
test_tracepoints $trace_command "~0xaaaaaaaa == 0x55555555" 10
+ test_tracepoints $trace_command "~0xaaaaaaaa == 0x11111111" 0
+
test_tracepoints $trace_command "21 < 42" 10
+ test_tracepoints $trace_command "61 < 42" 0
+
test_tracepoints $trace_command "42 <= 42" 10
+ test_tracepoints $trace_command "42 <= 11" 0
+
test_tracepoints $trace_command "42 >= 42" 10
+ test_tracepoints $trace_command "11 >= 42" 0
+
test_tracepoints $trace_command "42 > 21" 10
+ test_tracepoints $trace_command "11 > 21" 0
+
test_tracepoints $trace_command "(21 < 42 ? 0 : 1) == 0" 10 18955_i386_failure
+ test_tracepoints $trace_command "(66 < 42 ? 0 : 1) == 0" 0 18955_i386_failure
+
test_tracepoints $trace_command "(42 <= 42 ? 0 : 1) == 0" 10
+ test_tracepoints $trace_command "(66 <= 42 ? 0 : 1) == 0" 0
+
test_tracepoints $trace_command "(42 >= 42 ? 0 : 1) == 0" 10
+ test_tracepoints $trace_command "(11 >= 42 ? 0 : 1) == 0" 0
+
test_tracepoints $trace_command "(42 > 21 ? 0 : 1) == 0" 10 18955_i386_failure
+ test_tracepoints $trace_command "(11 > 21 ? 0 : 1) == 0" 0 18955_i386_failure
+
test_tracepoints $trace_command "\$trace_timestamp >= 0" 10
}