aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2019-07-04 16:45:23 +0100
committerPedro Alves <palves@redhat.com>2019-07-04 16:45:23 +0100
commit213fd9faf563ce5726ce66c8104cbaba44ba9c09 (patch)
tree6c8ba17b0cb609f52b3d890365686edc304e250a /gdb/testsuite/lib
parentArm/AArch64: Use a single set of Arm register set size defines (diff)
downloadbinutils-gdb-213fd9faf563ce5726ce66c8104cbaba44ba9c09.tar.gz
binutils-gdb-213fd9faf563ce5726ce66c8104cbaba44ba9c09.tar.bz2
binutils-gdb-213fd9faf563ce5726ce66c8104cbaba44ba9c09.zip
Fix foreach_with_prefix regression
Fix a silly bug in commit a26c8de0ee93 ("Fix early return in foreach_with_prefix"). That patch made foreach_with_prefix always return after the first iteration, making ~10k tests disappear from test runs... This fixes it, and as penance, adds a testcase that exercises all kinds of different returns possible (ok, error, return, break, continue). I've written it with regular "foreach", and then switched to foreach_with_prefix and made sure we get the same results. I put the testcase in a new gdb.testsuite/ subdir, since this is exercising the testsuite harness bits. We can move this elsewhere if people prefer a different place, but I'm going ahead in order to unbreak the testsuite ASAP. gdb/testsuite/ChangeLog: 2019-07-04 Pedro Alves <palves@redhat.com> * lib/gdb.exp (foreach_with_prefix): Don't return early if body returned ok(0), break(3) or continue(4). * gdb.testsuite/foreach_with_prefix.exp: New file.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/gdb.exp4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 41f0ef58393..49ec8b2a550 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2031,7 +2031,9 @@ proc foreach_with_prefix {var list body} {
if {$code == 1} {
global errorInfo errorCode
return -code $code -errorinfo $errorInfo -errorcode $errorCode $result
- } else {
+ } elseif {$code == 3} {
+ break
+ } elseif {$code == 2} {
return -code $code $result
}
}