2 # tests for canonicalize-missing mode (readlink -m).
4 # Copyright (C) 2004 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 2 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, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 if test "$VERBOSE" = yes; then
27 t0=`echo "$0" |sed 's,.*/,,'`.tmp; tmp=$t0/$$
28 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
29 trap 'status=$?; (exit $status); exit $status' 1 2 13 15
33 bindir=`cd ../../src; pwd`|| break
34 my_pwd=`$bindir/pwd` || break
36 mkdir -p $tmp || break
39 mkdir subdir removed || break
40 touch regfile || break
42 ln -s regfile link1 || break
43 ln -s subdir link2 || break
44 ln -s missing link3 || break
45 ln -s subdir/missing link4 || break
51 if test $fail = 1; then
52 echo "$0: failure in testing framework" 1>&2
58 cd "$pwd/$tmp/removed" || break
60 # Skip this test if the system doesn't let you remove the working directory.
61 if rmdir ../removed 2>/dev/null; then
62 v=`readlink -m .` && break
66 cd "$pwd/$tmp" || break
72 if test $fail = 1; then
73 (exit $fail); exit $fail
76 for p in "" "$pwd/$tmp/"; do
79 v=`readlink -m ${p}regfile` || break
80 test "$v" = "$my_pwd/$tmp/regfile" || break
82 v=`readlink -m ${p}./regfile/` || break
83 test "$v" = "$my_pwd/$tmp/regfile" || break
85 v=`readlink -m ${p}regfile/more` || break
86 test "$v" = "$my_pwd/$tmp/regfile/more" || break
88 v=`readlink -m ${p}./regfile/more/` || break
89 test "$v" = "$my_pwd/$tmp/regfile/more" || break
91 v=`readlink -m ${p}subdir` || break
92 test "$v" = "$my_pwd/$tmp/subdir" || break
94 v=`readlink -m ${p}./subdir/` || break
95 test "$v" = "$my_pwd/$tmp/subdir" || break
97 v=`readlink -m ${p}subdir/more` || break
98 test "$v" = "$my_pwd/$tmp/subdir/more" || break
100 v=`readlink -m ${p}./subdir/more/` || break
101 test "$v" = "$my_pwd/$tmp/subdir/more" || break
103 v=`readlink -m ${p}missing` || break
104 test "$v" = "$my_pwd/$tmp/missing" || break
106 v=`readlink -m ${p}./missing/` || break
107 test "$v" = "$my_pwd/$tmp/missing" || break
109 v=`readlink -m ${p}missing/more` || break
110 test "$v" = "$my_pwd/$tmp/missing/more" || break
112 v=`readlink -m ${p}./missing/more/` || break
113 test "$v" = "$my_pwd/$tmp/missing/more" || break
115 v=`readlink -m ${p}link1` || break
116 test "$v" = "$my_pwd/$tmp/regfile" || break
118 v=`readlink -m ${p}./link1/` || break
119 test "$v" = "$my_pwd/$tmp/regfile" || break
121 v=`readlink -m ${p}link1/more` || break
122 test "$v" = "$my_pwd/$tmp/regfile/more" || break
124 v=`readlink -m ${p}./link1/more/` || break
125 test "$v" = "$my_pwd/$tmp/regfile/more" || break
127 v=`readlink -m ${p}link2` || break
128 test "$v" = "$my_pwd/$tmp/subdir" || break
130 v=`readlink -m ${p}./link2/` || break
131 test "$v" = "$my_pwd/$tmp/subdir" || break
133 v=`readlink -m ${p}link2/more` || break
134 test "$v" = "$my_pwd/$tmp/subdir/more" || break
136 v=`readlink -m ${p}./link2/more/` || break
137 test "$v" = "$my_pwd/$tmp/subdir/more" || break
139 v=`readlink -m ${p}link2/more/more2` || break
140 test "$v" = "$my_pwd/$tmp/subdir/more/more2" || break
142 v=`readlink -m ${p}./link2/more/more2/` || break
143 test "$v" = "$my_pwd/$tmp/subdir/more/more2" || break
145 v=`readlink -m ${p}link3` || break
146 test "$v" = "$my_pwd/$tmp/missing" || break
148 v=`readlink -m ${p}./link3/` || break
149 test "$v" = "$my_pwd/$tmp/missing" || break
151 v=`readlink -m ${p}link3/more` || break
152 test "$v" = "$my_pwd/$tmp/missing/more" || break
154 v=`readlink -m ${p}./link3/more/` || break
155 test "$v" = "$my_pwd/$tmp/missing/more" || break
157 v=`readlink -m ${p}link4` || break
158 test "$v" = "$my_pwd/$tmp/subdir/missing" || break
160 v=`readlink -m ${p}./link4/` || break
161 test "$v" = "$my_pwd/$tmp/subdir/missing" || break
163 v=`readlink -m ${p}link4/more` || break
164 test "$v" = "$my_pwd/$tmp/subdir/missing/more" || break
166 v=`readlink -m ${p}./link4/more/` || break
167 test "$v" = "$my_pwd/$tmp/subdir/missing/more" || break
172 (exit $fail); exit $fail