11
22# -*-perl-*- hey - emacs - this is a perl file
33
4- # $PostgreSQL: pgsql/src/tools/msvc/vcregress.pl,v 1.10 2008/12/01 13:39:45 tgl Exp $
4+ # $PostgreSQL: pgsql/src/tools/msvc/vcregress.pl,v 1.11 2009/08/18 22:36:56 adunstan Exp $
55
66use strict;
77
@@ -180,15 +180,16 @@ sub contribcheck
180180 {
181181next unless -d " $module /sql" &&
182182-d " $module /expected" &&
183- (-f " $module /Makefile " ||-f " $module /GNUmakefile " );
183+ (-f " $module /GNUmakefile " ||-f " $module /Makefile " );
184184chdir $module ;
185185print " ============================================================\n " ;
186186print " Checking$module \n " ;
187187my @tests = fetchTests();
188+ my @opts = fetchRegressOpts();
188189my @args = (
189190" ../../$Config /pg_regress/pg_regress" ,
190191" --psqldir=../../$Config /psql" ,
191- " --dbname=contrib_regression" ,@tests
192+ " --dbname=contrib_regression" ,@opts , @ tests
192193 );
193194system (@args );
194195my $status =$? >> 8;
@@ -198,12 +199,31 @@ sub contribcheck
198199exit $mstat if $mstat ;
199200}
200201
202+ sub fetchRegressOpts
203+ {
204+ my $handle ;
205+ open ($handle ," <GNUmakefile" )
206+ ||open ($handle ," <Makefile" )
207+ ||die " Could not open Makefile" ;
208+ local ($/ ) =undef ;
209+ my $m = <$handle >;
210+ close ($handle );
211+ my @opts ;
212+ if ($m =~/ ^\s *REGRESS_OPTS\s *=(.*)/m )
213+ {
214+ # ignore options that use makefile variables - can't handle those
215+ # ignore anything that isn't an option staring with --
216+ @opts =grep {$_ !~/ \$\( / &&$_ =~/ ^--/ }split (/ \s +/ ,$1 );
217+ }
218+ return @opts ;
219+ }
220+
201221sub fetchTests
202222{
203223
204224my $handle ;
205- open ($handle ," <Makefile " )
206- ||open ($handle ," <GNUmakefile " )
225+ open ($handle ," <GNUmakefile " )
226+ ||open ($handle ," <Makefile " )
207227 ||die " Could not open Makefile" ;
208228local ($/ ) =undef ;
209229my $m = <$handle >;