From: Andrew Dunstan Date: Wed, 29 Apr 2015 17:49:24 +0000 (-0400) Subject: Enable transforms tests for python 2 on MSVC builds X-Git-Tag: REL9_5_ALPHA1~371 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=eb010637dd47be65e5d8b22d6965c2e96f6937b8;p=postgresql.git Enable transforms tests for python 2 on MSVC builds Currently regression tests for python 3 are disabled on MSVC, and these tests fail with python 3, too, so we have some work to do to enable both. Meanwhile, all the buildfarm hosts seem to be building with python 2 anyway, so this at least gets us some coverage. Original patch from Michael Paquier, significantly modified by me. --- diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index 8c071a5edde..d73775c7430 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -238,12 +238,46 @@ sub subdircheck { return; } + chdir $module; + my @tests = fetchTests(); + my @opts = fetchRegressOpts(); + + # Add some options for transform modules, see their respective + # Makefile for more details regarding Python-version specific + # dependencies. + if ($module eq "hstore_plpython" || + $module eq "ltree_plpython") + { + die "Python not enabled in configuration" + if !defined($config->{python}); + + # Attempt to get python version and location. + # Assume python.exe in specified dir. + my $pythonprog = "import sys;" . + "print(str(sys.version_info[0]))"; + my $prefixcmd = $config->{python} + . "\\python -c \"$pythonprog\""; + my $pyver = `$prefixcmd`; + die "Could not query for python version!\n" if $?; + chomp($pyver); + if ($pyver eq "2") + { + push @opts, "--load-extension=plpythonu"; + push @opts, '--load-extension=' . $module . 'u'; + } + else + { + # disable tests on python3 for now. + chdir ".."; + return; + } + } + + print "============================================================\n"; print "Checking $module\n"; - my @tests = fetchTests(); - my @opts = fetchRegressOpts(); my @args = ( "${tmp_installdir}/bin/pg_regress", "--bindir=${tmp_installdir}/bin", @@ -266,8 +300,8 @@ sub contribcheck next if ($module eq "sslinfo" && !defined($config->{openssl})); next if ($module eq "xml2" && !defined($config->{xml})); next if ($module eq "hstore_plperl" && !defined($config->{perl})); - next if ($module eq "hstore_plpython"); - next if ($module eq "ltree_plpython"); + next if ($module eq "hstore_plpython" && !defined($config->{python})); + next if ($module eq "ltree_plpython" && !defined($config->{python})); next if ($module eq "sepgsql"); subdircheck("$topdir/contrib", $module);