2 # tests for canonicalize-existing mode (readlink -e).
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
23 my_pwd
=$
("$abs_top_builddir/src/pwd")
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 -e "${p}regfile"` || fail
=1
50 test "$v" = "$my_pwd/$tmp/regfile" || fail
=1
52 v
=`readlink -e "${p}./regfile/"` && fail
=1
53 test -z "$v" || fail
=1
55 v
=`readlink -e "${p}subdir"` || fail
=1
56 test "$v" = "$my_pwd/$tmp/subdir" || fail
=1
58 v
=`readlink -e "${p}./subdir/"` || fail
=1
59 test "$v" = "$my_pwd/$tmp/subdir" || fail
=1
61 v
=`readlink -e "${p}missing"` && fail
=1
62 test -z "$v" || fail
=1
64 v
=`readlink -e "${p}./missing/"` && fail
=1
65 test -z "$v" || fail
=1
67 v
=`readlink -e "${p}link1"` || fail
=1
68 test "$v" = "$my_pwd/$tmp/regfile" || fail
=1
70 v
=`readlink -e "${p}./link1/"` && fail
=1
71 test -z "$v" || fail
=1
73 v
=`readlink -e "${p}link1/more"` && fail
=1
74 test -z "$v" || fail
=1
76 v
=`readlink -e "${p}link2"` || fail
=1
77 test "$v" = "$my_pwd/$tmp/subdir" || fail
=1
79 v
=`readlink -e "${p}./link2/"` || fail
=1
80 test "$v" = "$my_pwd/$tmp/subdir" || fail
=1
82 v
=`readlink -e "${p}link2/more"` && fail
=1
83 test -z "$v" || fail
=1
85 v
=`readlink -e "${p}link3"` && fail
=1
86 test -z "$v" || fail
=1
88 v
=`readlink -e "${p}./link3/"` && fail
=1
89 test -z "$v" || fail
=1
91 v
=`readlink -e "${p}link3/more"` && fail
=1
92 test -z "$v" || fail
=1
94 v
=`readlink -e "${p}link4"` && fail
=1
95 test -z "$v" || fail
=1
97 v
=`readlink -e "${p}./link4/"` && fail
=1
98 test -z "$v" || fail
=1
100 v
=`readlink -e "${p}link4/more"` && fail
=1
101 test -z "$v" || fail
=1