From 7fcb73cec07a9d8ae57d60d18bd1f9442281af51 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 8 May 2008 01:22:37 +0200 Subject: 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. --- tests/Coreutils.pm | 9 +++++++-- 1 file 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 -- cgit v1.2.3-70-g09d2