diff options
author | Jim Meyering <meyering@redhat.com> | 2011-11-22 10:08:04 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-11-22 10:35:03 +0100 |
commit | a2c811db420717d61bf948afdd879454d9187d38 (patch) | |
tree | d2a82ad94d4674069a72a6a162d00bb6694d431b /tests/rm | |
parent | 9d98634b3908786bb048b72624da244e681f87b9 (diff) | |
download | coreutils-a2c811db420717d61bf948afdd879454d9187d38.tar.xz |
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.
Diffstat (limited to 'tests/rm')
-rwxr-xr-x | tests/rm/cycle | 2 | ||||
-rwxr-xr-x | tests/rm/dir-no-w | 2 | ||||
-rwxr-xr-x | tests/rm/dir-nonrecur | 2 | ||||
-rwxr-xr-x | tests/rm/fail-2eperm | 2 | ||||
-rwxr-xr-x | tests/rm/fail-eacces | 4 | ||||
-rwxr-xr-x | tests/rm/i-never | 2 | ||||
-rwxr-xr-x | tests/rm/inaccessible | 2 | ||||
-rwxr-xr-x | tests/rm/interactive-always | 4 | ||||
-rwxr-xr-x | tests/rm/interactive-once | 4 | ||||
-rwxr-xr-x | tests/rm/isatty | 2 | ||||
-rwxr-xr-x | tests/rm/one-file-system | 2 | ||||
-rwxr-xr-x | tests/rm/rm1 | 2 | ||||
-rwxr-xr-x | tests/rm/rm2 | 2 | ||||
-rwxr-xr-x | tests/rm/rm3 | 2 | ||||
-rwxr-xr-x | tests/rm/rm5 | 2 | ||||
-rwxr-xr-x | tests/rm/unread2 | 2 | ||||
-rwxr-xr-x | tests/rm/v-slash | 2 |
17 files changed, 20 insertions, 20 deletions
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/'<out>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 |