2007-09-23 23:52:56 +02:00
|
|
|
# -*-perl-*- hey - emacs - this is a perl file
|
|
|
|
|
2010-09-20 22:08:53 +02:00
|
|
|
# src/tools/msvc/vcregress.pl
|
2007-09-23 23:52:56 +02:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
our $config;
|
|
|
|
|
|
|
|
use Cwd;
|
|
|
|
use File::Copy;
|
|
|
|
|
|
|
|
my $startdir = getcwd();
|
|
|
|
|
|
|
|
chdir "../../.." if (-d "../../../src/tools/msvc");
|
|
|
|
|
2011-04-19 21:01:15 +02:00
|
|
|
require 'src/tools/msvc/config_default.pl';
|
|
|
|
require 'src/tools/msvc/config.pl' if (-f 'src/tools/msvc/config.pl');
|
2010-03-02 18:06:51 +01:00
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
# buildenv.pl is for specifying the build environment settings
|
|
|
|
# it should contian lines like:
|
|
|
|
# $ENV{PATH} = "c:/path/to/bison/bin;$ENV{PATH}";
|
|
|
|
|
|
|
|
if ( -e "src/tools/msvc/buildenv.pl")
|
|
|
|
{
|
|
|
|
require "src/tools/msvc/buildenv.pl";
|
|
|
|
}
|
|
|
|
|
|
|
|
my $what = shift || "";
|
2011-05-15 23:55:05 +02:00
|
|
|
if ($what =~ /^(check|installcheck|plcheck|contribcheck|ecpgcheck|isolationcheck)$/i)
|
2007-09-23 23:52:56 +02:00
|
|
|
{
|
|
|
|
$what = uc $what;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
usage();
|
|
|
|
}
|
|
|
|
|
|
|
|
# use a capital C here because config.pl has $config
|
|
|
|
my $Config = -e "release/postgres/postgres.exe" ? "Release" : "Debug";
|
|
|
|
|
2008-05-30 02:04:32 +02:00
|
|
|
copy("$Config/refint/refint.dll","src/test/regress");
|
|
|
|
copy("$Config/autoinc/autoinc.dll","src/test/regress");
|
2007-09-23 23:52:56 +02:00
|
|
|
copy("$Config/regress/regress.dll","src/test/regress");
|
2010-09-28 16:00:28 +02:00
|
|
|
copy("$Config/dummy_seclabel/dummy_seclabel.dll","src/test/regress");
|
2007-09-23 23:52:56 +02:00
|
|
|
|
|
|
|
$ENV{PATH} = "../../../$Config/libpq;../../$Config/libpq;$ENV{PATH}";
|
|
|
|
|
|
|
|
my $schedule = shift;
|
|
|
|
unless ($schedule)
|
|
|
|
{
|
2010-04-09 15:05:58 +02:00
|
|
|
$schedule = "serial";
|
|
|
|
$schedule = "parallel" if ($what eq 'CHECK' || $what =~ /PARALLEL/);
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
my $topdir = getcwd();
|
|
|
|
|
|
|
|
$ENV{PERL5LIB} = "$topdir/src/tools/msvc";
|
|
|
|
|
|
|
|
my $maxconn = "";
|
|
|
|
$maxconn = "--max_connections=$ENV{MAX_CONNECTIONS}"
|
|
|
|
if $ENV{MAX_CONNECTIONS};
|
|
|
|
|
|
|
|
my $temp_config = "";
|
|
|
|
$temp_config = "--temp-config=\"$ENV{TEMP_CONFIG}\""
|
2010-04-09 15:05:58 +02:00
|
|
|
if $ENV{TEMP_CONFIG};
|
2007-09-23 23:52:56 +02:00
|
|
|
|
|
|
|
chdir "src/test/regress";
|
|
|
|
|
|
|
|
my %command = (
|
|
|
|
CHECK => \&check,
|
|
|
|
PLCHECK => \&plcheck,
|
|
|
|
INSTALLCHECK => \&installcheck,
|
|
|
|
ECPGCHECK => \&ecpgcheck,
|
|
|
|
CONTRIBCHECK => \&contribcheck
|
|
|
|
);
|
|
|
|
|
|
|
|
my $proc = $command{$what};
|
|
|
|
|
|
|
|
exit 3 unless $proc;
|
|
|
|
|
|
|
|
&$proc();
|
|
|
|
|
|
|
|
exit 0;
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
sub installcheck
|
|
|
|
{
|
|
|
|
my @args = (
|
2010-04-09 15:05:58 +02:00
|
|
|
"../../../$Config/pg_regress/pg_regress","--dlpath=.",
|
|
|
|
"--psqldir=../../../$Config/psql","--schedule=${schedule}_schedule",
|
2011-04-15 07:42:05 +02:00
|
|
|
"--encoding=SQL_ASCII","--no-locale"
|
2007-09-23 23:52:56 +02:00
|
|
|
);
|
|
|
|
push(@args,$maxconn) if $maxconn;
|
|
|
|
system(@args);
|
|
|
|
my $status = $? >>8;
|
|
|
|
exit $status if $status;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub check
|
|
|
|
{
|
|
|
|
my @args = (
|
2010-04-09 15:05:58 +02:00
|
|
|
"../../../$Config/pg_regress/pg_regress","--dlpath=.",
|
|
|
|
"--psqldir=../../../$Config/psql","--schedule=${schedule}_schedule",
|
2011-04-15 07:42:05 +02:00
|
|
|
"--encoding=SQL_ASCII","--no-locale",
|
2010-04-09 15:05:58 +02:00
|
|
|
"--temp-install=./tmp_check","--top-builddir=\"$topdir\""
|
2007-09-23 23:52:56 +02:00
|
|
|
);
|
|
|
|
push(@args,$maxconn) if $maxconn;
|
2010-04-09 15:05:58 +02:00
|
|
|
push(@args,$temp_config) if $temp_config;
|
2007-09-23 23:52:56 +02:00
|
|
|
system(@args);
|
|
|
|
my $status = $? >>8;
|
|
|
|
exit $status if $status;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub ecpgcheck
|
|
|
|
{
|
|
|
|
chdir $startdir;
|
|
|
|
system("msbuild ecpg_regression.proj /p:config=$Config");
|
|
|
|
my $status = $? >>8;
|
|
|
|
exit $status if $status;
|
|
|
|
chdir "$topdir/src/interfaces/ecpg/test";
|
|
|
|
$schedule="ecpg";
|
|
|
|
my @args = (
|
|
|
|
"../../../../$Config/pg_regress_ecpg/pg_regress_ecpg",
|
|
|
|
"--psqldir=../../../$Config/psql",
|
|
|
|
"--dbname=regress1,connectdb",
|
2007-10-03 13:34:11 +02:00
|
|
|
"--create-role=connectuser,connectdb",
|
2007-09-23 23:52:56 +02:00
|
|
|
"--schedule=${schedule}_schedule",
|
2011-04-15 07:42:05 +02:00
|
|
|
"--encoding=SQL_ASCII",
|
2007-09-23 23:52:56 +02:00
|
|
|
"--no-locale",
|
|
|
|
"--temp-install=./tmp_chk",
|
2008-12-01 14:39:45 +01:00
|
|
|
"--top-builddir=\"$topdir\""
|
2007-09-23 23:52:56 +02:00
|
|
|
);
|
|
|
|
push(@args,$maxconn) if $maxconn;
|
|
|
|
system(@args);
|
|
|
|
$status = $? >>8;
|
|
|
|
exit $status if $status;
|
|
|
|
}
|
|
|
|
|
2011-05-15 23:55:05 +02:00
|
|
|
sub isolationcheck
|
|
|
|
{
|
|
|
|
chdir "../isolation";
|
|
|
|
copy("../../../$Config/isolation_tester/isolation_tester.exe",".");
|
|
|
|
my @args = (
|
|
|
|
"../../../$Config/pg_isolation_regress/pg_isolation_regress",
|
|
|
|
"--inputdir=.", "--schedule=./isolation_schedule"
|
|
|
|
);
|
|
|
|
push(@args,$maxconn) if $maxconn;
|
|
|
|
system(@args);
|
|
|
|
my $status = $? >>8;
|
|
|
|
exit $status if $status;
|
|
|
|
}
|
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
sub plcheck
|
|
|
|
{
|
|
|
|
chdir "../../pl";
|
|
|
|
|
|
|
|
foreach my $pl (glob("*"))
|
|
|
|
{
|
|
|
|
next unless -d "$pl/sql" && -d "$pl/expected";
|
|
|
|
my $lang = $pl eq 'tcl' ? 'pltcl' : $pl;
|
|
|
|
next unless -d "../../$Config/$lang";
|
|
|
|
$lang = 'plpythonu' if $lang eq 'plpython';
|
2011-03-05 03:51:14 +01:00
|
|
|
my @lang_args = ("--load-extension=$lang");
|
2007-09-23 23:52:56 +02:00
|
|
|
chdir $pl;
|
2010-01-09 16:25:41 +01:00
|
|
|
my @tests = fetchTests();
|
2010-04-09 15:05:58 +02:00
|
|
|
if ($lang eq 'plperl')
|
|
|
|
{
|
|
|
|
|
|
|
|
# run both trusted and untrusted perl tests
|
2011-03-05 03:51:14 +01:00
|
|
|
push(@lang_args, "--load-extension=plperlu");
|
2010-04-09 15:05:58 +02:00
|
|
|
|
|
|
|
# assume we're using this perl to built postgres
|
|
|
|
# test if we can run two interpreters in one backend, and if so
|
|
|
|
# run the trusted/untrusted interaction tests
|
|
|
|
use Config;
|
|
|
|
if ($Config{usemultiplicity} eq 'define')
|
|
|
|
{
|
|
|
|
push(@tests,'plperl_plperlu');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "============================================================\n";
|
2007-09-23 23:52:56 +02:00
|
|
|
print "Checking $lang\n";
|
|
|
|
my @args = (
|
|
|
|
"../../../$Config/pg_regress/pg_regress",
|
|
|
|
"--psqldir=../../../$Config/psql",
|
2010-01-09 16:25:41 +01:00
|
|
|
"--dbname=pl_regression",@lang_args,@tests
|
2007-09-23 23:52:56 +02:00
|
|
|
);
|
|
|
|
system(@args);
|
|
|
|
my $status = $? >> 8;
|
|
|
|
exit $status if $status;
|
|
|
|
chdir "..";
|
|
|
|
}
|
|
|
|
|
|
|
|
chdir "../../..";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub contribcheck
|
|
|
|
{
|
|
|
|
chdir "../../../contrib";
|
|
|
|
my $mstat = 0;
|
|
|
|
foreach my $module (glob("*"))
|
|
|
|
{
|
2011-01-24 08:24:31 +01:00
|
|
|
next if ($module eq 'sepgsql');
|
2010-04-09 15:05:58 +02:00
|
|
|
next if ($module eq 'xml2' && !$config->{xml});
|
|
|
|
next
|
|
|
|
unless -d "$module/sql"
|
|
|
|
&&-d "$module/expected"
|
|
|
|
&&(-f "$module/GNUmakefile" || -f "$module/Makefile");
|
2007-09-23 23:52:56 +02:00
|
|
|
chdir $module;
|
2010-04-09 15:05:58 +02:00
|
|
|
print "============================================================\n";
|
2007-09-23 23:52:56 +02:00
|
|
|
print "Checking $module\n";
|
|
|
|
my @tests = fetchTests();
|
2010-04-09 15:05:58 +02:00
|
|
|
my @opts = fetchRegressOpts();
|
2007-09-23 23:52:56 +02:00
|
|
|
my @args = (
|
|
|
|
"../../$Config/pg_regress/pg_regress",
|
|
|
|
"--psqldir=../../$Config/psql",
|
2009-08-19 00:36:56 +02:00
|
|
|
"--dbname=contrib_regression",@opts,@tests
|
2007-09-23 23:52:56 +02:00
|
|
|
);
|
|
|
|
system(@args);
|
|
|
|
my $status = $? >> 8;
|
|
|
|
$mstat ||= $status;
|
|
|
|
chdir "..";
|
|
|
|
}
|
|
|
|
exit $mstat if $mstat;
|
|
|
|
}
|
|
|
|
|
2009-08-19 00:36:56 +02:00
|
|
|
sub fetchRegressOpts
|
|
|
|
{
|
|
|
|
my $handle;
|
|
|
|
open($handle,"<GNUmakefile")
|
|
|
|
|| open($handle,"<Makefile")
|
|
|
|
|| die "Could not open Makefile";
|
|
|
|
local($/) = undef;
|
|
|
|
my $m = <$handle>;
|
|
|
|
close($handle);
|
2010-04-09 15:05:58 +02:00
|
|
|
my @opts;
|
|
|
|
if ($m =~ /^\s*REGRESS_OPTS\s*=(.*)/m)
|
|
|
|
{
|
|
|
|
|
|
|
|
# ignore options that use makefile variables - can't handle those
|
|
|
|
# ignore anything that isn't an option staring with --
|
|
|
|
@opts = grep { $_ !~ /\$\(/ && $_ =~ /^--/ } split(/\s+/,$1);
|
|
|
|
}
|
2011-04-19 21:52:52 +02:00
|
|
|
if ($m =~ /^\s*ENCODING\s*=\s*(\S+)/m)
|
|
|
|
{
|
|
|
|
push @opts, "--encoding=$1";
|
|
|
|
}
|
|
|
|
if ($m =~ /^\s*NO_LOCALE\s*=\s*\S+/m)
|
|
|
|
{
|
|
|
|
push @opts, "--no-locale";
|
|
|
|
}
|
2010-04-09 15:05:58 +02:00
|
|
|
return @opts;
|
2009-08-19 00:36:56 +02:00
|
|
|
}
|
|
|
|
|
2007-09-23 23:52:56 +02:00
|
|
|
sub fetchTests
|
|
|
|
{
|
|
|
|
|
|
|
|
my $handle;
|
2009-08-19 00:36:56 +02:00
|
|
|
open($handle,"<GNUmakefile")
|
|
|
|
|| open($handle,"<Makefile")
|
2007-09-23 23:52:56 +02:00
|
|
|
|| die "Could not open Makefile";
|
|
|
|
local($/) = undef;
|
|
|
|
my $m = <$handle>;
|
|
|
|
close($handle);
|
|
|
|
my $t = "";
|
|
|
|
|
|
|
|
$m =~ s/\\[\r\n]*//gs;
|
|
|
|
if ($m =~ /^REGRESS\s*=\s*(.*)$/gm)
|
|
|
|
{
|
|
|
|
$t = $1;
|
|
|
|
$t =~ s/\s+/ /g;
|
|
|
|
|
|
|
|
if ($m =~ /contrib\/pgcrypto/)
|
|
|
|
{
|
|
|
|
|
|
|
|
# pgcrypto is special since the tests depend on the
|
|
|
|
# configuration of the build
|
|
|
|
|
|
|
|
my $cftests =
|
|
|
|
$config->{openssl}
|
|
|
|
?GetTests("OSSL_TESTS",$m)
|
|
|
|
: GetTests("INT_TESTS",$m);
|
|
|
|
my $pgptests =
|
|
|
|
$config->{zlib}
|
|
|
|
?GetTests("ZLIB_TST",$m)
|
|
|
|
: GetTests("ZLIB_OFF_TST",$m);
|
|
|
|
$t =~ s/\$\(CF_TESTS\)/$cftests/;
|
|
|
|
$t =~ s/\$\(CF_PGP_TESTS\)/$pgptests/;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return split(/\s+/,$t);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub GetTests
|
|
|
|
{
|
|
|
|
my $testname = shift;
|
|
|
|
my $m = shift;
|
|
|
|
if ($m =~ /^$testname\s*=\s*(.*)$/gm)
|
|
|
|
{
|
|
|
|
return $1;
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub usage
|
|
|
|
{
|
|
|
|
print STDERR
|
2010-04-09 15:05:58 +02:00
|
|
|
"Usage: vcregress.pl ",
|
|
|
|
"<check|installcheck|plcheck|contribcheck|ecpgcheck> [schedule]\n";
|
|
|
|
exit(1);
|
2007-09-23 23:52:56 +02:00
|
|
|
}
|