summaryrefslogtreecommitdiff
path: root/tests/mv
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2010-12-28 12:28:48 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2010-12-28 12:30:42 -0800
commitb0097f3d2180352896a4434fb8eaeb076f12794c (patch)
treeeb605f5d69d8c346278db1ccbec82d1a594403e1 /tests/mv
parent01211e9af728a5123b9cced19b7dfdc02b019f5b (diff)
downloadcoreutils-b0097f3d2180352896a4434fb8eaeb076f12794c.tar.xz
coreutils: keep lines within 80-column limits
* cfg.mk (LINE_LEN_MAX, FILTER_LONG_LINES): New macros. (sc_long_lines): New rule. * HACKING: Use shorter URLs to the same material. * doc/Makefile.am, doc/coreutils.texi, m4/boottime.m4: * man/help2man, man/stdbuf.x, src/Makefile.am, src/cat.c, src/copy.c: * src/cp.c, src/dd.c, src/df.c, src/du.c, src/groups.c, src/install.c: * src/ls.c, src/md5sum.c, src/mv.c, src/od.c, src/pinky.c, src/ptx.c: * src/readlink.c, src/remove.c, src/rmdir.c, src/setuidgid.c: * src/sort.c, src/tail.c, src/touch.c, tests/Coreutils.pm: * tests/cp/existing-perm-race, tests/cp/perm, tests/cp/preserve-gid: * tests/du/2g, tests/du/long-from-unreadable, tests/init.sh: * tests/install/basic-1, tests/ls/nameless-uid: * tests/ls/readdir-mountpoint-inode, tests/misc/chroot-credentials: * tests/misc/cut, tests/misc/date, tests/misc/join, tests/misc/md5sum: * tests/misc/sha1sum, tests/misc/sha224sum, tests/misc/sort: * tests/misc/sort-continue, tests/misc/sort-files0-from: * tests/misc/sort-rand, tests/misc/stdbuf, tests/misc/tr: * tests/misc/uniq, tests/mv/atomic, tests/mv/part-fail: * tests/mv/part-symlink, tests/mv/sticky-to-xpart, tests/pr/pr-tests: * tests/rm/fail-2eperm, tests/rm/interactive-always: Reformat to fit within 80 columns. * doc/Makefile.am (BAD_POSIX_PERL): New macro. * doc/coreutils.texi: Reword slightly, to make menus and index lines shorter. * src/md5sum.c: Redo --help output so that it fits within 79 columns, since that's a bit more portable and all the other --help strings fit in 79 columns.
Diffstat (limited to 'tests/mv')
-rwxr-xr-xtests/mv/atomic6
-rwxr-xr-xtests/mv/part-fail7
-rwxr-xr-xtests/mv/part-symlink164
-rwxr-xr-xtests/mv/sticky-to-xpart5
4 files changed, 123 insertions, 59 deletions
diff --git a/tests/mv/atomic b/tests/mv/atomic
index c75e62bb4..c62491fda 100755
--- a/tests/mv/atomic
+++ b/tests/mv/atomic
@@ -21,11 +21,13 @@ print_ver_ mv
require_strace_ unlink
# Before the fix, mv would unnecessarily unlink the destination symlink:
-# $ rm -rf s[12]; ln -s / s1; ln -s /tmp s2; strace -qe unlink /bin/mv -T s1 s2
+# $ rm -rf s[12]; ln -s / s1; ln -s /tmp s2
+# $ strace -qe unlink /bin/mv -T s1 s2
# unlink("s2") = 0
#
# With the fix, it doesn't call unlink:
-# $ rm -rf s[12]; ln -s / s1; ln -s /tmp s2; strace -qe unlink ./mv -T s1 s2
+# $ rm -rf s[12]; ln -s / s1; ln -s /tmp s2
+# $ strace -qe unlink ./mv -T s1 s2
# $
ln -s t1 s1 || framework_failure
diff --git a/tests/mv/part-fail b/tests/mv/part-fail
index 2d80f599d..a506b92ad 100755
--- a/tests/mv/part-fail
+++ b/tests/mv/part-fail
@@ -30,9 +30,10 @@ chmod u-w "$other_partition_tmpdir" || framework_failure
mv -f k "$other_partition_tmpdir" 2> out && fail=1
-cat <<EOF > exp
-mv: inter-device move failed: \`k' to \`$other_partition_tmpdir/k'; unable to remove target: Permission denied
-EOF
+printf \
+'mv: inter-device move failed: `%s'\'' to `%s'\'';'\
+' unable to remove target: Permission denied\n' \
+ k "$other_partition_tmpdir/k" >exp
# On some (less-compliant) systems, we get EPERM in this case.
# Accept either diagnostic.
diff --git a/tests/mv/part-symlink b/tests/mv/part-symlink
index 425718aff..0d40355cb 100755
--- a/tests/mv/part-symlink
+++ b/tests/mv/part-symlink
@@ -92,9 +92,10 @@ for copy in cp mv; do
# remove any site-dependent part of other-partition file name,
# and put brackets around the output.
test -s .err && {
- echo '[' | tr -d '\n'
- sed 's/^[^:][^:]*\(..\):/\1:/;s,'"$other_partition_tmpdir/,," .err
- echo ']' | tr -d '\n'
+ echo ' [' | tr -d '\n'
+ sed 's/^[^:][^:]*\(..\):/\1:/;s,'"$other_partition_tmpdir/,," .err |
+ tr -d '\n'
+ echo ']'
}
# Strip off all but the file names.
# Remove any site-dependent part of each file name.
@@ -110,16 +111,16 @@ for copy in cp mv; do
-e "s,$other_partition_tmpdir/,," \
-e "s,$pwd_tmp/,," \
-e 's/^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *//'`
- echo "($ls) ($ls2)"
+ echo " ("$ls") ("$ls2")"
# If the command failed, then it must not have changed the files.
if test $copy_status != 0; then
for f in $actual_args; do
test -f $f ||
- { echo "$copy FAILED but removed $f"; continue; }
+ { echo " $copy FAILED but removed $f"; continue; }
case "`cat $f`" in
"$contents") ;;
- *) echo "$copy FAILED but modified $f";;
+ *) echo " $copy FAILED but modified $f";;
esac
done
fi
@@ -134,15 +135,14 @@ for copy in cp mv; do
fi
case "`cat $f`" in
"$contents") ;;
- *) echo $copy FAILED;;
+ *) echo " $copy FAILED";;
esac
else
- echo symlink-loop
+ echo " symlink-loop"
fi
done
fi
- ) | tr '\n' ' '
- echo
+ )
) | sed 's/ *$//'
cd ..
done
@@ -154,49 +154,107 @@ test $fail = 1 &&
{ (exit 1); exit; }
cat <<\EOF > $expected
-1 cp loc_reg rem_sl [cp: `loc_reg' and `rem_sl' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-0 cp --rem loc_reg rem_sl (loc_reg) (rem_sl)
-0 cp --rem -d loc_reg rem_sl (loc_reg) (rem_sl)
-0 cp --rem -b loc_reg rem_sl (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg)
-0 cp -b loc_reg rem_sl (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg)
-0 cp -bd loc_reg rem_sl (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg)
-1 cp -d loc_reg rem_sl [cp: `loc_reg' and `rem_sl' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-
-1 cp rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-1 cp --rem rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-1 cp --rem -d rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-1 cp --rem -b rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-1 cp -b rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-0 cp -bd rem_sl loc_reg (loc_reg -> dir/loc_reg loc_reg~) (rem_sl -> dir/loc_reg) symlink-loop symlink-loop
-1 cp -d rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-
-1 cp loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-1 cp --rem loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-1 cp --rem -d loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-1 cp --rem -b loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-1 cp -b loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-0 cp -bd loc_sl rem_reg (loc_sl -> rem_reg) (rem_reg -> rem_reg rem_reg~) symlink-loop symlink-loop
-1 cp -d loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-
-1 cp rem_reg loc_sl [cp: `rem_reg' and `loc_sl' are the same file ](loc_sl -> rem_reg) (rem_reg)
-0 cp --rem rem_reg loc_sl (loc_sl) (rem_reg)
-0 cp --rem -d rem_reg loc_sl (loc_sl) (rem_reg)
-0 cp --rem -b rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg)
-0 cp -b rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg)
-0 cp -bd rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg)
-1 cp -d rem_reg loc_sl [cp: `rem_reg' and `loc_sl' are the same file ](loc_sl -> rem_reg) (rem_reg)
-
-0 mv loc_reg rem_sl () (rem_sl)
-0 mv -b loc_reg rem_sl () (rem_sl rem_sl~ -> dir/loc_reg)
-
-1 mv rem_sl loc_reg [mv: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg)
-0 mv -b rem_sl loc_reg (loc_reg -> dir/loc_reg loc_reg~) ()
-
-1 mv loc_sl rem_reg [mv: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg)
-0 mv -b loc_sl rem_reg () (rem_reg -> rem_reg rem_reg~)
-
-0 mv rem_reg loc_sl (loc_sl) ()
-0 mv -b rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) ()
+1 cp loc_reg rem_sl
+ [cp: `loc_reg' and `rem_sl' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+0 cp --rem loc_reg rem_sl
+ (loc_reg) (rem_sl)
+0 cp --rem -d loc_reg rem_sl
+ (loc_reg) (rem_sl)
+0 cp --rem -b loc_reg rem_sl
+ (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg)
+0 cp -b loc_reg rem_sl
+ (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg)
+0 cp -bd loc_reg rem_sl
+ (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg)
+1 cp -d loc_reg rem_sl
+ [cp: `loc_reg' and `rem_sl' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+
+1 cp rem_sl loc_reg
+ [cp: `rem_sl' and `loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+1 cp --rem rem_sl loc_reg
+ [cp: `rem_sl' and `loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+1 cp --rem -d rem_sl loc_reg
+ [cp: `rem_sl' and `loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+1 cp --rem -b rem_sl loc_reg
+ [cp: `rem_sl' and `loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+1 cp -b rem_sl loc_reg
+ [cp: `rem_sl' and `loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+0 cp -bd rem_sl loc_reg
+ (loc_reg -> dir/loc_reg loc_reg~) (rem_sl -> dir/loc_reg)
+ symlink-loop
+ symlink-loop
+1 cp -d rem_sl loc_reg
+ [cp: `rem_sl' and `loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+
+1 cp loc_sl rem_reg
+ [cp: `loc_sl' and `rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+1 cp --rem loc_sl rem_reg
+ [cp: `loc_sl' and `rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+1 cp --rem -d loc_sl rem_reg
+ [cp: `loc_sl' and `rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+1 cp --rem -b loc_sl rem_reg
+ [cp: `loc_sl' and `rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+1 cp -b loc_sl rem_reg
+ [cp: `loc_sl' and `rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+0 cp -bd loc_sl rem_reg
+ (loc_sl -> rem_reg) (rem_reg -> rem_reg rem_reg~)
+ symlink-loop
+ symlink-loop
+1 cp -d loc_sl rem_reg
+ [cp: `loc_sl' and `rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+
+1 cp rem_reg loc_sl
+ [cp: `rem_reg' and `loc_sl' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+0 cp --rem rem_reg loc_sl
+ (loc_sl) (rem_reg)
+0 cp --rem -d rem_reg loc_sl
+ (loc_sl) (rem_reg)
+0 cp --rem -b rem_reg loc_sl
+ (loc_sl loc_sl~ -> rem_reg) (rem_reg)
+0 cp -b rem_reg loc_sl
+ (loc_sl loc_sl~ -> rem_reg) (rem_reg)
+0 cp -bd rem_reg loc_sl
+ (loc_sl loc_sl~ -> rem_reg) (rem_reg)
+1 cp -d rem_reg loc_sl
+ [cp: `rem_reg' and `loc_sl' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+
+0 mv loc_reg rem_sl
+ () (rem_sl)
+0 mv -b loc_reg rem_sl
+ () (rem_sl rem_sl~ -> dir/loc_reg)
+
+1 mv rem_sl loc_reg
+ [mv: `rem_sl' and `loc_reg' are the same file]
+ (loc_reg) (rem_sl -> dir/loc_reg)
+0 mv -b rem_sl loc_reg
+ (loc_reg -> dir/loc_reg loc_reg~) ()
+
+1 mv loc_sl rem_reg
+ [mv: `loc_sl' and `rem_reg' are the same file]
+ (loc_sl -> rem_reg) (rem_reg)
+0 mv -b loc_sl rem_reg
+ () (rem_reg -> rem_reg rem_reg~)
+
+0 mv rem_reg loc_sl
+ (loc_sl) ()
+0 mv -b rem_reg loc_sl
+ (loc_sl loc_sl~ -> rem_reg) ()
EOF
diff --git a/tests/mv/sticky-to-xpart b/tests/mv/sticky-to-xpart
index dbb558483..a40f434fa 100755
--- a/tests/mv/sticky-to-xpart
+++ b/tests/mv/sticky-to-xpart
@@ -41,7 +41,10 @@ chmod go+x . || framework_failure
# Ensure that $NON_ROOT_USERNAME can access the required version of mv.
-version=`setuidgid $NON_ROOT_USERNAME env PATH="$PATH" mv --version|sed -n '1s/.* //p'`
+version=`
+ setuidgid $NON_ROOT_USERNAME env PATH="$PATH" mv --version |
+ sed -n '1s/.* //p'
+`
case $version in
$PACKAGE_VERSION) ;;
*) echo "$0: cannot access just-built mv as user $NON_ROOT_USERNAME" 1>&2