1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-20 18:56:39 +02:00

global: convert indentation-TABs to spaces

Transformed via this shell code:
t=$'\t'
git ls-files \
  | grep -vE '(^|/)((GNU)?[Mm]akefile|ChangeLog)|\.(am|mk)$' \
  | grep -vE 'tests/pr/|help2man' \
  | xargs grep -lE "^ *$t" \
  | xargs perl -MText::Tabs -ni -le \
    '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
This commit is contained in:
Jim Meyering
2009-08-22 18:56:06 +02:00
parent 2bc0f3caaa
commit 5e778f7c8d
176 changed files with 18808 additions and 18808 deletions

View File

@@ -114,25 +114,25 @@ foreach my $t (@Tests)
foreach my $e (@$t)
{
ref $e && ref $e eq 'HASH'
or next;
or next;
defined $e->{EXIT}
and $exit_val = $e->{EXIT};
defined $e->{IN}
and $in = $e->{IN};
if (defined $e->{OUT})
{
my $t = $e->{OUT};
push @out, $t;
my $len = length $t;
foreach my $i (0..$len)
{
my $u = $t;
substr ($u, $i, 0) = "\n";
push @out, $u;
10 <= $i
and last;
}
}
and $exit_val = $e->{EXIT};
defined $e->{IN}
and $in = $e->{IN};
if (defined $e->{OUT})
{
my $t = $e->{OUT};
push @out, $t;
my $len = length $t;
foreach my $i (0..$len)
{
my $u = $t;
substr ($u, $i, 0) = "\n";
push @out, $u;
10 <= $i
and last;
}
}
}
$exit_val
and next;
@@ -140,8 +140,8 @@ foreach my $t (@Tests)
my $i = 0;
foreach my $o (@out)
{
push @new, ["d$i-$t->[0]", '--decode', {IN => $o}, {OUT => $in}];
++$i;
push @new, ["d$i-$t->[0]", '--decode', {IN => $o}, {OUT => $in}];
++$i;
}
}
push @Tests, @new;

View File

@@ -26,7 +26,7 @@ use File::stat;
my $stat_single = stat('/');
my $stat_double = stat('//');
my $double_slash = ($stat_single->dev == $stat_double->dev
&& $stat_single->ino == $stat_double->ino) ? '/' : '//';
&& $stat_single->ino == $stat_double->ino) ? '/' : '//';
my $prog = 'basename';
@@ -67,8 +67,8 @@ foreach $t (@Tests)
my $e;
foreach $e (@$t)
{
$e->{OUT} = "$e->{OUT}\n"
if ref $e eq 'HASH' and exists $e->{OUT};
$e->{OUT} = "$e->{OUT}\n"
if ref $e eq 'HASH' and exists $e->{OUT};
}
}

View File

@@ -58,17 +58,17 @@ my @Tests =
# invalid missing command line argument (1)
['missing-arg1', $inputs[0], {EXIT=>1},
{ERR => "$prog: missing operand after `a'\n"
. "Try `$prog --help' for more information.\n"}],
. "Try `$prog --help' for more information.\n"}],
# invalid missing command line argument (both)
['missing-arg2', {EXIT=>1},
{ERR => "$prog: missing operand\n"
. "Try `$prog --help' for more information.\n"}],
. "Try `$prog --help' for more information.\n"}],
# invalid extra command line argument
['extra-arg', @inputs, 'no-such', {EXIT=>1},
{ERR => "$prog: extra operand `no-such'\n"
. "Try `$prog --help' for more information.\n"}],
. "Try `$prog --help' for more information.\n"}],
# out-of-order input
['ooo', {IN=>{a=>"1\n3"}}, {IN=>{b=>"3\n2"}}, {EXIT=>1},
@@ -88,13 +88,13 @@ my @Tests =
['ooo4', {IN=>{a=>"3\n1\n0"}}, {IN=>{b=>"3\n2\n0"}}, {EXIT=>1},
{OUT => "\t\t3\n1\n0\n\t2\n\t0\n"},
{ERR => "$prog: file 1 is not in sorted order\n".
"$prog: file 2 is not in sorted order\n" }],
"$prog: file 2 is not in sorted order\n" }],
# both inputs out-of-order on last pair
['ooo5', {IN=>{a=>"3\n1"}}, {IN=>{b=>"3\n2"}}, {EXIT=>1},
{OUT => "\t\t3\n1\n\t2\n"},
{ERR => "$prog: file 1 is not in sorted order\n".
"$prog: file 2 is not in sorted order\n" }],
"$prog: file 2 is not in sorted order\n" }],
# first input out-of-order extended
['ooo5b', {IN=>{a=>"0\n3\n1"}}, {IN=>{b=>"2\n3"}}, {EXIT=>1},

View File

@@ -128,7 +128,7 @@ my @Tests =
['next-y', "-d '$d1 next year' '+%Y-%m-%d %T'", {OUT=>"$dy $t0"}],
['utc-0', "-u -d '08/01/97 6:00' '+%D,%H:%M'", {OUT=>"08/01/97,06:00"},
{ENV => 'TZ=UTC+4'}],
{ENV => 'TZ=UTC+4'}],
['utc-0a', "-u -d '08/01/97 6:00 UTC +4 hours' '+%D,%H:%M'",
{OUT=>"08/01/97,10:00"}],
@@ -189,7 +189,7 @@ my @Tests =
# Relative days, no time, across time zones.
['relative-3', "-I -d '2006-04-23 21 days ago'", {OUT=>"2006-04-02"},
{ENV=>'TZ=PST8PDT,M4.1.0,M10.5.0'}],
{ENV=>'TZ=PST8PDT,M4.1.0,M10.5.0'}],
# This would infloop (or appear to) prior to coreutils-4.5.5,
# due to a bug in strftime.c.
@@ -243,8 +243,8 @@ my @Tests =
# Unfortunately (for ease of testing), if you set TZ at all, this
# failure is not triggered, hence the removal of TZ from the environment.
['cross-dst', "-d'2005-03-27 +1 day'", '+%Y', {OUT=>"2005"},
{ENV_DEL => 'TZ'},
],
{ENV_DEL => 'TZ'},
],
['empty-fmt', '+', {OUT=>""}],
@@ -284,9 +284,9 @@ my @Tests =
foreach my $i (1..364)
{
push @Tests, ["cross-dst$i",
"-d'2005-01-01 +$i day'", '+%Y', {OUT=>"2005"},
{ENV_DEL => 'TZ'},
];
"-d'2005-01-01 +$i day'", '+%Y', {OUT=>"2005"},
{ENV_DEL => 'TZ'},
];
}
# Append "\n" to each OUT=> RHS if the expected exit value is either
@@ -297,12 +297,12 @@ foreach my $t (@Tests)
foreach my $e (@$t)
{
ref $e && ref $e eq 'HASH' && defined $e->{EXIT}
and $exit_val = $e->{EXIT};
and $exit_val = $e->{EXIT};
}
foreach my $e (@$t)
{
ref $e && ref $e eq 'HASH' && defined $e->{OUT} && ! $exit_val
and $e->{OUT} .= "\n";
and $e->{OUT} .= "\n";
}
}

View File

@@ -55,12 +55,12 @@ foreach my $t (@Tests)
foreach my $e (@$t)
{
ref $e && ref $e eq 'HASH' && defined $e->{EXIT}
and $exit_val = $e->{EXIT};
and $exit_val = $e->{EXIT};
}
foreach my $e (@$t)
{
ref $e && ref $e eq 'HASH' && defined $e->{OUT} && ! $exit_val
and $e->{OUT} .= "\n";
and $e->{OUT} .= "\n";
}
}

View File

@@ -27,7 +27,7 @@ use File::stat;
my $stat_single = stat('/');
my $stat_double = stat('//');
my $double_slash = ($stat_single->dev == $stat_double->dev
&& $stat_single->ino == $stat_double->ino) ? '/' : '//';
&& $stat_single->ino == $stat_double->ino) ? '/' : '//';
my $prog = 'dirname';
@@ -61,8 +61,8 @@ foreach $t (@Tests)
my $e;
foreach $e (@$t)
{
$e->{OUT} = "$e->{OUT}\n"
if ref $e eq 'HASH' and exists $e->{OUT};
$e->{OUT} = "$e->{OUT}\n"
if ref $e eq 'HASH' and exists $e->{OUT};
}
}

View File

@@ -159,7 +159,7 @@ my @Tests =
['fail-b', '9 9', {ERR => "$prog: syntax error\n"},
{EXIT => 2}],
['fail-c', {ERR => "$prog: missing operand\n"
. "Try `$prog --help' for more information.\n"},
. "Try `$prog --help' for more information.\n"},
{EXIT => 2}],
['bignum-add', "$big + 1", {OUT => $big_p1}],
@@ -182,8 +182,8 @@ foreach $t (@Tests)
my $e;
foreach $e (@$t)
{
$e->{OUT} .= "\n"
if ref $e eq 'HASH' and exists $e->{OUT};
$e->{OUT} .= "\n"
if ref $e eq 'HASH' and exists $e->{OUT};
}
}

View File

@@ -79,14 +79,14 @@ foreach $t (@Tests)
# Don't fiddle with expected OUT string if there's a nonzero exit status.
foreach my $e (@$t)
{
ref $e eq 'HASH' && exists $e->{EXIT} && $e->{EXIT}
and next Test;
ref $e eq 'HASH' && exists $e->{EXIT} && $e->{EXIT}
and next Test;
}
foreach my $e (@$t)
{
ref $e eq 'HASH' && exists $e->{OUT}
and $e->{OUT} = "$arg1: $e->{OUT}\n"
ref $e eq 'HASH' && exists $e->{OUT}
and $e->{OUT} = "$arg1: $e->{OUT}\n"
}
}

View File

@@ -63,39 +63,39 @@ if ($ENV{RUN_EXPENSIVE_TESTS})
my $s = "abcdefghijklmnopqrst";
for my $file_size (0..20)
{
for my $n_elide (0..20)
{
my $input = substr $s, 0, $file_size;
my $out_len = $n_elide < $file_size ? $file_size - $n_elide : 0;
my $output = substr $input, 0, $out_len;
my $t = ["elideb$file_size-$n_elide", "--bytes=-$n_elide",
{IN=>$input}, {OUT=>$output}];
push @Tests, $t;
my @u = @$t;
# Insert the ---presume-input-pipe option.
$u[0] .= 'p';
$u[1] .= ' ---presume-input-pipe';
push @Tests, \@u;
}
for my $n_elide (0..20)
{
my $input = substr $s, 0, $file_size;
my $out_len = $n_elide < $file_size ? $file_size - $n_elide : 0;
my $output = substr $input, 0, $out_len;
my $t = ["elideb$file_size-$n_elide", "--bytes=-$n_elide",
{IN=>$input}, {OUT=>$output}];
push @Tests, $t;
my @u = @$t;
# Insert the ---presume-input-pipe option.
$u[0] .= 'p';
$u[1] .= ' ---presume-input-pipe';
push @Tests, \@u;
}
}
$s =~ s/(.)/$1\n/g;
for my $file_size (0..20)
{
for my $n_elide (0..20)
{
my $input = substr $s, 0, 2 * $file_size;
my $out_len = $n_elide < $file_size ? $file_size - $n_elide : 0;
my $output = substr $input, 0, 2 * $out_len;
my $t = ["elidel$file_size-$n_elide", "--lines=-$n_elide",
{IN=>$input}, {OUT=>$output}];
push @Tests, $t;
my @u = @$t;
# Insert the ---presume-input-pipe option.
$u[0] .= 'p';
$u[1] .= ' ---presume-input-pipe';
push @Tests, \@u;
}
for my $n_elide (0..20)
{
my $input = substr $s, 0, 2 * $file_size;
my $out_len = $n_elide < $file_size ? $file_size - $n_elide : 0;
my $output = substr $input, 0, 2 * $out_len;
my $t = ["elidel$file_size-$n_elide", "--lines=-$n_elide",
{IN=>$input}, {OUT=>$output}];
push @Tests, $t;
my @u = @$t;
# Insert the ---presume-input-pipe option.
$u[0] .= 'p';
$u[1] .= ' ---presume-input-pipe';
push @Tests, \@u;
}
}
}

View File

@@ -77,11 +77,11 @@ for lang in C fr da; do
eval "expected=\$expected_failure_status_$prog"
test x$expected = x && expected=1
if test $status = $expected; then
: # ok
: # ok
else
fail=1
echo "*** $i: bad exit status \`$status' (expected $expected)," 1>&2
echo " with --help or --version output redirected to /dev/full" 1>&2
fail=1
echo "*** $i: bad exit status \`$status' (expected $expected)," 1>&2
echo " with --help or --version output redirected to /dev/full" 1>&2
fi
fi
done

View File

@@ -57,12 +57,12 @@ sub setuid_setup()
{
my $test = shell_quote "$ENV{abs_top_builddir}/src/test";
system (qq(touch setuid && chmod u+s setuid && $test -u setuid &&
touch setgid && chmod g+s setgid && $test -g setgid &&
mkdir sticky && chmod +t sticky && $test -k sticky &&
mkdir owt && chmod +t,o+w owt && $test -k owt &&
mkdir owr && chmod o+w owr)) == 0
or (warn "$program_name: cannot create setuid/setgid/sticky files,"
. "so can't run this test\n"), exit 77;
touch setgid && chmod g+s setgid && $test -g setgid &&
mkdir sticky && chmod +t sticky && $test -k sticky &&
mkdir owt && chmod +t,o+w owt && $test -k owt &&
mkdir owr && chmod o+w owr)) == 0
or (warn "$program_name: cannot create setuid/setgid/sticky files,"
. "so can't run this test\n"), exit 77;
}
sub mk_file(@)
@@ -70,7 +70,7 @@ sub mk_file(@)
foreach my $f (@_)
{
open (F, '>', $f) && close F
or die "creating $f: $!\n";
or die "creating $f: $!\n";
}
}
@@ -80,31 +80,31 @@ my $mkdir = {PRE => sub {mkdir_d}};
my $rmdir = {POST => sub {rmdir_d}};
my $mkdir_reg = {PRE => sub {mkdir_d; mk_file 'd/f' }};
my $rmdir_reg = {POST => sub {unlink 'd/f' or die "d/f: $!\n";
rmdir 'd' or die "d: $!\n"}};
rmdir 'd' or die "d: $!\n"}};
my $mkdir2 = {PRE => sub {mkdir 'd',0755 or die "d: $!\n";
mkdir 'd/e',0755 or die "d/e: $!\n" }};
mkdir 'd/e',0755 or die "d/e: $!\n" }};
my $rmdir2 = {POST => sub {rmdir 'd/e' or die "d/e: $!\n";
rmdir 'd' or die "d: $!\n" }};
rmdir 'd' or die "d: $!\n" }};
my $target = {PRE => sub {
mkdir 'd',0755 or die "d: $!\n";
symlink '.', 'd/X' or die "d/X: $!\n";
push_ls_colors('ln=target')
}};
mkdir 'd',0755 or die "d: $!\n";
symlink '.', 'd/X' or die "d/X: $!\n";
push_ls_colors('ln=target')
}};
my $target2 = {POST => sub {unlink 'd/X' or die "d/X: $!\n";
rmdir 'd' or die "d: $!\n";
restore_ls_colors
}};
rmdir 'd' or die "d: $!\n";
restore_ls_colors
}};
my $slink_d = {PRE => sub {symlink '/', 'd' or die "d: $!\n";
push_ls_colors('ln=01;36:di=01;34:or=40;31;01')
}};
my $unlink_d = {POST => sub {unlink 'd' or die "d: $!\n"; restore_ls_colors}};
my $mkdir_d_slink = {PRE => sub {mkdir 'd',0755 or die "d: $!\n";
symlink '/', 'd/s' or die "d/s: $!\n" }};
symlink '/', 'd/s' or die "d/s: $!\n" }};
my $rmdir_d_slink = {POST => sub {unlink 'd/s' or die "d/s: $!\n";
rmdir 'd' or die "d: $!\n" }};
rmdir 'd' or die "d: $!\n" }};
sub make_j_d ()
{
@@ -118,7 +118,7 @@ my @v_files = ((map { ".$_" } @v1), @v1);
my $exe_in_subdir = {PRE => sub { make_j_d (); push_ls_colors('ex=01;32') }};
my $remove_j = {POST => sub {unlink 'j/d' or die "j/d: $!\n";
rmdir 'j' or die "j: $!\n";
restore_ls_colors }};
restore_ls_colors }};
my $e = "\e[0m";
my $q_bell = {IN => {"q\a" => ''}};
@@ -156,11 +156,11 @@ my @Tests =
# Test for a bug that was fixed in coreutils-4.5.4.
['sl-F-color', '-F --color=always d',
{OUT => "$e\e[01;36md$e\@\n\e[m"},
$slink_d, $unlink_d],
{OUT => "$e\e[01;36md$e\@\n\e[m"},
$slink_d, $unlink_d],
['sl-dF-color', '-dF --color=always d',
{OUT => "$e\e[01;36md$e\@\n\e[m"},
$slink_d, $unlink_d],
{OUT => "$e\e[01;36md$e\@\n\e[m"},
$slink_d, $unlink_d],
# A listing with no output should have no color sequences at all.
['no-c-empty', '--color=always d', {OUT => ""}, $mkdir, $rmdir],
@@ -176,44 +176,44 @@ my @Tests =
['sl-dangle', '--color=always d',
{OUT => "$e\e[40;31;01mX$e\n\e[m"},
{PRE => sub {
mkdir 'd',0755 or die "d: $!\n";
symlink 'non-existent', 'd/X' or die "d/X: $!\n";
push_ls_colors('or=40;31;01')
}},
mkdir 'd',0755 or die "d: $!\n";
symlink 'non-existent', 'd/X' or die "d/X: $!\n";
push_ls_colors('or=40;31;01')
}},
{POST => sub {unlink 'd/X' or die "d/X: $!\n";
rmdir 'd' or die "d: $!\n";
restore_ls_colors; }},
rmdir 'd' or die "d: $!\n";
restore_ls_colors; }},
],
# Test for a bug that was introduced in coreutils-4.5.4; fixed in 4.5.5.
# To demonstrate it, the file in question (with executable bit set)
# must not be a command line argument.
['color-exe1', '--color=always j',
{OUT => "$e\e[01;32md$e\n\e[m"},
$exe_in_subdir, $remove_j],
{OUT => "$e\e[01;32md$e\n\e[m"},
$exe_in_subdir, $remove_j],
# From Stéphane Chazelas.
['no-a-isdir-b', 'no-dir d',
{OUT => "d:\n"},
{ERR => "ls: cannot access no-dir: No such file or directory\n"},
$mkdir, $rmdir, {EXIT => 2}],
{OUT => "d:\n"},
{ERR => "ls: cannot access no-dir: No such file or directory\n"},
$mkdir, $rmdir, {EXIT => 2}],
['recursive-2', '-R d', {OUT => "d:\ne\n\nd/e:\n"}, $mkdir2, $rmdir2],
['setuid-etc', '-1 -d --color=always owr owt setgid setuid sticky',
{OUT =>
"$e\e[34;42mowr$e\n"
. "\e[30;42mowt$e\n"
. "\e[30;43msetgid$e\n"
. "\e[37;41msetuid$e\n"
. "\e[37;44msticky$e\n"
. "\e[m"
},
{OUT =>
"$e\e[34;42mowr$e\n"
. "\e[30;42mowt$e\n"
. "\e[30;43msetgid$e\n"
. "\e[37;41msetuid$e\n"
. "\e[37;44msticky$e\n"
. "\e[m"
},
{POST => sub {
{POST => sub {
unlink qw(setuid setgid);
foreach my $dir (qw(owr owt sticky)) {rmdir $dir} }},
],
foreach my $dir (qw(owr owt sticky)) {rmdir $dir} }},
],
# For 5.97 and earlier, --file-type acted like --indicator-style=slash.
['file-type', '--file-type d', {OUT => "s@\n"},

View File

@@ -31,42 +31,42 @@ my @Tests =
['2', {IN=> {f=> 'a'}}, {OUT=>"0cc175b9c0f1b6a831c399e269772661 f\n"}],
['3', {IN=> {f=> 'abc'}}, {OUT=>"900150983cd24fb0d6963f7d28e17f72 f\n"}],
['4', {IN=> {f=> 'message digest'}},
{OUT=>"f96b697d7cb7938d525a2f31aaf161d0 f\n"}],
{OUT=>"f96b697d7cb7938d525a2f31aaf161d0 f\n"}],
['5', {IN=> {f=> 'abcdefghijklmnopqrstuvwxyz'}},
{OUT=>"c3fcd3d76192e4007dfb496cca67e13b f\n"}],
{OUT=>"c3fcd3d76192e4007dfb496cca67e13b f\n"}],
['6', {IN=> {f=> join ('', 'A'..'Z', 'a'..'z', '0'..'9')}},
{OUT=>"d174ab98d277d9f5a5611c2c9f419d9f f\n"}],
{OUT=>"d174ab98d277d9f5a5611c2c9f419d9f f\n"}],
['7', {IN=> {f=> '1234567890' x 8}},
{OUT=>"57edf4a22be3c955ac49da2e2107b67a f\n"}],
{OUT=>"57edf4a22be3c955ac49da2e2107b67a f\n"}],
['backslash', {IN=> {".\\foo"=> ''}},
{OUT=>"\\$degenerate .\\\\foo\n"}],
{OUT=>"\\$degenerate .\\\\foo\n"}],
['check-1', '--check', {AUX=> {f=> ''}},
{IN=> {'f.md5' => "$degenerate f\n"}},
{OUT=>"f: OK\n"}],
{IN=> {'f.md5' => "$degenerate f\n"}},
{OUT=>"f: OK\n"}],
['check-2', '--check', '--status', {IN=>{'f.md5' => "$degenerate f\n"}},
{AUX=> {f=> 'foo'}}, {EXIT=> 1}],
{AUX=> {f=> 'foo'}}, {EXIT=> 1}],
['check-quiet1', '--check', '--quiet', {AUX=> {f=> ''}},
{IN=> {'f.md5' => "$degenerate f\n"}},
{OUT=>""}],
{IN=> {'f.md5' => "$degenerate f\n"}},
{OUT=>""}],
['check-quiet2', '--check', '--quiet',
{IN=>{'f.md5' => "$degenerate f\n"}},
{AUX=> {f=> 'foo'}}, {OUT=>"f: FAILED\n"},
{ERR=>"md5sum: WARNING: 1 of 1 computed"
. " checksum did NOT match\n"},
{EXIT=> 1}],
{IN=>{'f.md5' => "$degenerate f\n"}},
{AUX=> {f=> 'foo'}}, {OUT=>"f: FAILED\n"},
{ERR=>"md5sum: WARNING: 1 of 1 computed"
. " checksum did NOT match\n"},
{EXIT=> 1}],
# The sha1sum and md5sum drivers share a lot of code.
# Ensure that md5sum does *not* share the part that makes
# sha1sum accept BSD format.
['check-bsd', '--check', {IN=> {'f.sha1' => "SHA1 (f) = $degenerate\n"}},
{AUX=> {f=> ''}},
{ERR=>"md5sum: f.sha1: no properly formatted "
. "MD5 checksum lines found\n"},
{EXIT=> 1}],
{AUX=> {f=> ''}},
{ERR=>"md5sum: f.sha1: no properly formatted "
. "MD5 checksum lines found\n"},
{EXIT=> 1}],
['check-bsd2', '--check', {IN=> {'f.md5' => "MD5 (f) = $degenerate\n"}},
{AUX=> {f=> ''}}, {OUT=>"f: OK\n"}],
{AUX=> {f=> ''}}, {OUT=>"f: OK\n"}],
['check-bsd3', '--check', '--status',
{IN=> {'f.md5' => "MD5 (f) = $degenerate\n"}},
{AUX=> {f=> 'bar'}}, {EXIT=> 1}],
{IN=> {'f.md5' => "MD5 (f) = $degenerate\n"}},
{AUX=> {f=> 'bar'}}, {EXIT=> 1}],
['bsd-segv', '--check', {IN=> {'z' => "MD5 ("}}, {EXIT=> 1},
{ERR=> "$prog: z: no properly formatted MD5 checksum lines found\n"}],

View File

@@ -51,7 +51,7 @@ my @Tests =
{IN=>{i=>'c'}}, {OUT=>''}],
# Skip the sum of the lengths of the first three inputs, printing the 4th.
['j-bug4', '-c -j 3 -An', {IN=>{g=>'a'}}, {IN=>{h=>'b'}},
{IN=>{i=>'c'}}, {IN=>{j=>'d'}}, {OUT=>" d\n"}],
{IN=>{i=>'c'}}, {IN=>{j=>'d'}}, {OUT=>" d\n"}],
# Ensure that od -j doesn't fseek across a nonempty file in /proc,
# even if the kernel reports that the file has stat.st_size = 0.

View File

@@ -45,11 +45,11 @@ sub normalize_to_cwd_relative ($$$)
{
$slash = index $dir, '/', $slash + 1;
$slash <= -1
and die "$ME: $dir does not contain old CWD\n";
and die "$ME: $dir does not contain old CWD\n";
my $dir_prefix = $slash ? substr ($dir, 0, $slash) : '/';
my ($d, $i) = (stat $dir_prefix)[0, 1];
$d == $dev && $i == $ino
and return substr $dir, $slash + 1;
and return substr $dir, $slash + 1;
}
}

View File

@@ -102,7 +102,7 @@ my @Tests =
# fail to print the "2,0" endpoint.
['locale-dec-pt', qw(-0.1 0.1 2),
{OUT => [qw(-0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0)]},
1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0)]},
{ENV => "LC_ALL=$locale"},
{OUT_SUBST => 's/,/./g'},
@@ -116,8 +116,8 @@ foreach $t (@Tests)
my $e;
foreach $e (@$t)
{
$e->{OUT} = join ("\n", @{$e->{OUT}}) . "\n"
if ref $e eq 'HASH' and exists $e->{OUT};
$e->{OUT} = join ("\n", @{$e->{OUT}}) . "\n"
if ref $e eq 'HASH' and exists $e->{OUT};
}
}

View File

@@ -28,38 +28,38 @@ my $sha_degenerate = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
my @Tests =
(
['s1', {IN=> {f=> ''}},
{OUT=>"$sha_degenerate f\n"}],
{OUT=>"$sha_degenerate f\n"}],
['s2', {IN=> {f=> 'a'}},
{OUT=>"86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 f\n"}],
{OUT=>"86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 f\n"}],
['s3', {IN=> {f=> 'abc'}},
{OUT=>"a9993e364706816aba3e25717850c26c9cd0d89d f\n"}],
{OUT=>"a9993e364706816aba3e25717850c26c9cd0d89d f\n"}],
['s4',
{IN=> {f=> 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'}},
{OUT=>"84983e441c3bd26ebaae4aa1f95129e5e54670f1 f\n"}],
{OUT=>"84983e441c3bd26ebaae4aa1f95129e5e54670f1 f\n"}],
['s5', {IN=> {f=> 'abcdefghijklmnopqrstuvwxyz'}},
{OUT=>"32d10c7b8cf96570ca04ce37f2a19d84240d3a89 f\n"}],
{OUT=>"32d10c7b8cf96570ca04ce37f2a19d84240d3a89 f\n"}],
['s6', {IN=> {f=> join ('', 'A'..'Z', 'a'..'z', '0'..'9')}},
{OUT=>"761c457bf73b14d27e9e9265c46f4b4dda11f940 f\n"}],
{OUT=>"761c457bf73b14d27e9e9265c46f4b4dda11f940 f\n"}],
['s7', {IN=> {f=> '1234567890' x 8}},
{OUT=>"50abf5706a150990a08b2c5ea40fa0e585554732 f\n"}],
{OUT=>"50abf5706a150990a08b2c5ea40fa0e585554732 f\n"}],
['million-a', {IN=> {f=> 'a' x 1000000}},
{OUT=>"34aa973cd4c4daa4f61eeb2bdbad27316534016f f\n"}],
{OUT=>"34aa973cd4c4daa4f61eeb2bdbad27316534016f f\n"}],
['bs-sha', {IN=> {".\\foo"=> ''}},
{OUT=>"\\$sha_degenerate .\\\\foo\n"}],
{OUT=>"\\$sha_degenerate .\\\\foo\n"}],
# The sha1sum and md5sum drivers share a lot of code.
# Ensure that sha1sum does *not* share the part that makes
# md5sum accept BSD format.
['check-bsd', '--check', {IN=> {'f.md5' => "MD5 (f) = $sha_degenerate\n"}},
{AUX=> {f=> ''}},
{ERR=>"sha1sum: f.md5: no properly formatted "
. "SHA1 checksum lines found\n"},
{EXIT=> 1}],
{AUX=> {f=> ''}},
{ERR=>"sha1sum: f.md5: no properly formatted "
. "SHA1 checksum lines found\n"},
{EXIT=> 1}],
['check-bsd2', '--check',
{IN=> {'f.sha1' => "SHA1 (f) = $sha_degenerate\n"}},
{AUX=> {f=> ''}}, {OUT=>"f: OK\n"}],
{IN=> {'f.sha1' => "SHA1 (f) = $sha_degenerate\n"}},
{AUX=> {f=> ''}}, {OUT=>"f: OK\n"}],
['check-bsd3', '--check', '--status',
{IN=> {'f.sha1' => "SHA1 (f) = $sha_degenerate\n"}},
{AUX=> {f=> 'bar'}}, {EXIT=> 1}],
{IN=> {'f.sha1' => "SHA1 (f) = $sha_degenerate\n"}},
{AUX=> {f=> 'bar'}}, {EXIT=> 1}],
['bsd-segv', '--check', {IN=> {'z' => "SHA1 ("}}, {EXIT=> 1},
{ERR=> "$prog: z: no properly formatted SHA1 checksum lines found\n"}],
);

View File

@@ -26,12 +26,12 @@ use strict;
my @Tests =
(
['s3', {IN=> {f=> 'abc'}},
{OUT=>"23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 f\n"}],
{OUT=>"23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 f\n"}],
['s4',
{IN=> {f=> 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'}},
{OUT=>"75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525 f\n"}],
{OUT=>"75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525 f\n"}],
['s8', {IN=> {f=> 'a' x 1000000}},
{OUT=>"20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67 f\n"}],
{OUT=>"20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67 f\n"}],
);
# Insert the `--text' argument for each test.

View File

@@ -28,16 +28,16 @@ my $sha_degenerate = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b78
my @Tests =
(
['s1', {IN=> {f=> ''}},
{OUT=>"$sha_degenerate f\n"}],
{OUT=>"$sha_degenerate f\n"}],
['s2', {IN=> {f=> 'a'}},
{OUT=>"ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb f\n"}],
{OUT=>"ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb f\n"}],
['s3', {IN=> {f=> 'abc'}},
{OUT=>"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad f\n"}],
{OUT=>"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad f\n"}],
['s4',
{IN=> {f=> 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'}},
{OUT=>"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1 f\n"}],
{OUT=>"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1 f\n"}],
['s8', {IN=> {f=> 'a' x 1000000}},
{OUT=>"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0 f\n"}],
{OUT=>"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0 f\n"}],
);
# Insert the `--text' argument for each test.

View File

@@ -28,16 +28,16 @@ my $sha_degenerate = "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63
my @Tests =
(
['s1', {IN=> {f=> ''}},
{OUT=>"$sha_degenerate f\n"}],
{OUT=>"$sha_degenerate f\n"}],
['s2', {IN=> {f=> 'a'}},
{OUT=>"54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31 f\n"}],
{OUT=>"54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31 f\n"}],
['s3', {IN=> {f=> 'abc'}},
{OUT=>"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 f\n"}],
{OUT=>"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 f\n"}],
['s4',
{IN=> {f=> 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu'}},
{OUT=>"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039 f\n"}],
{OUT=>"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039 f\n"}],
['s8', {IN=> {f=> 'a' x 1000000}},
{OUT=>"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985 f\n"}],
{OUT=>"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985 f\n"}],
);
# Insert the `--text' argument for each test.

View File

@@ -28,16 +28,16 @@ my $sha_degenerate = "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d3
my @Tests =
(
['s1', {IN=> {f=> ''}},
{OUT=>"$sha_degenerate f\n"}],
{OUT=>"$sha_degenerate f\n"}],
['s2', {IN=> {f=> 'a'}},
{OUT=>"1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 f\n"}],
{OUT=>"1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 f\n"}],
['s3', {IN=> {f=> 'abc'}},
{OUT=>"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f f\n"}],
{OUT=>"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f f\n"}],
['s4',
{IN=> {f=> 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu'}},
{OUT=>"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909 f\n"}],
{OUT=>"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909 f\n"}],
['s8', {IN=> {f=> 'a' x 1000000}},
{OUT=>"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b f\n"}],
{OUT=>"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b f\n"}],
);
# Insert the `--text' argument for each test.

View File

@@ -31,8 +31,8 @@ my @Tests =
# invalid extra command line argument
['f-extra-arg', '--files0-from=- no-such', {IN=>"a"}, {EXIT=>2},
{ERR => "$prog: extra operand `no-such'\n"
. "file operands cannot be combined with --files0-from\n"
. "Try `$prog --help' for more information.\n"}
. "file operands cannot be combined with --files0-from\n"
. "Try `$prog --help' for more information.\n"}
],
# missing input file

View File

@@ -43,11 +43,11 @@ my @Tests =
# check validation of --batch-size option
['nmerge-0', "-m --batch-size=0", @inputs,
{ERR=>"$prog: invalid --batch-size argument `0'\n".
"$prog: minimum --batch-size argument is `2'\n"}, {EXIT=>2}],
"$prog: minimum --batch-size argument is `2'\n"}, {EXIT=>2}],
['nmerge-1', "-m --batch-size=1", @inputs,
{ERR=>"$prog: invalid --batch-size argument `1'\n".
"$prog: minimum --batch-size argument is `2'\n"}, {EXIT=>2}],
"$prog: minimum --batch-size argument is `2'\n"}, {EXIT=>2}],
['nmerge-neg', "-m --batch-size=-1", @inputs,
{ERR=>"$prog: invalid --batch-size argument `-1'\n"}, {EXIT=>2}],
@@ -56,9 +56,9 @@ my @Tests =
{ERR=>"$prog: invalid --batch-size argument `a'\n"}, {EXIT=>2}],
['nmerge-big', "-m --batch-size=$bigint", @inputs,
{ERR_SUBST=>'s/(current rlimit is) \d+/$1/'},
{ERR_SUBST=>'s/(current rlimit is) \d+/$1/'},
{ERR=>"$prog: --batch-size argument `$bigint' too large\n".
"$prog: maximum --batch-size argument with current rlimit is\n"},
"$prog: maximum --batch-size argument with current rlimit is\n"},
{EXIT=>2}],
# This should work since nmerge >= the number of input files
@@ -69,12 +69,12 @@ my @Tests =
['nmerge-no', "-m --batch-size=2 -T$badtmp", @inputs,
{ERR_SUBST=>"s|': .*|':|"},
{ERR=>"$prog: cannot create temporary file in `$badtmp':\n"},
{EXIT=>2}],
{EXIT=>2}],
# This used to fail because setting batch-size without also setting
# buffer size would cause the buffer size to be set to the minimum.
['batch-size', "--batch-size=16 -T$badtmp", {IN=> {big=> $big_input}},
{OUT=>$big_input}],
{OUT=>$big_input}],
);
my $save_temps = $ENV{DEBUG};

View File

@@ -24,86 +24,86 @@ fi
. $srcdir/test-lib.sh
cat > in <<- _EOF_
gcc-c++-10.fc9.tar.gz
gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2
glibc-2-0.1.beta1.fc10.rpm
glibc-common-5-0.2.beta2.fc9.ebuild
glibc-common-5-0.2b.deb
glibc-common-11b.ebuild
glibc-common-11-0.6rc2.ebuild
libstdc++-0.5.8.11-0.7rc2.fc10.tar.gz
libstdc++-4a.fc8.tar.gz
libstdc++-4.10.4.20040204svn.rpm
libstdc++-devel-3.fc8.ebuild
libstdc++-devel-3a.fc9.tar.gz
libstdc++-devel-8.fc8.deb
libstdc++-devel-8.6.2-0.4b.fc8
nss_ldap-1-0.2b.fc9.tar.bz2
nss_ldap-1-0.6rc2.fc8.tar.gz
nss_ldap-1.0-0.1a.tar.gz
nss_ldap-10beta1.fc8.tar.gz
nss_ldap-10.11.8.6.20040204cvs.fc10.ebuild
string start 5.0.0 end of str
string start 5.1.0 end of str
string start 5.10.0 end of str
string start 5.2.0 end of str
string start 5.20.0 end of str
string start 5.3.0 end of str
string start 5.30.0 end of str
string start 5.4.0 end of str
string start 5.40.0 end of str
string start 5.5.0 end of str
string start 5.50.0 end of str
string start 5.6.0 end of str
string start 5.60.0 end of str
string start 5.7.0 end of str
string start 5.70.0 end of str
string start 5.8.0 end of str
string start 5.80.0 end of str
string start 5.9.0 end of str
string start 5.90.0 end of str
_EOF_
gcc-c++-10.fc9.tar.gz
gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2
glibc-2-0.1.beta1.fc10.rpm
glibc-common-5-0.2.beta2.fc9.ebuild
glibc-common-5-0.2b.deb
glibc-common-11b.ebuild
glibc-common-11-0.6rc2.ebuild
libstdc++-0.5.8.11-0.7rc2.fc10.tar.gz
libstdc++-4a.fc8.tar.gz
libstdc++-4.10.4.20040204svn.rpm
libstdc++-devel-3.fc8.ebuild
libstdc++-devel-3a.fc9.tar.gz
libstdc++-devel-8.fc8.deb
libstdc++-devel-8.6.2-0.4b.fc8
nss_ldap-1-0.2b.fc9.tar.bz2
nss_ldap-1-0.6rc2.fc8.tar.gz
nss_ldap-1.0-0.1a.tar.gz
nss_ldap-10beta1.fc8.tar.gz
nss_ldap-10.11.8.6.20040204cvs.fc10.ebuild
string start 5.0.0 end of str
string start 5.1.0 end of str
string start 5.10.0 end of str
string start 5.2.0 end of str
string start 5.20.0 end of str
string start 5.3.0 end of str
string start 5.30.0 end of str
string start 5.4.0 end of str
string start 5.40.0 end of str
string start 5.5.0 end of str
string start 5.50.0 end of str
string start 5.6.0 end of str
string start 5.60.0 end of str
string start 5.7.0 end of str
string start 5.70.0 end of str
string start 5.8.0 end of str
string start 5.80.0 end of str
string start 5.9.0 end of str
string start 5.90.0 end of str
_EOF_
cat > exp <<- _EOF_
gcc-c++-10.fc9.tar.gz
gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2
glibc-2-0.1.beta1.fc10.rpm
glibc-common-5-0.2.beta2.fc9.ebuild
glibc-common-5-0.2b.deb
glibc-common-11b.ebuild
glibc-common-11-0.6rc2.ebuild
libstdc++-0.5.8.11-0.7rc2.fc10.tar.gz
libstdc++-4a.fc8.tar.gz
libstdc++-4.10.4.20040204svn.rpm
libstdc++-devel-3.fc8.ebuild
libstdc++-devel-3a.fc9.tar.gz
libstdc++-devel-8.fc8.deb
libstdc++-devel-8.6.2-0.4b.fc8
nss_ldap-1-0.2b.fc9.tar.bz2
nss_ldap-1-0.6rc2.fc8.tar.gz
nss_ldap-1.0-0.1a.tar.gz
nss_ldap-10beta1.fc8.tar.gz
nss_ldap-10.11.8.6.20040204cvs.fc10.ebuild
string start 5.0.0 end of str
string start 5.1.0 end of str
string start 5.2.0 end of str
string start 5.3.0 end of str
string start 5.4.0 end of str
string start 5.5.0 end of str
string start 5.6.0 end of str
string start 5.7.0 end of str
string start 5.8.0 end of str
string start 5.9.0 end of str
string start 5.10.0 end of str
string start 5.20.0 end of str
string start 5.30.0 end of str
string start 5.40.0 end of str
string start 5.50.0 end of str
string start 5.60.0 end of str
string start 5.70.0 end of str
string start 5.80.0 end of str
string start 5.90.0 end of str
_EOF_
gcc-c++-10.fc9.tar.gz
gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2
glibc-2-0.1.beta1.fc10.rpm
glibc-common-5-0.2.beta2.fc9.ebuild
glibc-common-5-0.2b.deb
glibc-common-11b.ebuild
glibc-common-11-0.6rc2.ebuild
libstdc++-0.5.8.11-0.7rc2.fc10.tar.gz
libstdc++-4a.fc8.tar.gz
libstdc++-4.10.4.20040204svn.rpm
libstdc++-devel-3.fc8.ebuild
libstdc++-devel-3a.fc9.tar.gz
libstdc++-devel-8.fc8.deb
libstdc++-devel-8.6.2-0.4b.fc8
nss_ldap-1-0.2b.fc9.tar.bz2
nss_ldap-1-0.6rc2.fc8.tar.gz
nss_ldap-1.0-0.1a.tar.gz
nss_ldap-10beta1.fc8.tar.gz
nss_ldap-10.11.8.6.20040204cvs.fc10.ebuild
string start 5.0.0 end of str
string start 5.1.0 end of str
string start 5.2.0 end of str
string start 5.3.0 end of str
string start 5.4.0 end of str
string start 5.5.0 end of str
string start 5.6.0 end of str
string start 5.7.0 end of str
string start 5.8.0 end of str
string start 5.9.0 end of str
string start 5.10.0 end of str
string start 5.20.0 end of str
string start 5.30.0 end of str
string start 5.40.0 end of str
string start 5.50.0 end of str
string start 5.60.0 end of str
string start 5.70.0 end of str
string start 5.80.0 end of str
string start 5.90.0 end of str
_EOF_
fail=0
sort --sort=version -o out in || fail=1

View File

@@ -40,7 +40,7 @@ my @Tests =
['hex-1', q!--printf='\x34\xf' .!, {OUT=>"\x34\xf"}],
['hex-2', q!--printf='.\x18p\xfq' .!, {OUT=>".\x18p\x0fq"}],
['hex-3', q!--printf='\x' .!, {OUT=>'x'},
{ERR=>"$prog: warning: unrecognized escape `\\x'\n"}],
{ERR=>"$prog: warning: unrecognized escape `\\x'\n"}],
# With --format, there *is* a trailing newline.
['f-nl', "--format=%n .", {OUT=>".\n"}],
@@ -49,12 +49,12 @@ my @Tests =
['end-pct', "--printf=% .", {OUT=>"%"}],
['pct-pct', "--printf=%% .", {OUT=>"%"}],
['end-bs', "--printf='\\' .", {OUT=>'\\'},
{ERR=>"$prog: warning: backslash at end of format\n"}],
{ERR=>"$prog: warning: backslash at end of format\n"}],
['err-1', "--printf=%9% .", {EXIT => 1},
{ERR=>"$prog: %9%: invalid directive\n"}],
{ERR=>"$prog: %9%: invalid directive\n"}],
['err-2', "--printf=%9 .", {EXIT => 1},
{ERR=>"$prog: %9: invalid directive\n"}],
{ERR=>"$prog: %9: invalid directive\n"}],
);
my $save_temps = $ENV{DEBUG};

View File

@@ -87,13 +87,13 @@ if test -n "$RUN_LONG_TESTS"; then
rev1=`eval echo "\\\$REV_$opt1"`
rev2=`eval echo "\\\$REV_$opt2"`
if test -n "$rev1"; then
stty -$opt1 $opt2 || fail=1
stty -$opt1 $opt2 || fail=1
fi
if test -n "$rev2"; then
stty $opt1 -$opt2 || fail=1
stty $opt1 -$opt2 || fail=1
fi
if test "$rev1$rev2" = 11; then
stty -$opt1 -$opt2 || fail=1
stty -$opt1 -$opt2 || fail=1
fi
done
done

View File

@@ -34,7 +34,7 @@ my @Tests =
['4', {IN=> {f=> 'message digest'}}, {OUT=>"26423 1\n"}],
['5', {IN=> {f=> 'abcdefghijklmnopqrstuvwxyz'}}, {OUT=>"53553 1\n"}],
['6', {IN=> {f=> join ('', 'A'..'Z', 'a'..'z', '0'..'9')}},
{OUT=>"25587 1\n"}],
{OUT=>"25587 1\n"}],
['7', {IN=> {f=> '1234567890' x 8}}, {OUT=>"21845 1\n"}],
['a-r-1k', '-r', {IN=> {f=> $in_1k}}, {OUT=>"65409 1\n"}],
@@ -49,7 +49,7 @@ my @Tests =
['5s', '-s', {IN=> {f=> 'abcdefghijklmnopqrstuvwxyz'}},
{OUT=>"2847 1 f\n"}],
['6s', '-s', {IN=> {f=> join ('', 'A'..'Z', 'a'..'z', '0'..'9')}},
{OUT=>"5387 1 f\n"}],
{OUT=>"5387 1 f\n"}],
['7s', '-s', {IN=> {f=> '1234567890' x 8}}, {OUT=>"4200 1 f\n"}],
);

View File

@@ -28,12 +28,12 @@ nums=`seq 9` || framework_failure
fail=0
for n in 0 $nums; do
files=`seq $n`
rm -f $files
tee $files <sample >out || fail=1
for f in out $files; do
compare sample $f || fail=1
done
files=`seq $n`
rm -f $files
tee $files <sample >out || fail=1
for f in out $files; do
compare sample $f || fail=1
done
done
Exit $fail

View File

@@ -33,12 +33,12 @@ sub digest_test ($)
foreach my $e (@$t)
{
!ref $e
and push (@args, $e), next;
and push (@args, $e), next;
ref $e eq 'HASH'
or (warn "$0: $t->[0]: unexpected entry type\n"), next;
or (warn "$0: $t->[0]: unexpected entry type\n"), next;
exists $e->{EXIT}
and $ret = $e->{EXIT}, next;
and $ret = $e->{EXIT}, next;
push @list_of_hashref, $e;
}
@@ -70,16 +70,16 @@ sub add_inverse_op_tests($)
# Generate corresponding tests of inverse ops.
# E.g. generate tests of `-ge' from those of `-lt'.
foreach my $op (qw(gt lt eq))
{
if ($test_name =~ /$op-/ && $flags =~ / -$op /)
{
my $inv = $inverse_op{$op};
$test_name =~ s/$op/$inv/;
$flags =~ s/-$op/-$inv/;
$ret = 1 - $ret;
push (@new, [$test_name, $flags, {EXIT=>$ret}, @$LoH]);
}
}
{
if ($test_name =~ /$op-/ && $flags =~ / -$op /)
{
my $inv = $inverse_op{$op};
$test_name =~ s/$op/$inv/;
$flags =~ s/-$op/-$inv/;
$ret = 1 - $ret;
push (@new, [$test_name, $flags, {EXIT=>$ret}, @$LoH]);
}
}
}
return @new;
}
@@ -93,8 +93,8 @@ sub add_pn_tests($)
# There are a few exceptions.
my %not_N = map {$_ => 1} qw (1a);
my %not_P = map {$_ => 1} qw (1a
streq-6 strne-6
paren-1 paren-2 paren-3 paren-4 paren-5);
streq-6 strne-6
paren-1 paren-2 paren-3 paren-4 paren-5);
foreach my $t (@$tests)
{
push @new, $t;
@@ -104,13 +104,13 @@ sub add_pn_tests($)
next if $ret == 2;
push (@new, ["N-$test_name", "! $flags", {EXIT=>1-$ret}, @$LoH])
unless $not_N{$test_name};
unless $not_N{$test_name};
push (@new, ["P-$test_name", "'(' $flags ')'", {EXIT=>$ret}, @$LoH])
unless $not_P{$test_name};
unless $not_P{$test_name};
push (@new, ["NP-$test_name", "! '(' $flags ')'", {EXIT=>1-$ret}, @$LoH])
unless $not_P{$test_name};
unless $not_P{$test_name};
push (@new, ["NNP-$test_name", "! ! '(' $flags ')'", {EXIT=>$ret, @$LoH}])
unless $not_P{$test_name};
unless $not_P{$test_name};
}
return @new;

View File

@@ -67,10 +67,10 @@ $@ and (warn "$ME: this script requires Perl's Expect package >=1.11\n"),
my $exp = new Expect;
$exp->log_user(0);
$exp->spawn("$cmd 2> $stderr")
or (warn "$ME: cannot run `$cmd': $!\n"), $fail=1, next;
or (warn "$ME: cannot run `$cmd': $!\n"), $fail=1, next;
# No input for cut -f2.
$cmd =~ /^cut/
or $exp->send("a b\n");
or $exp->send("a b\n");
$exp->send("\cD"); # This is Control-D. FIXME: what if that's not EOF?
$exp->expect (0, '-re', "^a b\\r?\$");
my $found = $exp->expect (1, '-re', "^.+\$");
@@ -78,32 +78,32 @@ $@ and (warn "$ME: this script requires Perl's Expect package >=1.11\n"),
$exp->expect(1, 'eof');
# Expect no output from cut, since we gave it no input.
defined $found || $cmd =~ /^cut/
or (warn "$ME: $cmd didn't produce expected output\n"),
$fail=1, next;
or (warn "$ME: $cmd didn't produce expected output\n"),
$fail=1, next;
defined $exp->exitstatus
or (warn "$ME: $cmd didn't exit after ^D from standard input\n"),
$fail=1, next;
or (warn "$ME: $cmd didn't exit after ^D from standard input\n"),
$fail=1, next;
my $s = $exp->exitstatus;
$s == 0
or (warn "$ME: $cmd exited with status $s (expected 0)\n"),
$fail=1;
or (warn "$ME: $cmd exited with status $s (expected 0)\n"),
$fail=1;
$exp->hard_close();
# dd normally writes to stderr. If it exits successfully, we're done.
$cmd eq 'dd' && $s == 0
and next;
and next;
if (-s $stderr)
{
warn "$ME: $cmd wrote to stderr:\n";
system "cat $stderr";
$fail = 1;
}
{
warn "$ME: $cmd wrote to stderr:\n";
system "cat $stderr";
$fail = 1;
}
}
continue
{
unlink $stderr
or warn "$ME: failed to remove stderr file from $cmd, $stderr: $!\n";
or warn "$ME: failed to remove stderr file from $cmd, $stderr: $!\n";
}
exit $fail

View File

@@ -38,42 +38,42 @@ sub add_z_variants($)
# skip the obsolete-syntax tests
$t->[0] =~ /^obs-plus/
and next;
and next;
my @args;
my @list_of_hash;
foreach my $e (@$t)
{
!ref $e
and push (@args, $e), next;
{
!ref $e
and push (@args, $e), next;
ref $e && ref $e eq 'HASH'
or (warn "$0: $t->[0]: unexpected entry type\n"), next;
my $tmp = $e;
foreach my $k (qw(IN OUT))
{
my $val = $e->{$k};
# skip any test whose input or output already contains a NUL byte
if (defined $val)
{
$val =~ /\0/
and next TEST;
ref $e && ref $e eq 'HASH'
or (warn "$0: $t->[0]: unexpected entry type\n"), next;
my $tmp = $e;
foreach my $k (qw(IN OUT))
{
my $val = $e->{$k};
# skip any test whose input or output already contains a NUL byte
if (defined $val)
{
$val =~ /\0/
and next TEST;
# Convert each NL in input or output to \0.
$val =~ s/\n/\0/g;
$tmp = {$k => $val};
last;
}
}
push @list_of_hash, $tmp;
}
# Convert each NL in input or output to \0.
$val =~ s/\n/\0/g;
$tmp = {$k => $val};
last;
}
}
push @list_of_hash, $tmp;
}
shift @args; # discard test name
# skip any test that uses the -z option
grep /z/, @args
and next;
and next;
push @new, ["$t->[0]-z", '-z', @args, @list_of_hash];
}

View File

@@ -31,8 +31,8 @@ my @Tests =
# invalid extra command line argument
['f-extra-arg', '--files0-from=- no-such', {IN=>"a"}, {EXIT=>1},
{ERR => "$prog: extra operand `no-such'\n"
. "file operands cannot be combined with --files0-from\n"
. "Try `$prog --help' for more information.\n"}
. "file operands cannot be combined with --files0-from\n"
. "Try `$prog --help' for more information.\n"}
],
# missing input file