From patchwork Wed Jun 17 20:17:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 7226 Received: (qmail 86225 invoked by alias); 17 Jun 2015 20:17:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk 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 86210 invoked by uid 89); 17 Jun 2015 20:17:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-qc0-f180.google.com Received: from mail-qc0-f180.google.com (HELO mail-qc0-f180.google.com) (209.85.216.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 17 Jun 2015 20:17:30 +0000 Received: by qcwx2 with SMTP id x2so17630122qcw.1 for ; Wed, 17 Jun 2015 13:17:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oJlxM8It7LeJ60m2fTx2fOr5xZaIlUA8QijyM4wWLB4=; b=DX6mP+4KLx+BvawA4KLntx97tkyGo8vyPwfPg2MmnBtGJ1cvDK7tm+pz6u3Ek4icdn mXQI82A2wVAYrD9VDWyhsI2mb0MGOWdoQAd3yCLCjp5U7h78kjNaj2tQtjZJUdLecjUV WLH4QvbIhV3f3Z72fSZ2HFVF8r7Uk8a7LUG+PEC+tpY+ApIz5WmqHTPaxtPVUvnk5YRn AJoFfV1PzMooolfQ5PILHJ2anFFNmfQaHafI11ABCsFqjjFNmMQHnVt5Kt+Zdyo98cCx IelC/nykgQEv/vGnTO1UGmyboxIdHabf9S7aWyaj/dxXqYNpAmdXV9BVKxT0OWG6xa1F PEUA== X-Gm-Message-State: ALoCoQlfPV3hWwIKli0E+HToBJd9ZKb9UU8IQCwTY1wcSzFuFZaBEIQJYRi0LBVyo6aDW9mHFxk4 X-Received: by 10.55.18.27 with SMTP id c27mr9561307qkh.84.1434572248679; Wed, 17 Jun 2015 13:17:28 -0700 (PDT) Received: from localhost.localdomain (ool-4353acd8.dyn.optonline.net. [67.83.172.216]) by mx.google.com with ESMTPSA id n62sm1768792qha.18.2015.06.17.13.17.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Jun 2015 13:17:27 -0700 (PDT) From: Patrick Palka To: gdb-patches@sourceware.org Cc: Patrick Palka Subject: [PATCH] Test the interaction between GDBHISTSIZE and .gdbinit Date: Wed, 17 Jun 2015 16:17:21 -0400 Message-Id: <1434572241-16019-1-git-send-email-patrick@parcs.ath.cx> The value inside the GDBHISTSIZE environment variable, only if valid, should override setting the history size through one's .gdbinit file. gdb/testsuite/ChangeLog: * gdb.base/gdbinit-history.exp: Test the interaction between setting GDBHISTSIZE and setting the history size via .gdbinit. --- gdb/testsuite/gdb.base/gdbinit-history.exp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp index 7bdce5f..85177f3 100644 --- a/gdb/testsuite/gdb.base/gdbinit-history.exp +++ b/gdb/testsuite/gdb.base/gdbinit-history.exp @@ -19,9 +19,10 @@ # Check that the history size is properly set to SIZE when reading the .gdbinit -# file located in HOME. +# file located in HOME with the environment variable GDBHISTSIZE optionally +# set to GDBHISTSIZE_VAL. -proc test_gdbinit_history_setting { home size } { +proc test_gdbinit_history_setting { home size { gdbhistsize_val "-" } } { global env global INTERNAL_GDBFLAGS global srcdir @@ -36,10 +37,19 @@ proc test_gdbinit_history_setting { home size } { # set. unset -nocomplain env(GDBHISTSIZE) + if { $gdbhistsize_val != "-" } { + set env(GDBHISTSIZE) $gdbhistsize_val + } + set saved_internal_gdbflags $INTERNAL_GDBFLAGS set INTERNAL_GDBFLAGS [string map {"-nx" ""} $INTERNAL_GDBFLAGS] - with_test_prefix "home=$home" { + set prefix "home=$home" + if { $gdbhistsize_val != "-" } { + append prefix " gdbhistsize=$gdbhistsize_val" + } + + with_test_prefix $prefix { gdb_exit gdb_start @@ -54,6 +64,7 @@ proc test_gdbinit_history_setting { home size } { set INTERNAL_GDBFLAGS $saved_internal_gdbflags + unset -nocomplain env(GDBHISTSIZE) array set env [array get old_env] } @@ -117,3 +128,9 @@ test_gdbinit_history_setting "gdbinit-history/unlimited" "unlimited" test_gdbinit_history_setting "gdbinit-history/zero" "0" test_no_truncation_of_unlimited_history_file + +# A valid GDBHISTSIZE value overrides the setting inside the .gdbinit file; an +# invalid GDBHISTSIZE value is ignored, falling back on the setting inside the +# .gdbinit file. +test_gdbinit_history_setting "gdbinit-history/unlimited" "1000" "1000" +test_gdbinit_history_setting "gdbinit-history/unlimited" "unlimited" "foo"