From: Jim Meyering Date: Mon, 18 Feb 2002 12:33:11 +0000 (+0000) Subject: When getting input via a pipe, apply the X-Git-Tag: TEXTUTILS-2_0_21~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68d442ddaf878955395a4fbc9d11d6437b93ee1e;p=thirdparty%2Fcoreutils.git When getting input via a pipe, apply the environment settings to the command in question, not to `cat'. No longer allow more than one element in the $Test::env or $Test::env_default arrays. No one used that. --- diff --git a/tests/mk-script b/tests/mk-script index b8bf735b7e..8995958b19 100755 --- a/tests/mk-script +++ b/tests/mk-script @@ -281,34 +281,35 @@ EOF1 my $via_msg = ($n_vias == 1 ? '' : $via_msg_string{$via}); my $file_args = join (' ', @srcdir_rel_in_file); + my $env = $Test::env{$test_name} || $Test::env_default || ['']; + @$env == 1 + or die "$program_name: unexpected environment: @$env\n"; + $env = $env->[0]; + if ($via eq 'FILE') { - $cmd = "\$xx $flags $file_args > $out 2> $err_output"; + $cmd = "$env \$xx $flags $file_args > $out 2> $err_output"; } elsif ($via eq 'PIPE') { $via_msg = "|$val" if $val; $val ||= 'cat'; - $cmd = "$val $file_args | \$xx $flags > $out 2> $err_output"; + $cmd = "$val $file_args | $env \$xx $flags > $out 2> $err_output"; } else { assert (@srcdir_rel_in_file == 1); - $cmd = "\$xx $flags < $file_args > $out 2> $err_output"; + $cmd = "$env \$xx $flags < $file_args > $out 2> $err_output"; } - my $env = $Test::env{$test_name} || $Test::env_default || ['']; - my $e; - foreach $e (@$env) - { - my $sep = ($via_msg && $e ? ':' : ''); - my $msg = "$e$sep$via_msg"; - $msg = "($msg)" if $msg; - my $t_name = "$test_name$msg"; - my $e_cmd = ($e ? "$e " : ''); - ++$n_tests; - print <&2 @@ -327,7 +328,6 @@ else fi test -s $err_output || rm -f $err_output EOF - } } } print <