From patchwork Wed May 13 01:09:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 6686 Received: (qmail 24536 invoked by alias); 13 May 2015 01:09:36 -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 24527 invoked by uid 89); 13 May 2015 01:09:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-qg0-f51.google.com Received: from mail-qg0-f51.google.com (HELO mail-qg0-f51.google.com) (209.85.192.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 13 May 2015 01:09:35 +0000 Received: by qgej70 with SMTP id j70so14062565qge.2 for ; Tue, 12 May 2015 18:09:33 -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:in-reply-to :references; bh=CjW7Y0qRszjmYhNPIFPZg8OWeCAONaHogbiCrN7wYSI=; b=JEcQhV3L5ZX9Ps1+6b4MdBKjM3K2oCctJ0BHzRdWjY3ZdWYRLlw3gNtfI4T6OkMkCN jQ4W0UHMj+LN5BwWeYcf7fiCiqhJda2YxpaYYZ/D14Jl74JCEfbL0q+iKTsWRW5Do65g FxIkwyoZTu8s+bB4OJiwnuarM0mAOkuTB8lKheGYPMrslDfHBMXl7XvGoOmGcOATgN7r bE7HvNOvvsb0L8w61ZQqhlZbx/mV4U/8TBGLmGXCQc/3Zee0VdaSjOZLPsW04bAIvOTQ 5mMKrW0MrT+a60o9JJypuOc3HKF1LQ1lDEmPl3+ygWvpDBF2vBP74sYxHNLAjkuZh/jp HBeg== X-Gm-Message-State: ALoCoQlgxiuUwNpjZM8o/TkFbpaco8KsXCLSuAClTEBrIKN19naWYt5RoBCgsC/eV/762ETPDIII X-Received: by 10.229.110.10 with SMTP id l10mr24479269qcp.5.1431479372966; Tue, 12 May 2015 18:09:32 -0700 (PDT) Received: from localhost.localdomain (ool-4353acd8.dyn.optonline.net. [67.83.172.216]) by mx.google.com with ESMTPSA id 6sm1471619qks.37.2015.05.12.18.09.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 May 2015 18:09:32 -0700 (PDT) From: Patrick Palka To: gdb-patches@sourceware.org Cc: Patrick Palka Subject: [PATCH] Test the setting of "history size" via $HOME/.gdbinit Date: Tue, 12 May 2015 21:09:26 -0400 Message-Id: <1431479366-18877-1-git-send-email-patrick@parcs.ath.cx> In-Reply-To: <55520D49.1010007@redhat.com> References: <55520D49.1010007@redhat.com> Heh, good point... Here is an updated patch that tests "show commands" too. gdb/testsuite/ChangeLog: PR gdb/17820 * gdb.base/gdbinit-history.exp: New test. * gdb.base/gdbinit-history/unlimited/.gdbinit: New file. * gdb.base/gdbinit-history/zero/.gdbinit: New file. --- gdb/testsuite/gdb.base/gdbinit-history.exp | 47 ++++++++++++++++++++++ .../gdb.base/gdbinit-history/unlimited/.gdbinit | 1 + .../gdb.base/gdbinit-history/zero/.gdbinit | 1 + 3 files changed, 49 insertions(+) create mode 100644 gdb/testsuite/gdb.base/gdbinit-history.exp create mode 100644 gdb/testsuite/gdb.base/gdbinit-history/unlimited/.gdbinit create mode 100644 gdb/testsuite/gdb.base/gdbinit-history/zero/.gdbinit diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp new file mode 100644 index 0000000..6caeb4b --- /dev/null +++ b/gdb/testsuite/gdb.base/gdbinit-history.exp @@ -0,0 +1,47 @@ +# Copyright 2015 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# This file is part of the gdb testsuite. + +# Test the setting of "history size" via $HOME/.gdbinit + +proc test_gdbinit_history_setting { home size } { + global env + global INTERNAL_GDBFLAGS + global srcdir + global subdir + + set old_home $env(HOME) + set env(HOME) "$srcdir/$subdir/$home" + set saved_internal_gdbflags $INTERNAL_GDBFLAGS + set INTERNAL_GDBFLAGS [string map {"-nx" ""} $INTERNAL_GDBFLAGS] + + gdb_exit + gdb_start + + gdb_test "show history size" "The size of the command history is $size." + + if { $size == "0" } { + gdb_test_no_output "show commands" + } elseif { $size != "1" } { + gdb_test "show commands" " . show history size\r\n . show commands" + } + + set INTERNAL_GDBFLAGS $saved_internal_gdbflags + set $env(HOME) $old_home +} + +test_gdbinit_history_setting "gdbinit-history/unlimited" "unlimited" +test_gdbinit_history_setting "gdbinit-history/zero" "0" diff --git a/gdb/testsuite/gdb.base/gdbinit-history/unlimited/.gdbinit b/gdb/testsuite/gdb.base/gdbinit-history/unlimited/.gdbinit new file mode 100644 index 0000000..6604d8f --- /dev/null +++ b/gdb/testsuite/gdb.base/gdbinit-history/unlimited/.gdbinit @@ -0,0 +1 @@ +set history size unlimited diff --git a/gdb/testsuite/gdb.base/gdbinit-history/zero/.gdbinit b/gdb/testsuite/gdb.base/gdbinit-history/zero/.gdbinit new file mode 100644 index 0000000..7cd6b24 --- /dev/null +++ b/gdb/testsuite/gdb.base/gdbinit-history/zero/.gdbinit @@ -0,0 +1 @@ +set history size 0