maint: update all copyright year number ranges
[coreutils.git] / tests / mv / part-rename.sh
blobdbe58560c8b0f8f412e7fb3ae918b5f431382048
1 #!/bin/sh
2 # Test various cases for moving directories across file systems
4 # Copyright (C) 2000-2017 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
20 print_ver_ mv
21 cleanup_() { rm -rf "$other_partition_tmpdir"; }
22 . "$abs_srcdir/tests/other-fs-tmpdir"
25 # Moving a directory specified with a trailing slash from one partition to
26 # another, and giving it a different name at the destination would cause mv
27 # to get a failed assertion.
28 mkdir foo || framework_failure_
29 mv foo/ "$other_partition_tmpdir/bar" || fail=1
32 # Moving a non directory from source shouldn't replace empty dir in dest
33 touch bar || framework_failure_
34 returns_ 1 mv bar "$other_partition_tmpdir/" || fail=1
37 # Moving a directory from source shouldn't replace non directory in dest
38 mkdir bar2
39 touch "$other_partition_tmpdir/bar2"
40 returns_ 1 mv bar2 "$other_partition_tmpdir/" || fail=1
43 # As per POSIX moving directory from source should replace empty dir in dest
44 mkdir bar3
45 touch bar3/file
46 mkdir "$other_partition_tmpdir/bar3"
47 mv bar3 "$other_partition_tmpdir/" || fail=1
48 test -e "$other_partition_tmpdir/bar3/file" || fail=1
51 # As per POSIX moving directory from source shouldn't update dir in dest
52 mkdir bar3
53 touch bar3/file2
54 returns_ 1 mv bar3 "$other_partition_tmpdir/" || fail=1
55 test -e "$other_partition_tmpdir/bar3/file2" && fail=1
57 Exit $fail