As we all know, the client programs (src/bin/) don't have any real test
suites. Some pieces are tested as part of the backend regression tests,
some as part of the pg_upgrade test script, but nothing is specifically
targeted, and pg_basebackup for example is not tested at all.
So I wrote something.
I chose to use Perl-based tools, prove and Test::More, because those are
available in a standard Perl installation, and we already require that.
I put together three handfuls of tests to show what it would look like.
For extra fun, I added a "todo" test in pg_basebackup for a feature
that's currently being proposed in the commit fest.
A significant near-future project would be adding tests for pg_dump and
pg_upgrade.
Lots of things to argue about here: tools, file layout, naming, Perl
code, test quality, etc.
To try it out, apply the attached patch and run make -C src/bin check
(or installcheck, after installation).