|
12 | 12 | use File::Copy;
|
13 | 13 | use File::Find ();
|
14 | 14 | use File::Path qw(rmtree);
|
| 15 | +use File::Spec qw(devnull); |
15 | 16 |
|
16 | 17 | use FindBin;
|
17 | 18 | use lib $FindBin::RealBin;
|
|
28 | 29 | do './src/tools/msvc/config_default.pl';
|
29 | 30 | do './src/tools/msvc/config.pl' if (-f 'src/tools/msvc/config.pl');
|
30 | 31 |
|
| 32 | +my $devnull = File::Spec->devnull; |
| 33 | + |
31 | 34 | # These values are defaults that can be overridden by the calling environment
|
32 |
| -# (see buildenv.pl processing below). |
| 35 | +# (see buildenv.pl processing below). We assume that the ones listed here |
| 36 | +# always exist by default. Other values may optionally be set for bincheck |
| 37 | +# or taptest, see set_command_env() below. |
33 | 38 | # c.f. src/Makefile.global.in and configure.ac
|
34 |
| -$ENV{GZIP_PROGRAM} ||= 'gzip'; |
35 |
| -$ENV{LZ4} ||= 'lz4'; |
36 | 39 | $ENV{TAR} ||= 'tar';
|
37 | 40 |
|
38 | 41 | # buildenv.pl is for specifying the build environment settings
|
|
116 | 119 |
|
117 | 120 | ########################################################################
|
118 | 121 |
|
| 122 | +# Helper function for set_command_env, to set one environment command. |
| 123 | +sub set_single_env |
| 124 | +{ |
| 125 | + my $envname = shift; |
| 126 | + my $envdefault = shift; |
| 127 | + |
| 128 | + # If a command is defined by the environment, just use it. |
| 129 | + return if (defined($ENV{$envname})); |
| 130 | + |
| 131 | + # Nothing is defined, so attempt to assign a default. The command |
| 132 | + # may not be in the current environment, hence check if it can be |
| 133 | + # executed. |
| 134 | + my $rc = system("$envdefault --version >$devnull 2>&1"); |
| 135 | + |
| 136 | + # Set the environment to the default if it exists, else leave it. |
| 137 | + $ENV{$envname} = $envdefault if $rc == 0; |
| 138 | + return; |
| 139 | +} |
| 140 | + |
| 141 | +# Set environment values for various command types. These can be used |
| 142 | +# in the TAP tests. |
| 143 | +sub set_command_env |
| 144 | +{ |
| 145 | + set_single_env('GZIP_PROGRAM', 'gzip'); |
| 146 | +} |
| 147 | + |
119 | 148 | sub installcheck_internal
|
120 | 149 | {
|
121 | 150 | my ($schedule, @EXTRA_REGRESS_OPTS) = @_;
|
@@ -244,6 +273,8 @@ sub bincheck
|
244 | 273 | {
|
245 | 274 | InstallTemp();
|
246 | 275 |
|
| 276 | + set_command_env(); |
| 277 | + |
247 | 278 | my $mstat = 0;
|
248 | 279 |
|
249 | 280 | # Find out all the existing TAP tests by looking for t/ directories
|
@@ -277,6 +308,9 @@ sub taptest
|
277 | 308 | push(@args, "$topdir/$dir");
|
278 | 309 |
|
279 | 310 | InstallTemp();
|
| 311 | + |
| 312 | + set_command_env(); |
| 313 | + |
280 | 314 | my $status = tap_check(@args);
|
281 | 315 | exit $status if $status;
|
282 | 316 | return;
|
|
0 commit comments