Add support for running postgres tests against a database with citus loaded.

Not that this is not with the citus *extension* loaded, just the shared
library. The former runs (by adding --use-existing to the flags) but
has a bunch of trivial test differences.
pull/1017/head
Andres Freund 2016-12-06 01:59:09 -08:00
parent a426c50a8c
commit b65814280f
2 changed files with 33 additions and 5 deletions

View File

@ -53,6 +53,9 @@ check-isolation: all tempinstall-main
$(pg_regress_multi_check) --load-extension=citus --isolationtester \ $(pg_regress_multi_check) --load-extension=citus --isolationtester \
-- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/isolation_schedule $(EXTRA_TESTS) -- $(MULTI_REGRESS_OPTS) --schedule=$(citus_abs_srcdir)/isolation_schedule $(EXTRA_TESTS)
check-vanilla: all tempinstall-main
$(pg_regress_multi_check) --load-extension=citus --vanillatest
check-multi-task-tracker-extra: all tempinstall-main check-multi-task-tracker-extra: all tempinstall-main
$(pg_regress_multi_check) --load-extension=citus \ $(pg_regress_multi_check) --load-extension=citus \
--server-option=citus.task_executor_type=task-tracker \ --server-option=citus.task_executor_type=task-tracker \

View File

@ -27,6 +27,7 @@ sub Usage()
print "\n"; print "\n";
print "Multi Options:\n"; print "Multi Options:\n";
print " --isolationtester Run isolationtester tests instead of plain tests\n"; print " --isolationtester Run isolationtester tests instead of plain tests\n";
print " --vanillatest Run postgres tests with citus loaded as shared preload library\n";
print " --bindir Path to postgres binary directory\n"; print " --bindir Path to postgres binary directory\n";
print " --libdir Path to postgres library directory\n"; print " --libdir Path to postgres library directory\n";
print " --postgres-builddir Path to postgres build directory\n"; print " --postgres-builddir Path to postgres build directory\n";
@ -39,6 +40,7 @@ sub Usage()
# Option parsing # Option parsing
my $isolationtester = 0; my $isolationtester = 0;
my $vanillatest = 0;
my $bindir = ""; my $bindir = "";
my $libdir = undef; my $libdir = undef;
my $pgxsdir = ""; my $pgxsdir = "";
@ -57,6 +59,7 @@ my $serversAreShutdown = "TRUE";
GetOptions( GetOptions(
'isolationtester' => \$isolationtester, 'isolationtester' => \$isolationtester,
'vanillatest' => \$vanillatest,
'bindir=s' => \$bindir, 'bindir=s' => \$bindir,
'libdir=s' => \$libdir, 'libdir=s' => \$libdir,
'pgxsdir=s' => \$pgxsdir, 'pgxsdir=s' => \$pgxsdir,
@ -109,6 +112,19 @@ directory is present locally
MESSAGE MESSAGE
} }
my $vanillaRegress = "${postgresBuilddir}/src/test/regress/pg_regress";
if ($vanillatest && ! -f "$vanillaRegress")
{
die <<"MESSAGE";
pg_regress (for vanilla tests) not found at $vanillaRegress.
Vanilla tests can only be run when source (detected as ${postgresSrcdir})
and build (detected as ${postgresBuilddir}) directory corresponding to $bindir
are present.
MESSAGE
}
# Set some default configuration options # Set some default configuration options
my $masterPort = 57636; my $masterPort = 57636;
my $workerCount = 2; my $workerCount = 2;
@ -144,7 +160,7 @@ for my $option (@userPgOptions)
} }
#define data types as a name->definition #define data types as a name->definition
%dataTypes = ('dummy_type', '(i integer)', %dataTypes = ('dummy_type', '(i integer)',
'order_side', ' ENUM (\'buy\', \'sell\')', 'order_side', ' ENUM (\'buy\', \'sell\')',
'test_composite_type', '(i integer, i2 integer)', 'test_composite_type', '(i integer, i2 integer)',
'bug_status', ' ENUM (\'new\', \'open\', \'closed\')'); 'bug_status', ' ENUM (\'new\', \'open\', \'closed\')');
@ -348,17 +364,26 @@ push(@arguments, @ARGV);
my $startTime = time(); my $startTime = time();
# Finally run the tests # Finally run the tests
if (!$isolationtester) if ($vanillatest)
{ {
system("$plainRegress", @arguments) == 0 push(@arguments, "--schedule=${postgresSrcdir}/parallel_schedule");
or die "Could not run regression tests"; $ENV{PGHOST} = $host;
$ENV{PGPORT} = $masterPort;
$ENV{PGUSER} = $user;
system("make -C $postgresBuilddir/src/test/regress installcheck-parallel")
} }
else elsif ($isolationtester)
{ {
push(@arguments, "--dbname=regression"); push(@arguments, "--dbname=regression");
system("$isolationRegress", @arguments) == 0 system("$isolationRegress", @arguments) == 0
or die "Could not run isolation tests"; or die "Could not run isolation tests";
} }
else
{
system("$plainRegress", @arguments) == 0
or die "Could not run regression tests";
}
my $endTime = time(); my $endTime = time();