From a2c811db420717d61bf948afdd879454d9187d38 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 22 Nov 2011 10:08:04 +0100 Subject: [PATCH] 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. --- tests/chgrp/no-x | 2 +- tests/chmod/no-x | 2 +- tests/chmod/silent | 2 +- tests/chmod/thru-dangling | 2 +- tests/chown/basic | 4 ++-- tests/chown/deref | 2 +- tests/chown/preserve-root | 2 +- tests/cp/abuse | 2 +- tests/cp/backup-is-src | 2 +- tests/cp/cp-a-selinux | 4 ++-- tests/cp/cp-mv-enotsup-xattr | 2 +- tests/cp/fail-perm | 4 ++-- tests/cp/into-self | 2 +- tests/cp/proc-zero-len | 2 +- tests/cp/src-base-dot | 2 +- tests/cp/thru-dangling | 4 ++-- tests/dd/reblock | 4 ++-- tests/dd/unblock-sync | 2 +- tests/du/2g | 2 +- tests/du/8gb | 2 +- tests/du/basic | 4 ++-- tests/du/bigtime | 2 +- tests/du/deref-args | 2 +- tests/du/exclude | 2 +- tests/du/files0-from-dir | 2 +- tests/du/hard-link | 2 +- tests/du/inacc-dest | 2 +- tests/du/inacc-dir | 4 ++-- tests/du/long-sloop | 2 +- tests/du/max-depth | 8 ++++---- tests/du/move-dir-while-traversing | 2 +- tests/du/no-deref | 2 +- tests/du/no-x | 2 +- tests/du/one-file-system | 2 +- tests/du/slash | 2 +- tests/du/trailing-slash | 2 +- tests/install/strip-program | 2 +- tests/ln/hard-backup | 2 +- tests/ls/block-size | 2 +- tests/ls/color-clear-to-eol | 2 +- tests/ls/color-dtype-dir | 4 ++-- tests/ls/color-norm | 2 +- tests/ls/dangle | 2 +- tests/ls/dired | 2 +- tests/ls/file-type | 8 ++++---- tests/ls/follow-slink | 4 ++-- tests/ls/infloop | 4 ++-- tests/ls/m-option | 2 +- tests/ls/no-arg | 4 ++-- tests/ls/recursive | 4 ++-- tests/ls/rt-1 | 4 ++-- tests/ls/stat-dtype | 4 ++-- tests/ls/stat-failed | 4 ++-- tests/ls/stat-free-symlinks | 2 +- tests/ls/x-option | 2 +- tests/misc/arch | 2 +- tests/misc/cat-buf | 2 +- tests/misc/cat-proc | 2 +- tests/misc/chcon | 4 ++-- tests/misc/csplit | 16 ++++++++-------- tests/misc/df-P | 2 +- tests/misc/fmt-long-line | 2 +- tests/misc/groups-dash | 2 +- tests/misc/groups-version | 2 +- tests/misc/head-pos | 2 +- tests/misc/nl | 2 +- tests/misc/od-N | 2 +- tests/misc/od-multiple-t | 2 +- tests/misc/od-x8 | 2 +- tests/misc/printf | 8 ++++---- tests/misc/printf-hex | 2 +- tests/misc/pwd-option | 2 +- tests/misc/readlink-fp-loop | 6 +++--- tests/misc/runcon-no-reorder | 2 +- tests/misc/seq-long-double | 2 +- tests/misc/sort-NaN-infloop | 2 +- tests/misc/sort-benchmark-random | 2 +- tests/misc/sort-debug-keys | 4 ++-- tests/misc/sort-float | 2 +- tests/misc/sort-merge-fdlimit | 2 +- tests/misc/sort-unique-segv | 2 +- tests/misc/stat-hyphen | 2 +- tests/misc/stat-slash | 2 +- tests/misc/stdbuf | 10 +++++----- tests/misc/sum-sysv | 4 ++-- tests/misc/tac-2-nonseekable | 4 ++-- tests/misc/tac-continue | 2 +- tests/misc/tr-case-class | 24 ++++++++++++------------ tests/misc/truncate-fail-diag | 2 +- tests/misc/wc-files0 | 4 ++-- tests/mkdir/selinux | 2 +- tests/mv/backup-dir | 2 +- tests/mv/backup-is-src | 2 +- tests/mv/diag | 2 +- tests/mv/dir2dir | 2 +- tests/mv/dup-source | 4 ++-- tests/mv/force | 2 +- tests/mv/hard-verbose | 2 +- tests/mv/i-link-no | 4 ++-- tests/mv/into-self | 2 +- tests/mv/into-self-2 | 2 +- tests/mv/into-self-3 | 2 +- tests/mv/mv-special-1 | 2 +- tests/mv/part-fail | 2 +- tests/mv/perm-1 | 2 +- tests/mv/sticky-to-xpart | 2 +- tests/mv/trailing-slash | 2 +- tests/rm/cycle | 2 +- tests/rm/dir-no-w | 2 +- tests/rm/dir-nonrecur | 2 +- tests/rm/fail-2eperm | 2 +- tests/rm/fail-eacces | 4 ++-- tests/rm/i-never | 2 +- tests/rm/inaccessible | 2 +- tests/rm/interactive-always | 4 ++-- tests/rm/interactive-once | 4 ++-- tests/rm/isatty | 2 +- tests/rm/one-file-system | 2 +- tests/rm/rm1 | 2 +- tests/rm/rm2 | 2 +- tests/rm/rm3 | 2 +- tests/rm/rm5 | 2 +- tests/rm/unread2 | 2 +- tests/rm/v-slash | 2 +- tests/sample-test | 2 +- tests/split/b-chunk | 12 ++++++------ tests/split/fail | 2 +- tests/split/l-chunk | 14 +++++++------- tests/split/lines | 6 +++--- tests/split/r-chunk | 14 +++++++------- tests/split/suffix-length | 4 ++-- tests/tail-2/big-4gb | 2 +- tests/tail-2/follow-name | 2 +- tests/tail-2/follow-stdin | 2 +- tests/tail-2/pipe-f | 2 +- tests/tail-2/pipe-f2 | 2 +- tests/tail-2/start-middle | 2 +- tests/touch/60-seconds | 2 +- tests/touch/fail-diag | 2 +- tests/touch/not-owner | 2 +- tests/touch/relative | 2 +- 141 files changed, 219 insertions(+), 219 deletions(-) diff --git a/tests/chgrp/no-x b/tests/chgrp/no-x index 2555c4532..9a2470be0 100755 --- a/tests/chgrp/no-x +++ b/tests/chgrp/no-x @@ -49,6 +49,6 @@ cat < exp $prog: \`d/no-x': Permission denied EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/chmod/no-x b/tests/chmod/no-x index f45c4466e..534eec133 100755 --- a/tests/chmod/no-x +++ b/tests/chmod/no-x @@ -44,7 +44,7 @@ cat < 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'' diff --git a/tests/chmod/silent b/tests/chmod/silent index 1745299de..e79c58f55 100755 --- a/tests/chmod/silent +++ b/tests/chmod/silent @@ -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 diff --git a/tests/chmod/thru-dangling b/tests/chmod/thru-dangling index 38187d002..d61b6bde5 100755 --- a/tests/chmod/thru-dangling +++ b/tests/chmod/thru-dangling @@ -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 diff --git a/tests/chown/basic b/tests/chown/basic index 102f17c79..8df8399af 100755 --- a/tests/chown/basic +++ b/tests/chown/basic @@ -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 diff --git a/tests/chown/deref b/tests/chown/deref index c228bde80..02175ff70 100755 --- a/tests/chown/deref +++ b/tests/chown/deref @@ -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 diff --git a/tests/chown/preserve-root b/tests/chown/preserve-root index 072cc831a..3ee304914 100755 --- a/tests/chown/preserve-root +++ b/tests/chown/preserve-root @@ -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 diff --git a/tests/cp/abuse b/tests/cp/abuse index 43b7df0d9..1573ed5b0 100755 --- a/tests/cp/abuse +++ b/tests/cp/abuse @@ -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. diff --git a/tests/cp/backup-is-src b/tests/cp/backup-is-src index bb6478940..9547c4e7e 100755 --- a/tests/cp/backup-is-src +++ b/tests/cp/backup-is-src @@ -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 diff --git a/tests/cp/cp-a-selinux b/tests/cp/cp-a-selinux index 0f9c14938..7ef24d801 100755 --- a/tests/cp/cp-a-selinux +++ b/tests/cp/cp-a-selinux @@ -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 diff --git a/tests/cp/cp-mv-enotsup-xattr b/tests/cp/cp-mv-enotsup-xattr index 32798d2fc..f30358136 100755 --- a/tests/cp/cp-mv-enotsup-xattr +++ b/tests/cp/cp-mv-enotsup-xattr @@ -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 diff --git a/tests/cp/fail-perm b/tests/cp/fail-perm index 404c83e39..d05189785 100755 --- a/tests/cp/fail-perm +++ b/tests/cp/fail-perm @@ -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/'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/'o1;mv o1 out -compare out exp || fail=1 +compare exp out || fail=1 chmod 700 D diff --git a/tests/cp/into-self b/tests/cp/into-self index deb5a5325..91c3a5a85 100755 --- a/tests/cp/into-self +++ b/tests/cp/into-self @@ -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 diff --git a/tests/cp/proc-zero-len b/tests/cp/proc-zero-len index 53abc43f9..cc6fd0fbc 100755 --- a/tests/cp/proc-zero-len +++ b/tests/cp/proc-zero-len @@ -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 diff --git a/tests/cp/src-base-dot b/tests/cp/src-base-dot index 069c1935c..4ec39a873 100755 --- a/tests/cp/src-base-dot +++ b/tests/cp/src-base-dot @@ -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 diff --git a/tests/cp/thru-dangling b/tests/cp/thru-dangling index 62f111587..1c5c12d4c 100755 --- a/tests/cp/thru-dangling +++ b/tests/cp/thru-dangling @@ -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 diff --git a/tests/dd/reblock b/tests/dd/reblock index 558d729e1..59e61fa27 100755 --- a/tests/dd/reblock +++ b/tests/dd/reblock @@ -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 diff --git a/tests/dd/unblock-sync b/tests/dd/unblock-sync index a6fd4a52c..f9e01e041 100755 --- a/tests/dd/unblock-sync +++ b/tests/dd/unblock-sync @@ -30,6 +30,6 @@ cat <<\EOF > exp || fail=1 xx EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/du/2g b/tests/du/2g index 280ba30f8..fe5876774 100755 --- a/tests/du/2g +++ b/tests/du/2g @@ -64,6 +64,6 @@ cat <<\EOF > exp || fail=1 ~2M EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/du/8gb b/tests/du/8gb index ab283e42e..22d09af50 100755 --- a/tests/du/8gb +++ b/tests/du/8gb @@ -48,6 +48,6 @@ cat <<\EOF > exp 8589934592 big EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/du/basic b/tests/du/basic index 3cb3c0d99..db75ee927 100755 --- a/tests/du/basic +++ b/tests/du/basic @@ -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 diff --git a/tests/du/bigtime b/tests/du/bigtime index b33b80126..dd69457c3 100755 --- a/tests/du/bigtime +++ b/tests/du/bigtime @@ -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 diff --git a/tests/du/deref-args b/tests/du/deref-args index 474f7d06c..3c3e97425 100755 --- a/tests/du/deref-args +++ b/tests/du/deref-args @@ -43,6 +43,6 @@ slink/ 64 slink-to-64k EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/du/exclude b/tests/du/exclude index 7403f5d04..87346fba5 100755 --- a/tests/du/exclude +++ b/tests/du/exclude @@ -53,6 +53,6 @@ a/x a/x/y EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/du/files0-from-dir b/tests/du/files0-from-dir index fc1e1844c..1d996c152 100755 --- a/tests/du/files0-from-dir +++ b/tests/du/files0-from-dir @@ -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 diff --git a/tests/du/hard-link b/tests/du/hard-link index 71cbf51d9..4113898ec 100755 --- a/tests/du/hard-link +++ b/tests/du/hard-link @@ -59,6 +59,6 @@ dir/f_ dir EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/du/inacc-dest b/tests/du/inacc-dest index fac7e0ede..96231a013 100755 --- a/tests/du/inacc-dest +++ b/tests/du/inacc-dest @@ -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 diff --git a/tests/du/inacc-dir b/tests/du/inacc-dir index c160fbbf5..638fc340a 100755 --- a/tests/du/inacc-dir +++ b/tests/du/inacc-dir @@ -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 diff --git a/tests/du/long-sloop b/tests/du/long-sloop index 6c1d8d5de..09bd2c1c6 100755 --- a/tests/du/long-sloop +++ b/tests/du/long-sloop @@ -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 diff --git a/tests/du/max-depth b/tests/du/max-depth index 6edc73e6e..e165d3278 100755 --- a/tests/du/max-depth +++ b/tests/du/max-depth @@ -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 diff --git a/tests/du/move-dir-while-traversing b/tests/du/move-dir-while-traversing index d0969fecc..29a65d8d5 100755 --- a/tests/du/move-dir-while-traversing +++ b/tests/du/move-dir-while-traversing @@ -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 diff --git a/tests/du/no-deref b/tests/du/no-deref index 09a1dcc41..731eb8ec5 100755 --- a/tests/du/no-deref +++ b/tests/du/no-deref @@ -28,6 +28,6 @@ cat <<\EOF > exp slink EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/du/no-x b/tests/du/no-x index e45f317e0..366818be9 100755 --- a/tests/du/no-x +++ b/tests/du/no-x @@ -44,6 +44,6 @@ cat < exp $prog: \`d/no-x': Permission denied EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/du/one-file-system b/tests/du/one-file-system index 8a57c9934..7195838bd 100755 --- a/tests/du/one-file-system +++ b/tests/du/one-file-system @@ -35,6 +35,6 @@ y/z y EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/du/slash b/tests/du/slash index c87dd3f3f..f796cc047 100755 --- a/tests/du/slash +++ b/tests/du/slash @@ -28,6 +28,6 @@ cat <<\EOF > exp / EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/du/trailing-slash b/tests/du/trailing-slash index 7c97ccec9..e22c9d628 100755 --- a/tests/du/trailing-slash +++ b/tests/du/trailing-slash @@ -42,6 +42,6 @@ slink/1 slink EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/install/strip-program b/tests/install/strip-program index 0f1e9fa22..ebd6a41e3 100755 --- a/tests/install/strip-program +++ b/tests/install/strip-program @@ -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 diff --git a/tests/ln/hard-backup b/tests/ln/hard-backup index e6c9631b7..a67fdbe35 100755 --- a/tests/ln/hard-backup +++ b/tests/ln/hard-backup @@ -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 diff --git a/tests/ls/block-size b/tests/ls/block-size index 16ede04b7..9b920f10f 100755 --- a/tests/ls/block-size +++ b/tests/ls/block-size @@ -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 diff --git a/tests/ls/color-clear-to-eol b/tests/ls/color-clear-to-eol index 164b163c7..25dfe37bb 100755 --- a/tests/ls/color-clear-to-eol +++ b/tests/ls/color-clear-to-eol @@ -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 diff --git a/tests/ls/color-dtype-dir b/tests/ls/color-dtype-dir index b677240db..3d1655c0c 100755 --- a/tests/ls/color-dtype-dir +++ b/tests/ls/color-dtype-dir @@ -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 diff --git a/tests/ls/color-norm b/tests/ls/color-norm index c8691034b..843c23824 100755 --- a/tests/ls/color-norm +++ b/tests/ls/color-norm @@ -79,6 +79,6 @@ norm nocolor$ norm exe$ EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/ls/dangle b/tests/ls/dangle index 35035febe..c85835f66 100755 --- a/tests/ls/dangle +++ b/tests/ls/dangle @@ -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 diff --git a/tests/ls/dired b/tests/ls/dired index 18cd1eaa3..271892145 100755 --- a/tests/ls/dired +++ b/tests/ls/dired @@ -30,6 +30,6 @@ cat < exp //DIRED-OPTIONS// --quoting-style=literal EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/ls/file-type b/tests/ls/file-type index b72229045..a4924ede1 100755 --- a/tests/ls/file-type +++ b/tests/ls/file-type @@ -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 diff --git a/tests/ls/follow-slink b/tests/ls/follow-slink index cb4922b37..fba68b58f 100755 --- a/tests/ls/follow-slink +++ b/tests/ls/follow-slink @@ -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 diff --git a/tests/ls/infloop b/tests/ls/infloop index 34d963311..78ee2008f 100755 --- a/tests/ls/infloop +++ b/tests/ls/infloop @@ -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 diff --git a/tests/ls/m-option b/tests/ls/m-option index 2e6ec03d2..4ec2342aa 100755 --- a/tests/ls/m-option +++ b/tests/ls/m-option @@ -35,6 +35,6 @@ b 0 a, 12 b EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/ls/no-arg b/tests/ls/no-arg index f61846b97..65aa55b57 100755 --- a/tests/ls/no-arg +++ b/tests/ls/no-arg @@ -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 diff --git a/tests/ls/recursive b/tests/ls/recursive index 677b5fdb2..3e0b2a0a7 100755 --- a/tests/ls/recursive +++ b/tests/ls/recursive @@ -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 diff --git a/tests/ls/rt-1 b/tests/ls/rt-1 index 05d2a039f..00090643f 100755 --- a/tests/ls/rt-1 +++ b/tests/ls/rt-1 @@ -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 diff --git a/tests/ls/stat-dtype b/tests/ls/stat-dtype index 8ee94344f..9b47930f5 100755 --- a/tests/ls/stat-dtype +++ b/tests/ls/stat-dtype @@ -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 diff --git a/tests/ls/stat-failed b/tests/ls/stat-failed index 5a22c7bf9..84ffa947d 100755 --- a/tests/ls/stat-failed +++ b/tests/ls/stat-failed @@ -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 diff --git a/tests/ls/stat-free-symlinks b/tests/ls/stat-free-symlinks index ab2011925..87304da4d 100755 --- a/tests/ls/stat-free-symlinks +++ b/tests/ls/stat-free-symlinks @@ -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 diff --git a/tests/ls/x-option b/tests/ls/x-option index 7a451f54b..0730de5e5 100755 --- a/tests/ls/x-option +++ b/tests/ls/x-option @@ -32,6 +32,6 @@ a b b a EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/misc/arch b/tests/misc/arch index 194f7f359..df45e4a19 100755 --- a/tests/misc/arch +++ b/tests/misc/arch @@ -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 diff --git a/tests/misc/cat-buf b/tests/misc/cat-buf index 348b41450..4bb5419b8 100755 --- a/tests/misc/cat-buf +++ b/tests/misc/cat-buf @@ -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 diff --git a/tests/misc/cat-proc b/tests/misc/cat-proc index 83c173513..2372980c3 100755 --- a/tests/misc/cat-proc +++ b/tests/misc/cat-proc @@ -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 diff --git a/tests/misc/chcon b/tests/misc/chcon index 0f367ef89..70837af6c 100755 --- a/tests/misc/chcon +++ b/tests/misc/chcon @@ -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 diff --git a/tests/misc/csplit b/tests/misc/csplit index 652690c5e..7536bbb39 100755 --- a/tests/misc/csplit +++ b/tests/misc/csplit @@ -28,14 +28,14 @@ cat < 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 < 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 < 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 < 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). diff --git a/tests/misc/df-P b/tests/misc/df-P index c55c8c1d4..042abb5ec 100755 --- a/tests/misc/df-P +++ b/tests/misc/df-P @@ -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 diff --git a/tests/misc/fmt-long-line b/tests/misc/fmt-long-line index 4d424c095..cf1356bf8 100755 --- a/tests/misc/fmt-long-line +++ b/tests/misc/fmt-long-line @@ -56,6 +56,6 @@ EOF fmt -s in > out || fail=1 -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/misc/groups-dash b/tests/misc/groups-dash index 711d452e7..b6cf873bd 100755 --- a/tests/misc/groups-dash +++ b/tests/misc/groups-dash @@ -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 diff --git a/tests/misc/groups-version b/tests/misc/groups-version index f086a74e7..e1ca78ccd 100755 --- a/tests/misc/groups-version +++ b/tests/misc/groups-version @@ -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 diff --git a/tests/misc/head-pos b/tests/misc/head-pos index 79e2a43e0..a8bfe2f86 100755 --- a/tests/misc/head-pos +++ b/tests/misc/head-pos @@ -27,6 +27,6 @@ cat < exp b EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/misc/nl b/tests/misc/nl index 05270c8d7..4eef6f867 100755 --- a/tests/misc/nl +++ b/tests/misc/nl @@ -38,6 +38,6 @@ cat <<\EOF > exp $ EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/misc/od-N b/tests/misc/od-N index 2aa210674..17c11aec5 100755 --- a/tests/misc/od-N +++ b/tests/misc/od-N @@ -27,6 +27,6 @@ cat < exp || fail=1 a b c d e f EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/misc/od-multiple-t b/tests/misc/od-multiple-t index 4f8698768..edcb5d9ae 100755 --- a/tests/misc/od-multiple-t +++ b/tests/misc/od-multiple-t @@ -37,6 +37,6 @@ for format1 in $list; do done done -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/misc/od-x8 b/tests/misc/od-x8 index b66269faf..2cbe5c34e 100755 --- a/tests/misc/od-x8 +++ b/tests/misc/od-x8 @@ -38,6 +38,6 @@ od -An -t x1 in \ | sort -n \ > exp -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/misc/printf b/tests/misc/printf index b9092e17f..276541968 100755 --- a/tests/misc/printf +++ b/tests/misc/printf @@ -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 diff --git a/tests/misc/printf-hex b/tests/misc/printf-hex index 106490ece..000f7b17f 100755 --- a/tests/misc/printf-hex +++ b/tests/misc/printf-hex @@ -24,6 +24,6 @@ cat <<\EOF > exp ~3 EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/misc/pwd-option b/tests/misc/pwd-option index 708401ff2..e51a0ae6e 100755 --- a/tests/misc/pwd-option +++ b/tests/misc/pwd-option @@ -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 diff --git a/tests/misc/readlink-fp-loop b/tests/misc/readlink-fp-loop index 1c50d6a4f..58bfde100 100755 --- a/tests/misc/readlink-fp-loop +++ b/tests/misc/readlink-fp-loop @@ -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 diff --git a/tests/misc/runcon-no-reorder b/tests/misc/runcon-no-reorder index 7a4825680..af99e1b50 100755 --- a/tests/misc/runcon-no-reorder +++ b/tests/misc/runcon-no-reorder @@ -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 diff --git a/tests/misc/seq-long-double b/tests/misc/seq-long-double index 230912cbe..cdf06ace6 100755 --- a/tests/misc/seq-long-double +++ b/tests/misc/seq-long-double @@ -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 diff --git a/tests/misc/sort-NaN-infloop b/tests/misc/sort-NaN-infloop index ead871e43..8075cbb7b 100755 --- a/tests/misc/sort-NaN-infloop +++ b/tests/misc/sort-NaN-infloop @@ -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 diff --git a/tests/misc/sort-benchmark-random b/tests/misc/sort-benchmark-random index 6a61a1462..1baf58788 100755 --- a/tests/misc/sort-benchmark-random +++ b/tests/misc/sort-benchmark-random @@ -48,6 +48,6 @@ close (FILE); time sort in > out || fail=1 -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/misc/sort-debug-keys b/tests/misc/sort-debug-keys index b4c2fb74e..db3a91364 100755 --- a/tests/misc/sort-debug-keys +++ b/tests/misc/sort-debug-keys @@ -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 diff --git a/tests/misc/sort-float b/tests/misc/sort-float index 850f57c15..aacd9b3be 100755 --- a/tests/misc/sort-float +++ b/tests/misc/sort-float @@ -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 diff --git a/tests/misc/sort-merge-fdlimit b/tests/misc/sort-merge-fdlimit index 2de14f4f7..add4bc3a4 100755 --- a/tests/misc/sort-merge-fdlimit +++ b/tests/misc/sort-merge-fdlimit @@ -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 diff --git a/tests/misc/sort-unique-segv b/tests/misc/sort-unique-segv index 6a40c379c..e8e9ecf74 100755 --- a/tests/misc/sort-unique-segv +++ b/tests/misc/sort-unique-segv @@ -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 diff --git a/tests/misc/stat-hyphen b/tests/misc/stat-hyphen index 9a950ba64..c2addcd20 100755 --- a/tests/misc/stat-hyphen +++ b/tests/misc/stat-hyphen @@ -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 diff --git a/tests/misc/stat-slash b/tests/misc/stat-slash index c317855d6..92dcd47ea 100755 --- a/tests/misc/stat-slash +++ b/tests/misc/stat-slash @@ -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 diff --git a/tests/misc/stdbuf b/tests/misc/stdbuf index ccf60b197..7a102d383 100755 --- a/tests/misc/stdbuf +++ b/tests/misc/stdbuf @@ -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 diff --git a/tests/misc/sum-sysv b/tests/misc/sum-sysv index f4d6a18ed..19b79ef0f 100755 --- a/tests/misc/sum-sysv +++ b/tests/misc/sum-sysv @@ -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 diff --git a/tests/misc/tac-2-nonseekable b/tests/misc/tac-2-nonseekable index 7b4877367..8ff30dce9 100755 --- a/tests/misc/tac-2-nonseekable +++ b/tests/misc/tac-2-nonseekable @@ -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 diff --git a/tests/misc/tac-continue b/tests/misc/tac-continue index 0040ac60a..be6325ce4 100755 --- a/tests/misc/tac-continue +++ b/tests/misc/tac-continue @@ -65,6 +65,6 @@ cat <<\EOF > exp || fail=1 1 EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/misc/tr-case-class b/tests/misc/tr-case-class index 92f1a576c..680f25a11 100755 --- a/tests/misc/tr-case-class +++ b/tests/misc/tr-case-class @@ -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 diff --git a/tests/misc/truncate-fail-diag b/tests/misc/truncate-fail-diag index cea79d464..50cb5f411 100755 --- a/tests/misc/truncate-fail-diag +++ b/tests/misc/truncate-fail-diag @@ -32,7 +32,7 @@ truncate -s0 $dir > out 2>&1 && fail=1 cat < 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 diff --git a/tests/misc/wc-files0 b/tests/misc/wc-files0 index 49df3b4b0..0cc4b8417 100755 --- a/tests/misc/wc-files0 +++ b/tests/misc/wc-files0 @@ -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 diff --git a/tests/mkdir/selinux b/tests/mkdir/selinux index 20a463f3c..aa0e8820b 100755 --- a/tests/mkdir/selinux +++ b/tests/mkdir/selinux @@ -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 diff --git a/tests/mv/backup-dir b/tests/mv/backup-dir index 3026365dd..b54210bac 100755 --- a/tests/mv/backup-dir +++ b/tests/mv/backup-dir @@ -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 diff --git a/tests/mv/backup-is-src b/tests/mv/backup-is-src index ba05870ab..0d4a06d4c 100755 --- a/tests/mv/backup-is-src +++ b/tests/mv/backup-is-src @@ -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 diff --git a/tests/mv/diag b/tests/mv/diag index 2007ee063..21bb5e61f 100755 --- a/tests/mv/diag +++ b/tests/mv/diag @@ -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 diff --git a/tests/mv/dir2dir b/tests/mv/dir2dir index 452bb7de9..cf4ba0a90 100755 --- a/tests/mv/dir2dir +++ b/tests/mv/dir2dir @@ -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 diff --git a/tests/mv/dup-source b/tests/mv/dup-source index 0bbe36aed..5b91ba51e 100755 --- a/tests/mv/dup-source +++ b/tests/mv/dup-source @@ -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 diff --git a/tests/mv/force b/tests/mv/force index 4aa754003..5ef6391d3 100755 --- a/tests/mv/force +++ b/tests/mv/force @@ -32,7 +32,7 @@ cat > exp < exp || fail=1 removed `x' EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/mv/i-link-no b/tests/mv/i-link-no index 7858eb91b..94fc43db9 100755 --- a/tests/mv/i-link-no +++ b/tests/mv/i-link-no @@ -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) ;; diff --git a/tests/mv/into-self b/tests/mv/into-self index a4df10a6b..16aa681d6 100755 --- a/tests/mv/into-self +++ b/tests/mv/into-self @@ -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 diff --git a/tests/mv/into-self-2 b/tests/mv/into-self-2 index 28e212768..9cc6ef016 100755 --- a/tests/mv/into-self-2 +++ b/tests/mv/into-self-2 @@ -47,6 +47,6 @@ XXX: `ZZZ' and `YYY' are the same file EOF #' -compare out2 exp || fail=1 +compare exp out2 || fail=1 Exit $fail diff --git a/tests/mv/into-self-3 b/tests/mv/into-self-3 index 8d1eadb5f..c937ebad1 100755 --- a/tests/mv/into-self-3 +++ b/tests/mv/into-self-3 @@ -36,6 +36,6 @@ cat > exp <<\EOF XXX: cannot move `ZZZ' to a subdirectory of itself, `ZZZ/ZZZ' EOF -compare out2 exp || fail=1 +compare exp out2 || fail=1 Exit $fail diff --git a/tests/mv/mv-special-1 b/tests/mv/mv-special-1 index f43a70791..34a226999 100755 --- a/tests/mv/mv-special-1 +++ b/tests/mv/mv-special-1 @@ -64,7 +64,7 @@ cat < exp \`$dir/d/e/f/file2' -> \`XXX/$dir/d/e/f/file2' EOF -compare out2 exp || fail=1 +compare exp out2 || fail=1 # cd "$other_partition_tmpdir" # ls -l -A -R "$other_partition_tmpdir" diff --git a/tests/mv/part-fail b/tests/mv/part-fail index c653df823..acf291e9e 100755 --- a/tests/mv/part-fail +++ b/tests/mv/part-fail @@ -50,6 +50,6 @@ else fail=1 fi fi -test $fail = 1 && compare out exp +test $fail = 1 && compare exp out Exit $fail diff --git a/tests/mv/perm-1 b/tests/mv/perm-1 index cab0076f2..6b37e04f8 100755 --- a/tests/mv/perm-1 +++ b/tests/mv/perm-1 @@ -30,6 +30,6 @@ cat <<\EOF > exp mv: cannot move `no-write/dir' to `./dir': Permission denied EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/mv/sticky-to-xpart b/tests/mv/sticky-to-xpart index 3d61c3c27..a8b2e5952 100755 --- a/tests/mv/sticky-to-xpart +++ b/tests/mv/sticky-to-xpart @@ -62,6 +62,6 @@ cat <<\EOF > exp mv: cannot remove `t/root-owned': Operation not permitted EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/mv/trailing-slash b/tests/mv/trailing-slash index 104cf594c..b00ce5ce9 100755 --- a/tests/mv/trailing-slash +++ b/tests/mv/trailing-slash @@ -60,6 +60,6 @@ cp b no-such/ 2> err && fail=1 # Map "No such file..." diagnostic to the expected "Not a directory" sed 's/No such file or directory/Not a directory/' err > k && mv k err -compare err expected-err || fail=1 +compare expected-err err || fail=1 Exit $fail diff --git a/tests/rm/cycle b/tests/rm/cycle index 30596fb69..4146a988f 100755 --- a/tests/rm/cycle +++ b/tests/rm/cycle @@ -31,6 +31,6 @@ rm: cannot remove `a/b/file' rm: cannot remove `a/b/file' EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/rm/dir-no-w b/tests/rm/dir-no-w index b4721ad4e..5f3f84058 100755 --- a/tests/rm/dir-no-w +++ b/tests/rm/dir-no-w @@ -37,6 +37,6 @@ EOF sed 's/remove directory/remove/' out-t > out rm -f out-t -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/rm/dir-nonrecur b/tests/rm/dir-nonrecur index 2e2f15237..6fdb884f8 100755 --- a/tests/rm/dir-nonrecur +++ b/tests/rm/dir-nonrecur @@ -29,6 +29,6 @@ rm: cannot remove `d': Is a directory EOF # Before coreutils-5.93 this test would fail on Solaris 9 and newer. -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/rm/fail-2eperm b/tests/rm/fail-2eperm index cd294c5bc..b9cdb57fd 100755 --- a/tests/rm/fail-2eperm +++ b/tests/rm/fail-2eperm @@ -50,6 +50,6 @@ cat <<\EOF > exp rm: cannot remove `a/b': Operation not permitted EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/rm/fail-eacces b/tests/rm/fail-eacces index 8e9b5b07e..89e6357ba 100755 --- a/tests/rm/fail-eacces +++ b/tests/rm/fail-eacces @@ -42,13 +42,13 @@ rm -rf d/f 2> out && fail=1 cat <<\EOF > exp rm: cannot remove `d/f': Permission denied EOF -compare out exp || fail=1 +compare exp out || fail=1 # This used to fail with ELOOP. rm -rf e 2> out && fail=1 cat <<\EOF > exp rm: cannot remove `e/slink': Permission denied EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/rm/i-never b/tests/rm/i-never index 5ffde73c7..7179bdbd1 100755 --- a/tests/rm/i-never +++ b/tests/rm/i-never @@ -28,6 +28,6 @@ touch exp || framework_failure_ rm --interactive=never f > out || fail=1 -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/rm/inaccessible b/tests/rm/inaccessible index e87ab793d..b0e087c2e 100755 --- a/tests/rm/inaccessible +++ b/tests/rm/inaccessible @@ -44,6 +44,6 @@ EOF # to the expected one: sed 's/: The file access permissions.*/: Permission denied/'o1;mv o1 out -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/rm/interactive-always b/tests/rm/interactive-always index 032c645ed..70bf03a11 100755 --- a/tests/rm/interactive-always +++ b/tests/rm/interactive-always @@ -83,7 +83,7 @@ WHEN=always rm: remove all arguments recursively? . EOF -compare out expout || fail=1 -compare err experr || fail=1 +compare expout out || fail=1 +compare experr err || fail=1 Exit $fail diff --git a/tests/rm/interactive-once b/tests/rm/interactive-once index fc1c76dd7..f2f946bdc 100755 --- a/tests/rm/interactive-once +++ b/tests/rm/interactive-once @@ -103,7 +103,7 @@ multiple files, recursion, answer yes rm: remove all arguments recursively? . EOF -compare out expout || fail=1 -compare err experr || fail=1 +compare expout out || fail=1 +compare experr err || fail=1 Exit $fail diff --git a/tests/rm/isatty b/tests/rm/isatty index 1118b9465..15e395f11 100755 --- a/tests/rm/isatty +++ b/tests/rm/isatty @@ -49,6 +49,6 @@ EOF # Append an `x' and a newline. echo x >> out -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/rm/one-file-system b/tests/rm/one-file-system index 064d27c2b..93c1f7ff6 100755 --- a/tests/rm/one-file-system +++ b/tests/rm/one-file-system @@ -43,6 +43,6 @@ EOF rm --one-file-system -rf a 2> out && fail=1 test -d $t/y || fail=1 -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/rm/rm1 b/tests/rm/rm1 index f4f43d042..3de093b4a 100755 --- a/tests/rm/rm1 +++ b/tests/rm/rm1 @@ -39,7 +39,7 @@ EOF cmp out exp > /dev/null 2>&1 || { cmp out exp2 || fail=1 } -test $fail = 1 && compare out exp +test $fail = 1 && compare exp out test -d b/a/p || fail=1 test -d b/c && fail=1 diff --git a/tests/rm/rm2 b/tests/rm/rm2 index 6df1e2090..e3fd0c911 100755 --- a/tests/rm/rm2 +++ b/tests/rm/rm2 @@ -42,7 +42,7 @@ EOF cmp out exp > /dev/null 2>&1 \ || { cmp out exp-solaris > /dev/null 2>&1 || fail=1; } -test $fail = 1 && compare out exp +test $fail = 1 && compare exp out test -d a/0 && fail=1 test -d a/1 || fail=1 diff --git a/tests/rm/rm3 b/tests/rm/rm3 index 56aea8c1e..b2f3b0e91 100755 --- a/tests/rm/rm3 +++ b/tests/rm/rm3 @@ -66,7 +66,7 @@ rm: remove write-protected directory \`z/du' rm: remove directory \`z' EOF -compare out exp || fail=1 +compare exp out || fail=1 test -d z && fail=1 diff --git a/tests/rm/rm5 b/tests/rm/rm5 index 5c33bf729..2dfaf73ec 100755 --- a/tests/rm/rm5 +++ b/tests/rm/rm5 @@ -47,6 +47,6 @@ mv o2 out # Make sure it's been removed. test -d d && fail=1 -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/rm/unread2 b/tests/rm/unread2 index ae3365f25..a26ad0393 100755 --- a/tests/rm/unread2 +++ b/tests/rm/unread2 @@ -30,6 +30,6 @@ cat <<\EOF > exp rm: cannot remove `a': Permission denied EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/rm/v-slash b/tests/rm/v-slash index 6620742ec..d257b4d3e 100755 --- a/tests/rm/v-slash +++ b/tests/rm/v-slash @@ -29,6 +29,6 @@ removed `a/x' removed directory: `a' EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/sample-test b/tests/sample-test index 1a4c24160..35dea0eec 100644 --- a/tests/sample-test +++ b/tests/sample-test @@ -31,6 +31,6 @@ cat <<\EOF > exp || fail=1 FIXME EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/split/b-chunk b/tests/split/b-chunk index 3191620aa..5e7f82d5d 100755 --- a/tests/split/b-chunk +++ b/tests/split/b-chunk @@ -39,12 +39,12 @@ printf '1\n2' > exp-1 printf '\n3\n' > exp-2 printf '4\n5\n' > exp-3 -compare xaa exp-1 || fail=1 -compare xab exp-2 || fail=1 -compare xac exp-3 || fail=1 -compare b1 exp-1 || fail=1 -compare b2 exp-2 || fail=1 -compare b3 exp-3 || fail=1 +compare exp-1 xaa || fail=1 +compare exp-2 xab || fail=1 +compare exp-3 xac || fail=1 +compare exp-1 b1 || fail=1 +compare exp-2 b2 || fail=1 +compare exp-3 b3 || fail=1 test -f xad && fail=1 Exit $fail diff --git a/tests/split/fail b/tests/split/fail index 039f457a3..79f62f81e 100755 --- a/tests/split/fail +++ b/tests/split/fail @@ -69,7 +69,7 @@ mv -f out-t out cat <<\EOF > exp split: line count option -99*... is too large EOF -compare out exp || fail=1 +compare exp out || fail=1 # Make sure split fails when it can't read input # (the current directory in this case) diff --git a/tests/split/l-chunk b/tests/split/l-chunk index e1c9ec7d8..8dbbece51 100755 --- a/tests/split/l-chunk +++ b/tests/split/l-chunk @@ -22,11 +22,11 @@ print_ver_ split # invalid number of chunks echo 'split: 1o: invalid number of chunks' > exp split -n l/1o 2>err && fail=1 -compare err exp || fail=1 +compare exp err || fail=1 echo "split: \`-': cannot determine file size" > exp echo | split -n l/1 2>err && fail=1 -compare err exp || fail=1 +compare exp err || fail=1 # N can be greater than the file size # in which case no data is extracted, or empty files are written @@ -52,7 +52,7 @@ printf "%s" "$lines" | tr '~' '\n' > in || framework_failure_ echo 'split: 16: invalid chunk number' > exp split -n l/16/15 in 2>err && fail=1 -compare err exp || fail=1 +compare exp err || fail=1 printf '%s' "\ 14 16 09 15 16 10 @@ -119,20 +119,20 @@ test "$DEBUGGING" && test "$VERBOSE" && set -x : > out printf '1\n12345\n' > exp split -n l/13/15 in > out -compare out exp || fail=1 +compare exp out || fail=1 : > out printf '' > exp split -n l/14/15 in > out -compare out exp || fail=1 +compare exp out || fail=1 : > out printf '1\n12345\n1\n' > exp split -n l/15/15 in > out -compare out exp || fail=1 +compare exp out || fail=1 # test input with no \n at end printf '12\n34\n5' > in printf '5' > exp split -n l/7/7 in > out -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/split/lines b/tests/split/lines index 1612c2e23..3269449d0 100755 --- a/tests/split/lines +++ b/tests/split/lines @@ -34,9 +34,9 @@ cat <<\EOF > exp-3 5 EOF -compare xaa exp-1 || fail=1 -compare xab exp-2 || fail=1 -compare xac exp-3 || fail=1 +compare exp-1 xaa || fail=1 +compare exp-2 xab || fail=1 +compare exp-3 xac || fail=1 test -f xad && fail=1 Exit $fail diff --git a/tests/split/r-chunk b/tests/split/r-chunk index ea2ac9f20..821b297fd 100755 --- a/tests/split/r-chunk +++ b/tests/split/r-chunk @@ -44,18 +44,18 @@ printf '1\n4\n' > exp-1 printf '2\n5\n' > exp-2 printf '3\n' > exp-3 -compare xaa exp-1 || fail=1 -compare xab exp-2 || fail=1 -compare xac exp-3 || fail=1 -compare r1 exp-1 || fail=1 -compare r2 exp-2 || fail=1 -compare r3 exp-3 || fail=1 +compare exp-1 xaa || fail=1 +compare exp-2 xab || fail=1 +compare exp-3 xac || fail=1 +compare exp-1 r1 || fail=1 +compare exp-2 r2 || fail=1 +compare exp-3 r3 || fail=1 test -f xad && fail=1 # Test input without trailing \n printf '1\n2\n3\n4\n5' | split -n r/2/3 > out printf '2\n5' > exp -compare out exp || fail=1 +compare exp out || fail=1 # Ensure we fall back to appending to a file at a time # if we hit the limit for the number of open files. diff --git a/tests/split/suffix-length b/tests/split/suffix-length index efb0d8166..da5b7fde3 100755 --- a/tests/split/suffix-length +++ b/tests/split/suffix-length @@ -45,11 +45,11 @@ test -f xz || fail=1 test -f xaa && fail=1 test -f xaz && fail=1 rm -f x* -compare err exp-too-short || fail=1 +compare exp-too-short err || fail=1 # With a longer suffix, it must succeed. split --verbose -b 1 -a 2 in > err || fail=1 -compare err exp || fail=1 +compare exp err || fail=1 # Ensure that xbb is *not* created. test -f xbb && fail=1 diff --git a/tests/tail-2/big-4gb b/tests/tail-2/big-4gb index 874081168..ecd73c09b 100755 --- a/tests/tail-2/big-4gb +++ b/tests/tail-2/big-4gb @@ -45,6 +45,6 @@ cat <<\EOF > exp 1 EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/tail-2/follow-name b/tests/tail-2/follow-name index e34b77964..15aff279c 100755 --- a/tests/tail-2/follow-name +++ b/tests/tail-2/follow-name @@ -31,6 +31,6 @@ test $? = 1 || fail=1 # we can compare against the above error sed '/inotify cannot be used/d' err > k && mv k err -compare err exp || fail=1 +compare exp err || fail=1 Exit $fail diff --git a/tests/tail-2/follow-stdin b/tests/tail-2/follow-stdin index 51520ab67..66fb26c3d 100755 --- a/tests/tail-2/follow-stdin +++ b/tests/tail-2/follow-stdin @@ -31,6 +31,6 @@ test $? = 124 || fail=1 test -s err && fail=1 # Ensure there was -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/tail-2/pipe-f b/tests/tail-2/pipe-f index db092e758..3552f1089 100755 --- a/tests/tail-2/pipe-f +++ b/tests/tail-2/pipe-f @@ -22,6 +22,6 @@ print_ver_ tail echo foo | timeout 10 tail -f -c3 > out || fail=1 echo oo > exp || fail=1 -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/tail-2/pipe-f2 b/tests/tail-2/pipe-f2 index 3421798b4..727b30676 100755 --- a/tests/tail-2/pipe-f2 +++ b/tests/tail-2/pipe-f2 @@ -35,7 +35,7 @@ check_tail_output() # Wait 6.3s for tail to write something. retry_delay_ check_tail_output .1 7 || fail=1 -compare out exp || fail=1 +compare exp out || fail=1 # Kill the still-running tail, or fail if it's gone. kill $pid || fail=1 diff --git a/tests/tail-2/start-middle b/tests/tail-2/start-middle index 3dcbacbf9..6658ca201 100755 --- a/tests/tail-2/start-middle +++ b/tests/tail-2/start-middle @@ -28,6 +28,6 @@ cat < exp 2 EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/touch/60-seconds b/tests/touch/60-seconds index 578aedc53..62b7ebff1 100755 --- a/tests/touch/60-seconds +++ b/tests/touch/60-seconds @@ -28,6 +28,6 @@ TZ=UTC0 touch -t 197001010000.60 f || fail=1 stat --p='%.9Y\n' f > out || fail=1 -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/touch/fail-diag b/tests/touch/fail-diag index a2613fe23..fbd0cd112 100755 --- a/tests/touch/fail-diag +++ b/tests/touch/fail-diag @@ -27,6 +27,6 @@ cat < exp touch: cannot touch \`$file': No such file or directory EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail diff --git a/tests/touch/not-owner b/tests/touch/not-owner index 98dd4e348..c8b567c63 100755 --- a/tests/touch/not-owner +++ b/tests/touch/not-owner @@ -50,6 +50,6 @@ EOF done test "$match" = 1 || fail=1 -test $fail = 1 && compare out exp +test $fail = 1 && compare exp out Exit $fail diff --git a/tests/touch/relative b/tests/touch/relative index a530eaa67..7e8249619 100755 --- a/tests/touch/relative +++ b/tests/touch/relative @@ -33,6 +33,6 @@ cat <<\EOF > exp || fail=1 2004-01-11 EOF -compare out exp || fail=1 +compare exp out || fail=1 Exit $fail -- 2.11.4.GIT