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