2 # tests for canonicalize mode (readlink -f).
4 # Copyright (C) 2004, 2006-2009 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 if test "$VERBOSE" = yes; then
27 my_pwd=$("$abs_top_builddir/src/pwd")
30 mkdir $tmp || framework_failure
31 cd $tmp || framework_failure
33 mkdir subdir removed || framework_failure
34 touch regfile || framework_failure
36 ln -s regfile link1 || framework_failure
37 ln -s subdir link2 || framework_failure
38 ln -s missing link3 || framework_failure
39 ln -s subdir/missing link4 || framework_failure
40 ln -s link5 link5 || framework_failure
42 cd "$pwd/$tmp/removed" || framework_failure
44 # Skip this test if the system doesn't let you remove the working directory.
45 if rmdir ../removed 2>/dev/null; then
46 v=`readlink -e .` && fail=1
47 test -z "$v" || fail=1
50 cd "$pwd/$tmp" || fail=1
52 for p in "" "$pwd/$tmp/"; do
54 v=`readlink -f "${p}regfile"` || fail=1
55 test "$v" = "$my_pwd/$tmp/regfile" || fail=1
57 v=`readlink -f "${p}./regfile/"` && fail=1
58 test -z "$v" || fail=1
60 v=`readlink -f "${p}regfile/more"` && fail=1
61 test -z "$v" || fail=1
63 v=`readlink -f "${p}./regfile/more/"` && fail=1
64 test -z "$v" || fail=1
66 v=`readlink -f "${p}subdir"` || fail=1
67 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
69 v=`readlink -f "${p}./subdir/"` || fail=1
70 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
72 v=`readlink -f "${p}subdir/more"` || fail=1
73 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
75 v=`readlink -f "${p}./subdir/more/"` || fail=1
76 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
78 v=`readlink -f "${p}missing"` || fail=1
79 test "$v" = "$my_pwd/$tmp/missing" || fail=1
81 v=`readlink -f "${p}./missing/"` || fail=1
82 test "$v" = "$my_pwd/$tmp/missing" || fail=1
84 v=`readlink -f "${p}missing/more"` && fail=1
85 test -z "$v" || fail=1
87 v=`readlink -f "${p}./missing/more/"` && fail=1
88 test -z "$v" || fail=1
90 v=`readlink -f "${p}link1"` || fail=1
91 test "$v" = "$my_pwd/$tmp/regfile" || fail=1
93 v=`readlink -f "${p}./link1/"` && fail=1
94 test -z "$v" || fail=1
96 v=`readlink -f "${p}link1/more"` && fail=1
97 test -z "$v" || fail=1
99 v=`readlink -f "${p}./link1/more/"` && fail=1
100 test -z "$v" || fail=1
102 v=`readlink -f "${p}link2"` || fail=1
103 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
105 v=`readlink -f "${p}./link2/"` || fail=1
106 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
108 v=`readlink -f "${p}link2/more"` || fail=1
109 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
111 v=`readlink -f "${p}./link2/more/"` || fail=1
112 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
114 v=`readlink -f "${p}link2/more/more2"` && fail=1
115 test -z "$v" || fail=1
117 v=`readlink -f "${p}./link2/more/more2/"` && fail=1
118 test -z "$v" || fail=1
120 v=`readlink -f "${p}link3"` || fail=1
121 test "$v" = "$my_pwd/$tmp/missing" || fail=1
123 v=`readlink -f "${p}./link3/"` || fail=1
124 test "$v" = "$my_pwd/$tmp/missing" || fail=1
126 v=`readlink -f "${p}link3/more"` && fail=1
127 test -z "$v" || fail=1
129 v=`readlink -f "${p}./link3/more/"` && fail=1
130 test -z "$v" || fail=1
132 v=`readlink -f "${p}link4"` || fail=1
133 test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1
135 v=`readlink -f "${p}./link4/"` || fail=1
136 test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1
138 v=`readlink -f "${p}link4/more"` && fail=1
139 test -z "$v" || fail=1
141 v=`readlink -f "${p}./link4/more"` && fail=1
142 test -z "$v" || fail=1
144 v=`readlink -f "${p}link5"` && fail=1
145 test -z "$v" || fail=1
147 v=`readlink -f "${p}./link5/"` && fail=1
148 test -z "$v" || fail=1
150 v=`readlink -f "${p}link5/more"` && fail=1
151 test -z "$v" || fail=1
153 v=`readlink -f "${p}./link5/more"` && fail=1
154 test -z "$v" || fail=1