2 # tests for canonicalize-existing mode (readlink -e).
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
41 cd "$pwd/$tmp/removed" || framework_failure
43 # Skip this test if the system doesn't let you remove the working directory.
44 if rmdir ../removed 2>/dev/null; then
45 v=`readlink -e .` && fail=1
46 test -z "$v" || fail=1
49 cd "$pwd/$tmp" || fail=1
51 for p in "" "$pwd/$tmp/"; do
53 v=`readlink -e "${p}regfile"` || fail=1
54 test "$v" = "$my_pwd/$tmp/regfile" || fail=1
56 v=`readlink -e "${p}./regfile/"` && fail=1
57 test -z "$v" || fail=1
59 v=`readlink -e "${p}subdir"` || fail=1
60 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
62 v=`readlink -e "${p}./subdir/"` || fail=1
63 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
65 v=`readlink -e "${p}missing"` && fail=1
66 test -z "$v" || fail=1
68 v=`readlink -e "${p}./missing/"` && fail=1
69 test -z "$v" || fail=1
71 v=`readlink -e "${p}link1"` || fail=1
72 test "$v" = "$my_pwd/$tmp/regfile" || fail=1
74 v=`readlink -e "${p}./link1/"` && fail=1
75 test -z "$v" || fail=1
77 v=`readlink -e "${p}link1/more"` && fail=1
78 test -z "$v" || fail=1
80 v=`readlink -e "${p}link2"` || fail=1
81 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
83 v=`readlink -e "${p}./link2/"` || fail=1
84 test "$v" = "$my_pwd/$tmp/subdir" || fail=1
86 v=`readlink -e "${p}link2/more"` && fail=1
87 test -z "$v" || fail=1
89 v=`readlink -e "${p}link3"` && fail=1
90 test -z "$v" || fail=1
92 v=`readlink -e "${p}./link3/"` && fail=1
93 test -z "$v" || fail=1
95 v=`readlink -e "${p}link3/more"` && fail=1
96 test -z "$v" || fail=1
98 v=`readlink -e "${p}link4"` && fail=1
99 test -z "$v" || fail=1
101 v=`readlink -e "${p}./link4/"` && fail=1
102 test -z "$v" || fail=1
104 v=`readlink -e "${p}link4/more"` && fail=1
105 test -z "$v" || fail=1