Rewriting the test of pg_upgrade as a TAP test - take two

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Postgres hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Rewriting the test of pg_upgrade as a TAP test - take two
Date: 2018-01-26 08:00:26
Message-ID: 20180126080026.GI17847@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

As promised on a recent thread, here is a second tentative to switch
pg_upgrade's test.sh into a TAP infrastructure.

This is a continuation of the following thread:
https://www.postgresql.org/message-id/CAB7nPqRdaN1A1YNjxNL9T1jUEWct8ttqq29dNv8W_o37%2Be8wfA%40mail.gmail.com

To begin with, compared to last version, I found and fixed a couple of
bugs, and I also implemented an interface which allows for tests of
pg_upgrade across major versions. The patch set is as follows:
- 0001 refactors PostgresNode.pm so as a node's binary path is
registered when created and can be enforced by the test creating the
node via get_new_node. That's useful for pg_upgrade because we want to
use different binary paths for the node to-be-upgraded and the new one.
This is also useful for test suites willing to work on cross-version
tests.
- 0002 begins the move to a TAP suite by introducing a base set of tests
for pg_upgrade.
- 0003 is the real meat, and removes test.sh in favor of a TAP script
aimed at supporting tests using the same version as well as
cross-version tests.

In order to do that, I have changed a bit the interface used for those
tests. A use can enforce the following variables to run a test using a
past version, while the new version is the one of the tree where the TAP
script is kicked:
export oldsrc=...somewhere/postgresql (old version's source tree)
export oldbindir=...otherversion/bin (old version's installed bin dir)
export oldlibdir=...otherversion/lib (old version's installed lib dir)
make check

That is documented as well in TESTING in the patch. While the patch is
working great when working on the same major version, there is still an
issue I am facing related to the loading of shared libraries in
src/test/regress/ for the old server's version after upgrading it. Even
by tweaking LD_LIBRARY_PATH I could not get the path load. The patch has
been tweaked so as the objects from regression tests that depend on
regress.so, autoinc.so and refint.so are not generated, allowing
pg_upgrade to work, which is definitely wrong. I am sure that I missed
a trick here but it is Friday here ;p

Note also that the diff of the dump still needs to be eyeballed for two
reasons:
- hash index handling is different in v10~, as those exist now in the
dumps taken.
- PostgreSQL origin version string shows up.
We could apply as well some post-filters to allow the test to pass, but
that's one subject I would like to discuss on this thread.

Another topic that I would like to discuss is how this interface is fit
for the buildfarm code. After hacking my stuff, I have looked at the
buildfarm code to notice that things like TestUpgradeXversion.pm do
*not* make use of test.sh, and that what I hacked is much similar to
what the buildfarm code is doing, which is itself roughly a copy of what
test.sh does. Andrew, your feedback would be important here.

So, thoughts?
--
Michael

Attachment Content-Type Size
0001-Refactor-PostgresNode.pm-so-as-nodes-can-use-custom-.patch text/x-diff 8.4 KB
0002-Add-basic-TAP-test-setup-for-pg_upgrade.patch text/x-diff 1.7 KB
0003-Replace-pg_upgrade-s-test.sh-by-a-TAP-test.patch text/x-diff 24.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-01-26 08:23:41 Re: JIT compiling with LLVM v9.0
Previous Message Konstantin Knizhnik 2018-01-26 07:56:06 Re: AS OF queries