diff options
author | Michael Paquier <michael@paquier.xyz> | 2021-03-05 10:12:49 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2021-03-05 10:12:49 +0900 |
commit | 5bca69a76b3046a85c60c48271c1831fd5affa51 (patch) | |
tree | 0f1daed847a2beafbe6f0a4722a044a97bbb4747 | |
parent | d3676a2e9f10a0972c6d6649235c1c7492cd6dea (diff) | |
download | postgresql-5bca69a76b3046a85c60c48271c1831fd5affa51.tar.gz postgresql-5bca69a76b3046a85c60c48271c1831fd5affa51.zip |
Add support for PROVE_TESTS and PROVE_FLAGS in MSVC scripts
These can be set in buildenv.pl or a "set" command within a Windows
terminal. The MSVC script vcregress.pl parses the values available in
the environment to build the resulting prove commands, and the parsing
of PROVE_TESTS is able to handle name patterns in the same way as other
platforms.
Not specifying those environment values makes vcregress.pl fall back to
the previous default, with no extra flags for the prove command, and all
the tests run within t/.
Author: Michael Paquier
Reviewed-by: Juan José SantamarÃa Flecha, Julien Rouhaud
Discussion: https://postgr.es/m/YD9GigwHoL6lFY2y@paquier.xyz
-rw-r--r-- | doc/src/sgml/install-windows.sgml | 18 | ||||
-rw-r--r-- | src/tools/msvc/vcregress.pl | 16 |
2 files changed, 33 insertions, 1 deletions
diff --git a/doc/src/sgml/install-windows.sgml b/doc/src/sgml/install-windows.sgml index 47e5f7c8ae4..64687b12e67 100644 --- a/doc/src/sgml/install-windows.sgml +++ b/doc/src/sgml/install-windows.sgml @@ -496,6 +496,24 @@ $ENV{PERL5LIB}=$ENV{PERL5LIB} . ';c:\IPC-Run-0.94\lib'; </varlistentry> </variablelist> </para> + + <para> + The TAP tests run with <command>vcregress</command> support the + environment variables <varname>PROVE_TESTS</varname>, that is expanded + automatically using the name patterns given, and + <varname>PROVE_FLAGS</varname>. These can be set on a Windows terminal, + before running <command>vcregress</command>: +<programlisting> +set PROVE_FLAGS=--timer --jobs 2 +set PROVE_TESTS=t/020*.pl t/010*.pl +</programlisting> + It is also possible to set up those parameters in + <filename>buildenv.pl</filename>: +<programlisting> +$ENV{PROVE_FLAGS}='--timer --jobs 2' +$ENV{PROVE_TESTS}='t/020*.pl t/010*.pl' +</programlisting> + </para> </sect2> </sect1> diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index 266098e1937..14cceac31e0 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -209,7 +209,21 @@ sub tap_check my $dir = shift; chdir $dir; - my @args = ("prove", @flags, glob("t/*.pl")); + # Fetch and adjust PROVE_TESTS, applying glob() to each element + # defined to build a list of all the tests matching patterns. + my $prove_tests_val = $ENV{PROVE_TESTS} || "t/*.pl"; + my @prove_tests_array = split(/\s+/, $prove_tests_val); + my @prove_tests = (); + foreach (@prove_tests_array) + { + push(@prove_tests, glob($_)); + } + + # Fetch and adjust PROVE_FLAGS, handling multiple arguments. + my $prove_flags_val = $ENV{PROVE_FLAGS} || ""; + my @prove_flags = split(/\s+/, $prove_flags_val); + + my @args = ("prove", @flags, @prove_tests, @prove_flags); # adjust the environment for just this test local %ENV = %ENV; |