[gdb/testsuite] Add -wrap pattern flag to gdb_test_multiple
Currently, in order to rewrite: ... gdb_test <command> <pattern> <message> ... using gdb_test_multiple, we get: ... gdb_test_multiple <command> <message> { -re "\[\r\n\]*(?:<pattern>)\[\r\n\]+$gdb_prompt $" { pass $gdb_test_name } } ... Add a '-wrap pattern flag to gdb_test_multiple, that wraps the regexp pattern as gdb_test wraps its message argument. This allows us to rewrite into the more compact: ... gdb_test_multiple <command> <message> { -re -wrap <pattern> { pass $gdb_test_name } } ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-10-24 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (gdb_test_multiple): Add -wrap pattern flag. * gdb.reverse/step-precsave.exp: Rewrite gdb_test_multiple containing kfail using -wrap pattern flag and convenience variable gdb_test_name. Change-Id: Ie42c97d5ab7acf6db351299ccd23a83540fe6e1a
This commit is contained in:
parent
33d569b709
commit
4ccdfbec50
|
@ -1,3 +1,10 @@
|
|||
2019-10-24 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
* lib/gdb.exp (gdb_test_multiple): Add -wrap pattern flag.
|
||||
* gdb.reverse/step-precsave.exp: Rewrite gdb_test_multiple containing
|
||||
kfail using -wrap pattern flag and convenience variable
|
||||
gdb_test_name.
|
||||
|
||||
2019-10-24 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* gdb.python/py-progspace.exp: Add tests for the
|
||||
|
|
|
@ -46,19 +46,15 @@ gdb_test "break $end_of_main" \
|
|||
|
||||
# This can take awhile.
|
||||
with_timeout_factor 20 {
|
||||
set test "run to end of main"
|
||||
set pass_pattern "Breakpoint .* end of main .*"
|
||||
set kfail_pattern "Process record does not support instruction 0xc5 at.*"
|
||||
set kfail2_pattern "Process record does not support instruction 0xfae64 at.*"
|
||||
gdb_test_multiple "continue" $test {
|
||||
-re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
|
||||
pass $test
|
||||
gdb_test_multiple "continue" "run to end of main" {
|
||||
-re -wrap "Breakpoint .* end of main .*" {
|
||||
pass $gdb_test_name
|
||||
}
|
||||
-re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {
|
||||
kfail "record/23188" $test
|
||||
-re -wrap "Process record does not support instruction 0xc5 at.*" {
|
||||
kfail "record/23188" $gdb_test_name
|
||||
}
|
||||
-re "\[\r\n\]*(?:$kfail2_pattern)\[\r\n\]+$gdb_prompt $" {
|
||||
kfail "record/25038" $test
|
||||
-re -wrap "Process record does not support instruction 0xfae64 at.*" {
|
||||
kfail "record/25038" $gdb_test_name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -764,6 +764,17 @@ proc gdb_internal_error_resync {} {
|
|||
# expected from $gdb_spawn_id. IOW, callers do not need to worry
|
||||
# about resetting "-i" back to $gdb_spawn_id explicitly.
|
||||
#
|
||||
# In EXPECT_ARGUMENTS we can use a -wrap pattern flag, that wraps the regexp
|
||||
# pattern as gdb_test wraps its message argument.
|
||||
# This allows us to rewrite:
|
||||
# gdb_test <command> <pattern> <message>
|
||||
# into:
|
||||
# gdb_test_multiple <command> <message> {
|
||||
# -re -wrap <pattern> {
|
||||
# pass $gdb_test_name
|
||||
# }
|
||||
# }
|
||||
#
|
||||
proc gdb_test_multiple { command message user_code { prompt_regexp "" } } {
|
||||
global verbose use_gdb_stub
|
||||
global gdb_prompt pagination_prompt
|
||||
|
@ -825,6 +836,7 @@ proc gdb_test_multiple { command message user_code { prompt_regexp "" } } {
|
|||
set patterns ""
|
||||
set expecting_action 0
|
||||
set expecting_arg 0
|
||||
set wrap_pattern 0
|
||||
foreach item $user_code subst_item $subst_code {
|
||||
if { $item == "-n" || $item == "-notransfer" || $item == "-nocase" } {
|
||||
lappend processed_code $item
|
||||
|
@ -839,6 +851,10 @@ proc gdb_test_multiple { command message user_code { prompt_regexp "" } } {
|
|||
lappend processed_code $item
|
||||
continue
|
||||
}
|
||||
if { $item == "-wrap" } {
|
||||
set wrap_pattern 1
|
||||
continue
|
||||
}
|
||||
if { $expecting_arg } {
|
||||
set expecting_arg 0
|
||||
lappend processed_code $subst_item
|
||||
|
@ -852,7 +868,14 @@ proc gdb_test_multiple { command message user_code { prompt_regexp "" } } {
|
|||
continue
|
||||
}
|
||||
set expecting_action 1
|
||||
lappend processed_code $subst_item
|
||||
if { $wrap_pattern } {
|
||||
# Wrap subst_item as is done for the gdb_test PATTERN argument.
|
||||
lappend processed_code \
|
||||
"\[\r\n\]*(?:$subst_item)\[\r\n\]+$gdb_prompt $"
|
||||
set wrap_pattern 0
|
||||
} else {
|
||||
lappend processed_code $subst_item
|
||||
}
|
||||
if {$patterns != ""} {
|
||||
append patterns "; "
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue