summaryrefslogtreecommitdiff
path: root/tests/du
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/du
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/du')
-rwxr-xr-xtests/du/2g2
-rwxr-xr-xtests/du/8gb2
-rwxr-xr-xtests/du/basic4
-rwxr-xr-xtests/du/bigtime2
-rwxr-xr-xtests/du/deref-args2
-rwxr-xr-xtests/du/exclude2
-rwxr-xr-xtests/du/files0-from-dir2
-rwxr-xr-xtests/du/hard-link2
-rwxr-xr-xtests/du/inacc-dest2
-rwxr-xr-xtests/du/inacc-dir4
-rwxr-xr-xtests/du/long-sloop2
-rwxr-xr-xtests/du/max-depth8
-rwxr-xr-xtests/du/move-dir-while-traversing2
-rwxr-xr-xtests/du/no-deref2
-rwxr-xr-xtests/du/no-x2
-rwxr-xr-xtests/du/one-file-system2
-rwxr-xr-xtests/du/slash2
-rwxr-xr-xtests/du/trailing-slash2
18 files changed, 23 insertions, 23 deletions
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 <<EOF > 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