Fix foreach_with_prefix regression
authorPedro Alves <palves@redhat.com>
Thu, 4 Jul 2019 15:45:23 +0000 (16:45 +0100)
committerPedro Alves <palves@redhat.com>
Thu, 4 Jul 2019 15:45:23 +0000 (16:45 +0100)
commit213fd9faf563ce5726ce66c8104cbaba44ba9c09
tree6c8ba17b0cb609f52b3d890365686edc304e250a
parent350fab54163e2dd178609d268e80bf31042d182d
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.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.testsuite/foreach_with_prefix.exp [new file with mode: 0644]
gdb/testsuite/lib/gdb.exp