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 1inQLM-0000kv-D9 for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Jan 2020 17:02:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1inQLK-0007XL-WF for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Jan 2020 17:02:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1inQLK-0007XD-N7 for pgsql-hackers@lists.postgresql.org; Fri, 03 Jan 2020 17:02:34 +0000 Received: from feynman.df7cb.de ([195.49.152.168]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1inQLD-0004Fz-Ct for pgsql-hackers@postgresql.org; Fri, 03 Jan 2020 17:02:34 +0000 Received: from msg.df7cb.de (unknown [IPv6:2a02:908:1476:ff00:76e5:bff:fef3:7e00]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by feynman.df7cb.de (Postfix) with ESMTPSA id 47qB6B2kZqz3Dwk; Fri, 3 Jan 2020 18:02:26 +0100 (CET) Date: Fri, 3 Jan 2020 18:02:26 +0100 From: Christoph Berg To: Tom Lane Cc: PostgreSQL Hackers Subject: Re: pgsql: Add basic TAP tests for psql's tab-completion logic. Message-ID: <20200103170226.GB32629@msg.df7cb.de> Mail-Followup-To: Christoph Berg , Tom Lane , PostgreSQL Hackers MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <14261.1578060227@sss.pgh.pa.us> <13708.1578059577@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Re: Tom Lane 2020-01-03 <13708.1578059577@sss.pgh.pa.us> > I found out while investigating this that the libedit version shipping > with buster (3.1-20181209) is differently broken for the same case: (Fwiw this wasn't spotted before because we have this LD_PRELOAD hack that replaces libedit with readline at psql runtime. I guess that means that the hack is pretty stable... Still, looking forward to the day that OpenSSL is finally relicensing so we can properly link to readline.) Re: Tom Lane 2020-01-03 <14261.1578060227@sss.pgh.pa.us> > > Shouldn't this print some "expected foo, got bar" diagnostics instead > > of just dying? >=20 > BTW, as far as that goes, we do: see for instance the tail end of >=20 > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Ddesmoxytes&dt= =3D2020-01-02%2020%3A04%3A03 >=20 > ok 8 - offer multiple table choices > ok 9 - finish completion of one of multiple table choices > ok 10 - \r works > not ok 11 - complete \DRD to \drds >=20 > # Failed test 'complete \DRD to \drds' > # at t/010_tab_completion.pl line 64. > # Actual output was "\DRD=07" > ok 12 - \r works >=20 > Not sure why you are not seeing the "Actual output" bit in your log. > I used a "note" command to print it, maybe that's not best practice? I think best practice is to use something like like($out, qr/$pattern/, $annotation) instead of plain "ok()" which doesn't know about the actual values compared. The "&& !$timer->is_expired" condition can be dropped from the test because all we care about is if the output matches. I never really grasped in which contexts TAP is supposed to print the full test output ("ok 10 -..."). Apparently the way the testsuite is invoked at package build time only prints the terse failure summary in which "note"s aren't included. Is there a switch to configure that? > Also, while I'm asking for Perl advice: I can see in my editor that > there's a control-G bell character in that string, but this is far > from obvious on the web page. I'd kind of like to get the report > to escapify control characters so that what comes out is more like >=20 > # Actual output was "\DRD^G" > or > # Actual output was "\\DRD\007" >=20 > or some such. Anybody know an easy way to do that in Perl? I don't know for note(), but maybe like() would do that automatically. Christoph