summaryrefslogtreecommitdiff
path: root/tests/cp
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-08-22 18:56:06 +0200
committerJim Meyering <meyering@redhat.com>2009-08-25 09:21:00 +0200
commit5e778f7c8d1ecf3d8f11385db013af2ba026e2a5 (patch)
treee460d471f37f0dce1ba06f60f88114d1a65326c4 /tests/cp
parent2bc0f3caaafeb240cdcfd050b7ad1fe0ad14addf (diff)
downloadcoreutils-5e778f7c8d1ecf3d8f11385db013af2ba026e2a5.tar.xz
global: convert indentation-TABs to spaces
Transformed via this shell code: t=$'\t' git ls-files \ | grep -vE '(^|/)((GNU)?[Mm]akefile|ChangeLog)|\.(am|mk)$' \ | grep -vE 'tests/pr/|help2man' \ | xargs grep -lE "^ *$t" \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
Diffstat (limited to 'tests/cp')
-rwxr-xr-xtests/cp/cp-mv-backup2
-rwxr-xr-xtests/cp/perm64
-rwxr-xr-xtests/cp/same-file80
3 files changed, 73 insertions, 73 deletions
diff --git a/tests/cp/cp-mv-backup b/tests/cp/cp-mv-backup
index d179d6617..59d03a3ef 100755
--- a/tests/cp/cp-mv-backup
+++ b/tests/cp/cp-mv-backup
@@ -41,7 +41,7 @@ for prog in cp mv; do
for initial_files in 'x' 'x y' 'x y y~' 'x y y.~1~' 'x y y~ y.~1~'; do
for opt in none off numbered t existing nil simple never; do
touch $initial_files
- $prog --backup=$opt x y || fail=1
+ $prog --backup=$opt x y || fail=1
echo $initial_files $opt: `ls [xy]*`; rm -f x y y~ y.~?~
done
done
diff --git a/tests/cp/perm b/tests/cp/perm
index 11c4b3ba1..7cc6f419e 100755
--- a/tests/cp/perm
+++ b/tests/cp/perm
@@ -37,39 +37,39 @@ for u in 31 37 2; do
for cmd in mv 'cp -p' cp; do
for force in '' -f; do
for existing_dest in yes no; do
- for g_perm in r w x rw wx xr rwx; do
- for o_perm in r w x rw wx xr rwx; do
- touch src || exit 1
- chmod u=r,g=rx,o= src || exit 1
- expected_perms=$(stat --format=%A src)
- rm -f dest
- test $existing_dest = yes && {
- touch dest || exit 1
- chmod u=rw,g=$g_perm,o=$o_perm dest || exit 1
- }
- $cmd $force src dest || exit 1
- test "$cmd" = mv && test -f src && exit 1
- test "$cmd" = cp && { test -f src || exit 1; }
- actual_perms=$(stat --format=%A dest)
+ for g_perm in r w x rw wx xr rwx; do
+ for o_perm in r w x rw wx xr rwx; do
+ touch src || exit 1
+ chmod u=r,g=rx,o= src || exit 1
+ expected_perms=$(stat --format=%A src)
+ rm -f dest
+ test $existing_dest = yes && {
+ touch dest || exit 1
+ chmod u=rw,g=$g_perm,o=$o_perm dest || exit 1
+ }
+ $cmd $force src dest || exit 1
+ test "$cmd" = mv && test -f src && exit 1
+ test "$cmd" = cp && { test -f src || exit 1; }
+ actual_perms=$(stat --format=%A dest)
- case "$cmd:$force:$existing_dest" in
- cp:*:yes)
- _g_perm=`echo rwx|sed 's/[^'$g_perm']/-/g'`
- _o_perm=`echo rwx|sed 's/[^'$o_perm']/-/g'`
- expected_perms=-rw-$_g_perm$_o_perm
- ;;
- cp:*:no)
- test $u = 37 &&
- expected_perms=`echo $expected_perms|sed 's/.....$/-----/'`
- test $u = 31 &&
- expected_perms=`echo $expected_perms|sed 's/..\(..\).$/--\1-/'`
- ;;
- esac
- test _$actual_perms = _$expected_perms || exit 1
- # Perform only one iteration when there's no existing destination.
- test $existing_dest = no && break 3
- done
- done
+ case "$cmd:$force:$existing_dest" in
+ cp:*:yes)
+ _g_perm=`echo rwx|sed 's/[^'$g_perm']/-/g'`
+ _o_perm=`echo rwx|sed 's/[^'$o_perm']/-/g'`
+ expected_perms=-rw-$_g_perm$_o_perm
+ ;;
+ cp:*:no)
+ test $u = 37 &&
+ expected_perms=`echo $expected_perms|sed 's/.....$/-----/'`
+ test $u = 31 &&
+ expected_perms=`echo $expected_perms|sed 's/..\(..\).$/--\1-/'`
+ ;;
+ esac
+ test _$actual_perms = _$expected_perms || exit 1
+ # Perform only one iteration when there's no existing destination.
+ test $existing_dest = no && break 3
+ done
+ done
done
done
done
diff --git a/tests/cp/same-file b/tests/cp/same-file
index 1556011aa..6d57ebd6a 100755
--- a/tests/cp/same-file
+++ b/tests/cp/same-file
@@ -53,7 +53,7 @@ contents=XYZ
for args in 'foo symlink' 'symlink foo' 'foo foo' 'sl1 sl2' 'foo hardlink'; do
for options in '' -d -f -df --rem -b -bd -bf -bdf \
- -l -dl -fl -dfl -bl -bdl -bfl -bdfl; do
+ -l -dl -fl -dfl -bl -bdl -bfl -bdfl; do
case $args$options in
# These tests are not portable.
# They all involve making a hard link to a symbolic link.
@@ -61,28 +61,28 @@ for args in 'foo symlink' 'symlink foo' 'foo foo' 'sl1 sl2' 'foo hardlink'; do
# by doing "continue" here and eliminating the corresponding
# expected output lines below. Don't do that anymore.
'symlink foo'-dfl)
- continue;;
+ continue;;
'symlink foo'-bdl)
- continue;;
+ continue;;
'symlink foo'-bdfl)
- continue;;
+ continue;;
'sl1 sl2'-dfl)
- continue;;
+ continue;;
'sl1 sl2'-bd*l)
- continue;;
+ continue;;
'sl1 sl2'-dl)
- continue;;
+ continue;;
esac
# cont'd Instead, skip them only on systems for which link does
# dereference a symlink. Detect and skip such tests here.
case $hard_link_to_symlink_does_the_deref:$args:$options in
'yes:sl1 sl2:-fl')
- continue ;;
+ continue ;;
'yes:sl1 sl2:-bl')
- continue ;;
+ continue ;;
'yes:sl1 sl2:-bfl')
- continue ;;
+ continue ;;
esac
rm -rf dir
@@ -95,37 +95,37 @@ for args in 'foo symlink' 'symlink foo' 'foo foo' 'sl1 sl2' 'foo hardlink'; do
case "$args" in *sl2*) ln -s foo sl2;; esac
(
(
- # echo 1>&2 cp $options $args
- cp $options $args 2>_err
- echo $? $options
-
- # Normalize the program name and diagnostics in the error output,
- # and put brackets around the output.
- if test -s _err; then
- sed '
- s/^[^:]*:\([^:]*\).*/cp:\1/
- 1s/^/[/
- $s/$/]/
- ' _err
+ # echo 1>&2 cp $options $args
+ cp $options $args 2>_err
+ echo $? $options
+
+ # Normalize the program name and diagnostics in the error output,
+ # and put brackets around the output.
+ if test -s _err; then
+ sed '
+ s/^[^:]*:\([^:]*\).*/cp:\1/
+ 1s/^/[/
+ $s/$/]/
+ ' _err
fi
- # Strip off all but the file names.
- ls=`ls -gG --ignore=_err . \
- | sed \
- -e '/^total /d' \
- -e 's/^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *//'`
- echo "($ls)"
- # Make sure the original is unchanged and that
- # the destination is a copy.
- for f in $args; do
- if test -f $f; then
- case "`cat $f`" in
- "$contents") ;;
- *) echo cp FAILED;;
- esac
- else
- echo symlink-loop
- fi
- done
+ # Strip off all but the file names.
+ ls=`ls -gG --ignore=_err . \
+ | sed \
+ -e '/^total /d' \
+ -e 's/^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *//'`
+ echo "($ls)"
+ # Make sure the original is unchanged and that
+ # the destination is a copy.
+ for f in $args; do
+ if test -f $f; then
+ case "`cat $f`" in
+ "$contents") ;;
+ *) echo cp FAILED;;
+ esac
+ else
+ echo symlink-loop
+ fi
+ done
) | tr '\n' ' '
echo
) | sed 's/ *$//'