Fix test_gdb_complete_tab_multiple race
authorPedro Alves <palves@redhat.com>
Wed, 3 Jul 2019 15:57:48 +0000 (16:57 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 3 Jul 2019 15:57:48 +0000 (16:57 +0100)
Running 'make check-read1 TESTS="gdb.base/options.exp"' revealed a
race in test_gdb_complete_tab_multiple.  There's a gdb_test_multiple
call that expects a prompt in the middle of the regexp.  That's racy
because gdb_test_multiple includes a built-in FAIL pattern for the
prompt, which may match if gdb is slow enough to produce the rest of
the output after the prompt.

Fix this in the usual way of splitting the matching in two.

gdb/testsuite/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

* lib/completion-support.exp (test_gdb_complete_tab_multiple):
Split one gdb_test_multiple call in two to avoid a race.

gdb/testsuite/ChangeLog
gdb/testsuite/lib/completion-support.exp

index 9b988dcfcc68d27644ebcabc288a2ed8fbf952d8..6e2234984da82ac4329a2e0520f43d7f34f13537 100644 (file)
@@ -1,3 +1,8 @@
+2019-07-03  Pedro Alves  <palves@redhat.com>
+
+       * lib/completion-support.exp (test_gdb_complete_tab_multiple):
+       Split one gdb_test_multiple call in two to avoid a race.
+
 2019-07-03  Pedro Alves  <palves@redhat.com>
 
        * gdb.base/with.c: New file.
index 97fed18b055c5d9a2617de7f0c4f407f0716e965..3199e85fd4d3e8c74595bb09f454a87af22f5870 100644 (file)
@@ -151,8 +151,12 @@ proc test_gdb_complete_tab_multiple { input_line add_completed_line \
                set maybe_bell ""
            }
            gdb_test_multiple "" "$test (second tab)" {
-               -re "^${maybe_bell}\r\n$expected_re\r\n$gdb_prompt $input_line_re$add_completed_line_re$" {
-                   pass "$test"
+               -re "^${maybe_bell}\r\n$expected_re\r\n$gdb_prompt " {
+                   gdb_test_multiple "" "$test (second tab)" {
+                       -re "^$input_line_re$add_completed_line_re$" {
+                           pass "$test"
+                       }
+                   }
                }
            }
        }
This page took 0.032094 seconds and 4 git commands to generate.