1
# -*-perl-*- hey - emacs - this is a perl file
3
# src/tools/msvc/vcregress.pl
12
my $startdir = getcwd();
14
chdir "../../.." if (-d "../../../src/tools/msvc");
16
require 'src/tools/msvc/config_default.pl';
17
require 'src/tools/msvc/config.pl' if (-f 'src/tools/msvc/config.pl');
19
# buildenv.pl is for specifying the build environment settings
20
# it should contian lines like:
21
# $ENV{PATH} = "c:/path/to/bison/bin;$ENV{PATH}";
23
if ( -e "src/tools/msvc/buildenv.pl")
25
require "src/tools/msvc/buildenv.pl";
28
my $what = shift || "";
29
if ($what =~ /^(check|installcheck|plcheck|contribcheck|ecpgcheck)$/i)
38
# use a capital C here because config.pl has $config
39
my $Config = -e "release/postgres/postgres.exe" ? "Release" : "Debug";
41
copy("$Config/refint/refint.dll","src/test/regress");
42
copy("$Config/autoinc/autoinc.dll","src/test/regress");
43
copy("$Config/regress/regress.dll","src/test/regress");
44
copy("$Config/dummy_seclabel/dummy_seclabel.dll","src/test/regress");
46
$ENV{PATH} = "../../../$Config/libpq;../../$Config/libpq;$ENV{PATH}";
52
$schedule = "parallel" if ($what eq 'CHECK' || $what =~ /PARALLEL/);
55
my $topdir = getcwd();
57
$ENV{PERL5LIB} = "$topdir/src/tools/msvc";
60
$maxconn = "--max_connections=$ENV{MAX_CONNECTIONS}"
61
if $ENV{MAX_CONNECTIONS};
64
$temp_config = "--temp-config=\"$ENV{TEMP_CONFIG}\""
67
chdir "src/test/regress";
72
INSTALLCHECK => \&installcheck,
73
ECPGCHECK => \&ecpgcheck,
74
CONTRIBCHECK => \&contribcheck
77
my $proc = $command{$what};
85
########################################################################
90
"../../../$Config/pg_regress/pg_regress","--dlpath=.",
91
"--psqldir=../../../$Config/psql","--schedule=${schedule}_schedule",
92
"--encoding=SQL_ASCII","--no-locale"
94
push(@args,$maxconn) if $maxconn;
97
exit $status if $status;
103
"../../../$Config/pg_regress/pg_regress","--dlpath=.",
104
"--psqldir=../../../$Config/psql","--schedule=${schedule}_schedule",
105
"--encoding=SQL_ASCII","--no-locale",
106
"--temp-install=./tmp_check","--top-builddir=\"$topdir\""
108
push(@args,$maxconn) if $maxconn;
109
push(@args,$temp_config) if $temp_config;
112
exit $status if $status;
118
system("msbuild ecpg_regression.proj /p:config=$Config");
120
exit $status if $status;
121
chdir "$topdir/src/interfaces/ecpg/test";
124
"../../../../$Config/pg_regress_ecpg/pg_regress_ecpg",
125
"--psqldir=../../../$Config/psql",
126
"--dbname=regress1,connectdb",
127
"--create-role=connectuser,connectdb",
128
"--schedule=${schedule}_schedule",
129
"--encoding=SQL_ASCII",
131
"--temp-install=./tmp_chk",
132
"--top-builddir=\"$topdir\""
134
push(@args,$maxconn) if $maxconn;
137
exit $status if $status;
144
foreach my $pl (glob("*"))
146
next unless -d "$pl/sql" && -d "$pl/expected";
147
my $lang = $pl eq 'tcl' ? 'pltcl' : $pl;
148
next unless -d "../../$Config/$lang";
149
$lang = 'plpythonu' if $lang eq 'plpython';
150
my @lang_args = ("--load-extension=$lang");
152
my @tests = fetchTests();
153
if ($lang eq 'plperl')
156
# run both trusted and untrusted perl tests
157
push(@lang_args, "--load-extension=plperlu");
159
# assume we're using this perl to built postgres
160
# test if we can run two interpreters in one backend, and if so
161
# run the trusted/untrusted interaction tests
163
if ($Config{usemultiplicity} eq 'define')
165
push(@tests,'plperl_plperlu');
168
print "============================================================\n";
169
print "Checking $lang\n";
171
"../../../$Config/pg_regress/pg_regress",
172
"--psqldir=../../../$Config/psql",
173
"--dbname=pl_regression",@lang_args,@tests
176
my $status = $? >> 8;
177
exit $status if $status;
186
chdir "../../../contrib";
188
foreach my $module (glob("*"))
190
next if ($module eq 'sepgsql');
191
next if ($module eq 'xml2' && !$config->{xml});
193
unless -d "$module/sql"
194
&&-d "$module/expected"
195
&&(-f "$module/GNUmakefile" || -f "$module/Makefile");
197
print "============================================================\n";
198
print "Checking $module\n";
199
my @tests = fetchTests();
200
my @opts = fetchRegressOpts();
202
"../../$Config/pg_regress/pg_regress",
203
"--psqldir=../../$Config/psql",
204
"--dbname=contrib_regression",@opts,@tests
207
my $status = $? >> 8;
211
exit $mstat if $mstat;
217
open($handle,"<GNUmakefile")
218
|| open($handle,"<Makefile")
219
|| die "Could not open Makefile";
224
if ($m =~ /^\s*REGRESS_OPTS\s*=(.*)/m)
227
# ignore options that use makefile variables - can't handle those
228
# ignore anything that isn't an option staring with --
229
@opts = grep { $_ !~ /\$\(/ && $_ =~ /^--/ } split(/\s+/,$1);
231
if ($m =~ /^\s*ENCODING\s*=\s*(\S+)/m)
233
push @opts, "--encoding=$1";
235
if ($m =~ /^\s*NO_LOCALE\s*=\s*\S+/m)
237
push @opts, "--no-locale";
246
open($handle,"<GNUmakefile")
247
|| open($handle,"<Makefile")
248
|| die "Could not open Makefile";
254
$m =~ s/\\[\r\n]*//gs;
255
if ($m =~ /^REGRESS\s*=\s*(.*)$/gm)
260
if ($m =~ /contrib\/pgcrypto/)
263
# pgcrypto is special since the tests depend on the
264
# configuration of the build
268
?GetTests("OSSL_TESTS",$m)
269
: GetTests("INT_TESTS",$m);
272
?GetTests("ZLIB_TST",$m)
273
: GetTests("ZLIB_OFF_TST",$m);
274
$t =~ s/\$\(CF_TESTS\)/$cftests/;
275
$t =~ s/\$\(CF_PGP_TESTS\)/$pgptests/;
279
return split(/\s+/,$t);
284
my $testname = shift;
286
if ($m =~ /^$testname\s*=\s*(.*)$/gm)
296
"Usage: vcregress.pl ",
297
"<check|installcheck|plcheck|contribcheck|ecpgcheck> [schedule]\n";