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/mv | |
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/mv')
-rwxr-xr-x | tests/mv/backup-dir | 2 | ||||
-rwxr-xr-x | tests/mv/backup-is-src | 2 | ||||
-rwxr-xr-x | tests/mv/diag | 2 | ||||
-rwxr-xr-x | tests/mv/dir2dir | 2 | ||||
-rwxr-xr-x | tests/mv/dup-source | 4 | ||||
-rwxr-xr-x | tests/mv/force | 2 | ||||
-rwxr-xr-x | tests/mv/hard-verbose | 2 | ||||
-rwxr-xr-x | tests/mv/i-link-no | 4 | ||||
-rwxr-xr-x | tests/mv/into-self | 2 | ||||
-rwxr-xr-x | tests/mv/into-self-2 | 2 | ||||
-rwxr-xr-x | tests/mv/into-self-3 | 2 | ||||
-rwxr-xr-x | tests/mv/mv-special-1 | 2 | ||||
-rwxr-xr-x | tests/mv/part-fail | 2 | ||||
-rwxr-xr-x | tests/mv/perm-1 | 2 | ||||
-rwxr-xr-x | tests/mv/sticky-to-xpart | 2 | ||||
-rwxr-xr-x | tests/mv/trailing-slash | 2 |
16 files changed, 18 insertions, 18 deletions
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 <<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 diff --git a/tests/mv/hard-verbose b/tests/mv/hard-verbose index 95d959d57..b354447ee 100755 --- a/tests/mv/hard-verbose +++ b/tests/mv/hard-verbose @@ -28,6 +28,6 @@ cat <<\EOF > 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 <<EOF | sort > 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 |