diff options
author | Jim Meyering <meyering@redhat.com> | 2008-05-08 01:22:37 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-05-08 09:12:43 +0200 |
commit | 7fcb73cec07a9d8ae57d60d18bd1f9442281af51 (patch) | |
tree | 0776add7a53365680318640e06b962407560eccf | |
parent | 6a9c6804ddd9eca47135f66290a2e7718a919c54 (diff) | |
download | coreutils-7fcb73cec07a9d8ae57d60d18bd1f9442281af51.tar.xz |
tests: Coreutils.pm: support running a program that is a shell built-in
* tests/Coreutils.pm (run_tests): Add support for running a
program like 'test', that is a shell built-in.
-rw-r--r-- | tests/Coreutils.pm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/Coreutils.pm b/tests/Coreutils.pm index e97596563..2406dd107 100644 --- a/tests/Coreutils.pm +++ b/tests/Coreutils.pm @@ -214,6 +214,11 @@ sub run_tests ($$$$$) { my ($program_name, $prog, $t_spec, $save_temps, $verbose) = @_; + # To indicate that $prog is a shell built-in, you'd make it a string 'ref'. + # E.g., call run_tests ($prog, \$prog, \@Tests, $save_temps, $verbose); + # If it's a ref, invoke it via "env": + my @prog = ref $prog ? ('env', $$prog) : $prog; + # Warn about empty t_spec. # FIXME @@ -260,7 +265,7 @@ sub run_tests ($$$$$) return 1 if $bad_test_name; # FIXME check exit status - system ($prog, '--version') if $verbose; + system (@prog, '--version') if $verbose; my @junk_files; my $fail = 0; @@ -445,7 +450,7 @@ sub run_tests ($$$$$) $actual{OUT} = "$test_name.O"; $actual{ERR} = "$test_name.E"; push @junk_files, $actual{OUT}, $actual{ERR}; - my @cmd = ($prog, @args, "> $actual{OUT}", "2> $actual{ERR}"); + my @cmd = (@prog, @args, "> $actual{OUT}", "2> $actual{ERR}"); $env_prefix and unshift @cmd, $env_prefix; defined $input_pipe_cmd |