2 # Test various cases for moving directories across file systems
4 # Copyright (C) 2000-2024 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 <https://www.gnu.org/licenses/>.
19 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
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
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
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
54 returns_
1 mv bar3
"$other_partition_tmpdir/" || fail
=1
55 test -e "$other_partition_tmpdir/bar3/file2" && fail
=1