From patchwork Tue Mar 26 14:46:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 31990 Received: (qmail 100199 invoked by alias); 26 Mar 2019 14:47:01 -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 99986 invoked by uid 89); 26 Mar 2019 14:47:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1875 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Mar 2019 14:46:59 +0000 Received: from [172.16.0.89] (192-222-157-41.qc.cable.ebox.net [192.222.157.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 72F321E478; Tue, 26 Mar 2019 10:46:57 -0400 (EDT) From: Simon Marchi Subject: Re: GDB version as convenience variable To: Eli Zaretskii Cc: gdb-patches@sourceware.org, brobecker@adacore.com References: <20181128001435.12703-1-tom@tromey.com> <83k1kxfzwo.fsf@gnu.org> <8736rja4i8.fsf@tromey.com> <83r2brhw8k.fsf@gnu.org> <87h8cmh1wg.fsf@tromey.com> <83va12gz8j.fsf@gnu.org> <87mumeb935.fsf@tromey.com> <83d0n8eyzw.fsf@gnu.org> <87d0n6adk2.fsf@tromey.com> <83imwyee29.fsf@gnu.org> <87d0n67d29.fsf@tromey.com> <83imwwc7pj.fsf@gnu.org> <83k1gts5it.fsf@gnu.org> <83r2aun9mk.fsf@gnu.org> <9d445bd2-28dd-be84-5414-510e061e4db1@simark.ca> <83mulin7ui.fsf@gnu.org> <83k1gmn6b2.fsf@gnu.org> <83imw6n4ny.fsf@gnu.org> Message-ID: Date: Tue, 26 Mar 2019 10:46:56 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <83imw6n4ny.fsf@gnu.org> On 2019-03-25 3:18 p.m., Eli Zaretskii wrote: >> Date: Mon, 25 Mar 2019 14:51:36 -0400 >> From: Simon Marchi >> Cc: gdb-patches@sourceware.org, brobecker@adacore.com >> >> comparing the output with gdb --version, or some other automated >> mean, would be perfect. > > Well, I never wrote any tests for GDB, and I'm not sure I have a > system on which to run such a test. So I hope someone else will add > this test. > Apparently, the test default.exp needs to be changed in any case, because it adds new convenience variables. Without modification, the "show convenience" test fails because there is a new entry it doesn't know about. So for now, I would suggest adding the modification below to your patch to keep the test passing. It is not obvious to change the test to match the convenience variable value against a variable or even against a regexp, because it uses gdb_test_list_exact, which does straight string comparison. Also, I am not sure if reading the output of "show version" and testing against that would be a really good test, because the implementation and the test would work essentially work the same way. So if the version string erroneously becomes 0.0.0 because of some bug in some script, the test would still pass, even though the values are wrong. At least, the following is simple and robust. Simon diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index ece1428e617e..9ff5144448d8 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -602,6 +602,8 @@ set show_conv_list \ {$_probe_arg10 = } \ {$_probe_arg11 = } \ {$_isvoid = } \ + {$_gdb_major = 8} \ + {$_gdb_minor = 4} \ } if ![skip_python_tests] { append show_conv_list \