[1/2] gdb/testsuite: fix gdb.ada/complete.exp timeout in READ1 mode
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
Commit Message
While reviewing another patch I spotted a timeout in
gdb.ada/complete.exp when testing in READ1 mode, e.g.:
$ make check-read1 TESTS="gdb.ada/complete.exp"
...
FAIL: gdb.ada/complete.exp: complete break ada (timeout)
...
The problem is an attempt to match the entire output from GDB within a
single gdb_test_multiple pattern, for a completion command that
returns a large number of completions.
This commit changes the gdb_test_multiple to process the output line
by line. I don't use the gdb_test_multiple -lbl option, as I've
always found that option backward -- it checks for the \r\n at the
start of each line rather than the end, I think it's much clearer to
use '^' at the start of each pattern, and '\r\n' at the end, so that's
what I've done here.
.... Or I would, if this test didn't already define $eol as the end of
line regexp ... except that $eol was set to '[\r\n]*', which isn't
that helpful, so I've updated $eol to be just '\r\n' the actual end of
line regexp.
And now, the test passes without a timeout when using READ1.
There should be no change in what is tested after this commit.
---
gdb/testsuite/gdb.ada/complete.exp | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
Comments
>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
Andrew> While reviewing another patch I spotted a timeout in
Andrew> gdb.ada/complete.exp when testing in READ1 mode, e.g.:
Andrew> $ make check-read1 TESTS="gdb.ada/complete.exp"
Andrew> ...
Andrew> FAIL: gdb.ada/complete.exp: complete break ada (timeout)
Andrew> ...
Andrew> The problem is an attempt to match the entire output from GDB within a
Andrew> single gdb_test_multiple pattern, for a completion command that
Andrew> returns a large number of completions.
...
Thank you. This looks good to me.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
@@ -28,7 +28,7 @@ clean_restart ${testfile}
set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb]
runto "foo.adb:$bp_location"
-set eol "\[\r\n\]*"
+set eol "\r\n"
# A convenience function that verifies that the "complete EXPR" command
# returns the EXPECTED_OUTPUT.
@@ -227,11 +227,20 @@ test_gdb_complete "ambiguous_func" \
gdb_test_no_output "set max-completions unlimited"
set test "complete break ada"
-gdb_test_multiple "$test" $test {
- -re "^$test$eol\(break ada\[\]\[a-z0-9._@/-\]*$eol\)+$gdb_prompt $" {
- pass $test
+gdb_test_multiple $test "" {
+ -re "^($test$eol)" {
+ exp_continue
}
+
+ -re "^(break ada\[\]\[a-z0-9._@/-\]*$eol)" {
+ exp_continue
+ }
+
+ -re "^$gdb_prompt $" {
+ pass $gdb_test_name
+ }
+
-re "\[A-Z\].*$gdb_prompt $" {
- fail "$test (gdb/22670)"
+ fail "$gdb_test_name (gdb/22670)"
}
}