From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42258 invoked by alias); 10 Jul 2019 22:31:42 -0000 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 Received: (qmail 42250 invoked by uid 89); 10 Jul 2019 22:31:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,UNSUBSCRIBE_BODY autolearn=no version=3.3.1 spammy=harsh X-HELO: mailsec108.isp.belgacom.be Received: from mailsec108.isp.belgacom.be (HELO mailsec108.isp.belgacom.be) (195.238.20.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Jul 2019 22:31:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1562797900; x=1594333900; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=e/gRyBUjrmdIgCgHBRJQW+HMo7RNqUhXFQfsHmm8WEI=; b=P1zg50J0bOdhR7EHKBO7fFvQfHwWImy/kvFVqOGhEMqr2NSZrlbAVkH7 Pxl1Guapne9gz7iEGNsYFPW06ufa1Q==; Received: from 96.218-128-109.adsl-dyn.isp.belgacom.be (HELO md) ([109.128.218.96]) by relay.skynet.be with ESMTP/TLS/AES256-GCM-SHA384; 11 Jul 2019 00:31:38 +0200 Message-ID: <1562797898.1521.10.camel@skynet.be> Subject: Re: [RFA] Make first and last lines of 'command help documentation' consistent. From: Philippe Waroquiers To: Tom Tromey Cc: gdb-patches@sourceware.org Date: Wed, 10 Jul 2019 22:31:00 -0000 In-Reply-To: <874l3tg6vh.fsf@tromey.com> References: <20190616195804.9427-1-philippe.waroquiers@skynet.be> <874l3tg6vh.fsf@tromey.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-07/txt/msg00288.txt.bz2 On Wed, 2019-07-10 at 11:02 -0600, Tom Tromey wrote: > Philippe> + /* Checks that the documentation does not help with a new line. > Philippe> + If it does, output a special marker string that gdb.base/help.exp > Philippe> + will detect. */ > Philippe> + if (c->doc[strlen (c->doc) - 1] == '\n') > Philippe> + fprintf_filtered (stream, "END_OF_LINE@END_OF_DOC %s%s\n", > Philippe> + prefix, c->name); > > I think this can't be an assertion, because user commands could hit it, > and that seems too harsh; but could it be a unit test? That might be > better than printing something magic, especially since IIUC the user can > end up seeing this stuff. Effectively, the user can end up seeing this, but only if the GDB test was not run and/or was not fixed. > Philippe> +gdb_test_no_output \ > Philippe> + "|apropos .| grep -e '\[^\.\]$' -e '^END_OF_LINE@END_OF_DOC '" \ > Philippe> + "command help doc first line ends with a dot, doc does not end with eol" > > I'm not sure we can rely on having grep in the test suite. If you > switch the patch to a self-test, then this is moot; otherwise, is this > used elsewhere? I think a different approach is to write to a log file > and then examine it with Tcl. I believe some other tests do this. The testsuite uses various unix commands such as mv/touch/grep/stty/... But maybe these tests are all failing e.g. on windows ? In any case, I will see if it is easy to do a selftest instead, without duplicating too much of e.g. the recursive traversal of the commands, maybe by adding a 'for_self_test' boolean arg to apropos_command ... Thanks for the comments, Philippe