doc: stat: clarify that %t and %T expand to the file system type
[coreutils/ericb.git] / tests / readlink / can-m
blob150d6572cf2241f07a2c2afeefe7dc435cef7024
1 #!/bin/sh
2 # tests for canonicalize-missing mode (readlink -m).
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_
37 cd "$pwd/$tmp/removed" || framework_failure_
39 # Skip this test if the system doesn't let you remove the working directory.
40 if rmdir ../removed 2>/dev/null; then
41 v=`readlink -e .` && fail=1
42 test -z "$v" || fail=1
45 cd "$pwd/$tmp" || fail=1
47 for p in "" "$pwd/$tmp/"; do
49 v=`readlink -m "${p}regfile"` || fail=1
50 test "$v" = "$my_pwd/$tmp/regfile" || fail=1
52 v=`readlink -m "${p}./regfile/"` || fail=1
53 test "$v" = "$my_pwd/$tmp/regfile" || fail=1
55 v=`readlink -m "${p}regfile/more"` || fail=1
56 test "$v" = "$my_pwd/$tmp/regfile/more" || fail=1
58 v=`readlink -m "${p}./regfile/more/"` || fail=1
59 test "$v" = "$my_pwd/$tmp/regfile/more" || fail=1
61 v=`readlink -m "${p}subdir"` || fail=1
62 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
64 v=`readlink -m "${p}./subdir/"` || fail=1
65 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
67 v=`readlink -m "${p}subdir/more"` || fail=1
68 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
70 v=`readlink -m "${p}./subdir/more/"` || fail=1
71 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
73 v=`readlink -m "${p}missing"` || fail=1
74 test "$v" = "$my_pwd/$tmp/missing" || fail=1
76 v=`readlink -m "${p}./missing/"` || fail=1
77 test "$v" = "$my_pwd/$tmp/missing" || fail=1
79 v=`readlink -m "${p}missing/more"` || fail=1
80 test "$v" = "$my_pwd/$tmp/missing/more" || fail=1
82 v=`readlink -m "${p}./missing/more/"` || fail=1
83 test "$v" = "$my_pwd/$tmp/missing/more" || fail=1
85 v=`readlink -m "${p}link1"` || fail=1
86 test "$v" = "$my_pwd/$tmp/regfile" || fail=1
88 v=`readlink -m "${p}./link1/"` || fail=1
89 test "$v" = "$my_pwd/$tmp/regfile" || fail=1
91 v=`readlink -m "${p}link1/more"` || fail=1
92 test "$v" = "$my_pwd/$tmp/regfile/more" || fail=1
94 v=`readlink -m "${p}./link1/more/"` || fail=1
95 test "$v" = "$my_pwd/$tmp/regfile/more" || fail=1
97 v=`readlink -m "${p}link2"` || fail=1
98 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
100 v=`readlink -m "${p}./link2/"` || fail=1
101 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
103 v=`readlink -m "${p}link2/more"` || fail=1
104 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
106 v=`readlink -m "${p}./link2/more/"` || fail=1
107 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
109 v=`readlink -m "${p}link2/more/more2"` || fail=1
110 test "$v" = "$my_pwd/$tmp/subdir/more/more2" || fail=1
112 v=`readlink -m "${p}./link2/more/more2/"` || fail=1
113 test "$v" = "$my_pwd/$tmp/subdir/more/more2" || fail=1
115 v=`readlink -m "${p}link3"` || fail=1
116 test "$v" = "$my_pwd/$tmp/missing" || fail=1
118 v=`readlink -m "${p}./link3/"` || fail=1
119 test "$v" = "$my_pwd/$tmp/missing" || fail=1
121 v=`readlink -m "${p}link3/more"` || fail=1
122 test "$v" = "$my_pwd/$tmp/missing/more" || fail=1
124 v=`readlink -m "${p}./link3/more/"` || fail=1
125 test "$v" = "$my_pwd/$tmp/missing/more" || fail=1
127 v=`readlink -m "${p}link4"` || fail=1
128 test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1
130 v=`readlink -m "${p}./link4/"` || fail=1
131 test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1
133 v=`readlink -m "${p}link4/more"` || fail=1
134 test "$v" = "$my_pwd/$tmp/subdir/missing/more" || fail=1
136 v=`readlink -m "${p}./link4/more/"` || fail=1
137 test "$v" = "$my_pwd/$tmp/subdir/missing/more" || fail=1
139 done
141 Exit $fail