From b65814280fc3e024f4ef72286f6f56932160121b Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Tue, 6 Dec 2016 01:59:09 -0800 Subject: [PATCH] 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. --- src/test/regress/Makefile | 3 +++ src/test/regress/pg_regress_multi.pl | 35 ++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/test/regress/Makefile b/src/test/regress/Makefile index 7ad661a36..6b1d2c7f4 100644 --- a/src/test/regress/Makefile +++ b/src/test/regress/Makefile @@ -53,6 +53,9 @@ check-isolation: all tempinstall-main $(pg_regress_multi_check) --load-extension=citus --isolationtester \ -- $(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 $(pg_regress_multi_check) --load-extension=citus \ --server-option=citus.task_executor_type=task-tracker \ diff --git a/src/test/regress/pg_regress_multi.pl b/src/test/regress/pg_regress_multi.pl index 161e69e70..9aa45f42c 100755 --- a/src/test/regress/pg_regress_multi.pl +++ b/src/test/regress/pg_regress_multi.pl @@ -27,6 +27,7 @@ sub Usage() print "\n"; print "Multi Options:\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 " --libdir Path to postgres library directory\n"; print " --postgres-builddir Path to postgres build directory\n"; @@ -39,6 +40,7 @@ sub Usage() # Option parsing my $isolationtester = 0; +my $vanillatest = 0; my $bindir = ""; my $libdir = undef; my $pgxsdir = ""; @@ -57,6 +59,7 @@ my $serversAreShutdown = "TRUE"; GetOptions( 'isolationtester' => \$isolationtester, + 'vanillatest' => \$vanillatest, 'bindir=s' => \$bindir, 'libdir=s' => \$libdir, 'pgxsdir=s' => \$pgxsdir, @@ -109,6 +112,19 @@ directory is present locally 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 my $masterPort = 57636; my $workerCount = 2; @@ -144,7 +160,7 @@ for my $option (@userPgOptions) } #define data types as a name->definition -%dataTypes = ('dummy_type', '(i integer)', +%dataTypes = ('dummy_type', '(i integer)', 'order_side', ' ENUM (\'buy\', \'sell\')', 'test_composite_type', '(i integer, i2 integer)', 'bug_status', ' ENUM (\'new\', \'open\', \'closed\')'); @@ -348,17 +364,26 @@ push(@arguments, @ARGV); my $startTime = time(); # Finally run the tests -if (!$isolationtester) +if ($vanillatest) { - system("$plainRegress", @arguments) == 0 - or die "Could not run regression tests"; + push(@arguments, "--schedule=${postgresSrcdir}/parallel_schedule"); + $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"); system("$isolationRegress", @arguments) == 0 or die "Could not run isolation tests"; } +else +{ + system("$plainRegress", @arguments) == 0 + or die "Could not run regression tests"; +} my $endTime = time();