1
0
mirror of https://git.savannah.gnu.org/git/coreutils.git synced 2025-08-07 07:22:55 +03:00

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.
This commit is contained in:
Jim Meyering
2008-05-04 21:36:00 +02:00
parent 2656da4705
commit 5ad6145142

View File

@@ -247,12 +247,13 @@ sub run_tests ($$$$$)
$seen_8dot3{$t8} = $test_name; $seen_8dot3{$t8} = $test_name;
} }
# The test name may be no longer than 12 bytes, # The test name may be no longer than 30 bytes.
# so that we can add a two-byte suffix without exceeding # Yes, this is an arbitrary limit. If it causes trouble,
# the maximum of 14 imposed on some old file systems. # consider removing it.
if (14 < (length $test_name) + 2) 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; $bad_test_name = 1;
} }
} }
@@ -288,8 +289,13 @@ sub run_tests ($$$$$)
next; 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; my $n = keys %$io_spec;
die "$program_name: $test_name: spec has $n elements --" die "$program_name: $test_name: spec has $n elements --"
@@ -440,9 +446,11 @@ sub run_tests ($$$$$)
$actual{ERR} = "$test_name.E"; $actual{ERR} = "$test_name.E";
push @junk_files, $actual{OUT}, $actual{ERR}; 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 defined $input_pipe_cmd
and unshift @cmd, $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 # Delete from the environment any symbols specified by syntax
# like this: {ENV_DEL => 'TZ'}. # like this: {ENV_DEL => 'TZ'}.