Extract generic bash initialization process from pg_upgrade

Such initialization is useful as well for some other utilities and makes
test settings consistent.
Buffer capture facility: check WAL replay consistency

It is a tool aimed to be used by developers and buildfarm machines that
can be used to check for consistency at page level when replaying WAL
files among several nodes of a cluster (generally master and standby
node).

This facility is made of two parts:
- A server part, where all the changes happening at page level are
captured and inserted in a file called buffer_captures located at the
root of PGDATA. Each buffer entry is masked to make the comparison
across node consistent (flags like hint bits for example) and then each
buffer is captured is with the following format as a single line of
the output file:
LSN: %08X/%08X page: PAGE_IN_HEXA
Hexadecimal format makes it easier to detect differences between pages,
and format is chosen to facilitate comparison between buffer entries.
- A client part, located in contrib/buffer_capture_cmp, that can be used
to compare buffer captures between nodes.

The footprint on core code is minimal and is controlled by a CFLAGS
called BUFFER_CAPTURE that needs to be set at build time to enable the
buffer capture at server level. If this symbol is not enabled, both
server and client parts are idle and generate nothing.

Note that this facility can generate a lot of output (11G when running
regression tests, counting double when using both master and standby).

contrib/buffer_capture_cmp contains a regression test facility easing
testing with buffer captures. The user just needs to run "make check"
in this folder... There is a default set of tests saved in test-default.sh
but user is free to set up custom tests by creating a file called
test-custom.sh that can be kicked by the test facility if this file
is present instead of the defaults.