tests: use "compare exp out", not "compare out exp"

Likewise, when an empty file is expected, use "compare /dev/null out",
not "compare out /dev/null". I.e., specify the expected/desired contents
via the first file name.  Prompted by a suggestion from Bruno Haible
in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4020/focus=29154

Run these commands:

    git grep -l -E 'compare [^ ]+ exp' \
      |xargs perl -pi -e 's/(compare) (\S+) (exp\S*)/$1 $3 $2/'
    git grep -l -E 'compare [^ ]+ /dev/null' \
      |xargs perl -pi -e 's/(compare) (\S+) (\/dev\/null)/$1 $3 $2/'

* tests/chgrp/no-x: As above.
* tests/chmod/no-x: Likewise.
* tests/chmod/silent: Likewise.
* tests/chmod/thru-dangling: Likewise.
* tests/chown/basic: Likewise.
* tests/chown/deref: Likewise.
* tests/chown/preserve-root: Likewise.
* tests/cp/abuse: Likewise.
* tests/cp/backup-is-src: Likewise.
* tests/cp/cp-a-selinux: Likewise.
* tests/cp/cp-mv-enotsup-xattr: Likewise.
* tests/cp/fail-perm: Likewise.
* tests/cp/into-self: Likewise.
* tests/cp/proc-zero-len: Likewise.
* tests/cp/src-base-dot: Likewise.
* tests/cp/thru-dangling: Likewise.
* tests/dd/reblock: Likewise.
* tests/dd/unblock-sync: Likewise.
* tests/du/2g: Likewise.
* tests/du/8gb: Likewise.
* tests/du/basic: Likewise.
* tests/du/bigtime: Likewise.
* tests/du/deref-args: Likewise.
* tests/du/exclude: Likewise.
* tests/du/files0-from-dir: Likewise.
* tests/du/hard-link: Likewise.
* tests/du/inacc-dest: Likewise.
* tests/du/inacc-dir: Likewise.
* tests/du/long-sloop: Likewise.
* tests/du/max-depth: Likewise.
* tests/du/move-dir-while-traversing: Likewise.
* tests/du/no-deref: Likewise.
* tests/du/no-x: Likewise.
* tests/du/one-file-system: Likewise.
* tests/du/slash: Likewise.
* tests/du/trailing-slash: Likewise.
* tests/install/strip-program: Likewise.
* tests/ln/hard-backup: Likewise.
* tests/ls/block-size: Likewise.
* tests/ls/color-clear-to-eol: Likewise.
* tests/ls/color-dtype-dir: Likewise.
* tests/ls/color-norm: Likewise.
* tests/ls/dangle: Likewise.
* tests/ls/dired: Likewise.
* tests/ls/file-type: Likewise.
* tests/ls/follow-slink: Likewise.
* tests/ls/infloop: Likewise.
* tests/ls/m-option: Likewise.
* tests/ls/no-arg: Likewise.
* tests/ls/recursive: Likewise.
* tests/ls/rt-1: Likewise.
* tests/ls/stat-dtype: Likewise.
* tests/ls/stat-failed: Likewise.
* tests/ls/stat-free-symlinks: Likewise.
* tests/ls/x-option: Likewise.
* tests/misc/arch: Likewise.
* tests/misc/cat-buf: Likewise.
* tests/misc/cat-proc: Likewise.
* tests/misc/chcon: Likewise.
* tests/misc/csplit: Likewise.
* tests/misc/df-P: Likewise.
* tests/misc/fmt-long-line: Likewise.
* tests/misc/groups-dash: Likewise.
* tests/misc/groups-version: Likewise.
* tests/misc/head-pos: Likewise.
* tests/misc/nl: Likewise.
* tests/misc/od-N: Likewise.
* tests/misc/od-multiple-t: Likewise.
* tests/misc/od-x8: Likewise.
* tests/misc/printf: Likewise.
* tests/misc/printf-hex: Likewise.
* tests/misc/pwd-option: Likewise.
* tests/misc/readlink-fp-loop: Likewise.
* tests/misc/runcon-no-reorder: Likewise.
* tests/misc/seq-long-double: Likewise.
* tests/misc/sort-NaN-infloop: Likewise.
* tests/misc/sort-benchmark-random: Likewise.
* tests/misc/sort-debug-keys: Likewise.
* tests/misc/sort-float: Likewise.
* tests/misc/sort-merge-fdlimit: Likewise.
* tests/misc/sort-unique-segv: Likewise.
* tests/misc/stat-hyphen: Likewise.
* tests/misc/stat-slash: Likewise.
* tests/misc/stdbuf: Likewise.
* tests/misc/sum-sysv: Likewise.
* tests/misc/tac-2-nonseekable: Likewise.
* tests/misc/tac-continue: Likewise.
* tests/misc/tr-case-class: Likewise.
* tests/misc/truncate-fail-diag: Likewise.
* tests/misc/wc-files0: Likewise.
* tests/mkdir/selinux: Likewise.
* tests/mv/backup-dir: Likewise.
* tests/mv/backup-is-src: Likewise.
* tests/mv/diag: Likewise.
* tests/mv/dir2dir: Likewise.
* tests/mv/dup-source: Likewise.
* tests/mv/force: Likewise.
* tests/mv/hard-verbose: Likewise.
* tests/mv/i-link-no: Likewise.
* tests/mv/into-self: Likewise.
* tests/mv/into-self-2: Likewise.
* tests/mv/into-self-3: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/part-fail: Likewise.
* tests/mv/perm-1: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/mv/trailing-slash: Likewise.
* tests/rm/rm1: Likewise.
* tests/rm/rm2: Likewise.
* tests/rm/cycle: Likewise.
* tests/rm/dir-no-w: Likewise.
* tests/rm/dir-nonrecur: Likewise.
* tests/rm/fail-2eperm: Likewise.
* tests/rm/fail-eacces: Likewise.
* tests/rm/i-never: Likewise.
* tests/rm/inaccessible: Likewise.
* tests/rm/interactive-always: Likewise.
* tests/rm/interactive-once: Likewise.
* tests/rm/isatty: Likewise.
* tests/rm/one-file-system: Likewise.
* tests/rm/rm3: Likewise.
* tests/rm/rm5: Likewise.
* tests/rm/unread2: Likewise.
* tests/rm/v-slash: Likewise.
* tests/sample-test: Likewise.
* tests/split/b-chunk: Likewise.
* tests/split/fail: Likewise.
* tests/split/l-chunk: Likewise.
* tests/split/lines: Likewise.
* tests/split/r-chunk: Likewise.
* tests/split/suffix-length: Likewise.
* tests/tail-2/big-4gb: Likewise.
* tests/tail-2/follow-name: Likewise.
* tests/tail-2/follow-stdin: Likewise.
* tests/tail-2/pipe-f: Likewise.
* tests/tail-2/pipe-f2: Likewise.
* tests/tail-2/start-middle: Likewise.
* tests/touch/60-seconds: Likewise.
* tests/touch/fail-diag: Likewise.
* tests/touch/not-owner: Likewise.
* tests/touch/relative: Likewise.
This commit is contained in:
Jim Meyering
2011-11-22 10:08:04 +01:00
parent 9d98634b39
commit a2c811db42
141 changed files with 219 additions and 219 deletions

View File

@@ -49,6 +49,6 @@ cat <<EOF > exp
$prog: \`d/no-x': Permission denied
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -44,7 +44,7 @@ cat <<EOF > exp
$prog: \`d/no-x': Permission denied
EOF
compare out exp || fail=1
compare exp out || fail=1
cd a
# This will fail with ``chmod: fts_read failed: Permission denied''

View File

@@ -24,6 +24,6 @@ chgrp -f 0 no-such 2>> out && fail=1
chown -f 0:0 no-such 2>> out && fail=1
touch exp || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -26,6 +26,6 @@ ln -s non-existent dangle || framework_failure_
chmod 644 dangle 2> out && fail=1
echo "chmod: cannot operate on dangling symlink \`dangle'" > exp
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -31,12 +31,12 @@ set _ `ls -n f`; shift; test "$3:$4" = 0:1 || fail=1
# Note we output a name even though an id was specified.
chown -v --from=42 43 f > out || fail=1
printf "ownership of \`f' retained as `id -nu`\n" > exp
compare out exp || fail=1
compare exp out || fail=1
# Ensure diagnostics work for non existent files.
chown -v 0 nf > out && fail=1
printf "failed to change ownership of \`nf' to 0\n" > exp
compare out exp || fail=1
compare exp out || fail=1
chown --from=0:1 2:010 f || fail=1

View File

@@ -33,6 +33,6 @@ cat <<\EOF > exp || fail=1
chown: cannot dereference `dangle'
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -61,6 +61,6 @@ chgrp: it is dangerous to operate recursively on `d/slink-to-root' (same as `/')
chgrp: use --no-preserve-root to override this failsafe
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -34,7 +34,7 @@ for i in dangling-dest existing-dest; do
cp -dR a/1 b/1 c 2> out && fail=1
compare out exp || fail=1
compare exp out || fail=1
# When the destination is a dangling symlink,
# ensure that cp does not create it.

View File

@@ -31,6 +31,6 @@ cat > exp <<\EOF
XXX: backing up `a' would destroy source; `a~' not copied
EOF
compare out2 exp || fail=1
compare exp out2 || fail=1
Exit $fail

View File

@@ -100,7 +100,7 @@ cp --preserve=context f g 2> out && fail=1
test -s g && fail=1
sed "s/ .g' to .*//" out > k
mv k out
compare out exp || fail=1
compare exp out || fail=1
rm -f g
echo > g
@@ -110,6 +110,6 @@ cp -a --preserve=context f g 2> out2 && fail=1
test -s g && fail=1
sed "s/ .g' to .*//" out2 > k
mv k out2
compare out2 exp || fail=1
compare exp out2 || fail=1
Exit $fail

View File

@@ -98,7 +98,7 @@ cp: cannot preserve extended attributes, cp is built without xattr support
EOF
fi
compare err exp || fail=1
compare exp err || fail=1
rm -f err noxattr/a

View File

@@ -47,11 +47,11 @@ cp F symlink 2> out && fail=1
# ...: The file access permissions do not allow the specified action.
# to the expected one:
sed 's/: The file access permissions.*/: Permission denied/'<out>o1;mv o1 out
compare out exp || fail=1
compare exp out || fail=1
cp --target-directory=symlink F 2> out && fail=1
sed 's/: The file access permissions.*/: Permission denied/'<out>o1;mv o1 out
compare out exp || fail=1
compare exp out || fail=1
chmod 700 D

View File

@@ -52,6 +52,6 @@ cp: cannot copy a directory, `dir', into itself, `dir/dir'
EOF
#'
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -35,6 +35,6 @@ cp $f exp || fail=1
test -s out && { rm -f out; echo nonempty > out; }
test -s exp && { rm -f exp; echo nonempty > exp; }
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -27,6 +27,6 @@ cp --verbose -ab ../x/. . > out 2>&1 || fail=1
cat <<\EOF > exp || fail=1
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -29,13 +29,13 @@ echo "cp: not writing through dangling symlink \`dangle'" \
# Starting with 6.9.90, this usage fails, by default:
cp f dangle > err 2>&1 && fail=1
compare err exp-err || fail=1
compare exp-err err || fail=1
test -f no-such && fail=1
# But you can set POSIXLY_CORRECT to get the historical behavior.
env POSIXLY_CORRECT=1 cp f dangle > out 2>&1 || fail=1
cat no-such >> out || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -50,7 +50,7 @@ dd_reblock_1()
(printf 'ab'; sleep $delay; printf 'cd') > dd.fifo
wait #for dd to complete
sed 's/,.*//' err > k && mv k err
compare err exp-reblock
compare exp-reblock err
}
retry_delay_ dd_reblock_1 .1 6 || fail=1
@@ -64,7 +64,7 @@ dd_reblock_2()
(printf 'ab'; sleep $delay; printf 'cd') > dd.fifo
wait #for dd to complete
sed 's/,.*//' err > k && mv k err
compare err exp-no-reblock
compare exp-no-reblock err
}
retry_delay_ dd_reblock_2 .1 6 || fail=1

View File

@@ -30,6 +30,6 @@ cat <<\EOF > exp || fail=1
xx
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -64,6 +64,6 @@ cat <<\EOF > exp || fail=1
~2M
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -48,6 +48,6 @@ cat <<\EOF > exp
8589934592 big
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -55,7 +55,7 @@ $a a # size of dir entry, a
$tot a
EOF
compare out exp || fail=1
compare exp out || fail=1
# Perform this test only if "." is on a local file system.
# Otherwise, it would fail e.g., on an NFS-mounted Solaris ZFS file system.
@@ -83,7 +83,7 @@ $s2 d/sub
$d1 d # d + d/1; don't count the dir. entry for d/sub
EOF
compare out exp || fail=1
compare exp out || fail=1
fi
Exit $fail

View File

@@ -45,7 +45,7 @@ du --time future >out 2>err || fail=1
# Map the number of blocks to 0.
sed 's/^[0-9][0-9]*/0/' out > k && mv k out
compare out exp || fail=1
compare exp out || fail=1
compare err err_ok || fail=1
Exit $fail

View File

@@ -43,6 +43,6 @@ slink/
64 slink-to-64k
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -53,6 +53,6 @@ a/x
a/x/y
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -33,7 +33,7 @@ for prog in du wc; do
# The diagnostic string is usually "Is a directory" (ENOTDIR),
# but accept a different string or errno value.
sed 's/dir:.*/dir:/' err > k; mv k err
compare err exp || fail=1
compare exp err || fail=1
done
Exit $fail

View File

@@ -59,6 +59,6 @@ dir/f_
dir
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -51,6 +51,6 @@ EOF
sed "s,/c/j': ,/c': ," out > t && mv t out
sed 's,cannot access,cannot read directory,' out > t && mv t out
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -27,7 +27,7 @@ chmod 0 a/sub || fail=1
# Expect failure, ignore diagnostics.
du -s a > out 2> /dev/null && fail=1
compare out exp || fail=1
compare exp out || fail=1
# Same as above, but don't use -s, so we print
# an entry for the unreadable "sub", too.
@@ -37,6 +37,6 @@ chmod 0 a/sub || fail=1
# Expect failure, ignore diagnostics.
du -k a > out 2> /dev/null && fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -67,6 +67,6 @@ sed "s, .1/s/s/s/[/s]*',," out1 > out || fail=1
echo "du: cannot access: $too_many" > exp || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -25,14 +25,14 @@ du --max-depth=2 a > out 2>err || fail=1
# Remove the sizes. They vary between file systems.
cut -f2- out > k && mv k out
compare out exp || fail=1
compare err /dev/null || fail=1
compare exp out || fail=1
compare /dev/null err || fail=1
# Repeat, but use -d 1.
printf 'a/b\na\n' > exp || framework_failure_
du -d 1 a > out 2>err || fail=1
cut -f2- out > k && mv k out
compare out exp || fail=1
compare err /dev/null || fail=1
compare exp out || fail=1
compare /dev/null err || fail=1
Exit $fail

View File

@@ -91,6 +91,6 @@ test $? = 1 || fail=1
# check for the new diagnostic
printf "du: fts_read failed: $t/3/a/b: No such file or directory\n" > exp \
|| fail=1
compare err exp || fail=1
compare exp err || fail=1
Exit $fail

View File

@@ -28,6 +28,6 @@ cat <<\EOF > exp
slink
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -44,6 +44,6 @@ cat <<EOF > exp
$prog: \`d/no-x': Permission denied
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -35,6 +35,6 @@ y/z
y
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -28,6 +28,6 @@ cat <<\EOF > exp
/
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -42,6 +42,6 @@ slink/1
slink
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -31,6 +31,6 @@ chmod a+x b || framework_failure_
echo abc > src || fail=1
echo aBc > exp || fail=1
ginstall src dest -s --strip-program=./b || fail=1
compare dest exp || fail=1
compare exp dest || fail=1
Exit $fail

View File

@@ -27,6 +27,6 @@ cat <<\EOF > exp || fail=1
ln: `f' and `f' are the same file
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -168,6 +168,6 @@ cat >exp <<'EOF'
4 Jan 1 2001 file4096
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -36,6 +36,6 @@ echo >> out || fail=1
sed 's/.*T //' out > k && mv k out
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -41,7 +41,7 @@ out$
^[[37;44msticky^[[0m$
EOF
compare out exp || fail=1
compare exp out || fail=1
rm exp
@@ -59,6 +59,6 @@ out$
^[[37;44msticky^[[0m$
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -79,6 +79,6 @@ norm nocolor$
norm exe$
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -47,7 +47,7 @@ sub
sub
EOF
compare out exp || fail=1
compare exp out || fail=1
# Ensure that ls -Li prints "?" as the inode of a dangling symlink.
rm -f out

View File

@@ -30,6 +30,6 @@ cat <<EOF > exp
//DIRED-OPTIONS// --quoting-style=literal
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -53,13 +53,13 @@ ls --indicator-style=file-type sub > out2 || fail=1
sed 's/[@|]$//' exp2 > exp3
ls -p sub > out3 || fail=1
compare out exp || fail=1
compare exp out || fail=1
compare out2 exp2 || fail=1
compare exp2 out2 || fail=1
compare out3 exp3 || fail=1
compare exp3 out3 || fail=1
ls --color=auto -F sub > out || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -55,7 +55,7 @@ link-to-dir/
sub/link-to-dir:
EOF
compare out-L exp-L || fail=1
compare out-FLR-sub exp-FLR-sub || fail=1
compare exp-L out-L || fail=1
compare exp-FLR-sub out-FLR-sub || fail=1
Exit $fail

View File

@@ -36,7 +36,7 @@ timeout 10 ls -RL loop >out 2>err
# Ensure that ls exits with status 2 upon detecting a cycle
test $? = 2 || fail=1
compare err exp-err || fail=1
compare out exp-out || fail=1
compare exp-err err || fail=1
compare exp-out out || fail=1
Exit $fail

View File

@@ -35,6 +35,6 @@ b
0 a, 12 b
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -33,7 +33,7 @@ EOF
ls -1 > out || fail=1
compare out exp || fail=1
compare exp out || fail=1
cat > exp <<\EOF
.:
@@ -51,6 +51,6 @@ EOF
ls -R1 > out || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -45,7 +45,7 @@ b:
c:
EOF
compare out exp || fail=1
compare exp out || fail=1
rm -rf out exp
ls -R1 x y f > out || fail=1
@@ -57,6 +57,6 @@ x:
y:
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -32,7 +32,7 @@ a
b
c
EOF
compare out exp || fail=1
compare exp out || fail=1
rm -rf out exp
ls -1rt a b c > out || fail=1
@@ -41,6 +41,6 @@ c
b
a
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -46,7 +46,7 @@ cat <<\EOF > exp || fail=1
s@
EOF
compare out exp || fail=1
compare exp out || fail=1
rm -f out exp
# Check for the ls -CF misaligned-columns bug:
@@ -56,6 +56,6 @@ ls -CF e > out || fail=1
# rather than the appropriate TAB.
printf 'a2345/\tb/\n' > exp || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -34,7 +34,7 @@ total 0
?????????? ? ? ? s
EOF
sed 's/^l/?/' out | compare - exp || fail=1
sed 's/^l/?/' out | compare exp - || fail=1
# Ensure that the offsets in --dired output are accurate.
rm -f out exp
@@ -47,6 +47,6 @@ cat <<\EOF > exp || fail=1
//DIRED-OPTIONS// --quoting-style=literal
EOF
sed 's/^ l/ ?/' out | compare - exp || fail=1
sed 's/^ l/ ?/' out | compare exp - || fail=1
Exit $fail

View File

@@ -47,6 +47,6 @@ grep '^stat("x"' err && fail=1
printf '\033[01;32mx\033[0m*\n'
} > exp || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -32,6 +32,6 @@ a b
b a
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -24,6 +24,6 @@ require_built_ arch
arch > out || fail=1
uname -m > exp || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -36,7 +36,7 @@ cat_buf_1()
dd count=1 if=fifo > out &
(echo 1; sleep $delay; echo 2) | cat -v > fifo
wait # for dd to complete
compare out exp
compare exp out
}
retry_delay_ cat_buf_1 .1 6 || fail=1

View File

@@ -33,6 +33,6 @@ test -f $f \
cat -E $f | sed 's/[0-9][0-9]*/D/g' | tr -d '$' > out || fail=1
cat $f | sed 's/[0-9][0-9]*/D/g' | tr -d '$' > exp || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -68,10 +68,10 @@ f|-robject_r|root:object_r:file_t:$range
f|-ttmp_t|root:object_r:tmp_t:$range
EOF
compare out exp || fail=1
compare exp out || fail=1
chcon --verbose -u$u1 f > out || fail=1
echo 'changing security context of `f'\' > exp
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -28,14 +28,14 @@ cat <<EOF > exp
0
2
EOF
compare out exp || fail=1
compare exp out || fail=1
rm -f in out exp
# Ensure that xx02 contains just two newlines.
# This would fail due to reading from freed buffer with coreutils-5.0.91.
printf '\n\n' > exp
cp xx02 out || fail=1
compare out exp || fail=1
compare exp out || fail=1
rm -f in out exp
# csplit would infloop
@@ -45,7 +45,7 @@ cat <<EOF > exp
0
3
EOF
compare out exp || fail=1
compare exp out || fail=1
rm -f in out exp
# `echo |csplit - 1 1' used to abort.
@@ -56,11 +56,11 @@ cat <<EOF > exp
0
1
EOF
compare out exp || fail=1
compare exp out || fail=1
cat <<\EOF > experr
csplit: warning: line number `1' is the same as preceding line number
EOF
compare err experr || fail=1
compare experr err || fail=1
rm -f in out exp err experr
# `echo | csplit -b '%0#6.3x' - 1' incorrectly warned about the format
@@ -71,9 +71,9 @@ cat <<EOF > exp
0
1
EOF
compare out exp || fail=1
compare exp out || fail=1
touch experr
compare err experr || fail=1
compare experr err || fail=1
compare 'xx 000' experr || fail=1
compare 'xx 0x001' in || fail=1
rm -f in out exp err experr xx*
@@ -89,7 +89,7 @@ csplit: line number `1' is smaller than preceding line number, 2
csplit: warning: line number `3' is the same as preceding line number
csplit: `3': line number out of range
EOF
compare err experr || fail=1
compare experr err || fail=1
# Ensure that lines longer than the initial buffer length don't cause
# trouble (e.g. reading from freed memory, resulting in corrupt output).

View File

@@ -32,6 +32,6 @@ BLOCK_SIZE=1M df -P . > t2 || fail=1
head -n1 t1 > exp || fail=1
head -n1 t2 > out || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -56,6 +56,6 @@ EOF
fmt -s in > out || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -27,6 +27,6 @@ echo $? >> out
groups -- none -- > exp 2>&1 && fail=1
echo $? >> exp
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -23,6 +23,6 @@ require_built_ groups
groups --version | sed 's/^groups/id/; /^$/q' > out || fail=1
id --version | sed '/^$/q' > exp || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -27,6 +27,6 @@ cat <<EOF > exp
b
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -38,6 +38,6 @@ cat <<\EOF > exp
$
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -27,6 +27,6 @@ cat <<EOF > exp || fail=1
a b c
d e f
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -37,6 +37,6 @@ for format1 in $list; do
done
done
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -38,6 +38,6 @@ od -An -t x1 in \
| sort -n \
> exp
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -34,7 +34,7 @@ cat <<\EOF > exp
foo
EOF
compare out exp || fail=1
compare exp out || fail=1
rm -f out exp
# Until coreutils-4.5.10, this would elicit a segfault.
@@ -94,7 +94,7 @@ cat <<\EOF > exp
11 x
EOF
compare out exp || fail=1
compare exp out || fail=1
# Verify handling of single quote chars (\' or \")
@@ -121,7 +121,7 @@ printf: ": expected a numeric value
printf: a: expected a numeric value
EOF
compare out exp || fail=1
compare err exp_err || fail=1
compare exp out || fail=1
compare exp_err err || fail=1
Exit $fail

View File

@@ -24,6 +24,6 @@ cat <<\EOF > exp
~3
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -57,6 +57,6 @@ printf %s\\n "$base/a/b" >> exp || fail=1
env -- PWD="$base/a/../c" pwd -L >> out || fail=1
printf %s\\n "$base/a/b" >> exp || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -35,7 +35,7 @@ ln -s ../s/2 d/1 || framework_failure_
readlink -v -e p/1 > out || fail=1
# readlink -e d/2 > exp || fail=1
echo "$cwd/d/2" > exp || fail=1
compare out exp || fail=1
compare exp out || fail=1
# Construct a real loop and make sure readlink still detects it.
ln -sf ../s/1 d/2 || framework_failure_
@@ -57,12 +57,12 @@ ln -nsf ../p/8 d/7 || framework_failure_
echo x > d/8 || framework_failure_
readlink -v -e p/1 > out || fail=1
echo "$cwd/d/8" > exp || fail=1
compare out exp || fail=1
compare exp out || fail=1
# A trivial loop
ln -s loop loop
readlink -v -e loop 2> out && fail=1
echo "readlink: loop: $symlink_loop_msg" > exp || framework_failure_
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -37,6 +37,6 @@ case `cat out` in
'runcon: invalid context: '*) echo "$diag" > out;;
esac
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -42,6 +42,6 @@ b=$INTMAX_OFLOW
seq $a $b > out || fail=1
printf "$a\n$b\n" > exp || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -23,6 +23,6 @@ echo nan > F || fail=1
printf 'nan\nnan\n' > exp || fail=1
timeout 10 sort -g -m F F > out || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -48,6 +48,6 @@ close (FILE);
time sort in > out || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -284,7 +284,7 @@ printf '\0\ta\n' | sort -s -k2b,2 --debug | tr -d '\0'
printf 'A\tchr10\nB\tchr1\n' | sort -s -k2.4b,2.3n --debug
) > out
compare out exp || fail=1
compare exp out || fail=1
cat <<\EOF > exp
1²---++3 1,234 Mi
@@ -324,7 +324,7 @@ if test "$LOCALE_FR_UTF8" != "none"; then
sort --debug -k1,1n -k1,1g \
-k1,1h -k2,2n -k2,2g -k2,2h -k3,3n -k3,3g -k3,3h
) > out
compare out exp || fail=1
compare exp out || fail=1
fi
Exit $fail

View File

@@ -88,7 +88,7 @@ $LDBL_MAX
tac exp | LC_ALL=$LOC sort -sg > out || fail=1
compare out exp || fail=1
compare exp out || fail=1
done
Exit $fail

View File

@@ -68,6 +68,6 @@ echo 6 >out || fail=1
ulimit -n 10 &&
sort -n -m --batch-size=7 -o out out in/1 in/2 in/3 in/4 in/5 out
) &&
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -43,6 +43,6 @@ EOF
sort --parallel=1 -u in > exp || fail=1
sort --parallel=2 -u -S 10b < in > out || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -25,6 +25,6 @@ touch f || framework_failure_
stat --format=%n - < f > out || fail=1
stat -f - < f && fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -39,6 +39,6 @@ stat --format=%F link2 >> out || fail=1
stat -L --format=%F link2 >> out || fail=1
stat --format=%F link2/ >> out || fail=1
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -65,7 +65,7 @@ stdbuf_linebuffer()
dd count=1 if=fifo > out 2> err &
(printf '1\n'; sleep $delay; printf '2\n') | stdbuf -oL uniq > fifo
wait # for dd to complete
compare out exp
compare exp out
}
retry_delay_ stdbuf_linebuffer .1 6 || fail=1
@@ -79,7 +79,7 @@ stdbuf_unbuffer()
dd count=1 if=fifo > out 2> err &
(printf '1\n'; sleep $delay; printf '2\n') | stdbuf -o0 uniq > fifo
wait # for dd to complete
compare out exp
compare exp out
}
retry_delay_ stdbuf_unbuffer .1 6 || fail=1
@@ -92,7 +92,7 @@ retry_delay_ stdbuf_unbuffer .1 6 || fail=1
# dd count=1 if=fifo > /dev/null 2> err &
# printf '1\n\2\n3\n' | (stdbuf -i0 -oL uniq > fifo; cat) > out
# wait # for dd to complete
# compare out exp || fail=1
# compare exp out || fail=1
# One could remove the need for dd (used to close the fifo to get uniq to quit
# early), if head -n1 read stdin char by char. Note uniq | head -c2 doesn't
# suffice due to the buffering implicit in the pipe. sed currently does read
@@ -100,7 +100,7 @@ retry_delay_ stdbuf_unbuffer .1 6 || fail=1
# adding this dependency on a program outside of coreutils.
# printf '2\n' > exp
# printf '1\n2\n' | (stdbuf -i0 sed 1q >/dev/null; cat) > out
# compare out exp || fail=1
# compare exp out || fail=1
# Ensure block buffering stdout takes effect
# We don't currently test block buffering failures as
@@ -113,7 +113,7 @@ retry_delay_ stdbuf_unbuffer .1 6 || fail=1
# dd count=1 if=fifo > out 2> err &
# (printf '1\n'; sleep $delay; printf '2\n') | stdbuf -o4 uniq > fifo
# wait # for dd to complete
# compare out exp
# compare exp out
# }
#
# retry_delay_ stdbuf_blockbuffer .1 6 || fail=1

View File

@@ -35,7 +35,7 @@ $PERL -e '$s = chr(255) x 65537; foreach (1..257) {print $s}' \
cat > exp <<\EOF
65535 32897
EOF
compare out exp || fail=1
compare exp out || fail=1
rm -f out exp
@@ -45,6 +45,6 @@ $PERL -e '$s = chr(255) x 65537; foreach (1..257) {print $s}; print chr(255)' \
cat > exp <<\EOF
254 32897
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -21,7 +21,7 @@ print_ver_ tac
echo x | tac - - > out 2> err || fail=1
echo x > exp || fail=1
compare out exp || fail=1
compare err /dev/null || fail=1
compare exp out || fail=1
compare /dev/null err || fail=1
Exit $fail

View File

@@ -65,6 +65,6 @@ cat <<\EOF > exp || fail=1
1
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -23,10 +23,10 @@ print_ver_ tr
echo '01234567899999999999999999' > exp
echo 'abcdefghijklmnopqrstuvwxyz' |
tr '[:lower:]' '0-9' > out || fail=1
compare out exp || fail=1
compare exp out || fail=1
echo 'abcdefghijklmnopqrstuvwxyz' |
tr '[:lower:][:lower:]' '[:upper:]0-9' > out || fail=1
compare out exp || fail=1
compare exp out || fail=1
# Validate the alignment of case classes
tr 'A-Z[:lower:]' 'a-y[:upper:]' < /dev/null && fail=1
@@ -44,21 +44,21 @@ tr '[:upper:][:lower:]' '[:upper:]a-z' < /dev/null || fail=1
tr '[:upper:] ' '[:lower:]' < /dev/null 2>out && fail=1
echo 'tr: when translating with string1 longer than string2,
the latter string must not end with a character class' > exp
compare out exp || fail=1
compare exp out || fail=1
# Up to coreutils-6.9, tr rejected an unmatched [:lower:] or [:upper:] in SET1.
echo '#$%123abcABC' | tr '[:lower:]' '[.*]' > out || fail=1
echo '#$%123...ABC' > exp
compare out exp || fail=1
compare exp out || fail=1
echo '#$%123abcABC' | tr '[:upper:]' '[.*]' > out || fail=1
echo '#$%123abc...' > exp
compare out exp || fail=1
compare exp out || fail=1
# When doing a case-converting translation with something after the
# [:upper:] and [:lower:] elements, ensure that tr honors the following byte.
echo 'abc.' | tr '[:lower:].' '[:upper:]x' > out || fail=1
echo 'ABCx' > exp
compare out exp || fail=1
compare exp out || fail=1
# Before coreutils 8.6 the disparate number of upper and lower
# characters in some locales, triggered abort()s and invalid behavior
@@ -73,41 +73,41 @@ if test "$(locale charmap 2>/dev/null)" = ISO-8859-1; then
tr '[:upper:] ' '[:lower:]' < /dev/null 2>out && fail=1
echo 'tr: when translating with string1 longer than string2,
the latter string must not end with a character class' > exp
compare out exp || fail=1
compare exp out || fail=1
# Ensure when there are a different number of elements
# in each string, we validate the case mapping correctly
echo 'abc.xyz' |
tr 'ab[:lower:]' '0-1[:upper:]' > out || fail=1
echo 'ABC.XYZ' > exp
compare out exp || fail=1
compare exp out || fail=1
# Ensure we extend string2 appropriately
echo 'ABC- XYZ' |
tr '[:upper:]- ' '[:lower:]_' > out || fail=1
echo 'abc__xyz' > exp
compare out exp || fail=1
compare exp out || fail=1
# Ensure the size of the case classes are accounted
# for as a unit.
echo 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
tr '[:upper:]A-B' '[:lower:]0' >out || fail=1
echo '00cdefghijklmnopqrstuvwxyz' > exp
compare out exp || fail=1
compare exp out || fail=1
# Ensure the size of the case classes are accounted
# for as a unit.
echo 'a' |
tr -t '[:lower:]a' '[:upper:]0' >out || fail=1
echo '0' > exp
compare out exp || fail=1
compare exp out || fail=1
# Ensure the size of the case classes are accounted
# for as a unit.
echo 'a' |
tr -t '[:lower:][:lower:]a' '[:lower:][:upper:]0' >out || fail=1
echo '0' > exp
compare out exp || fail=1
compare exp out || fail=1
fi
Exit $fail

View File

@@ -32,7 +32,7 @@ truncate -s0 $dir > out 2>&1 && fail=1
cat <<EOF > exp
truncate: cannot open \`$dir' for writing: No such file or directory
EOF
compare out exp || fail=1
compare exp out || fail=1
dir=$d1/
truncate -s0 $dir > out 2>&1 && fail=1

View File

@@ -31,13 +31,13 @@ cat <<\EOF > exp || fail=1
2 3 10 total
EOF
compare out exp || fail=1
compare exp out || fail=1
if test "$fail" = ''; then
# Repeat the above test, but read the file name list from stdin.
rm -f out
wc --files0-from=- < names > out || fail=1
compare out exp || fail=1
compare exp out || fail=1
fi
Exit $fail

View File

@@ -50,7 +50,7 @@ for cmd_w_arg in 'mkdir dir' 'mknod b p' 'mkfifo f'; do
-e 's/ Unknown error .*$//' \
-e 's/ No such file or directory$//' out > k || fail=1
mv k out || fail=1
compare out exp || fail=1
compare exp out || fail=1
done
Exit $fail

View File

@@ -29,6 +29,6 @@ cat <<\EOF > exp || fail=1
`A' -> `B' (backup: `B.~1~')
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -41,6 +41,6 @@ cat > exp <<\EOF
XXX: backing up `YYY' would destroy source; `ZZZ' not moved
EOF
compare out2 exp || fail=1
compare exp out2 || fail=1
Exit $fail

View File

@@ -43,6 +43,6 @@ mv: target `f1' is not a directory
mv: target `f2' is not a directory
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -37,6 +37,6 @@ cat <<\EOF > exp || fail=1
mv: cannot move `b/t' to `a/t': Directory not empty
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -45,7 +45,7 @@ $i: warning: source file \`a' specified more than once
$i: warning: source file \`a' specified more than once
$i: will not overwrite just-created \`d/a' with \`a'
EOF
compare out exp || fail=1
compare exp out || fail=1
done
for i in mv; do
@@ -59,7 +59,7 @@ for i in mv; do
$i: cannot stat \`a': No such file or directory
$i: cannot stat \`a': No such file or directory
EOF
compare out exp || fail=1
compare exp out || fail=1
done
Exit $fail

View File

@@ -32,7 +32,7 @@ cat > exp <<EOF
mv: \`$ff' and \`$ff' are the same file
EOF
compare out exp || fail=1
compare exp out || fail=1
test `cat $ff` = force-contents || fail=1
# This should succeed, even though the source and destination

View File

@@ -28,6 +28,6 @@ cat <<\EOF > exp || fail=1
removed `x'
EOF
compare out exp || fail=1
compare exp out || fail=1
Exit $fail

View File

@@ -32,8 +32,8 @@ mv a/bar a/foo b < no > out 2> err || fail=1
touch exp
touch exp_err
compare out exp || fail=1
compare err exp_err || fail=1
compare exp out || fail=1
compare exp_err err || fail=1
case "`cat b/foo`" in
foo) ;;

View File

@@ -40,7 +40,7 @@ cat > exp <<\EOF
XXX: cannot move `SRC' to a subdirectory of itself, `DEST'
EOF
compare out2 exp || fail=1
compare exp out2 || fail=1
# Make sure the file is gone.
test -f $file && fail=1

Some files were not shown because too many files have changed in this diff Show More