Re: pgsql: Add basic TAP tests for psql's tab-completion logic.

Michael Paquier <[email protected]> Fri, 3 Jan 2020 20:46:07 +0900
Newsgroups gmane.comp.db.postgresql.devel.cvs
Message-ID <[email protected]>
On Thu, Jan 02, 2020 at 08:02:29PM +0000, Tom Lane wrote:
> Add basic TAP tests for psql's tab-completion logic.
> 
> Up to now, psql's tab-complete.c has had exactly no regression test
> coverage.  This patch is an experimental attempt to add some.
> 
> This needs Perl's IO::Pty module, which isn't installed everywhere,
> so the test script just skips all tests if that's not present.
> There may be other portability gotchas too, so I await buildfarm
> results with interest.

Reading through the commit logs, I am not a fan of this part:
+if ($ENV{with_readline} ne 'yes')
+{
+   plan skip_all => 'readline is not supported by this build';
+}
+
+# If we don't have IO::Pty, forget it, because IPC::Run depends on that
+# to support pty connections
+eval { require IO::Pty; };
+if ($@)
+{
+   plan skip_all => 'IO::Pty is needed to run this test';
+}

This has the disadvantage to have people never actually notice if the
tests are running or not because this does not generate a dependency
error.  Skipping things if libreadline is not around is perfectly fine
IMO, but I think that we should harden things for IO::Pty by removing
this skipping part, and by adding a test in configure.in's
AX_PROG_PERL_MODULES.  That would be also more consistent with the
approach we take with other tests.
--
Michael
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl4PKX8ACgkQnvQgOdby
QH1w9Q/9GiwpOee3gvqNVxz1J/GOL/65/cB3zM5kzdiLrGen2k38/ldHSae9JEmz
AYfn31HlvUM3lr3++0ekMCmNZn0+C3nRw/szFZsIOejPsdPtWI+MBjW+QkGlPgHo
lXbpznEE4kHiZnpDUpl5jM0GZdLaeNe8NQ+p8P0FLdg3hCV64jvOqQXf62BK+aCZ
Rzb+FW/4CQI17Mkp/2bgg48UHGTYk3BS5/olwwC096jrWAS05Nlqb/IQXLbwhjYI
31pQG+cuagBPJJGO2vfWItlmKSZoqJfBceQxp/FgjtuE1qji1lz2432sVKi3h3yo
b0fRlwOoFbSNBCB8u7ZqmZHr/C/mxTdgTaJ74S3LshDkuCcs19Ugorno0WBwCHWx
EM+FPFVH4nBGxL2uXDMOzDzItP21uUxBESoCl82Q88NVJuIiud3eB8/WCDF3LSSz
oGccipbY0J5kc323TwfbHQmAi5vuzVcpkpeXJYacadMttJNJJAdwTLlQse64CVX4
IkQYuzxaJ5YzJLkmxPQeDSv1jgEV8ulCgeUskjO/nFpo3BaZNJ4fk8795ROM9WG3
8GL4OMFdx8cJfX77MiBTl4zVBtWCzr1omlERJ/BJCb4XT6TF5xKosSaPIYzNQyO7
kl0Ts15wOjk7MLeCR4UMbCOIdfwtR85gGPgGJdebFhjS0FAfcDA=
=AhiE
-----END PGP SIGNATURE-----