On non-Windows machines, you can execute the testing process
described below by running the following command in this directory:
+
make check
This will run the TAP tests to run pg_upgrade, performing an upgrade
export oldinstall=...otherversion/ (old version's install base path)
Finally, the tests can be done by running
+
make check
+You can also test the different transfer modes (--copy, --link,
+--clone) by setting the environment variable PG_TEST_PG_UPGRADE_MODE
+to the respective command-line option, like
+
+ make check PG_TEST_PG_UPGRADE_MODE=--link
+
+The default is --copy. Note that the other modes are not supported on
+all operating systems.
+
DETAILS
-------
use PostgreSQL::Test::Utils;
use Test::More;
+# Can be changed to test the other modes.
+my $mode = $ENV{PG_TEST_PG_UPGRADE_MODE} || '--copy';
+
# Generate a database with a name made of a range of ASCII characters.
sub generate_db
{
my $dump1_file = "$tempdir/dump1.sql";
my $dump2_file = "$tempdir/dump2.sql";
+note "testing using transfer mode $mode";
+
# Initialize node to upgrade
my $oldnode =
PostgreSQL::Test::Cluster->new('old_node',
# --inputdir points to the path of the input files.
my $inputdir = "$srcdir/src/test/regress";
+ note 'running regression tests in old instance';
my $rc =
system($ENV{PG_REGRESS}
. " $extra_opts "
'-s', $newnode->host,
'-p', $oldnode->port,
'-P', $newnode->port,
- '--check'
+ $mode,
+ '--check',
],
'run of pg_upgrade --check for new instance with incorrect binary path');
ok(-d $newnode->data_dir . "/pg_upgrade_output.d",
'-D', $newnode->data_dir, '-b', $oldbindir,
'-B', $newbindir, '-s', $newnode->host,
'-p', $oldnode->port, '-P', $newnode->port,
- '--check'
+ $mode,
+ '--check',
],
'run of pg_upgrade --check for new instance');
ok(!-d $newnode->data_dir . "/pg_upgrade_output.d",
'pg_upgrade', '--no-sync', '-d', $oldnode->data_dir,
'-D', $newnode->data_dir, '-b', $oldbindir,
'-B', $newbindir, '-s', $newnode->host,
- '-p', $oldnode->port, '-P', $newnode->port
+ '-p', $oldnode->port, '-P', $newnode->port,
+ $mode,
],
'run of pg_upgrade for new instance');
ok( !-d $newnode->data_dir . "/pg_upgrade_output.d",