tests: avoid a race in tail --retry testing
[coreutils.git] / tests / mv / backup-is-src.sh
bloba0d7a917895dcce406151ea2fb0bfbcffbaa32af
1 #!/bin/sh
2 # Force mv to use the copying code.
4 # Copyright (C) 1998-2013 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"
24 a="$other_partition_tmpdir/a"
25 a2="$other_partition_tmpdir/a~"
27 rm -f "$a" "$a2" || framework_failure_
28 echo a > "$a" || framework_failure_
29 echo a2 > "$a2" || framework_failure_
31 # This mv command should exit nonzero.
32 mv --b=simple "$a2" "$a" > out 2>&1 && fail=1
34 sed \
35 -e "s,mv:,XXX:," \
36 -e "s,$a,YYY," \
37 -e "s,$a2,ZZZ," \
38 out > out2
40 cat > exp <<\EOF
41 XXX: backing up 'YYY' would destroy source; 'ZZZ' not moved
42 EOF
44 compare exp out2 || fail=1
46 Exit $fail