2 # -*-perl-*- hey - emacs - this is a perl file
4 # $PostgreSQL: pgsql/src/tools/msvc/vcregress.pl,v 1.8 2008/10/06 02:55:20 tgl Exp $
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",
99 "--psqldir=../../../$Config/psql",
100 "--schedule=${schedule}_schedule",
101 "--multibyte=SQL_ASCII",
102 "--load-language=plpgsql",
105 push(@args,$maxconn) if $maxconn;
108 exit $status if $status;
114 "../../../$Config/pg_regress/pg_regress",
116 "--psqldir=../../../$Config/psql",
117 "--schedule=${schedule}_schedule",
118 "--multibyte=SQL_ASCII",
119 "--load-language=plpgsql",
121 "--temp-install=./tmp_check",
122 "--top-builddir=\"$topdir\"",
123 "--temp-port=$temp_port"
125 push(@args,$maxconn) if $maxconn;
126 push(@args,$temp_config) if $temp_config;
129 exit $status if $status;
135 system("msbuild ecpg_regression.proj /p:config=$Config");
137 exit $status if $status;
138 chdir "$topdir/src/interfaces/ecpg/test";
141 "../../../../$Config/pg_regress_ecpg/pg_regress_ecpg",
142 "--psqldir=../../../$Config/psql",
143 "--dbname=regress1,connectdb",
144 "--create-role=connectuser,connectdb",
145 "--schedule=${schedule}_schedule",
146 "--multibyte=SQL_ASCII",
147 "--load-language=plpgsql",
149 "--temp-install=./tmp_chk",
150 "--top-builddir=\"$topdir\"",
151 "--temp-port=$temp_port"
153 push(@args,$maxconn) if $maxconn;
156 exit $status if $status;
163 foreach my $pl (glob("*"))
165 next unless -d "$pl/sql" && -d "$pl/expected";
166 my $lang = $pl eq 'tcl' ? 'pltcl' : $pl;
167 next unless -d "../../$Config/$lang";
168 $lang = 'plpythonu' if $lang eq 'plpython';
170 print "============================================================\n";
171 print "Checking $lang\n";
172 my @tests = fetchTests();
174 "../../../$Config/pg_regress/pg_regress",
175 "--psqldir=../../../$Config/psql",
176 "--dbname=pl_regression","--load-language=$lang",@tests
179 my $status = $? >> 8;
180 exit $status if $status;
189 chdir "../../../contrib";
191 foreach my $module (glob("*"))
193 next unless -d "$module/sql" &&
194 -d "$module/expected" &&
195 (-f "$module/Makefile" || -f "$module/GNUmakefile");
197 print "============================================================\n";
198 print "Checking $module\n";
199 my @tests = fetchTests();
201 "../../$Config/pg_regress/pg_regress",
202 "--psqldir=../../$Config/psql",
203 "--dbname=contrib_regression",@tests
206 my $status = $? >> 8;
210 exit $mstat if $mstat;
217 open($handle,"<Makefile")
218 || open($handle,"<GNUmakefile")
219 || die "Could not open Makefile";
225 $m =~ s/\\[\r\n]*//gs;
226 if ($m =~ /^REGRESS\s*=\s*(.*)$/gm)
231 if ($m =~ /contrib\/pgcrypto/)
234 # pgcrypto is special since the tests depend on the
235 # configuration of the build
239 ?GetTests("OSSL_TESTS",$m)
240 : GetTests("INT_TESTS",$m);
243 ?GetTests("ZLIB_TST",$m)
244 : GetTests("ZLIB_OFF_TST",$m);
245 $t =~ s/\$\(CF_TESTS\)/$cftests/;
246 $t =~ s/\$\(CF_PGP_TESTS\)/$pgptests/;
250 return split(/\s+/,$t);
255 my $testname = shift;
257 if ($m =~ /^$testname\s*=\s*(.*)$/gm)
267 "Usage: vcregress.pl ",
268 "<check|installcheck|plcheck|contribcheck|ecpgcheck> [schedule]\n" ;