summaryrefslogtreecommitdiff
path: root/tests/ls
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-11-22 10:08:04 +0100
committerJim Meyering <meyering@redhat.com>2011-11-22 10:35:03 +0100
commita2c811db420717d61bf948afdd879454d9187d38 (patch)
treed2a82ad94d4674069a72a6a162d00bb6694d431b /tests/ls
parent9d98634b3908786bb048b72624da244e681f87b9 (diff)
downloadcoreutils-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/ls')
-rwxr-xr-xtests/ls/block-size2
-rwxr-xr-xtests/ls/color-clear-to-eol2
-rwxr-xr-xtests/ls/color-dtype-dir4
-rwxr-xr-xtests/ls/color-norm2
-rwxr-xr-xtests/ls/dangle2
-rwxr-xr-xtests/ls/dired2
-rwxr-xr-xtests/ls/file-type8
-rwxr-xr-xtests/ls/follow-slink4
-rwxr-xr-xtests/ls/infloop4
-rwxr-xr-xtests/ls/m-option2
-rwxr-xr-xtests/ls/no-arg4
-rwxr-xr-xtests/ls/recursive4
-rwxr-xr-xtests/ls/rt-14
-rwxr-xr-xtests/ls/stat-dtype4
-rwxr-xr-xtests/ls/stat-failed4
-rwxr-xr-xtests/ls/stat-free-symlinks2
-rwxr-xr-xtests/ls/x-option2
17 files changed, 28 insertions, 28 deletions
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 <<EOF > 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