mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-26 22:07:58 +08:00
testsuite: Introduce gdb_assert
Often we'll do something like: if {$ok} { fail "whatever" } else { pass "whatever" } This adds a helper procedure for that, and converts one random place to use it, as an example. 2014-07-14 Pedro Alves <palves@redhat.com> * lib/gdb.exp (gdb_assert): New procedure. * gdb.trace/backtrace.exp (gdb_backtrace_tdp_4): Use it.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2014-07-14 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
|
* lib/gdb.exp (gdb_assert): New procedure.
|
||||||
|
* gdb.trace/backtrace.exp (gdb_backtrace_tdp_4): Use it.
|
||||||
|
|
||||||
2014-07-14 Pedro Alves <palves@redhat.com>
|
2014-07-14 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
* gdb.base/execution-termios.c: New file.
|
* gdb.base/execution-termios.c: New file.
|
||||||
|
@ -256,11 +256,8 @@ proc gdb_backtrace_tdp_4 { msg depth traceframe } {
|
|||||||
|
|
||||||
# Output of 'tdump' on frame 0 and frame 1 should be
|
# Output of 'tdump' on frame 0 and frame 1 should be
|
||||||
# identical.
|
# identical.
|
||||||
if ![string compare $output_string0 $output_string1] {
|
gdb_assert ![string compare $output_string0 $output_string1] \
|
||||||
pass "tdump output"
|
"tdump output"
|
||||||
} else {
|
|
||||||
fail "tdump output"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1205,6 +1205,27 @@ proc gdb_test_list_exact { cmd name elm_find_regexp elm_extract_regexp result_ma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Issue a PASS and return true if evaluating CONDITION in the caller's
|
||||||
|
# frame returns true, and issue a FAIL and return false otherwise.
|
||||||
|
# MESSAGE is the pass/fail message to be printed. If MESSAGE is
|
||||||
|
# omitted or is empty, then the pass/fail messages use the condition
|
||||||
|
# string as the message.
|
||||||
|
|
||||||
|
proc gdb_assert { condition {message ""} } {
|
||||||
|
if { $message == ""} {
|
||||||
|
set message $condition
|
||||||
|
}
|
||||||
|
|
||||||
|
set res [uplevel 1 expr $condition]
|
||||||
|
if {!$res} {
|
||||||
|
fail $message
|
||||||
|
} else {
|
||||||
|
pass $message
|
||||||
|
}
|
||||||
|
return $res
|
||||||
|
}
|
||||||
|
|
||||||
proc gdb_reinitialize_dir { subdir } {
|
proc gdb_reinitialize_dir { subdir } {
|
||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user