summaryrefslogtreecommitdiff
path: root/tests/split
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/split
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/split')
-rwxr-xr-xtests/split/b-chunk12
-rwxr-xr-xtests/split/fail2
-rwxr-xr-xtests/split/l-chunk14
-rwxr-xr-xtests/split/lines6
-rwxr-xr-xtests/split/r-chunk14
-rwxr-xr-xtests/split/suffix-length4
6 files changed, 26 insertions, 26 deletions
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