This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix racy test in gdb.base/new-ui.exp


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=792ccf005f391f46e295e250f285d040ab105ab7

commit 792ccf005f391f46e295e250f285d040ab105ab7
Author: Pedro Alves <palves@redhat.com>
Date:   Tue Oct 24 23:22:56 2017 +0100

    Fix racy test in gdb.base/new-ui.exp
    
    I noticed gdb.base/new-ui.exp failing once here with:
    
     FAIL: gdb.base/new-ui.exp: do_test: delete all breakpoints on extra console (got interactive prompt)
     FAIL: gdb.base/new-ui.exp: do_test: main console: next causes no spurious output on other console
     FAIL: gdb.base/new-ui.exp: do_test: main console: breakpoint hit reported on other console
    
    The problem is 100% reproducible with check-read1:
      $ make check-read1 TESTS="gdb.*/new-ui.exp"
    
    testsuite/gdb.log shows:
      delete
      Delete all breakpoints? (y or n) [answered Y; input not from terminal]
      (gdb) FAIL: gdb.base/new-ui.exp: do_test: delete all breakpoints on extra console (got interactive prompt)
    
    This commit fixes the problem.
    
    gdb/testsuite/ChangeLog:
    2017-10-24  Pedro Alves  <palves@redhat.com>
    
    	* gdb.base/new-ui.exp (do_test): Split "delete all breakpoints on
    	extra console" test in two stages.

Diff:
---
 gdb/testsuite/ChangeLog           |  5 +++++
 gdb/testsuite/gdb.base/new-ui.exp | 15 ++++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d9ed687..0c6c93a 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
 2017-10-24  Pedro Alves  <palves@redhat.com>
 
+	* gdb.base/new-ui.exp (do_test): Split "delete all breakpoints on
+	extra console" test in two stages.
+
+2017-10-24  Pedro Alves  <palves@redhat.com>
+
 	* gdb.threads/attach-into-signal.exp (corefunc): Reindent.
 
 2017-10-24  Pedro Alves  <palves@redhat.com>
diff --git a/gdb/testsuite/gdb.base/new-ui.exp b/gdb/testsuite/gdb.base/new-ui.exp
index b84f4de..f9a1851 100644
--- a/gdb/testsuite/gdb.base/new-ui.exp
+++ b/gdb/testsuite/gdb.base/new-ui.exp
@@ -135,9 +135,18 @@ proc_with_prefix do_test {} {
 		 "Delete all breakpoints. .y or n. $" "n"
     }
     with_spawn_id $extra_spawn_id {
-	gdb_test "delete" \
-		 "Delete all breakpoints. .y or n. .answered Y; input not from terminal." \
-		 "delete all breakpoints on extra console"
+	# Check output in two stages in order to override
+	# gdb_test_multiple's internal "got interactive prompt" fail
+	# that would otherwise match if the expect buffer happens to
+	# fill with partial output that ends in "(y or n) ".
+	set test "delete all breakpoints on extra console"
+	gdb_test_multiple "delete" $test {
+	    -re "Delete all breakpoints. .y or n. " {
+		gdb_test "" \
+		    ".answered Y; input not from terminal." \
+		    $test
+	    }
+	}
     }
 
     # Run a few execution tests with the main console as the driver


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]