2 # Test "mv" with special files.
4 # Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005, 2006 Free Software
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 if test "$VERBOSE" = yes; then
29 trap 'status=$?; cd "$pwd" && exec 1>&2; rm -rf $tmp $other_partition_tmpdir && exit $status' 0
30 trap '(exit $?); exit' 1 2 13 15
32 . $srcdir/../other-fs-tmpdir
33 . $srcdir/../envvar-check
34 # Make sure we get English translations.
35 . $srcdir/../lang-default
37 if test -z "$other_partition_tmpdir"; then
45 mkdir $tmp || framework_failure=1
46 cd $tmp || framework_failure=1
47 rm -f $null || framework_failure=1
48 mknod $null p || framework_failure=1
49 test -p $null || framework_failure=1
50 mkdir -p $dir/a/b/c $dir/d/e/f || framework_failure=1
51 touch $dir/a/b/c/file1 $dir/d/e/f/file2 || framework_failure=1
53 if test $framework_failure = 1; then
54 echo '********************************************'
55 echo 'NOTICE: unable to create test prerequisites'
56 echo '********************************************'
57 # exit 77 here to indicate that we couldn't run the test.
58 # At least running on SunOS 4.1.4, using a directory NFS mounted
59 # from an OpenBSD system, the above mknod fails.
64 mv --verbose $null $dir $other_partition_tmpdir > out || fail=1
65 # Make sure the files are gone.
66 test -p $null && fail=1
67 test -d $dir && fail=1
68 # Make sure they were moved.
69 test -p $other_partition_tmpdir/$null || fail=1
70 test -d $other_partition_tmpdir/$dir/a/b/c || fail=1
72 # POSIX says rename (A, B) can succeed if A and B are on different file systems,
73 # so ignore chatter about when files are removed and copied rather than renamed.
76 s,$other_partition_tmpdir,XXX,
79 cat <<EOF | sort > exp
80 \`$null' -> \`XXX/$null'
81 \`$dir' -> \`XXX/$dir'
82 \`$dir/a' -> \`XXX/$dir/a'
83 \`$dir/a/b' -> \`XXX/$dir/a/b'
84 \`$dir/a/b/c' -> \`XXX/$dir/a/b/c'
85 \`$dir/a/b/c/file1' -> \`XXX/$dir/a/b/c/file1'
86 \`$dir/d' -> \`XXX/$dir/d'
87 \`$dir/d/e' -> \`XXX/$dir/d/e'
88 \`$dir/d/e/f' -> \`XXX/$dir/d/e/f'
89 \`$dir/d/e/f/file2' -> \`XXX/$dir/d/e/f/file2'
92 cmp out2 exp || fail=1
94 # cd $other_partition_tmpdir
95 # ls -l -A -R $other_partition_tmpdir
97 (exit $fail); exit $fail