From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13872 invoked by alias); 4 Feb 2010 06:08:57 -0000 Received: (qmail 13863 invoked by uid 22791); 4 Feb 2010 06:08:55 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Feb 2010 06:08:50 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 2E6002BABA9 for ; Thu, 4 Feb 2010 01:08:49 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id abglMV+OY6-M for ; Thu, 4 Feb 2010 01:08:49 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 9211B2BAB01 for ; Thu, 4 Feb 2010 01:08:48 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 3FB79F59A2; Thu, 4 Feb 2010 10:08:41 +0400 (RET) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [RFA/testsuite] Reset the timeout duration at the start of each testcase. Date: Thu, 04 Feb 2010 06:08:00 -0000 Message-Id: <1265263706-22569-1-git-send-email-brobecker@adacore.com> In-Reply-To: <20100129153726.GC30542@caradoc.them.org> References: <20100129153726.GC30542@caradoc.them.org> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-02/txt/msg00101.txt.bz2 Hello, This is a followup on a suggestion made during a previous thread (http://www.sourceware.org/ml/gdb-patches/2010-01/msg00630.html). The idea is to systematically reset the timeout, in order to prevent testcases that change its value without resetting it do not affect subsequent testcases. The suggestion was to find a per-start-of-exp-file hook, which I eventually found: gdb_init is always called before running any .exp file. I should say that I found this by reading the runtest.exp code rather than from the reading the dejagnu documentation. But I'm pretty sure it's fine to rely on this. So the approach is to use a global variable called default_test_timeout. The default is the same value as the timeout value set by runtest.exp. The user is allowed to override that default by setting a new value in a site.exp file. In chronological order: 1. site.exp is read 2. gdb.exp is read 3. for each .exp testcase: 3.a: call gdb_init 3.b: run the .exp testcase Based on this, I made two changes in gdb.exp: * set default_test_timeout during gdb.exp evaluation if not already overridden by the user (site.exp); * update gdb_init to reset timeout to default_test_timeout. I have tested this change by observing the value of the timeout variable at the start of a couple of testcases in a variety of situations, and it seems to work great. gdb/testsuite/ChangeLog: * lib/gdb.exp (default_test_timeout): New global variable. Set it to timeout if not already set. (gdb_init): Reset the value of timeout to default_test_timeout. Also tested by running the entire testsuite on x86_64-linux. I'll look at possible documentation if the patch gets in (we might decide to use a different variable name for the default, for instance). OK to apply? Thanks, -- Joel --- gdb/testsuite/lib/gdb.exp | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 9b06a2f..621fc3b 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2410,7 +2410,22 @@ proc default_gdb_init { args } { } } +# The default timeout used when testing GDB commands. We want to use +# the same timeout as the default dejagnu timeout, unless the user has +# already provided a specific value (probably through a site.exp file). +global default_test_timeout +if ![info exists default_test_timeout] { + set default_test_timeout $timeout +} + proc gdb_init { args } { + # Reset the timeout value to the default. This way, any testcase + # that changes the timeout value without resetting it cannot affect + # the timeout used in subsequent testcases. + global default_test_timeout + global timeout + set timeout $default_test_timeout + return [eval default_gdb_init $args]; } -- 1.6.3.3