summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-05-04 21:36:00 +0200
committerJim Meyering <meyering@redhat.com>2008-05-06 08:21:30 +0200
commit5ad6145142ad3417fe3598349d75a6fa366f6647 (patch)
tree37013aa9345e562aaec4a28d120b0790717bbcc9
parent2656da4705eb26a30da6b51be18d9ba474bc4d00 (diff)
downloadcoreutils-5ad6145142ad3417fe3598349d75a6fa366f6647.tar.xz
tests: Coreutils.pm improvements
* tests/Coreutils.pm: Allow test names longer than 12. Print a useful diagnostic for bogus spec entry. Handle the combination of IN_PIPE and ENV properly. * tests/Coreutils.pm (run_tests): Put ENV right before command, not before the "cat INPUT_FILE |" prefix.
-rw-r--r--tests/Coreutils.pm24
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/Coreutils.pm b/tests/Coreutils.pm
index 7a5f8362c..36dae2c13 100644
--- a/tests/Coreutils.pm
+++ b/tests/Coreutils.pm
@@ -247,12 +247,13 @@ sub run_tests ($$$$$)
$seen_8dot3{$t8} = $test_name;
}
- # The test name may be no longer than 12 bytes,
- # so that we can add a two-byte suffix without exceeding
- # the maximum of 14 imposed on some old file systems.
- if (14 < (length $test_name) + 2)
+ # The test name may be no longer than 30 bytes.
+ # Yes, this is an arbitrary limit. If it causes trouble,
+ # consider removing it.
+ my $max = 30;
+ if ($max < length $test_name)
{
- warn "$program_name: $test_name: test name is too long (> 12)\n";
+ warn "$program_name: $test_name: test name is too long (> $max)\n";
$bad_test_name = 1;
}
}
@@ -288,8 +289,13 @@ sub run_tests ($$$$$)
next;
}
- die "$program_name: $test_name: invalid test spec\n"
- if ref $io_spec ne 'HASH';
+ if (ref $io_spec ne 'HASH')
+ {
+ eval 'use Data::Dumper';
+ die "$program_name: $test_name: invalid entry in test spec; "
+ . "expected HASH-ref,\nbut got this:\n"
+ . Data::Dumper->Dump ([\$io_spec], ['$io_spec']) . "\n";
+ }
my $n = keys %$io_spec;
die "$program_name: $test_name: spec has $n elements --"
@@ -440,9 +446,11 @@ sub run_tests ($$$$$)
$actual{ERR} = "$test_name.E";
push @junk_files, $actual{OUT}, $actual{ERR};
my @cmd = ($prog, @args, "> $actual{OUT}", "2> $actual{ERR}");
+ $env_prefix
+ and unshift @cmd, $env_prefix;
defined $input_pipe_cmd
and unshift @cmd, $input_pipe_cmd;
- my $cmd_str = $env_prefix . join (' ', @cmd);
+ my $cmd_str = join (' ', @cmd);
# Delete from the environment any symbols specified by syntax
# like this: {ENV_DEL => 'TZ'}.