build: prepare to enable -Werror also for gnulib-tests/
[coreutils/ericb.git] / tests / mv / trailing-slash
blobc23fbdb7300537c09535a7da915a7171b987ac58
1 #!/bin/sh
2 # On some operating systems, e.g. SunOS-4.1.1_U1 on sun3x,
3 # rename() doesn't accept trailing slashes.
4 # Also, ensure that "mv dir non-exist-dir/" works.
5 # Also, ensure that "cp dir non-exist-dir/" works.
7 # Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc.
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 if test "$VERBOSE" = yes; then
23 set -x
24 mv --version
27 . $srcdir/test-lib.sh
29 mkdir foo || framework_failure
32 mv foo/ bar || fail=1
34 # mv and cp would misbehave for coreutils versions [5.3.0..5.97], 6.0 and 6.1
35 for cmd in mv 'cp -r'; do
36 for opt in '' -T -u; do
37 rm -rf d e || framework_failure
38 mkdir d || framework_failure
40 $cmd $opt d e/ || fail=1
41 if test "$cmd" = mv; then
42 test -d d && fail=1
43 else
44 test -d d || fail=1
46 test -d e || fail=1
47 done
48 done
50 # We would like the erroneous-looking "mv any non-dir/" to fail,
51 # but with the current implementation, it depends on how the
52 # underlying rename syscall handles the trailing slash.
53 # It does fail, as desired, on recent Linux and Solaris systems.
54 #touch a a2
55 #mv a a2/ && fail=1
57 Exit $fail