[1/5] Fix test_gdb_complete_tab_multiple race

Message ID 20190627191427.20742-2-palves@redhat.com
State New
Headers show
Series
  • pipe command completer, and string options
Related show

Commit Message

Pedro Alves June 27, 2019, 7:14 p.m.
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:
yyyy-mm-dd  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/lib/completion-support.exp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

-- 
2.14.5

Patch

diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
index 97fed18b055..3199e85fd4d 100644
--- a/gdb/testsuite/lib/completion-support.exp
+++ b/gdb/testsuite/lib/completion-support.exp
@@ -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"
+			}
+		    }
 		}
 	    }
 	}