Tizen 2.0 Release
[external/tizen-coreutils.git] / tests / mv / part-rename
1 #!/bin/sh
2 # Moving a directory specified with a trailing slash from one partition to
3 # another, and giving it a different name at the destination would cause mv
4 # to get a failed assertion.
5
6 # Copyright (C) 2000, 2002, 2004, 2006 Free Software Foundation, Inc.
7
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 # 02110-1301, USA.
22
23 if test "$VERBOSE" = yes; then
24   set -x
25   mv --version
26 fi
27
28 . $srcdir/../other-fs-tmpdir
29 . $srcdir/../envvar-check
30
31 pwd=`pwd`
32 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
33 trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
34 trap '(exit $?); exit' 1 2 13 15
35
36 if test -z "$other_partition_tmpdir"; then
37   (exit 77); exit 77
38 fi
39 t0="$t0 $other_partition_tmpdir"
40
41 framework_failure=0
42 mkdir -p $tmp || framework_failure=1
43 cd $tmp || framework_failure=1
44 mkdir foo || framework_failure=1
45
46 if test $framework_failure = 1; then
47   echo "$0: failure in testing framework" 1>&2
48   (exit 1); exit 1
49 fi
50
51 fail=0
52
53 mv foo/ $other_partition_tmpdir/bar || fail=1
54
55 (exit $fail); exit $fail