2 # -*-perl-*- hey - emacs - this is a perl file
13 my $startdir = getcwd
();
15 chdir "../../.." if (-d
"../../../src/tools/msvc");
17 # buildenv.pl is for specifying the build environment settings
18 # it should contian lines like:
19 # $ENV{PATH} = "c:/path/to/bison/bin;$ENV{PATH}";
21 if ( -e
"src/tools/msvc/buildenv.pl")
23 require "src/tools/msvc/buildenv.pl";
26 my $what = shift || "";
27 if ($what =~ /^(check|installcheck|plcheck|contribcheck|ecpgcheck)$/i)
36 # use a capital C here because config.pl has $config
37 my $Config = -e
"release/postgres/postgres.exe" ?
"Release" : "Debug";
39 copy
("$Config/refint/refint.dll","src/test/regress");
40 copy
("$Config/autoinc/autoinc.dll","src/test/regress");
41 copy
("$Config/regress/regress.dll","src/test/regress");
43 $ENV{PATH
} = "../../../$Config/libpq;../../$Config/libpq;$ENV{PATH}";
49 $schedule = "parallel" if ($what eq 'CHECK' || $what =~ /PARALLEL/);
53 if (-e
"src/tools/msvc/config.pl")
56 require "src/tools/msvc/config.pl";
57 $temp_port = $config->{'--with-pgport'};
62 my $topdir = getcwd
();
64 $ENV{PERL5LIB
} = "$topdir/src/tools/msvc";
67 $maxconn = "--max_connections=$ENV{MAX_CONNECTIONS}"
68 if $ENV{MAX_CONNECTIONS
};
71 $temp_config = "--temp-config=\"$ENV{TEMP_CONFIG}\""
74 chdir "src/test/regress";
79 INSTALLCHECK
=> \
&installcheck
,
80 ECPGCHECK
=> \
&ecpgcheck
,
81 CONTRIBCHECK
=> \
&contribcheck
84 my $proc = $command{$what};
92 ########################################################################
97 "../../../$Config/pg_regress/pg_regress",
98 "--psqldir=../../../$Config/psql",
99 "--schedule=${schedule}_schedule",
100 "--multibyte=SQL_ASCII",
101 "--load-language=plpgsql",
104 push(@args,$maxconn) if $maxconn;
107 exit $status if $status;
113 "../../../$Config/pg_regress/pg_regress",
114 "--psqldir=../../../$Config/psql",
115 "--schedule=${schedule}_schedule",
116 "--multibyte=SQL_ASCII",
117 "--load-language=plpgsql",
119 "--temp-install=./tmp_check",
120 "--top-builddir=\"$topdir\"",
121 "--temp-port=$temp_port"
123 push(@args,$maxconn) if $maxconn;
124 push(@args,$temp_config) if $temp_config;
127 exit $status if $status;
133 system("msbuild ecpg_regression.proj /p:config=$Config");
135 exit $status if $status;
136 chdir "$topdir/src/interfaces/ecpg/test";
139 "../../../../$Config/pg_regress_ecpg/pg_regress_ecpg",
140 "--psqldir=../../../$Config/psql",
141 "--dbname=regress1,connectdb",
142 "--create-role=connectuser,connectdb",
143 "--schedule=${schedule}_schedule",
144 "--multibyte=SQL_ASCII",
145 "--load-language=plpgsql",
147 "--temp-install=./tmp_chk",
148 "--top-builddir=\"$topdir\"",
149 "--temp-port=$temp_port"
151 push(@args,$maxconn) if $maxconn;
154 exit $status if $status;
161 foreach my $pl (glob("*"))
163 next unless -d
"$pl/sql" && -d
"$pl/expected";
164 my $lang = $pl eq 'tcl' ?
'pltcl' : $pl;
165 next unless -d
"../../$Config/$lang";
166 $lang = 'plpythonu' if $lang eq 'plpython';
168 print "============================================================\n";
169 print "Checking $lang\n";
170 my @tests = fetchTests
();
172 "../../../$Config/pg_regress/pg_regress",
173 "--psqldir=../../../$Config/psql",
174 "--dbname=pl_regression","--load-language=$lang",@tests
177 my $status = $?
>> 8;
178 exit $status if $status;
187 chdir "../../../contrib";
189 foreach my $module (glob("*"))
191 next unless -d
"$module/sql" &&
192 -d
"$module/expected" &&
193 (-f
"$module/Makefile" || -f
"$module/GNUmakefile");
195 print "============================================================\n";
196 print "Checking $module\n";
197 my @tests = fetchTests
();
199 "../../$Config/pg_regress/pg_regress",
200 "--psqldir=../../$Config/psql",
201 "--dbname=contrib_regression",@tests
204 my $status = $?
>> 8;
208 exit $mstat if $mstat;
215 open($handle,"<Makefile")
216 || open($handle,"<GNUmakefile")
217 || die "Could not open Makefile";
223 $m =~ s/\\[\r\n]*//gs;
224 if ($m =~ /^REGRESS\s*=\s*(.*)$/gm)
229 if ($m =~ /contrib\/pgcrypto
/)
232 # pgcrypto is special since the tests depend on the
233 # configuration of the build
237 ?GetTests
("OSSL_TESTS",$m)
238 : GetTests
("INT_TESTS",$m);
241 ?GetTests
("ZLIB_TST",$m)
242 : GetTests
("ZLIB_OFF_TST",$m);
243 $t =~ s/\$\(CF_TESTS\)/$cftests/;
244 $t =~ s/\$\(CF_PGP_TESTS\)/$pgptests/;
248 return split(/\s+/,$t);
253 my $testname = shift;
255 if ($m =~ /^$testname\s*=\s*(.*)$/gm)
265 "Usage: vcregress.pl ",
266 "<check|installcheck|plcheck|contribcheck|ecpgcheck> [schedule]\n" ;