gdb/testsuite: prevent timeout in gdb.gdb/unittest.exp
authorAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 16 Nov 2020 15:16:25 +0000 (15:16 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 17 Nov 2020 10:11:50 +0000 (10:11 +0000)
When GDB is compiled with --enable-targets=all I would sometimes see
the 'maintenance selftest' in gdb.gdb/unittest.exp test timeout.

This one command causes GDB to run many separate self tests, this can
take some time.  The output of this command basically follows this
pattern:

  (gdb) maintenance selftest
  Running selftest aarch64-analyze-prologue.
  Running selftest aarch64-process-record.
  Running selftest arm-record.
  Running selftest arm_analyze_prologue.
  Running selftest array_view.
  Running selftest child_path.
  Running selftest cli_utils.
  ..... snip lots more lines ....
  Ran 79 unit tests, 0 failed

Currently the expect script waits for the final summary line ("Ran 79
unit test, 0 failed") before declaring pass or fail.  The problem is
that if the summary line takes too long to appear the test will
timeout.

As this test makes use of gdb_test_multiple then all I've done is add
an extra pattern that matches the 'Running selftest ....' lines and
then calls exp_continue.  Doing this means we find matches much more
frequently, and each time we do the timeout timer resets, preventing
the overall test from timing out.

gdb/testsuite/ChangeLog:

* gdb.gdb/unittest.exp: Spot 'Running...' lines.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.gdb/unittest.exp

index 3795205309d7d26eb705973711144df88bc4d5af..9c326d52431d49b6a53450a3d08c82facd98bd44 100644 (file)
@@ -1,3 +1,7 @@
+2020-11-17  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * gdb.gdb/unittest.exp: Spot 'Running...' lines.
+
 2020-11-17  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * gdb.base/completion.exp: Add new tests.
index 20027b85e1f789f20349479c5f5f3367e54318d3..28a14520f4733966732df2749557cce16d904ad8 100644 (file)
@@ -26,6 +26,13 @@ gdb_start
 
 set test "maintenance selftest"
 gdb_test_multiple $test $test {
+  -re ".*Running selftest \[^\n\r\]+\." {
+       # The selftests can take some time to complete.  To prevent
+       # timeout spot the 'Running ...' lines going past, so long as
+       # these are produced quickly enough then the overall test will
+       # not timeout.
+       exp_continue
+  }
   -re "Ran ($decimal) unit tests, 0 failed\r\n$gdb_prompt $" {
        set num_ran $expect_out(1,string)
        gdb_assert "$num_ran > 0" $test
This page took 0.034115 seconds and 4 git commands to generate.