Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ilSjd-00056A-9X for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Dec 2019 07:11:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ilSjb-00044Q-SQ for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Dec 2019 07:11:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ilSjb-000444-AM for pgsql-hackers@lists.postgresql.org; Sun, 29 Dec 2019 07:11:31 +0000 Received: from courriel.mines-paristech.fr ([77.158.173.149] helo=antispam-1.ensmp.fr) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ilSjX-0004Uk-5A for pgsql-hackers@lists.postgresql.org; Sun, 29 Dec 2019 07:11:30 +0000 Received: from smtp-4.mines-paristech.fr (smtp-4.ensmp.fr [77.158.173.143]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by antispam-1.ensmp.fr (antispam.mines-paristech.fr) with ESMTPS id 2713F57CE2; Sun, 29 Dec 2019 08:11:13 +0100 (CET) Received: from pc54.home (agrenoble-653-1-42-9.w92-129.abo.wanadoo.fr [92.129.130.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-4.mines-paristech.fr (Postfix) with ESMTPSA id E4A022C0091; Sun, 29 Dec 2019 08:11:12 +0100 (CET) Date: Sun, 29 Dec 2019 08:11:07 +0100 (CET) From: Fabien COELHO X-X-Sender: fabien@pseudo To: Tom Lane cc: PostgreSQL Developers Subject: Re: TAP testing for psql's tab completion code In-Reply-To: <7904.1577573534@sss.pgh.pa.us> Message-ID: References: <10967.1577562752@sss.pgh.pa.us> <7904.1577573534@sss.pgh.pa.us> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-CLAMAV-SCAN: ok X-VRSPAM-SCORE: 0 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdefvddgtdehucetufdoteggodetrfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffujgfkfhgfgggtsehttdertddtredvnecuhfhrohhmpefhrggsihgvnhcuvefqgffnjffquceotghovghlhhhosegtrhhirdgvnhhsmhhprdhfrheqnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenucfkphepledvrdduvdelrddufedtrdelnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhht X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello Tom, >>> We've often talked about the problem that we have no regression test >>> coverage for psql's tab completion code. I got interested in this >>> issue while messing with the filename completion logic therein [1], >>> so here is a draft patch that adds some testing for that code. > >> After you raised the issue, I submitted something last August, which did >> not attract much attention. >> https://commitfest.postgresql.org/26/2262/ >> It covers some tab-completion stuff. It uses Expect for the interactive >> stuff (tab completion, \h, ...). > > Now that you mention it, I seem to recall looking at that and not being > happy with the additional dependency on Expect. Possibly. You did not say it out very loud. > Expect is *not* a standard module; Somehow. It is an old one, though. > on the machines I have handy, the only one in which it appears in the > default Perl installation is macOS. (Huh, what's Apple doing out ahead > of the pack?) I'm pretty sure that Expect also relies on IO::Pty, Indeed, it does. > so it's a strictly worse dependency than what I've got here. If you have to install IO::Pty anyway, ISTM you can also install Expect. IO::Pty documentation says that it is "mainly used by Expect", which is a clue that IO::Pty is not much better than Expect as a dependency. For installation, "apt install libexpect-perl" did the trick for me. "cpan install Expect" should work as well on most setup. I guess it is possible to check whether Expect is available and to skip the corresponding tests if not. > Can we recast what you did into something like this patch's methods? Basically it means reimplementing some expect functionality in the script, including new bugs. Modules were invented to avert that, so I cannot say I'm happy with the prospect of re-inventing the wheel. Note that Expect is a pure-perl 1600-LOC module. Anyway, I'll have a look. At least I used a very limited subset of Expect capabilities which should help matters along. -- Fabien.