f8a142589e2f85fe75275445f75b175da091fe27
[platform/upstream/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 if test "$VERBOSE" = yes; then
7   set -x
8   mv --version
9 fi
10
11 . $srcdir/setup
12 . $srcdir/../envvar-check
13
14 pwd=`pwd`
15 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
16 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
17 trap '(exit $?); exit' 1 2 13 15
18
19 if test -z "$other_partition_tmpdir"; then
20   (exit 77); exit 77
21 fi
22 t0="$t0 $other_partition_tmpdir"
23
24 framework_failure=0
25 mkdir -p $tmp || framework_failure=1
26 cd $tmp || framework_failure=1
27 mkdir foo || framework_failure=1
28
29 if test $framework_failure = 1; then
30   echo "$0: failure in testing framework" 1>&2
31   (exit 1); exit 1
32 fi
33
34 fail=0
35
36 mv foo/ $other_partition_tmpdir/bar || fail=1
37
38 (exit $fail); exit $fail