doc: stat: clarify that %t and %T expand to the file system type
[coreutils/ericb.git] / tests / readlink / can-f
bloba557c2297a618dd73f6223499e459db34be3b738
1 #!/bin/sh
2 # tests for canonicalize mode (readlink -f).
4 # Copyright (C) 2004, 2006-2011 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=.}/init.sh"; path_prepend_ ../src
20 print_ver_ readlink
22 pwd=`pwd`
23 my_pwd=$("$abs_top_builddir/src/pwd")
24 tmp=d
26 mkdir $tmp || framework_failure_
27 cd $tmp || framework_failure_
29 mkdir subdir removed || framework_failure_
30 touch regfile || framework_failure_
32 ln -s regfile link1 || framework_failure_
33 ln -s subdir link2 || framework_failure_
34 ln -s missing link3 || framework_failure_
35 ln -s subdir/missing link4 || framework_failure_
36 ln -s link5 link5 || framework_failure_
38 cd "$pwd/$tmp/removed" || framework_failure_
40 # Skip this test if the system doesn't let you remove the working directory.
41 if rmdir ../removed 2>/dev/null; then
42 v=`readlink -e .` && fail=1
43 test -z "$v" || fail=1
46 cd "$pwd/$tmp" || fail=1
48 for p in "" "$pwd/$tmp/"; do
50 v=`readlink -f "${p}regfile"` || fail=1
51 test "$v" = "$my_pwd/$tmp/regfile" || fail=1
53 v=`readlink -f "${p}./regfile/"` && fail=1
54 test -z "$v" || fail=1
56 v=`readlink -f "${p}regfile/more"` && fail=1
57 test -z "$v" || fail=1
59 v=`readlink -f "${p}./regfile/more/"` && fail=1
60 test -z "$v" || fail=1
62 v=`readlink -f "${p}subdir"` || fail=1
63 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
65 v=`readlink -f "${p}./subdir/"` || fail=1
66 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
68 v=`readlink -f "${p}subdir/more"` || fail=1
69 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
71 v=`readlink -f "${p}./subdir/more/"` || fail=1
72 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
74 v=`readlink -f "${p}missing"` || fail=1
75 test "$v" = "$my_pwd/$tmp/missing" || fail=1
77 v=`readlink -f "${p}./missing/"` || fail=1
78 test "$v" = "$my_pwd/$tmp/missing" || fail=1
80 v=`readlink -f "${p}missing/more"` && fail=1
81 test -z "$v" || fail=1
83 v=`readlink -f "${p}./missing/more/"` && fail=1
84 test -z "$v" || fail=1
86 v=`readlink -f "${p}link1"` || fail=1
87 test "$v" = "$my_pwd/$tmp/regfile" || fail=1
89 v=`readlink -f "${p}./link1/"` && fail=1
90 test -z "$v" || fail=1
92 v=`readlink -f "${p}link1/more"` && fail=1
93 test -z "$v" || fail=1
95 v=`readlink -f "${p}./link1/more/"` && fail=1
96 test -z "$v" || fail=1
98 v=`readlink -f "${p}link2"` || fail=1
99 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
101 v=`readlink -f "${p}./link2/"` || fail=1
102 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
104 v=`readlink -f "${p}link2/more"` || fail=1
105 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
107 v=`readlink -f "${p}./link2/more/"` || fail=1
108 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
110 v=`readlink -f "${p}link2/more/more2"` && fail=1
111 test -z "$v" || fail=1
113 v=`readlink -f "${p}./link2/more/more2/"` && fail=1
114 test -z "$v" || fail=1
116 v=`readlink -f "${p}link3"` || fail=1
117 test "$v" = "$my_pwd/$tmp/missing" || fail=1
119 v=`readlink -f "${p}./link3/"` || fail=1
120 test "$v" = "$my_pwd/$tmp/missing" || fail=1
122 v=`readlink -f "${p}link3/more"` && fail=1
123 test -z "$v" || fail=1
125 v=`readlink -f "${p}./link3/more/"` && fail=1
126 test -z "$v" || fail=1
128 v=`readlink -f "${p}link4"` || fail=1
129 test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1
131 v=`readlink -f "${p}./link4/"` || fail=1
132 test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1
134 v=`readlink -f "${p}link4/more"` && fail=1
135 test -z "$v" || fail=1
137 v=`readlink -f "${p}./link4/more"` && fail=1
138 test -z "$v" || fail=1
140 v=`readlink -f "${p}link5"` && fail=1
141 test -z "$v" || fail=1
143 v=`readlink -f "${p}./link5/"` && fail=1
144 test -z "$v" || fail=1
146 v=`readlink -f "${p}link5/more"` && fail=1
147 test -z "$v" || fail=1
149 v=`readlink -f "${p}./link5/more"` && fail=1
150 test -z "$v" || fail=1
151 done
153 Exit $fail