Patchwork [committed,gdb/testsuite] Run read1 timeout tests with with_read1_timeout_factor

login
register
mail settings
Submitter Tom de Vries
Date Aug. 5, 2019, 1:41 p.m.
Message ID <20190805134157.GA15436@delia>
Download mbox | patch
Permalink /patch/33965/
State New
Headers show

Comments

Tom de Vries - Aug. 5, 2019, 1:41 p.m.
Hi,

When running tests with check-read1, we run into some timeouts where the tests
are not easy to rewrite using gdb_test_sequence:
...
FAIL: gdb.base/help.exp: help data (timeout)
FAIL: gdb.base/help.exp: help files (timeout)
FAIL: gdb.base/help.exp: help internals (timeout)
FAIL: gdb.base/help.exp: help user-defined (timeout)
FAIL: gdb.base/help.exp: help breakpoint "b" abbreviation (timeout)
FAIL: gdb.base/help.exp: help breakpoint "br" abbreviation (timeout)
FAIL: gdb.base/help.exp: help breakpoint "bre" abbreviation (timeout)
FAIL: gdb.base/info-macros.exp: info macros 2 (timeout)
FAIL: gdb.base/info-macros.exp: next (timeout)
FAIL: gdb.base/info-macros.exp: info macros 3 (timeout)
FAIL: gdb.base/info-macros.exp: next (timeout)
FAIL: gdb.base/info-macros.exp: next (timeout)
FAIL: gdb.base/info-macros.exp: info macros (timeout)
FAIL: gdb.base/info-macros.exp: next (timeout)
FAIL: gdb.base/info-macros.exp: next (timeout)
FAIL: gdb.base/info-macros.exp: info macros 7 (timeout)
FAIL: gdb.cp/nested-types.exp: ptype S10 (limit = -1) // parse failed (timeout)
FAIL: gdb.cp/nested-types.exp: set print type nested-type-limit 1 (timeout)
...

Fix these by increasing the timeout by a factor 10.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Run read1 timeout tests with with_read1_timeout_factor

gdb/testsuite/ChangeLog:

2019-08-05  Tom de Vries  <tdevries@suse.de>

	PR testsuite/24863
	* lib/gdb.exp (with_read1_timeout_factor): New proc.
	* gdb.base/help.exp: Use with_read1_timeout_factor.
	* gdb.base/info-macros.exp: Same.
	* gdb.cp/nested-types.exp: Same.

---
 gdb/testsuite/gdb.base/help.exp        | 54 +++++++++++++++++++---------------
 gdb/testsuite/gdb.base/info-macros.exp | 25 +++++++++++-----
 gdb/testsuite/gdb.cp/nested-types.exp  | 11 +++++--
 gdb/testsuite/lib/gdb.exp              | 12 ++++++++
 4 files changed, 68 insertions(+), 34 deletions(-)

Patch

diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp
index e65f7c875f..19933db79b 100644
--- a/gdb/testsuite/gdb.base/help.exp
+++ b/gdb/testsuite/gdb.base/help.exp
@@ -29,13 +29,15 @@  test_class_help "aliases" {"Aliases of other commands\.\[\r\n\]+"}
 test_class_help "breakpoints" {
     "Making program stop at certain points\.\[\r\n\]+"
 }
-test_class_help "data" {"Examining data\.\[\r\n\]+"}
-test_class_help "files" {"Specifying and examining files\.\[\r\n\]+"}
-test_class_help "internals" {
-    "Maintenance commands\.\[\r\n\]+"
-    "Some gdb commands are provided just for use by gdb maintainers\.\[\r\n\]+"
-    "These commands are subject to frequent change, and may not be as\[\r\n\]+"
-    "well documented as user commands\.\[\r\n\]+"
+with_read1_timeout_factor 10 {
+    test_class_help "data" {"Examining data\.\[\r\n\]+"}
+    test_class_help "files" {"Specifying and examining files\.\[\r\n\]+"}
+    test_class_help "internals" {
+	"Maintenance commands\.\[\r\n\]+"
+	"Some gdb commands are provided just for use by gdb maintainers\.\[\r\n\]+"
+	"These commands are subject to frequent change, and may not be as\[\r\n\]+"
+	"well documented as user commands\.\[\r\n\]+"
+    }
 }
 test_class_help "obscure" {"Obscure features\.\[\r\n\]+"}
 test_class_help "running" {"Running the program\.\[\r\n\]+"}
@@ -44,25 +46,29 @@  test_class_help "stack" {
     "When the program being debugged stops, gdb selects the innermost frame\.\[\r\n\]+"
     "The commands below can be used to select other frames by number or address\.\[\r\n\]+"
 }
-test_class_help "status" {
-    "Status inquiries\.\[\r\n\]+"
-}
-test_class_help "support" {"Support facilities\.\[\r\n\]+"}
-test_class_help "tracepoints" {
-    "Tracing of program execution without stopping the program\.\[\r\n\]+"
+with_read1_timeout_factor 10 {
+    test_class_help "status" {
+	"Status inquiries\.\[\r\n\]+"
+    }
+    test_class_help "support" {"Support facilities\.\[\r\n\]+"}
+    test_class_help "tracepoints" {
+	"Tracing of program execution without stopping the program\.\[\r\n\]+"
+    }
 }
 
-test_user_defined_class_help
-
-# Test help of an abbreviated command.  "break" is picked at random.
-set help_breakpoint_text "Set breakpoint at specified location\..*"
-# test help breakpoint "b" abbreviation
-gdb_test "help b" $help_breakpoint_text "help breakpoint \"b\" abbreviation"
-# test help breakpoint "br" abbreviation
-gdb_test "help br" $help_breakpoint_text "help breakpoint \"br\" abbreviation"
-# test help breakpoint "bre" abbreviation
-gdb_test "help bre" $help_breakpoint_text "help breakpoint \"bre\" abbreviation"
-# test help breakpoint "brea" abbreviation
+with_read1_timeout_factor 10 {
+    test_user_defined_class_help
+
+    # Test help of an abbreviated command.  "break" is picked at random.
+    set help_breakpoint_text "Set breakpoint at specified location\..*"
+    # test help breakpoint "b" abbreviation
+    gdb_test "help b" $help_breakpoint_text "help breakpoint \"b\" abbreviation"
+    # test help breakpoint "br" abbreviation
+    gdb_test "help br" $help_breakpoint_text "help breakpoint \"br\" abbreviation"
+    # test help breakpoint "bre" abbreviation
+    gdb_test "help bre" $help_breakpoint_text "help breakpoint \"bre\" abbreviation"
+    # test help breakpoint "brea" abbreviation
+}
 gdb_test "help brea" $help_breakpoint_text "help breakpoint \"brea\" abbreviation"
 # test help breakpoint "break" abbreviation
 gdb_test "help break" $help_breakpoint_text "help breakpoint \"break\" abbreviation"
diff --git a/gdb/testsuite/gdb.base/info-macros.exp b/gdb/testsuite/gdb.base/info-macros.exp
index b76a5bbeef..7abfb32e04 100644
--- a/gdb/testsuite/gdb.base/info-macros.exp
+++ b/gdb/testsuite/gdb.base/info-macros.exp
@@ -132,12 +132,19 @@  set test "info macro  -a  --  FOO"
 set testname "$test"
 gdb_test "$test" "$r1$r2$r3$r4" "$testname"
 
+proc gdb_test_multiple_with_read1_timeout_factor { factor command message \
+						       user_code } {
+    with_read1_timeout_factor $factor {
+        uplevel [list gdb_test_multiple $command $message $user_code]
+    }
+}
+
 set test "info macros"
 set r1 ".*#define FOO \"hello\""
 set r2 ".*#define ONE"
 set r3 ".*\r\n$gdb_prompt"
 set testname "$test 2"
-gdb_test_multiple "$test" $testname {
+gdb_test_multiple_with_read1_timeout_factor 10 "$test" $testname {
   -re "$r1$r2$r3" {
      pass $testname
   }
@@ -158,7 +165,7 @@  set r2 ".*#define ONE"
 set r3 ".*#define TWO"
 set r4 ".*\r\n$gdb_prompt"
 set testname "$test 3"
-gdb_test_multiple "$test" $testname {
+gdb_test_multiple_with_read1_timeout_factor 10 "$test" $testname {
   -re ".*#define THREE.*\r\n$gdb_prompt" {
      fail $testname
   }
@@ -178,7 +185,7 @@  set r3 ".*#define THREE"
 set r4 ".*#define TWO"
 set r5 ".*\r\n$gdb_prompt"
 set testname "$test 4"
-gdb_test_multiple "$test" $testname {
+gdb_test_multiple_with_read1_timeout_factor 10 "$test" $testname {
   -re ".*#define FOUR.*\r\n$gdb_prompt" {
      fail $testname
   }
@@ -188,7 +195,7 @@  gdb_test_multiple "$test" $testname {
 }
 # same as above with a linespec.
 set test "info macros *\$pc"
-gdb_test_multiple "$test" $test {
+gdb_test_multiple_with_read1_timeout_factor 10 "$test" $test {
   -re ".*#define FOUR.*\r\n$gdb_prompt" {
      fail $test
   }
@@ -204,7 +211,7 @@  set r3 ".*#define TWO."
 set r4 ".*\r\n$gdb_prompt"
 set test "info macros"
 set testname "$test 5"
-gdb_test_multiple "$test" $test {
+gdb_test_multiple_with_read1_timeout_factor 10 "$test" $test {
   -re ".*#define THREE.*\r\n$gdb_prompt" {
      fail $testname
   }
@@ -221,7 +228,7 @@  gdb_test "next" ".*" ""
 set r1 ".*#define DEF_MACROS"
 set r2 ".*\r\n$gdb_prompt"
 set testname "$test 6"
-gdb_test_multiple "$test" $testname {
+gdb_test_multiple_with_read1_timeout_factor 10 "$test" $testname {
   -re ".*#define FOO \" \".*\r\n$gdb_prompt" {
      fail $testname
   }
@@ -257,7 +264,7 @@  set r2 ".*#define FOO\\(a\\) foo = a"
 set r3 ".*#define FOUR"
 set r4 ".*\r\n$gdb_prompt"
 set testname "$test 7"
-gdb_test_multiple "$test" $testname {
+gdb_test_multiple_with_read1_timeout_factor 10 "$test" $testname {
   -re ".*#define FOO \" \".*\r\n$gdb_prompt" {
      fail $testname
   }
@@ -288,4 +295,6 @@  set r2 ".*define ONE"
 # info macros on the line where the #define or #include is
 # fails to find the macro defined (though it works on the next line.)
 setup_kfail "gdb/NNNN" *-*-*
-gdb_test "$test" "$r1$r2" "$test"
+with_read1_timeout_factor 10 {
+  gdb_test "$test" "$r1$r2" "$test"
+}
diff --git a/gdb/testsuite/gdb.cp/nested-types.exp b/gdb/testsuite/gdb.cp/nested-types.exp
index 9b2f569631..f0c9922d0e 100644
--- a/gdb/testsuite/gdb.cp/nested-types.exp
+++ b/gdb/testsuite/gdb.cp/nested-types.exp
@@ -278,13 +278,20 @@  proc test_nested_limit {limit log} {
     node_result result 10 $limit {} 0 $log
 
     if {!$log} {
+	if {$limit < 0 || $limit >= 8 } {
+	    set read1_timeout_factor 10
+	} else {
+	    set read1_timeout_factor 1
+	}
 	# The only output we check for is the contents of the struct,
 	# ignoring the leading "type = struct S10 {" and trailing "}" of
 	# the outermost node.
 	set result [lindex $result 0]
 	lassign $result type access key name children
-	cp_test_ptype_class $name "ptype $name (limit = $limit)" $key \
-	    $name $children
+	with_read1_timeout_factor $read1_timeout_factor {
+	    cp_test_ptype_class $name "ptype $name (limit = $limit)" $key \
+		$name $children
+	}
     }
 }
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 529b6f6030..edc8dfcdfd 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2364,6 +2364,18 @@  proc with_timeout_factor { factor body } {
     }
 }
 
+# Run BODY with timeout factor FACTOR if check-read1 is used.
+
+proc with_read1_timeout_factor { factor body } {
+    if { [info exists ::env(READ1)] == 1 && $::env(READ1) == 1 } {
+	# Use timeout factor
+    } else {
+	# Reset timeout factor
+	set factor 1
+    }
+    return [uplevel [list with_timeout_factor $factor $body]]
+}
+
 # Return 1 if _Complex types are supported, otherwise, return 0.
 
 gdb_caching_proc support_complex_tests {