From patchwork Tue Apr 14 15:00:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 47149 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E3DCA20553 for ; Tue, 14 Apr 2015 15:01:20 +0000 (UTC) Received: by layy10 with SMTP id y10sf3381722lay.0 for ; Tue, 14 Apr 2015 08:01:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:subject:date :message-id:x-original-sender:x-original-authentication-results; bh=TM/QKunxEi7WHOqET77eEx147MC8mPfAjYVVvYprQkg=; b=Q7Ck7+6jKESVedD9VecW9aATr8gcm3T23iYi0aGVwyS6QVTZlBO900X/pn1LkMUw/o IzPDAPI5heYAFl63NRrXfCqsrJ3pIDdngyRbr3DXVBMBT8UtYSxnwpeHMz2iE7nnfVqq 3Q+XjFFtsxp2FhKvVgnBQ/bC6pipft+u5z9GSMra7L6XnvntARG/owAFkiXtNR7+7vwG zYX1dIZH966y0zqWQH7j7WZJx4VIkC74azp+/OSWzIQ9QmEwcH0fDvjpDPkiIONjBpJ+ GwHq1zpmstlESzajtCGAe588XGmar9fDQpC8tWTX6vQJXZXpNwzNjT9mCHmP09KE1fgY GsaQ== X-Gm-Message-State: ALoCoQkEq0eLZGQvi/sJgo630w6YJVQob5JINONkFrbFbuw5jyNsCIqt3l3pwTqMawpl2Md2hqez X-Received: by 10.112.29.39 with SMTP id g7mr3341280lbh.1.1429023679650; Tue, 14 Apr 2015 08:01:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.194 with SMTP id v2ls72423lag.59.gmail; Tue, 14 Apr 2015 08:01:19 -0700 (PDT) X-Received: by 10.152.178.133 with SMTP id cy5mr18702775lac.2.1429023679242; Tue, 14 Apr 2015 08:01:19 -0700 (PDT) Received: from mail-lb0-x22b.google.com (mail-lb0-x22b.google.com. [2a00:1450:4010:c04::22b]) by mx.google.com with ESMTPS id xh7si1269165lac.132.2015.04.14.08.01.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Apr 2015 08:01:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22b as permitted sender) client-ip=2a00:1450:4010:c04::22b; Received: by lbbzk7 with SMTP id zk7so10847136lbb.0 for ; Tue, 14 Apr 2015 08:01:19 -0700 (PDT) X-Received: by 10.152.197.34 with SMTP id ir2mr19271774lac.36.1429023678925; Tue, 14 Apr 2015 08:01:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp1934992lbt; Tue, 14 Apr 2015 08:01:17 -0700 (PDT) X-Received: by 10.66.196.163 with SMTP id in3mr37143458pac.70.1429023677032; Tue, 14 Apr 2015 08:01:17 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id e10si2067453pdk.106.2015.04.14.08.01.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Apr 2015 08:01:17 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-return-121938-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 37702 invoked by alias); 14 Apr 2015 15:01:05 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Subscribe: List-Archive: List-Post: , List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 37642 invoked by uid 89); 14 Apr 2015 15:01:04 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f172.google.com Received: from mail-pd0-f172.google.com (HELO mail-pd0-f172.google.com) (209.85.192.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 14 Apr 2015 15:00:54 +0000 Received: by pdea3 with SMTP id a3so15018732pde.3 for ; Tue, 14 Apr 2015 08:00:52 -0700 (PDT) X-Received: by 10.70.53.40 with SMTP id y8mr37385128pdo.61.1429023652573; Tue, 14 Apr 2015 08:00:52 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by mx.google.com with ESMTPSA id qc10sm1346824pbc.72.2015.04.14.08.00.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Apr 2015 08:00:51 -0700 (PDT) From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] Increase timeout in watch-bitfields.exp for software watchpoint Date: Tue, 14 Apr 2015 16:00:44 +0100 Message-Id: <1429023644-13403-1-git-send-email-qiyaoltc@gmail.com> X-IsSubscribed: yes X-Original-Sender: qiyaoltc@gmail.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22b as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com X-Google-Group-Id: 836684582541 From: Yao Qi I see the following two timeout fails on pandaboard (arm-linux target), FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: continue until exit (timeout) FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: continue until exit (timeout) In this test, more than one watchpoint is used, so the following watchpoint requests fall back to software watchpoint, so that GDB will single step all the way and it is very slow. This patch is to copy the fix from [PATCH] GDB/testsuite: Correct gdb.base/watchpoint-solib.exp timeout tweak https://sourceware.org/ml/gdb-patches/2014-07/msg00716.html I find the left-over of this patch review is to factor out code into a procedure, so I do that in this patch. Re-run tests watch-bitfields.exp, watchpoint-solib.exp, sigall-reverse.exp, and until-precsave.exp on pandaboard, no regression. gdb/testsuite: 2015-04-14 Yao Qi * gdb.base/watch-bitfields.exp (test_watch_location): Increase timeout by factor of 4. (test_regular_watch): Likewise. * gdb.base/watchpoint-solib.exp: Use with_timeout_factor. * gdb.reverse/sigall-reverse.exp: Likewise. * gdb.reverse/until-precsave.exp: Likewise. * lib/gdb.exp (with_timeout_factor): New proc. --- gdb/testsuite/gdb.base/watch-bitfields.exp | 22 ++++++++++++++++++++-- gdb/testsuite/gdb.base/watchpoint-solib.exp | 13 ++----------- gdb/testsuite/gdb.reverse/sigall-reverse.exp | 15 ++++----------- gdb/testsuite/gdb.reverse/until-precsave.exp | 21 ++++++++------------- gdb/testsuite/lib/gdb.exp | 26 ++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 37 deletions(-) diff --git a/gdb/testsuite/gdb.base/watch-bitfields.exp b/gdb/testsuite/gdb.base/watch-bitfields.exp index 9d5293b..b7896bb 100644 --- a/gdb/testsuite/gdb.base/watch-bitfields.exp +++ b/gdb/testsuite/gdb.base/watch-bitfields.exp @@ -43,6 +43,8 @@ proc expect_watchpoint { expr old new } { # Check that -location watchpoints against bitfields trigger properly. proc test_watch_location {} { + global timeout + with_test_prefix "-location watch against bitfields" { if {![runto_main]} { return -1 @@ -54,13 +56,22 @@ proc test_watch_location {} { expect_watchpoint "q.e" 0 5 expect_watchpoint "q.a" 1 0 expect_watchpoint "q.e" 5 4 - gdb_continue_to_end + + # It'll execute a large amount of code with software watchpoint + # enabled, which means GDB will single stepping all the way + # through til the inferior exits. Increase the timeout by a + # factor of 4. + with_timeout_factor 4 { + gdb_continue_to_end + } } } # Check that regular watchpoints against expressions involving # bitfields trigger properly. proc test_regular_watch {} { + global timeout + with_test_prefix "regular watch against bitfields" { if {![runto_main]} { return -1 @@ -73,7 +84,14 @@ proc test_regular_watch {} { expect_watchpoint "q.d + q.f + q.g" 3 2 expect_watchpoint "q.d + q.f + q.g" 2 1 expect_watchpoint "q.d + q.f + q.g" 1 0 - gdb_continue_to_end + + # It'll execute a large amount of code with software watchpoint + # enabled, which means GDB will single stepping all the way + # through til the inferior exits. Increase the timeout by a + # factor of 4. + with_timeout_factor 4 { + gdb_continue_to_end + } } } diff --git a/gdb/testsuite/gdb.base/watchpoint-solib.exp b/gdb/testsuite/gdb.base/watchpoint-solib.exp index 85e83f7..9475b37 100644 --- a/gdb/testsuite/gdb.base/watchpoint-solib.exp +++ b/gdb/testsuite/gdb.base/watchpoint-solib.exp @@ -75,17 +75,8 @@ gdb_test "watch g" "atchpoint 3: g" "set watchpoint on g" gdb_test "continue" ".*New value = 1.*" "continue to watchpoint hit" rerun_to_main -set savedtimeout $timeout -if { [target_info exists gdb,timeout] - && $timeout < [target_info gdb,timeout] } { - set oldtimeout [target_info gdb,timeout] -} else { - set oldtimeout $timeout +with_timeout_factor 30 { + gdb_test "continue" ".*Breakpoint 2.*foo.*" "continue to foo again" } -set timeout [expr $oldtimeout * 30] - -gdb_test "continue" ".*Breakpoint 2.*foo.*" "continue to foo again" - -set timeout $savedtimeout gdb_test "continue" ".*New value = 1.*" "continue to watchpoint hit again" diff --git a/gdb/testsuite/gdb.reverse/sigall-reverse.exp b/gdb/testsuite/gdb.reverse/sigall-reverse.exp index 69152d4..065eea7 100644 --- a/gdb/testsuite/gdb.reverse/sigall-reverse.exp +++ b/gdb/testsuite/gdb.reverse/sigall-reverse.exp @@ -251,18 +251,11 @@ gdb_test "continue" \ "get signal TERM" gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM" -set savedtimeout $timeout -if { [target_info exists gdb,timeout] - && $timeout < [target_info gdb,timeout] } { - set oldtimeout [target_info gdb,timeout] -} else { - set oldtimeout $timeout +with_timeout_factor 2 { + gdb_test "continue" "\[process \[0-9\]+ .*" "continue to signal exit" \ + "The next instruction is syscall exit_group.* program...y. or n. " \ + "yes" } -set timeout [expr $oldtimeout * 2] -gdb_test "continue" "\[process \[0-9\]+ .*" "continue to signal exit" \ - "The next instruction is syscall exit_group.* program...y. or n. " \ - "yes" -set timeout $savedtimeout foreach sig [lreverse $signals] { test_one_sig_reverse $sig diff --git a/gdb/testsuite/gdb.reverse/until-precsave.exp b/gdb/testsuite/gdb.reverse/until-precsave.exp index 1684645..640839f 100644 --- a/gdb/testsuite/gdb.reverse/until-precsave.exp +++ b/gdb/testsuite/gdb.reverse/until-precsave.exp @@ -49,22 +49,17 @@ gdb_test "break $end_of_main" \ "BP at end of main" # This can take awhile. -set savedtimeout $timeout -if { [target_info exists gdb,timeout] - && $timeout < [target_info gdb,timeout] } { - set oldtimeout [target_info gdb,timeout] -} else { - set oldtimeout $timeout +with_timeout_factor 15 { + gdb_test "continue" "Breakpoint .* set breakpoint 10a here .*" "run to end of main" } -set timeout [expr $oldtimeout * 15] -gdb_test "continue" "Breakpoint .* set breakpoint 10a here .*" "run to end of main" # So can this, against gdbserver, for example. -set timeout [expr $oldtimeout * 3] -gdb_test "record save $precsave" \ - "Saved core file $precsave with execution log\." \ - "save process recfile" -set timeout $savedtimeout + +with_timeout_factor 3 { + gdb_test "record save $precsave" \ + "Saved core file $precsave with execution log\." \ + "save process recfile" +} gdb_test "kill" "" "Kill process, prepare to debug log file" \ "Kill the program being debugged\\? \\(y or n\\) " "y" diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 1448fba..bf72c53 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1919,6 +1919,32 @@ proc with_target_charset { target_charset body } { } } +# Run tests in BODY with timeout increased by factor of FACTOR. When +# BODY is finished, restore timeout. + +proc with_timeout_factor { factor body } { + global timeout + + set savedtimeout $timeout + if { [target_info exists gdb,timeout] + && $timeout < [target_info gdb,timeout] } { + set oldtimeout [target_info gdb,timeout] + } else { + set oldtimeout $timeout + } + set timeout [expr $oldtimeout * $factor] + + set code [catch {uplevel 1 $body} result] + if {$code == 1} { + global errorInfo errorCode + return -code $code -errorinfo $errorInfo -errorcode $errorCode $result + } else { + return -code $code $result + } + + set timeout $savedtimeout +} + # Return 1 if _Complex types are supported, otherwise, return 0. gdb_caching_proc support_complex_tests {