pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Berg <myon@debian.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: pgsql: Add basic TAP tests for psql's tab-completion logic.
Date: Fri, 3 Jan 2020 18:02:26 +0100
Message-ID: <20200103170226.GB32629@msg.df7cb.de> (raw)
In-Reply-To: <14261.1578060227@sss.pgh.pa.us> <13708.1578059577@sss.pgh.pa.us>

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?
> 
> BTW, as far as that goes, we do: see for instance the tail end of
> 
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=desmoxytes&dt=2020-01-02%2020%3A04%3A03
> 
> 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<tab> to \drds
> 
> #   Failed test 'complete \DRD<tab> to \drds'
> #   at t/010_tab_completion.pl line 64.
> # Actual output was "\DRD"
> ok 12 - \r works
> 
> 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
> 
> 	# Actual output was "\DRD^G"
> or
> 	# Actual output was "\\DRD\007"
> 
> 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





view thread (64+ messages)  latest in thread

Message-ID: <20200103170226.GB32629@msg.df7cb.de>
Permalink:  ../20200103170226.GB32629@msg.df7cb.de/
Also on:    postgresql.org/message-id/20200103170226.GB32629@msg.df7cb.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: myon@debian.org, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
  Subject: Re: pgsql: Add basic TAP tests for psql's tab-completion logic.
  In-Reply-To: <20200103170226.GB32629@msg.df7cb.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox