summaryrefslogtreecommitdiff
path: root/tests/cp
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-10-30 10:50:21 +0100
committerJim Meyering <meyering@redhat.com>2009-10-30 12:50:12 +0100
commit3c88587b2eadee11413f4207abbbf13af07c438d (patch)
tree79d45c03b5c6ba2520eeeb236170dbafef49fac7 /tests/cp
parent12a0a583f6fe3303bd9dfb30de4a5fe46e8e486f (diff)
downloadcoreutils-3c88587b2eadee11413f4207abbbf13af07c438d.tar.xz
tests: factor 350 fail=0 initializations into test-lib.sh
Run this command to remove the factored-out "fail=0" lines. perl -ni -e '/^fail=0$/ or print' $(g grep -l '^fail=0$') * tests/test-lib.sh: Initialize fail=0 here, not in 300+ scripts. * tests/...: nearly all bourne shell scripts Suggested by Eric Blake.
Diffstat (limited to 'tests/cp')
-rwxr-xr-xtests/cp/abuse1
-rwxr-xr-xtests/cp/acl1
-rwxr-xr-xtests/cp/backup-11
-rwxr-xr-xtests/cp/backup-dir1
-rwxr-xr-xtests/cp/backup-is-src1
-rwxr-xr-xtests/cp/cp-HL1
-rwxr-xr-xtests/cp/cp-a-selinux1
-rwxr-xr-xtests/cp/cp-deref1
-rwxr-xr-xtests/cp/cp-i1
-rwxr-xr-xtests/cp/cp-mv-backup1
-rwxr-xr-xtests/cp/cp-mv-enotsup-xattr1
-rwxr-xr-xtests/cp/cp-parents1
-rwxr-xr-xtests/cp/deref-slink1
-rwxr-xr-xtests/cp/dir-rm-dest1
-rwxr-xr-xtests/cp/dir-slash1
-rwxr-xr-xtests/cp/dir-vs-file1
-rwxr-xr-xtests/cp/existing-perm-race1
-rwxr-xr-xtests/cp/fail-perm1
-rwxr-xr-xtests/cp/into-self1
-rwxr-xr-xtests/cp/link1
-rwxr-xr-xtests/cp/link-heap1
-rwxr-xr-xtests/cp/link-no-deref1
-rwxr-xr-xtests/cp/link-preserve1
-rwxr-xr-xtests/cp/no-deref-link11
-rwxr-xr-xtests/cp/no-deref-link21
-rwxr-xr-xtests/cp/no-deref-link31
-rwxr-xr-xtests/cp/parent-perm1
-rwxr-xr-xtests/cp/parent-perm-race1
-rwxr-xr-xtests/cp/perm1
-rwxr-xr-xtests/cp/preserve-21
-rwxr-xr-xtests/cp/preserve-gid1
-rwxr-xr-xtests/cp/preserve-slink-time1
-rwxr-xr-xtests/cp/proc-short-read1
-rwxr-xr-xtests/cp/proc-zero-len1
-rwxr-xr-xtests/cp/r-vs-symlink1
-rwxr-xr-xtests/cp/reflink-auto1
-rwxr-xr-xtests/cp/reflink-perm1
-rwxr-xr-xtests/cp/same-file1
-rwxr-xr-xtests/cp/slink-2-slink1
-rwxr-xr-xtests/cp/sparse1
-rwxr-xr-xtests/cp/special-bits1
-rwxr-xr-xtests/cp/special-f1
-rwxr-xr-xtests/cp/src-base-dot1
-rwxr-xr-xtests/cp/symlink-slash1
-rwxr-xr-xtests/cp/thru-dangling1
45 files changed, 0 insertions, 45 deletions
diff --git a/tests/cp/abuse b/tests/cp/abuse
index e9086b8f5..42f669205 100755
--- a/tests/cp/abuse
+++ b/tests/cp/abuse
@@ -32,7 +32,6 @@ echo "cp: will not copy \`b/1' through just-created symlink \`c/1'" \
# Check both cases: a dangling symlink, and one pointing to a writable file.
-fail=0
for i in dangling-dest existing-dest; do
test $i = existing-dest && echo i > t
test $i = dangling-dest && rm -f t
diff --git a/tests/cp/acl b/tests/cp/acl
index 059a1e10c..2f8742880 100755
--- a/tests/cp/acl
+++ b/tests/cp/acl
@@ -45,7 +45,6 @@ acl1=`cd a && getfacl file | grep -v ':bin:' | grep -v 'mask::'` \
test $skip = yes &&
skip_test_ "'.' is not on a suitable file system for this test"
-fail=0
# copy a file without preserving permissions
cp a/file b/ || fail=1
diff --git a/tests/cp/backup-1 b/tests/cp/backup-1
index cc19f938c..73745956b 100755
--- a/tests/cp/backup-1
+++ b/tests/cp/backup-1
@@ -29,7 +29,6 @@ file_backup="$file$suffix"
temp_files="$file $file_backup"
rm -f $temp_files
-fail=0
echo test > $file || fail=1
# Specify both version control and suffix so the environment variables
diff --git a/tests/cp/backup-dir b/tests/cp/backup-dir
index 9f0d0d719..a82d213e2 100755
--- a/tests/cp/backup-dir
+++ b/tests/cp/backup-dir
@@ -25,7 +25,6 @@ fi
mkdir x y || framework_failure
-fail=0
cp -a x y || fail=1
diff --git a/tests/cp/backup-is-src b/tests/cp/backup-is-src
index f226382d0..bf03e590a 100755
--- a/tests/cp/backup-is-src
+++ b/tests/cp/backup-is-src
@@ -26,7 +26,6 @@ fi
echo a > a || framework_failure
echo a-tilde > a~ || framework_failure
-fail=0
# This cp command should exit nonzero.
cp --b=simple a~ a > out 2>&1 && fail=1
diff --git a/tests/cp/cp-HL b/tests/cp/cp-HL
index 17fff79b9..88f10e9cd 100755
--- a/tests/cp/cp-HL
+++ b/tests/cp/cp-HL
@@ -28,7 +28,6 @@ echo f > f || framework_failure
ln -s f slink || framework_failure
ln -s no-such-file src-dir/slink || framework_failure
-fail=0
cp -H -R slink src-dir dest-dir || fail=1
test -d src-dir || fail=1
diff --git a/tests/cp/cp-a-selinux b/tests/cp/cp-a-selinux
index b1359c098..82bf4ae30 100755
--- a/tests/cp/cp-a-selinux
+++ b/tests/cp/cp-a-selinux
@@ -59,7 +59,6 @@ cd mnt || framework_failure
echo > f || framework_failure
echo > g || framework_failure
-fail=0
# /bin/cp from coreutils-6.7-3.fc7 would fail this test by letting cp
# succeed (giving no diagnostics), yet leaving the destination file empty.
diff --git a/tests/cp/cp-deref b/tests/cp/cp-deref
index 5868fa207..3e3dab422 100755
--- a/tests/cp/cp-deref
+++ b/tests/cp/cp-deref
@@ -28,7 +28,6 @@ mkdir a b c d || framework_failure
ln -s ../c a || framework_failure
ln -s ../c b || framework_failure
-fail=0
# Before coreutils-5.94, the following would fail with this message:
# cp: will not create hard link `d/b/c' to directory `d/a/c'
diff --git a/tests/cp/cp-i b/tests/cp/cp-i
index 67f8a5652..59f60dd4c 100755
--- a/tests/cp/cp-i
+++ b/tests/cp/cp-i
@@ -26,7 +26,6 @@ fi
mkdir -p a b/a/c || framework_failure
touch a/c || framework_failure
-fail=0
# coreutils 6.2 cp would neglect to prompt in this case.
echo n | cp -iR a b 2>/dev/null || fail=1
diff --git a/tests/cp/cp-mv-backup b/tests/cp/cp-mv-backup
index 59d03a3ef..c43734ef1 100755
--- a/tests/cp/cp-mv-backup
+++ b/tests/cp/cp-mv-backup
@@ -36,7 +36,6 @@ expected=expected
exec 1> $actual
-fail=0
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
diff --git a/tests/cp/cp-mv-enotsup-xattr b/tests/cp/cp-mv-enotsup-xattr
index 8f3020bec..620560b26 100755
--- a/tests/cp/cp-mv-enotsup-xattr
+++ b/tests/cp/cp-mv-enotsup-xattr
@@ -59,7 +59,6 @@ getfattr -d a >out_a || skip_test_ "failed to get xattr of file"
grep -F "$xattr_pair" out_a >/dev/null \
|| skip_test_ "failed to set xattr of file"
-fail=0
# This should pass without diagnostics
cp -a a mnt/ 2>err || fail=1
diff --git a/tests/cp/cp-parents b/tests/cp/cp-parents
index da04c451f..1ba585fe0 100755
--- a/tests/cp/cp-parents
+++ b/tests/cp/cp-parents
@@ -34,7 +34,6 @@ mkdir -p a/b/c d e g || framework_failure
ln -s d/a sym || framework_failure
touch f || framework_failure
-fail=0
# With 4.0.37 and earlier (back to when?), this would fail
# with the failed assertion from dirname.c.
diff --git a/tests/cp/deref-slink b/tests/cp/deref-slink
index d37cb1152..0a8872d89 100755
--- a/tests/cp/deref-slink
+++ b/tests/cp/deref-slink
@@ -27,7 +27,6 @@ fi
touch f slink-target || framework_failure
ln -s slink-target slink || framework_failure
-fail=0
cp -d f slink || fail=1
Exit $fail
diff --git a/tests/cp/dir-rm-dest b/tests/cp/dir-rm-dest
index c5429d72c..aecc41bad 100755
--- a/tests/cp/dir-rm-dest
+++ b/tests/cp/dir-rm-dest
@@ -25,7 +25,6 @@ fi
mkdir d e || framework_failure
-fail=0
# Do it once with no destination...
cp -R --remove-destination d e || fail=1
diff --git a/tests/cp/dir-slash b/tests/cp/dir-slash
index 0c1e282a9..df41c1783 100755
--- a/tests/cp/dir-slash
+++ b/tests/cp/dir-slash
@@ -27,7 +27,6 @@ fi
mkdir dir1 dir2 || framework_failure
touch dir1/file || framework_failure
-fail=0
cp -R dir1/ dir2 || fail=1
# This file should not exist, but it did with fileutils-4.0w.
diff --git a/tests/cp/dir-vs-file b/tests/cp/dir-vs-file
index 7e5e9d001..341536aa9 100755
--- a/tests/cp/dir-vs-file
+++ b/tests/cp/dir-vs-file
@@ -26,7 +26,6 @@ fi
mkdir dir || framework_failure
touch file || framework_failure
-fail=0
# In 4.0.35, this cp invocation silently succeeded.
cp -R dir file 2>/dev/null && fail=1
diff --git a/tests/cp/existing-perm-race b/tests/cp/existing-perm-race
index e7166a717..0299e1e9c 100755
--- a/tests/cp/existing-perm-race
+++ b/tests/cp/existing-perm-race
@@ -28,7 +28,6 @@ set _ $groups; shift
g1=$1
g2=$2
-fail=0
umask 077
mkfifo fifo ||
diff --git a/tests/cp/fail-perm b/tests/cp/fail-perm
index f47066504..0a4b25323 100755
--- a/tests/cp/fail-perm
+++ b/tests/cp/fail-perm
@@ -29,7 +29,6 @@ touch D/a || framework_failure
chmod 0 D/a || framework_failure
chmod u=rx,go=,-st D || framework_failure
-fail=0
# This is expected to exit non-zero, because it can't read D/a.
cp -pR D DD > /dev/null 2>&1 && fail=1
diff --git a/tests/cp/into-self b/tests/cp/into-self
index cd8723236..84a0096f8 100755
--- a/tests/cp/into-self
+++ b/tests/cp/into-self
@@ -30,7 +30,6 @@ fi
mkdir a dir || framework_failure
-fail=0
# This command should exit nonzero.
cp -R dir dir 2> out && fail=1
diff --git a/tests/cp/link b/tests/cp/link
index d9cf4f827..416e64ea8 100755
--- a/tests/cp/link
+++ b/tests/cp/link
@@ -28,7 +28,6 @@ touch src || framework_failure
touch dest || framework_failure
touch dest2 || framework_failure
-fail=0
cp -f --link src dest || fail=1
cp -f --symbolic-link src dest2 || fail=1
diff --git a/tests/cp/link-heap b/tests/cp/link-heap
index d9379b52e..c0f36bf86 100755
--- a/tests/cp/link-heap
+++ b/tests/cp/link-heap
@@ -35,7 +35,6 @@ cp -al $a $b || framework_failure
mkdir e || framework_failure
mv $a $b e || framework_failure
-fail=0
(ulimit -v 20000; cp -al e f) || fail=1
Exit $fail
diff --git a/tests/cp/link-no-deref b/tests/cp/link-no-deref
index d71a114e1..aa570671b 100755
--- a/tests/cp/link-no-deref
+++ b/tests/cp/link-no-deref
@@ -25,7 +25,6 @@ fi
ln -s no-such-file dangling-slink || framework_failure
-fail=0
# Prior to coreutils-6.0, this would fail on non-Linux kernels,
# with link being applied to the dangling symlink.
diff --git a/tests/cp/link-preserve b/tests/cp/link-preserve
index fcaef2d8e..b07a9d9b2 100755
--- a/tests/cp/link-preserve
+++ b/tests/cp/link-preserve
@@ -31,7 +31,6 @@ cp -d a b c || framework_failure
test -f c/a || framework_failure
test -f c/b || framework_failure
-fail=0
a_inode=`ls -i c/a|sed 's,c/.*,,'`
b_inode=`ls -i c/b|sed 's,c/.*,,'`
diff --git a/tests/cp/no-deref-link1 b/tests/cp/no-deref-link1
index 86164ecc0..a362471ba 100755
--- a/tests/cp/no-deref-link1
+++ b/tests/cp/no-deref-link1
@@ -30,7 +30,6 @@ cd b
ln -s ../a/foo .
cd ..
-fail=0
# It should fail with a message something like this:
# ./cp: `a/foo' and `b/foo' are the same file
diff --git a/tests/cp/no-deref-link2 b/tests/cp/no-deref-link2
index f323d6bd1..1f70bec13 100755
--- a/tests/cp/no-deref-link2
+++ b/tests/cp/no-deref-link2
@@ -30,7 +30,6 @@ cd b
ln -s ../a .
cd ..
-fail=0
# It should fail with a message something like this:
# cp: `a' and `b/foo' are the same file
diff --git a/tests/cp/no-deref-link3 b/tests/cp/no-deref-link3
index 353e3ce05..c1af5448e 100755
--- a/tests/cp/no-deref-link3
+++ b/tests/cp/no-deref-link3
@@ -27,7 +27,6 @@ msg=bar
echo $msg > a
ln -s a b
-fail=0
# It should fail with a message something like this:
# cp: `a' and `b' are the same file
diff --git a/tests/cp/parent-perm b/tests/cp/parent-perm
index fe1304105..5da5ea7c6 100755
--- a/tests/cp/parent-perm
+++ b/tests/cp/parent-perm
@@ -34,7 +34,6 @@ cp -p --parent a/b/c/foo e || framework_failure
# to a destination directory that it doesn't create.
chmod g-rx e/a e/a/b || framework_failure
-fail=0
cp -p --parent a/b/d/foo e || fail=1
# Ensure that permissions on just-created directory, e/a/,
diff --git a/tests/cp/parent-perm-race b/tests/cp/parent-perm-race
index 186e7b2fb..674824bbe 100755
--- a/tests/cp/parent-perm-race
+++ b/tests/cp/parent-perm-race
@@ -27,7 +27,6 @@ umask 002
mkdir mode ownership d || framework_failure
chmod g+s d 2>/dev/null # The cp test is valid either way.
-fail=0
for attr in mode ownership
do
diff --git a/tests/cp/perm b/tests/cp/perm
index 7cc6f419e..0f1572587 100755
--- a/tests/cp/perm
+++ b/tests/cp/perm
@@ -27,7 +27,6 @@ very_expensive_
umask 037
-fail=0
# Now, try it with `mv', with combinations of --force, no-f and
# existing-destination and not.
diff --git a/tests/cp/preserve-2 b/tests/cp/preserve-2
index f2739a3e6..9549fd176 100755
--- a/tests/cp/preserve-2
+++ b/tests/cp/preserve-2
@@ -25,7 +25,6 @@ fi
touch f || framework_failure
-fail=0
cp --preserve=mode,links f g || fail=1
diff --git a/tests/cp/preserve-gid b/tests/cp/preserve-gid
index 1f3f10b88..5b932af60 100755
--- a/tests/cp/preserve-gid
+++ b/tests/cp/preserve-gid
@@ -102,5 +102,4 @@ t1 b1 "$nameless_uid" "$nameless_gid2" cp -p
t1 c0 "$nameless_uid" "$nameless_gid1" cp -p
t1 c1 "$nameless_uid" "$nameless_gid2" cp -p
-fail=0
Exit $fail
diff --git a/tests/cp/preserve-slink-time b/tests/cp/preserve-slink-time
index 407b77272..f9afc8618 100755
--- a/tests/cp/preserve-slink-time
+++ b/tests/cp/preserve-slink-time
@@ -40,7 +40,6 @@ cp -Pp dangle d2 || framework_failure
stat --format=%y dangle > t1 || framework_failure
stat --format=%y d2 > t2 || framework_failure
-fail=0
compare t1 t2 || fail=1
Exit $fail
diff --git a/tests/cp/proc-short-read b/tests/cp/proc-short-read
index e06143c9f..93e21bdc1 100755
--- a/tests/cp/proc-short-read
+++ b/tests/cp/proc-short-read
@@ -23,7 +23,6 @@ fi
. $srcdir/test-lib.sh
-fail=0
kall=/proc/kallsyms
test -r $kall || skip_test_ "your system lacks $kall"
diff --git a/tests/cp/proc-zero-len b/tests/cp/proc-zero-len
index 9103d8a0a..f71db612a 100755
--- a/tests/cp/proc-zero-len
+++ b/tests/cp/proc-zero-len
@@ -28,7 +28,6 @@ touch empty || framework_failure
f=/proc/cpuinfo
test -r $f || f=empty
-fail=0
cat $f > out || fail=1
# With coreutils-6.9, this would create a zero-length "exp" file.
diff --git a/tests/cp/r-vs-symlink b/tests/cp/r-vs-symlink
index 4b4e63586..b88dc1e15 100755
--- a/tests/cp/r-vs-symlink
+++ b/tests/cp/r-vs-symlink
@@ -31,7 +31,6 @@ echo abc > foo || framework_failure
ln -s foo slink || framework_failure
ln -s no-such-file no-file || framework_failure
-fail=0
# This would fail in 4.1.5, not in 4.1.6.
cp -r no-file junk 2>/dev/null || fail=1
diff --git a/tests/cp/reflink-auto b/tests/cp/reflink-auto
index 5e39b7265..949acb48c 100755
--- a/tests/cp/reflink-auto
+++ b/tests/cp/reflink-auto
@@ -30,7 +30,6 @@ rm -f "$a_other" || framework_failure
echo non_zero_size > "$a_other" || framework_failure
-fail=0
# we shouldn't be able to reflink() files on separate partitions
cp --reflink "$a_other" b && fail=1
diff --git a/tests/cp/reflink-perm b/tests/cp/reflink-perm
index 0c752467c..7e4c9073e 100755
--- a/tests/cp/reflink-perm
+++ b/tests/cp/reflink-perm
@@ -23,7 +23,6 @@ fi
. $srcdir/test-lib.sh
-fail=0
: > time_check
: > file
diff --git a/tests/cp/same-file b/tests/cp/same-file
index d5deb6857..79b599ab2 100755
--- a/tests/cp/same-file
+++ b/tests/cp/same-file
@@ -220,7 +220,6 @@ cat <<\EOF | sed "$remove_these_sed" > $expected
EOF
-fail=0
compare $expected $actual 1>&2 || fail=1
diff --git a/tests/cp/slink-2-slink b/tests/cp/slink-2-slink
index ed755bc13..1225af2c5 100755
--- a/tests/cp/slink-2-slink
+++ b/tests/cp/slink-2-slink
@@ -30,7 +30,6 @@ ln -s file b || framework_failure
ln -s no-such-file c || framework_failure
ln -s no-such-file d || framework_failure
-fail=0
cp --update --no-dereference a b || fail=1
cp --update --no-dereference c d || fail=1
diff --git a/tests/cp/sparse b/tests/cp/sparse
index 9683a9e33..cb1734bf2 100755
--- a/tests/cp/sparse
+++ b/tests/cp/sparse
@@ -31,7 +31,6 @@ require_sparse_support_
size=`expr 128 \* 1024 + 1`
dd bs=1 seek=$size of=sparse < /dev/null 2> /dev/null || framework_failure
-fail=0
cp --sparse=always sparse copy || fail=1
diff --git a/tests/cp/special-bits b/tests/cp/special-bits
index eaacd1475..d7829f346 100755
--- a/tests/cp/special-bits
+++ b/tests/cp/special-bits
@@ -35,7 +35,6 @@ chmod a=r,ug+sx c || framework_failure
chown $NON_ROOT_USERNAME . || framework_failure
chmod u=rwx,g=rx,o=rx . || framework_failure
-fail=0
cp -p a a2 || fail=1
set _ `ls -l a`; shift; p1=$1
diff --git a/tests/cp/special-f b/tests/cp/special-f
index c2641dbbe..65816a13c 100755
--- a/tests/cp/special-f
+++ b/tests/cp/special-f
@@ -28,7 +28,6 @@ mkfifo fifo ||
skip_test_ "fifos not supported"
touch e || framework-failure
-fail=0
# Without -f, expect it to fail.
cp -R fifo e || fail=1
diff --git a/tests/cp/src-base-dot b/tests/cp/src-base-dot
index 1b0ee7ada..6ed9c26be 100755
--- a/tests/cp/src-base-dot
+++ b/tests/cp/src-base-dot
@@ -25,7 +25,6 @@ fi
mkdir x y || framework_failure
-fail=0
cd y
cp --verbose -ab ../x/. . > out 2>&1 || fail=1
diff --git a/tests/cp/symlink-slash b/tests/cp/symlink-slash
index a821e7ec0..1e4e94c3d 100755
--- a/tests/cp/symlink-slash
+++ b/tests/cp/symlink-slash
@@ -27,7 +27,6 @@ fi
mkdir dir || framework_failure
ln -s dir symlink || framework_failure
-fail=0
cp -dR symlink/ s || fail=1
set `ls -l s`
diff --git a/tests/cp/thru-dangling b/tests/cp/thru-dangling
index b2a5d7449..633183984 100755
--- a/tests/cp/thru-dangling
+++ b/tests/cp/thru-dangling
@@ -29,7 +29,6 @@ echo hi > exp || framework_failure
echo "cp: not writing through dangling symlink \`dangle'" \
> exp-err || framework_failure
-fail=0
# Starting with 6.9.90, this usage fails, by default:
cp f dangle > err 2>&1 && fail=1