PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" \
CONFIG_HEADER=$(CONFIG_HEADER) \
PROG=mv
+
+include $(top_srcdir)/tests/check.mk
# move files/directories across file system boundaries
# and make sure acls are preserved
-# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2005-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/../acl
-. $srcdir/../other-fs-tmpdir
-# Make sure we get English translations.
-. $srcdir/../lang-default
# Skip this test if cp was built without ACL support:
grep '^#define USE_ACL 0' $CONFIG_HEADER > /dev/null && \
setfacl --version
fi
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-t0="$t0 $other_partition_tmpdir"
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
+. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_top_srcdir/tests/other-fs-tmpdir"
-touch file || framework_failure=1
+touch file || framework_failure
t1=$other_partition_tmpdir/t1
-touch $t1 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- (exit 1); exit 1
-fi
+touch $t1 || framework_failure
skip=no
# Ensure that setfacl and getfacl work on this file system.
# move the access acl of a file
mv file $other_partition_tmpdir || fail=1
-acl2=`cd $other_partition_tmpdir && getfacl file` || framework_failure=1
+acl2=`cd $other_partition_tmpdir && getfacl file` || framework_failure
test "$acl1" = "$acl2" || fail=1
# move the access acl of a directory
-mkdir dir || framework_failure=1
-setfacl -m user:bin:rw dir || framework_failure=1
-acl1=`getfacl dir` || framework_failure=1
+mkdir dir || framework_failure
+setfacl -m user:bin:rw dir || framework_failure
+acl1=`getfacl dir` || framework_failure
mv dir $other_partition_tmpdir || fail=1
-acl2=`cd $other_partition_tmpdir && getfacl dir` || framework_failure=1
+acl2=`cd $other_partition_tmpdir && getfacl dir` || framework_failure
test "$acl1" = "$acl2" || fail=1
# move the default acl of a directory
-mkdir dir2 || framework_failure=1
-setfacl -d -m user:bin:rw dir2 || framework_failure=1
-acl1=`getfacl dir2` || framework_failure=1
+mkdir dir2 || framework_failure
+setfacl -d -m user:bin:rw dir2 || framework_failure
+acl1=`getfacl dir2` || framework_failure
mv dir2 $other_partition_tmpdir || fail=1
-acl2=`cd $other_partition_tmpdir && getfacl dir2` || framework_failure=1
+acl2=`cd $other_partition_tmpdir && getfacl dir2` || framework_failure
test "$acl1" = "$acl2" || fail=1
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- (exit 1); exit 1
-fi
-
exit $fail
fi
. $srcdir/../strace
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
+. $srcdir/../test-lib.sh
# 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 ./mv -T s1 s2
# $
-ln -s t1 s1 || framework_failure=1
-ln -s t2 s2 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+ln -s t1 s1 || framework_failure
+ln -s t2 s2 || framework_failure
fail=0
#!/bin/sh
# Ensure "mv --verbose --backup" works the same for dirs and non-dirs.
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-mkdir A B || framework_failure=1
-touch X Y || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+mkdir A B || framework_failure
+touch X Y || framework_failure
fail=0
`A' -> `B' (backup: `B.~1~')
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
#!/bin/sh
# Force mv to use the copying code.
-# Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1998, 1999, 2000, 2004, 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-
-if test -z "$other_partition_tmpdir"; then
- exit 77
-fi
+. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_top_srcdir/tests/other-fs-tmpdir"
a="$other_partition_tmpdir/a"
a2="$other_partition_tmpdir/a~"
-framework_failure=0
-rm -f $a $a2 || framework_failure=1
-echo a > $a || framework_failure=1
-echo a2 > $a2 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-# Make sure we get English translations.
-. $srcdir/../lang-default
+rm -f $a $a2 || framework_failure
+echo a > $a || framework_failure
+echo a2 > $a2 || framework_failure
# This mv command should exit nonzero.
mv --b=simple $a2 $a > out 2>&1 && fail=1
XXX: backing up `YYY' would destroy source; `ZZZ' not moved
EOF
-cmp out2 exp || fail=1
-
-rm -fr out out2 exp $a $a2 $other_partition_tmpdir
+compare out2 exp || fail=1
exit $fail
ln --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-tmp=childproof.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir a b c || framework_failure=1
-echo a > a/f || framework_failure=1
-echo b > b/f || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework' 1>&2
- (exit 1); exit 1
-fi
+mkdir a b c || framework_failure
+echo a > a/f || framework_failure
+echo b > b/f || framework_failure
fail=0
#!/bin/sh
# make sure we get proper diagnostics: e.g., with --target-dir=d but no args
-# Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Make sure we get English translations.
. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-tmp=diag-$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap 'exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-touch f1 || framework_failure=1
-touch f2 || framework_failure=1
-touch d || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
+touch f1 || framework_failure
+touch f2 || framework_failure
+touch d || framework_failure
# These mv commands should all exit nonzero.
mv: target `f2' is not a directory
EOF
-cmp out exp || fail=1
+compare out exp || fail=1
(exit $fail)
exit $fail
#!/bin/sh
# mv must fail when src and dest are mismatched directory/non-directory.
-# Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-tmp=mv-mismatch-$$
-pwd=`pwd`
-trap 'cd "$pwd" && rm -rf $tmp' 0 1 2 3 15
+. $srcdir/../test-lib.sh
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp
-mkdir -p dir/file || framework_failure=1
-> file || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
+mkdir -p dir/file || framework_failure
+> file || framework_failure
fail=0
# Ensure that mv prints the right diagnostic for a dir->dir move
# where the destination directory is not empty.
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-mkdir -p a/t b/t || framework_failure=1
-touch a/t/f || framework_failure=1
-
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+mkdir -p a/t b/t || framework_failure
+touch a/t/f || framework_failure
fail=0
mv: cannot move `b/t' to `a/t': Directory not empty
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
# made this fail: cp a a d/
# Ensure that mv fails with a similar command.
-# Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-pwd=`pwd`
-tmp=dup-src.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
fail=0
$i: warning: source file \`a' specified more than once
$i: will not overwrite just-created \`d/a' with \`a'
EOF
- cmp out exp || fail=1
- test $fail = 1 && diff out exp 2> /dev/null
+ compare out exp || fail=1
done
for i in mv; do
$i: cannot stat \`a': No such file or directory
$i: cannot stat \`a': No such file or directory
EOF
- cmp out exp || fail=1
- test $fail = 1 && diff out exp 2> /dev/null
+ compare out exp || fail=1
done
(exit $fail); exit $fail
#!/bin/sh
# move a file onto itself
-# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2002, 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
+. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
+
ff=mvforce
ff2=mvforce2
-framework_failure=0
-rm -f $ff $ff2 || framework_failure=1
-echo force-contents > $ff || framework_failure=1
-ln $ff $ff2 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-# Make sure we get English translations.
-. $srcdir/../lang-default
+echo force-contents > $ff || framework_failure
+ln $ff $ff2 || framework_failure
# This mv command should exit nonzero.
mv $ff $ff > out 2>&1 && fail=1
mv: \`$ff' and \`$ff' are the same file
EOF
-cmp out exp || fail=1
+compare out exp || fail=1
test `cat $ff` = force-contents || fail=1
# This should succeed, even though the source and destination
# device and inodes are the same.
mv $ff $ff2 || fail=1
-rm -fr out exp $ff $ff2
-
exit $fail
# Ensure that moving hard-linked arguments onto existing destinations works.
# Likewise when using cp --preserve=link.
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
cp --version
fi
-. $srcdir/../envvar-check
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir dst || framework_failure=1
-(cd dst && touch a b c) || framework_failure=1
-touch a || framework_failure=1
-ln a b || framework_failure=1
-ln a c || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+mkdir dst || framework_failure
+(cd dst && touch a b c) || framework_failure
+touch a || framework_failure
+ln a b || framework_failure
+ln a c || framework_failure
fail=0
# Ensure that using `cp --preserve=link' to copy hard-linked arguments
# onto existing destinations works, even when one of the link operations fails.
-# Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
cp --version
fi
-. $srcdir/../envvar-check
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir -p x dst/x || framework_failure=1
-touch dst/x/b || framework_failure=1
+mkdir -p x dst/x || framework_failure
+touch dst/x/b || framework_failure
chmod a-w dst/x
-touch a || framework_failure=1
-ln a x/b || framework_failure=1
-ln a c || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+touch a || framework_failure
+ln a x/b || framework_failure
+ln a c || framework_failure
fail=0
#!/bin/sh
# ensure that mv removes a in this case: touch a; ln a b; mv a b
-# Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../envvar-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch a || framework_failure=1
-ln a b || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
+touch a || framework_failure
+ln a b || framework_failure
fail=0
# move a directory containing hard-linked files and
# make sure the links are preserved
-# Copyright (C) 1998, 1999, 2000, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1998, 1999, 2000, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../other-fs-tmpdir
-# Make sure we get English translations.
. $srcdir/../lang-default
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
+. $srcdir/../test-lib.sh
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_top_srcdir/tests/other-fs-tmpdir"
dir=hlink
-framework_failure=0
-mkdir $dir || framework_failure=1
-> $dir/a || framework_failure=1
-ln $dir/a $dir/b || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- (exit 1); exit 1
-fi
+mkdir $dir || framework_failure
+> $dir/a || framework_failure
+ln $dir/a $dir/b || framework_failure
mv $dir $other_partition_tmpdir || fail=1
b=`sed -n 's/ b$//p' out`
test "$a" = "$b" || fail=1
-rm -fr out $dir $other_partition_tmpdir
-
exit $fail
#!/bin/sh
# ensure that mv's --verbose options works even in this unusual case
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-touch x || framework_failure=1
-ln x y || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+touch x || framework_failure
+ln x y || framework_failure
fail=0
removed `x'
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
# Test both cp and mv for their behavior with -if and -fi
# The standards (POSIX and SuS) dictate annoyingly inconsistent behavior.
-# Copyright (C) 2000, 2001, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
cp --version
fi
-. $srcdir/../envvar-check
# Make sure we get English translations.
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-pwd=`pwd`
-tmp=cp-mv-if-$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap 'exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
+. $srcdir/../test-lib.sh
for i in a b c d e f g h; do
- echo $i > $i || framework_failure=1
+ echo $i > $i || framework_failure
done
-chmod 0 b d f h || framework_failure=1
-echo y > y || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
+chmod 0 b d f h || framework_failure
+echo y > y || framework_failure
fail=0
mv -if a b || fail=1
test -f e || fail=1
test -f f || fail=1
-cmp e f || fail=1
+compare e f || fail=1
cp -fi g h < y > out 2>&1 || fail=1
test -f g || fail=1
test -f h || fail=1
-cmp g h || fail=1
+compare g h || fail=1
exit $fail
# Make sure that `mv file unwritable-file' prompts the user
# and that `mv -f file unwritable-file' doesn't.
-# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-tmp=mv-i.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch f g h i || framework_failure=1
-chmod 0 g i || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework' 1>&2
- (exit 1); exit 1
-fi
+touch f g h i || framework_failure
+chmod 0 g i || framework_failure
fail=0
#!/bin/sh
# make sure `mv -i a b' does its job with a positive response
-# Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2005-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
-
-pwd=`pwd`
-tmp=mv-i4-$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap 'exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
+. $srcdir/../test-lib.sh
for i in a b; do
- echo $i > $i || framework_failure=1
+ echo $i > $i || framework_failure
done
-echo y > y || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
+echo y > y || framework_failure
fail=0
mv -i a b < y >/dev/null 2>&1 || fail=1
#!/bin/sh
# Make sure `mv -i dir file' prompts before failing.
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-mkdir a || framework_failure=1
-touch b || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
+mkdir a || framework_failure
+touch b || framework_failure
fail=0
#!/bin/sh
# Show that mv doesn't preserve links to files the user has declined to move.
-# Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-tmp=i-link-no.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir a b || framework_failure=1
-echo foo > a/foo || framework_failure=1
-ln a/foo a/bar || framework_failure=1
-echo FUBAR > b/FUBAR || framework_failure=1
-ln b/FUBAR b/bar || framework_failure=1
-chmod a-w b/bar || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+mkdir a b || framework_failure
+echo foo > a/foo || framework_failure
+ln a/foo a/bar || framework_failure
+echo FUBAR > b/FUBAR || framework_failure
+ln b/FUBAR b/bar || framework_failure
+chmod a-w b/bar || framework_failure
fail=0
mv: the --reply option is deprecated; use -i or -f instead
EOF
-cmp err exp_err || fail=1
-test $fail = 1 && diff err exp_err 2> /dev/null
-
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare err exp_err || fail=1
+compare out exp || fail=1
case "`cat b/foo`" in
foo) ;;
#! /bin/sh
# Demonstrate how mv fails when it tries to move a directory into itself.
-# Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1998, 1999, 2000, 2002, 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
+. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
+
dir=toself-dir
file=toself-file
-test_failure=0
-
-rm -rf $dir $file || test_failure=1
-mkdir -p $dir/a/b || test_failure=1
-touch $file || test_failure=1
-
-if test $test_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
+rm -rf $dir $file || framework_failure
+mkdir -p $dir/a/b || framework_failure
+touch $file || framework_failure
fail=0
-# Make sure we get English translations.
-. $srcdir/../lang-default
-
# This mv command should fail.
mv $dir $file $dir > out 2>&1 && fail=1
XXX: cannot move `SRC' to a subdirectory of itself, `DEST'
EOF
-cmp out2 exp || fail=1
+compare out2 exp || fail=1
# Make sure the file is gone.
test -f $file && fail=1
test -d $dir/$dir && fail=1
# Make sure the file has been moved to the right place.
test -f $dir/$file || fail=1
-rm -rf $dir $file out out2 exp
exit $fail
# Consider the case where SRC and DEST are on different
# partitions and DEST is a symlink to SRC.
-# Copyright (C) 1998, 1999, 200 Free Software Foundation, Inc.
+# Copyright (C) 1998, 1999, 200, 007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-
-if test -z "$other_partition_tmpdir"; then
- exit 77
-fi
+. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_top_srcdir/tests/other-fs-tmpdir"
file="$other_partition_tmpdir/file"
symlink=symlink
fail=0
-trap 'rm -fr out out2 exp $file $symlink $other_partition_tmpdir; exit $fail' \
- 0 1 2 3 15
-
-framework_failure=0
-rm -f $file $symlink || framework_failure=1
-echo whatever > $file || framework_failure=1
-ln -s $file $symlink || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-# Make sure we get English translations.
-. $srcdir/../lang-default
+echo whatever > $file || framework_failure
+ln -s $file $symlink || framework_failure
# This mv command should exit nonzero.
mv $symlink $file > out 2>&1 && fail=1
EOF
#'
-cmp out2 exp || fail=1
-test $fail = 1 && diff out2 exp 2> /dev/null
+compare out2 exp || fail=1
exit $fail
#!/bin/sh
# move a directory into itself, with a twist
-# Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
+. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
+
dir1=is3-dir1
dir2=is3-dir2
-framework_failure=0
-rm -rf $dir1 $dir2 || framework_failure=1
-mkdir $dir1 $dir2 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-# Make sure we get English translations.
-. $srcdir/../lang-default
+mkdir $dir1 $dir2 || framework_failure
# This mv command should exit nonzero.
mv $dir1 $dir2 $dir2 > out 2>&1 && fail=1
XXX: cannot move `ZZZ' to a subdirectory of itself, `ZZZ/ZZZ'
EOF
-cmp out2 exp || fail=1
-
-rm -fr out out2 exp $dir1 $dir2
+compare out2 exp || fail=1
exit $fail
# confirm that `mv symlink symlink' doesn't remove symlink
# Based on an example from David Luyer.
-# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-tmp=mv-slink2.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch file || framework_failure=1
-ln -s file s || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework' 1>&2
- (exit 1); exit 1
-fi
+touch file || framework_failure
+ln -s file s || framework_failure
fail=0
# Exercise mv's file-descriptor-leak bug, reported against coreutils-5.2.1
# and fixed (properly) on 2004-10-21.
-# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-# This test is relatively expensive, and might well evoke a
-# framework-failure on systems with a smaller command-line length
# limit so don't run it by default.
-. $srcdir/../expensive
if test "$VERBOSE" = yes; then
set -x
mv --version
fi
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-t0="$t0 $other_partition_tmpdir"
+# This test is relatively expensive, and might well evoke a
+# framework-failure on systems with a smaller command-line length
+. $srcdir/../expensive
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
+PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_top_srcdir/tests/other-fs-tmpdir"
b="0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
echo $i$j
done
done > .dirs
-mkdir `cat .dirs` || framework_failure=1
+mkdir `cat .dirs` || framework_failure
sed 's,$,/f,' .dirs | xargs touch
last_file=`tail -n1 .dirs`/f
-test -f $last_file || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+test -f $last_file || framework_failure
fail=0
test -f $last_file/f && fail=1
rm .dirs
-ls -A > ../out || fail=1
-test -s ../out && fail=1
+out=$(ls -A) || fail=1
+test -z "$out" || fail=1
(exit $fail); exit $fail
#! /bin/sh
# Test "mv" with special files.
-# Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005, 2006 Free Software
+# Copyright (C) 1998, 1999, 2000, 2002, 2004-2007 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
mv --version
fi
-pwd=`pwd`
-tmp=mv-spec.$$
-trap 'status=$?; cd "$pwd" && exec 1>&2; rm -rf $tmp $other_partition_tmpdir && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-# Make sure we get English translations.
. $srcdir/../lang-default
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
+. $srcdir/../test-lib.sh
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_top_srcdir/tests/other-fs-tmpdir"
null=mv-null
dir=mv-dir
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-rm -f $null || framework_failure=1
-mknod $null p || framework_failure=1
-test -p $null || framework_failure=1
-mkdir -p $dir/a/b/c $dir/d/e/f || framework_failure=1
-touch $dir/a/b/c/file1 $dir/d/e/f/file2 || framework_failure=1
+rm -f $null || framework_failure
+mknod $null p || framework_failure
+test -p $null || framework_failure
+mkdir -p $dir/a/b/c $dir/d/e/f || framework_failure
+touch $dir/a/b/c/file1 $dir/d/e/f/file2 || framework_failure
-if test $framework_failure = 1; then
- echo '********************************************'
- echo 'NOTICE: unable to create test prerequisites'
- echo '********************************************'
- # exit 77 here to indicate that we couldn't run the test.
- # At least running on SunOS 4.1.4, using a directory NFS mounted
- # from an OpenBSD system, the above mknod fails.
- (exit 77); exit 77
-fi
+# We used to...
+# exit 77 here to indicate that we couldn't run the test.
+# At least running on SunOS 4.1.4, using a directory NFS mounted
+# from an OpenBSD system, the above mknod fails.
+# It's not worth making an exception any more.
fail=0
mv --verbose $null $dir $other_partition_tmpdir > out || fail=1
\`$dir/d/e/f/file2' -> \`XXX/$dir/d/e/f/file2'
EOF
-cmp out2 exp || fail=1
+compare out2 exp || fail=1
# cd $other_partition_tmpdir
# ls -l -A -R $other_partition_tmpdir
# ensure that --no-target-directory (-T) works when the destination is
# an empty directory.
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
+. $srcdir/../test-lib.sh
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir -p d/sub empty src d2/sub e2 || framework_failure=1
-touch f || framework_failure=1
+mkdir -p d/sub empty src d2/sub e2 || framework_failure
+touch f || framework_failure
# Skip this test if there's an underlying kernel bug.
-mkdir a b b/a || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+mkdir a b b/a || framework_failure
mv a b || {
echo "$0: skipping this test: your kernel's rename syscall is buggy" 1>&2
# Ensure that the dest dir now has a subdirectory.
test -d empty/sub || fail=1
-
# rename must fail, since the dest is non-empty.
mv -fT src d2 2> /dev/null && fail=1
# This is a bit fragile since it relies on the string used
# for EPERM: `permission denied'.
-# Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
+cleanup_() { t=$other_partition_tmpdir; chmod -R 700 "$t"; rm -rf "$t"; }
+. "$abs_top_srcdir/tests/other-fs-tmpdir"
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-t0="$t0 $other_partition_tmpdir"
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch k $other_partition_tmpdir/k || framework_failure=1
-chmod u-w $other_partition_tmpdir || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+touch k $other_partition_tmpdir/k || framework_failure
+chmod u-w $other_partition_tmpdir || framework_failure
fail=0
# For additional constraints, see the comment in copy.c.
# Before coreutils-5.2.1, this test would fail.
-# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2004-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_top_srcdir/tests/other-fs-tmpdir"
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-t0="$t0 $other_partition_tmpdir"
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch f || framework_failure=1
-ln f g || framework_failure=1
-mkdir a b || framework_failure=1
-touch a/1 || framework_failure=1
-ln a/1 b/1 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+touch f || framework_failure
+ln f g || framework_failure
+mkdir a b || framework_failure
+touch a/1 || framework_failure
+ln a/1 b/1 || framework_failure
fail=0
# another, and giving it a different name at the destination would cause mv
# to get a failed assertion.
-# Copyright (C) 2000, 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2002, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_top_srcdir/tests/other-fs-tmpdir"
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-t0="$t0 $other_partition_tmpdir"
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir foo || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+mkdir foo || framework_failure
fail=0
# make sure cp and mv can handle many combinations of local and
# other-partition regular/symlink'd files.
-# Copyright (C) 2000, 2003, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2003, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
cp --version
fi
-pwd=`pwd`
-tmp=part-sl.$$
-trap 'status=$?; cd "$pwd" && exec 1>&2; rm -rf $tmp $other_partition_tmpdir && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-pwd_tmp=$pwd/$tmp
-
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-# Make sure the programs use C-locale formats/translations.
. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_top_srcdir/tests/other-fs-tmpdir"
+
+pwd_tmp=`pwd`
# Unset CDPATH. Otherwise, output from the `cd dir' command
# can make this test fail.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-if test -z "$other_partition_tmpdir"; then
- (exit 77); exit 77
-fi
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
fail=0
# Four cases:
EOF
-# Some folks may don't have diff.
-cmp $expected $actual \
- || { diff -c $expected $actual 1>&2; fail=1; }
+# Redirect to stderr, since stdout is already
+compare $expected $actual || fail=1
(exit $fail); exit $fail
#!/bin/sh
# Make sure permissions are preserved when moving from one partition to another.
-# Copyright (C) 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_top_srcdir/tests/other-fs-tmpdir"
-if test -z "$other_partition_tmpdir"; then
- exit 77
-fi
-
-pwd=`pwd`
-dir=p-perm-$$
-trap 'cd "$pwd" && rm -rf $dir $other_partition_tmpdir' 0 1 2 3 15
-
-mkdir $dir
-
-cd $dir
: > file
chmod a=rwx file
# ensure that mv gives one diagnostic, not two, when failing
# due to lack of permissions
-# Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir -p no-write/dir || framework_failure=1
-chmod u-w no-write || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+mkdir -p no-write/dir || framework_failure
+chmod u-w no-write || framework_failure
fail=0
mv: cannot move `no-write/dir' to `./dir': Permission denied
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
#!/bin/sh
# Ensure that `mv --reply=no f1 f2' works.
-# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2005-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
fi
. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch a b || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+touch a b || framework_failure
fail=0
mv: the --reply option is deprecated; use -i or -f instead
EOF
-cmp out exp_err || fail=1
-test $fail = 1 && diff out exp_err 2> /dev/null
+compare out exp_err || fail=1
(exit $fail); exit $fail
# Make sure that the copying code used in an inter-partition
# move unlinks a destination symlink before opening it.
-# Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-. $srcdir/../other-fs-tmpdir
-. $srcdir/../envvar-check
-
-if test -z "$other_partition_tmpdir"; then
- exit 77
-fi
+. $srcdir/../test-lib.sh
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_top_srcdir/tests/other-fs-tmpdir"
rem_file="$other_partition_tmpdir/file"
rem_symlink="$other_partition_tmpdir/symlink"
fail=0
-trap 'rm -fr $file $other_partition_tmpdir; exit $fail' 0 1 2 3 15
-
-framework_failure=0
-rm -f $file || framework_failure=1
-echo local > $file || framework_failure=1
-echo remote > $rem_file || framework_failure=1
-ln -s $rem_file $rem_symlink || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
+rm -f $file || framework_failure
+echo local > $file || framework_failure
+echo remote > $rem_file || framework_failure
+ln -s $rem_file $rem_symlink || framework_failure
# This mv command should succeed, unlinking the symlink
# before copying.
# Also, ensure that "mv dir non-exist-dir/" works.
# Also, ensure that "cp dir non-exist-dir/" works.
-# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mv --version
fi
-pwd=`pwd`
-tmp=mv-tslash.$$
-trap 'status=$?; cd "$pwd" && exec 1>&2; rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
+. $srcdir/../test-lib.sh
-. $srcdir/../envvar-check
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir foo || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework' 1>&2
- exit 1
-fi
+mkdir foo || framework_failure
fail=0
# mv and cp would misbehave for coreutils versions [5.3.0..5.97], 6.0 and 6.1
for cmd in mv 'cp -r'; do
for opt in '' -T -u; do
- rm -rf d e || framework_failure=1
- mkdir d || framework_failure=1
- if test $framework_failure = 1; then
- echo 'failure in testing framework'
- (exit 1); exit 1
- fi
+ rm -rf d e || framework_failure
+ mkdir d || framework_failure
$cmd $opt d e/ || fail=1
if test "$cmd" = mv; then
mv --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-tmp=mv-update.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-echo old > old || framework_failure=1
-touch -d yesterday old || framework_failure=1
-echo new > new || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework' 1>&2
- (exit 1); exit 1
-fi
+echo old > old || framework_failure
+touch -d yesterday old || framework_failure
+echo new > new || framework_failure
fail=0
# of the current directory. If one is found, create a temporary directory
# inside it.
-# Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1998, 1999, 2001, 2002, 2005, 2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
this test use a different list.
**************************************
EOF
- #'
+ (exit 77); exit 77
fi
test "$VERBOSE" = yes && set -x