summaryrefslogtreecommitdiff
path: root/tests/misc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/misc')
-rwxr-xr-xtests/misc/chroot-credentials13
-rwxr-xr-xtests/misc/cut11
-rwxr-xr-xtests/misc/date3
-rwxr-xr-xtests/misc/join3
-rwxr-xr-xtests/misc/md5sum4
-rwxr-xr-xtests/misc/sha1sum3
-rwxr-xr-xtests/misc/sha224sum6
-rwxr-xr-xtests/misc/sort17
-rwxr-xr-xtests/misc/sort-continue3
-rwxr-xr-xtests/misc/sort-files0-from2
-rwxr-xr-xtests/misc/sort-rand6
-rwxr-xr-xtests/misc/stdbuf3
-rwxr-xr-xtests/misc/tr9
-rwxr-xr-xtests/misc/uniq9
14 files changed, 61 insertions, 31 deletions
diff --git a/tests/misc/chroot-credentials b/tests/misc/chroot-credentials
index cfa903dd5..2bce5cfd9 100755
--- a/tests/misc/chroot-credentials
+++ b/tests/misc/chroot-credentials
@@ -28,12 +28,17 @@ test $(chroot / whoami) = root || fail=1
test "$(groups)" = "$(chroot / groups)" || fail=1
# Verify that credentials are changed correctly.
-test "$(chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP / whoami)" != root \
- || fail=1
+whoami_after_chroot=$(
+ chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP / whoami
+)
+test "$whoami_after_chroot" != root || fail=1
# Verify that there are no additional groups.
-test "$(chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP --groups=$NON_ROOT_GROUP / id -G)"\
- = $NON_ROOT_GROUP || fail=1
+id_G_after_chroot=$(
+ chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP \
+ --groups=$NON_ROOT_GROUP / id -G
+)
+test "$id_G_after_chroot" = $NON_ROOT_GROUP || fail=1
# Verify that when specifying only the user name we get the current
# primary group ID.
diff --git a/tests/misc/cut b/tests/misc/cut
index e8f003ff2..f91932c02 100755
--- a/tests/misc/cut
+++ b/tests/misc/cut
@@ -87,7 +87,8 @@ my @Tests =
. "\tonly when operating on fields\n$try"}],
# You must specify bytes or fields (or chars)
['z', '', {IN=>":\n"}, {OUT=>""}, {EXIT=>1},
- {ERR=>"$prog: you must specify a list of bytes, characters, or fields\n$try"}],
+ {ERR=>"$prog: you must specify a list of bytes, characters, or fields\n$try"}
+ ],
# Empty field list
['empty-fl', qw(-f ''), {IN=>":\n"}, {OUT=>""}, {EXIT=>1}, {ERR=>$from_1}],
# Missing field list
@@ -124,7 +125,7 @@ my @Tests =
['out-delim3a', '-c1-3,2-4,6-', '--output-d=:', {IN=>"abcdefg\n"},
{OUT=>"abcd:fg\n"}],
# Ensure that the following two commands produce the same output.
- # Before an off-by-one fix, the output from the former would not contain a `:'.
+ # Before an off-by-1 fix, the output from the former would not contain a `:'.
['out-delim4', '-c4-,2-3', '--output-d=:',
{IN=>"abcdefg\n"}, {OUT=>"bc:defg\n"}],
['out-delim5', '-c2-3,4-', '--output-d=:',
@@ -137,14 +138,16 @@ my @Tests =
['od-overlap2', '-b1-2,2-', '--output-d=:', {IN=>"abc\n"}, {OUT=>"abc\n"}],
['od-overlap3', '-b1-3,2-', '--output-d=:', {IN=>"abcd\n"}, {OUT=>"abcd\n"}],
['od-overlap4', '-b1-3,2-3', '--output-d=:', {IN=>"abcd\n"}, {OUT=>"abc\n"}],
- ['od-overlap5', '-b1-3,1-4', '--output-d=:', {IN=>"abcde\n"}, {OUT=>"abcd\n"}],
+ ['od-overlap5', '-b1-3,1-4', '--output-d=:',
+ {IN=>"abcde\n"}, {OUT=>"abcd\n"}],
# None of the following invalid ranges provoked an error up to coreutils-6.9.
['inval1', qw(-f 2-0), {IN=>''}, {OUT=>''}, {EXIT=>1},
{ERR=>"$prog: invalid decreasing range\n$try"}],
['inval2', qw(-f -), {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
['inval3', '-f', '4,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
- ['inval4', '-f', '1-2,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
+ ['inval4', '-f', '1-2,-', {IN=>''}, {OUT=>''}, {EXIT=>1},
+ {ERR=>$no_endpoint}],
['inval5', '-f', '1-,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
['inval6', '-f', '-1,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
);
diff --git a/tests/misc/date b/tests/misc/date
index 1b64558b4..38c4f3726 100755
--- a/tests/misc/date
+++ b/tests/misc/date
@@ -230,7 +230,8 @@ my @Tests =
['tz-5wf', '+%:8z', {OUT=>"%:8z"}, {ENV=>'TZ=XXX0:01'}],
['ns-relative',
- '--iso=ns', "-d'1970-01-01 00:00:00.1234567 UTC +961062237.987654321 sec'",
+ '--iso=ns',
+ "-d'1970-01-01 00:00:00.1234567 UTC +961062237.987654321 sec'",
{OUT=>"2000-06-15T09:43:58,111111021+0000"}],
['ns-relativer', '--rfc-3339=ns',
"-d'1970-01-01 00:00:00.1234567 UTC +961062237.987654321 sec'",
diff --git a/tests/misc/join b/tests/misc/join
index a319b943c..ab43b5d56 100755
--- a/tests/misc/join
+++ b/tests/misc/join
@@ -216,7 +216,8 @@ my @tv = (
# '--header' always outputs headers from the first file
# even if the headers from the second file don't match
['header-5', '--header',
- [ "ID1 Name\n1 A\n2 B\n", "ID2 Color\n1 red\n"], "ID1 Name Color\n1 A red\n", 0],
+ [ "ID1 Name\n1 A\n2 B\n", "ID2 Color\n1 red\n"],
+ "ID1 Name Color\n1 A red\n", 0],
);
diff --git a/tests/misc/md5sum b/tests/misc/md5sum
index 819a81925..fc3bbb8c6 100755
--- a/tests/misc/md5sum
+++ b/tests/misc/md5sum
@@ -62,8 +62,8 @@ my @Tests =
. "invalid\n" }},
{AUX=> {f=> 'foo'}},
{OUT=>"f: FAILED\nf: FAILED\n"},
- {ERR=>"md5sum: WARNING: 1 line is improperly formatted\n"
- . "md5sum: WARNING: 2 computed checksums did NOT match\n"},
+ {ERR=>"md5sum: WARNING: 1 line is improperly formatted\n"
+ . "md5sum: WARNING: 2 computed checksums did NOT match\n"},
{EXIT=> 1}],
# Similar to the above, but use --warn to evoke one more diagnostic.
['check-multifail-warn', '--check', '--warn',
diff --git a/tests/misc/sha1sum b/tests/misc/sha1sum
index ecd779620..15badc085 100755
--- a/tests/misc/sha1sum
+++ b/tests/misc/sha1sum
@@ -60,7 +60,8 @@ my @Tests =
['check-bsd3', '--check', '--status',
{IN=> {'f.sha1' => "SHA1 (f) = $sha_degenerate\n"}},
{AUX=> {f=> 'bar'}}, {EXIT=> 1}],
- ['check-openssl', '--check', {IN=> {'f.md5' => "MD5(f)= $sha_degenerate\n"}},
+ ['check-openssl', '--check',
+ {IN=> {'f.md5' => "MD5(f)= $sha_degenerate\n"}},
{AUX=> {f=> ''}},
{ERR=>"sha1sum: f.md5: no properly formatted "
. "SHA1 checksum lines found\n"},
diff --git a/tests/misc/sha224sum b/tests/misc/sha224sum
index a46c2a1fa..634150dd1 100755
--- a/tests/misc/sha224sum
+++ b/tests/misc/sha224sum
@@ -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.
diff --git a/tests/misc/sort b/tests/misc/sort
index 5bc526a27..e01e29bbe 100755
--- a/tests/misc/sort
+++ b/tests/misc/sort
@@ -55,8 +55,11 @@ my @Tests =
["n11b", '-s -n -k1,1', {IN=>".010\n.01a\n"}, {OUT=>".010\n.01a\n"}],
# human readable suffixes
-["h1", '-h', {IN=>"1Y\n1Z\n1E\n1P\n1T\n1G\n1M\n1K\n02\n1\nY\n-1k\n-1M\n-1G\n-1T\n-1P\n-1E\n-1Z\n-1Y\n"},
- {OUT=>"-1Y\n-1Z\n-1E\n-1P\n-1T\n-1G\n-1M\n-1k\nY\n1\n02\n1K\n1M\n1G\n1T\n1P\n1E\n1Z\n1Y\n"}],
+["h1", '-h',
+ {IN=>"1Y\n1Z\n1E\n1P\n1T\n1G\n1M\n1K\n02\n1\nY\n-1k\n-1M\n-1G\n-1T\n"
+ . "-1P\n-1E\n-1Z\n-1Y\n"},
+ {OUT=>"-1Y\n-1Z\n-1E\n-1P\n-1T\n-1G\n-1M\n-1k\nY\n1\n02\n1K\n1M\n1G\n1T\n"
+ . "1P\n1E\n1Z\n1Y\n"}],
["h2", '-h', {IN=>"1M\n-2G\n-3K"}, {OUT=>"-2G\n-3K\n1M\n"}],
# check that it works with powers of 1024
["h3", '-k 2,2h -k 1,1', {IN=>"a 1G\nb 1023M\n"}, {OUT=>"b 1023M\na 1G\n"}],
@@ -275,8 +278,14 @@ my @Tests =
# of memcmp in the Next C library. With optimization, gcc uses its
# (working) builtin version. Test case form William Lewis.
["20a", '',
- {IN=>"_________U__free\n_________U__malloc\n_________U__abort\n_________U__memcpy\n_________U__memset\n_________U_dyld_stub_binding_helper\n_________U__malloc\n_________U___iob\n_________U__abort\n_________U__fprintf\n"},
- {OUT=>"_________U___iob\n_________U__abort\n_________U__abort\n_________U__fprintf\n_________U__free\n_________U__malloc\n_________U__malloc\n_________U__memcpy\n_________U__memset\n_________U_dyld_stub_binding_helper\n"}],
+ {IN=>"_________U__free\n_________U__malloc\n_________U__abort\n"
+ . "_________U__memcpy\n_________U__memset\n"
+ . "_________U_dyld_stub_binding_helper\n_________U__malloc\n"
+ . "_________U___iob\n_________U__abort\n_________U__fprintf\n"},
+ {OUT=>"_________U___iob\n_________U__abort\n_________U__abort\n"
+ . "_________U__fprintf\n_________U__free\n_________U__malloc\n"
+ . "_________U__malloc\n_________U__memcpy\n_________U__memset\n"
+ . "_________U_dyld_stub_binding_helper\n"}],
# Demonstrate that folding changes the ordering of e.g. A, a, and _
# because while they normally (in the C locale) collate like A, _, a,
diff --git a/tests/misc/sort-continue b/tests/misc/sort-continue
index 95f2c488e..f82255d6f 100755
--- a/tests/misc/sort-continue
+++ b/tests/misc/sort-continue
@@ -33,7 +33,8 @@ done
exec 0</dev/null 3<&- 4<&- 5<&-
sort -n -m __test.* > out
) &&
-compare in out || { fail=1; echo 'file descriptor exhaustion not handled' 1>&2; }
+compare in out ||
+ { fail=1; echo 'file descriptor exhaustion not handled' 1>&2; }
echo 32 | tee -a in > in1
(
diff --git a/tests/misc/sort-files0-from b/tests/misc/sort-files0-from
index e2eb5c47f..6082e8a02 100755
--- a/tests/misc/sort-files0-from
+++ b/tests/misc/sort-files0-from
@@ -80,7 +80,7 @@ my @Tests =
['2a', '--files0-from=-', '<',
{IN=>{f=>"g\0g\0"}}, {AUX=>{g=>'a'}}, {OUT=>"a\na\n"} ],
- # Ensure that $prog performs no processing when there is a zero-length filename
+ # Ensure that $prog does nothing when there is a zero-length filename.
# Note that the behavior here differs from `wc' in that the
# first zero-length file name is treated as fatal, so there
# should be no output on STDOUT.
diff --git a/tests/misc/sort-rand b/tests/misc/sort-rand
index 8fa3bc366..0034c452a 100755
--- a/tests/misc/sort-rand
+++ b/tests/misc/sort-rand
@@ -40,11 +40,13 @@ if (locale --version) > /dev/null 2>&1; then
LC_ALL=$locale sort --random-sort in > out2 || fail=1
# Fail if the output "randomly" is the same twice in a row.
- compare out1 out2 > /dev/null && { fail=1; echo "not random with LC_ALL=$locale" 1>&2; }
+ compare out1 out2 > /dev/null &&
+ { fail=1; echo "not random with LC_ALL=$locale" 1>&2; }
# Fail if the sorted output is not the same as the input.
sort -n out > out1
- compare in out1 || { fail=1; echo "not a permutation with LC_ALL=$locale" 1>&2; }
+ compare in out1 ||
+ { fail=1; echo "not a permutation with LC_ALL=$locale" 1>&2; }
fi
Exit $fail
diff --git a/tests/misc/stdbuf b/tests/misc/stdbuf
index 59c780370..2b7bdb833 100755
--- a/tests/misc/stdbuf
+++ b/tests/misc/stdbuf
@@ -22,7 +22,8 @@ print_ver_ stdbuf mv
getlimits_
require_built_ stdbuf
-# stdbuf fails when the absolute top build dir name contains e.g., space, TAB, NL
+# stdbuf fails when the absolute top build dir name contains e.g.,
+# space, TAB, NL
lf='
'
case $abs_top_builddir in
diff --git a/tests/misc/tr b/tests/misc/tr
index 00cd8e62c..8d7d755b7 100755
--- a/tests/misc/tr
+++ b/tests/misc/tr
@@ -54,7 +54,8 @@ my @Tests =
['i', qw(-d '[:xdigit:]'), {IN=>'w0x1y2z3456789acbdefABCDEFz'},
{OUT=>'wxyzz'}],
['j', qw(-d '[:digit:]'), {IN=>'0123456789'}, {OUT=>''}],
- ['k', qw(-d '[:digit:]'), {IN=>'a0b1c2d3e4f5g6h7i8j9k'}, {OUT=>'abcdefghijk'}],
+ ['k', qw(-d '[:digit:]'),
+ {IN=>'a0b1c2d3e4f5g6h7i8j9k'}, {OUT=>'abcdefghijk'}],
['l', qw(-d '[:lower:]'), {IN=>'abcdefghijklmnopqrstuvwxyz'}, {OUT=>''}],
['m', qw(-d '[:upper:]'), {IN=>'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, {OUT=>''}],
['n', qw(-d '[:lower:][:upper:]'),
@@ -83,11 +84,13 @@ my @Tests =
['u', qw(-ds b a), {IN=>'aabbaa'}, {OUT=>'a'}],
['v', qw(-ds '[:xdigit:]' Z), {IN=>'ZZ0123456789acbdefABCDEFZZ'}, {OUT=>'Z'}],
- # Try some data with 8th bit set in case something is mistakenly sign-extended.
+ # Try some data with 8th bit set in case something is mistakenly
+ # sign-extended.
['w', qw(-ds '\350' '\345'),
{IN=>"\300\301\377\345\345\350\345"},
{OUT=>"\300\301\377\345"}],
- ['x', qw(-s abcdefghijklmn '[:*016]'), {IN=>'abcdefghijklmnop'}, {OUT=>':op'}],
+ ['x', qw(-s abcdefghijklmn '[:*016]'),
+ {IN=>'abcdefghijklmnop'}, {OUT=>':op'}],
['y', qw(-d a-z), {IN=>'abc $code'}, {OUT=>' $'}],
['z', qw(-ds a-z '$.'), {IN=>'a.b.c $$$$code\\'}, {OUT=>'. $\\'}],
diff --git a/tests/misc/uniq b/tests/misc/uniq
index 4d1f8a4ff..5e83ad94f 100755
--- a/tests/misc/uniq
+++ b/tests/misc/uniq
@@ -180,10 +180,13 @@ my @Tests =
"$prog: printing all duplicated lines and repeat counts is meaningless\n$try"}
],
['113', '--all-repeated=separate', {IN=>"a\na\n"}, {OUT=>"a\na\n"}],
- ['114', '--all-repeated=separate', {IN=>"a\na\nb\nc\nc\n"}, {OUT=>"a\na\n\nc\nc\n"}],
- ['115', '--all-repeated=separate', {IN=>"a\na\nb\nb\nc\n"}, {OUT=>"a\na\n\nb\nb\n"}],
+ ['114', '--all-repeated=separate',
+ {IN=>"a\na\nb\nc\nc\n"}, {OUT=>"a\na\n\nc\nc\n"}],
+ ['115', '--all-repeated=separate',
+ {IN=>"a\na\nb\nb\nc\n"}, {OUT=>"a\na\n\nb\nb\n"}],
['116', '--all-repeated=prepend', {IN=>"a\na\n"}, {OUT=>"\na\na\n"}],
- ['117', '--all-repeated=prepend', {IN=>"a\na\nb\nc\nc\n"}, {OUT=>"\na\na\n\nc\nc\n"}],
+ ['117', '--all-repeated=prepend',
+ {IN=>"a\na\nb\nc\nc\n"}, {OUT=>"\na\na\n\nc\nc\n"}],
['118', '--all-repeated=prepend', {IN=>"a\nb\n"}, {OUT=>""}],
['119', '--all-repeated=badoption', {IN=>"a\n"}, {OUT=>""}, {EXIT=>1},
{ERR=>"$prog: invalid argument \`badoption' for \`--all-repeated'\n"