~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/readlink/can-m.sh

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# tests for canonicalize-missing mode (readlink -m).
 
3
 
 
4
# Copyright (C) 2004-2012 Free Software Foundation, Inc.
 
5
 
 
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.
 
10
 
 
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.
 
15
 
 
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/>.
 
18
 
 
19
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 
20
print_ver_ readlink
 
21
 
 
22
pwd=$(pwd)
 
23
my_pwd=$("$abs_top_builddir/src/pwd")
 
24
tmp=d
 
25
 
 
26
mkdir $tmp || framework_failure_
 
27
cd $tmp || framework_failure_
 
28
 
 
29
mkdir subdir removed || framework_failure_
 
30
touch regfile || framework_failure_
 
31
 
 
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_
 
36
 
 
37
cd "$pwd/$tmp/removed" || framework_failure_
 
38
 
 
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
 
43
fi
 
44
 
 
45
cd "$pwd/$tmp" || fail=1
 
46
 
 
47
for p in "" "$pwd/$tmp/"; do
 
48
 
 
49
  v=$(readlink -m "${p}regfile") || fail=1
 
50
  test "$v" = "$my_pwd/$tmp/regfile" || fail=1
 
51
 
 
52
  v=$(readlink -m "${p}./regfile/") || fail=1
 
53
  test "$v" = "$my_pwd/$tmp/regfile" || fail=1
 
54
 
 
55
  v=$(readlink -m "${p}regfile/more") || fail=1
 
56
  test "$v" = "$my_pwd/$tmp/regfile/more" || fail=1
 
57
 
 
58
  v=$(readlink -m "${p}./regfile/more/") || fail=1
 
59
  test "$v" = "$my_pwd/$tmp/regfile/more" || fail=1
 
60
 
 
61
  v=$(readlink -m "${p}subdir") || fail=1
 
62
  test "$v" = "$my_pwd/$tmp/subdir" || fail=1
 
63
 
 
64
  v=$(readlink -m "${p}./subdir/") || fail=1
 
65
  test "$v" = "$my_pwd/$tmp/subdir" || fail=1
 
66
 
 
67
  v=$(readlink -m "${p}subdir/more") || fail=1
 
68
  test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
 
69
 
 
70
  v=$(readlink -m "${p}./subdir/more/") || fail=1
 
71
  test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
 
72
 
 
73
  v=$(readlink -m "${p}missing") || fail=1
 
74
  test "$v" = "$my_pwd/$tmp/missing" || fail=1
 
75
 
 
76
  v=$(readlink -m "${p}./missing/") || fail=1
 
77
  test "$v" = "$my_pwd/$tmp/missing" || fail=1
 
78
 
 
79
  v=$(readlink -m "${p}missing/more") || fail=1
 
80
  test "$v" = "$my_pwd/$tmp/missing/more" || fail=1
 
81
 
 
82
  v=$(readlink -m "${p}./missing/more/") || fail=1
 
83
  test "$v" = "$my_pwd/$tmp/missing/more" || fail=1
 
84
 
 
85
  v=$(readlink -m "${p}link1") || fail=1
 
86
  test "$v" = "$my_pwd/$tmp/regfile" || fail=1
 
87
 
 
88
  v=$(readlink -m "${p}./link1/") || fail=1
 
89
  test "$v" = "$my_pwd/$tmp/regfile" || fail=1
 
90
 
 
91
  v=$(readlink -m "${p}link1/more") || fail=1
 
92
  test "$v" = "$my_pwd/$tmp/regfile/more" || fail=1
 
93
 
 
94
  v=$(readlink -m "${p}./link1/more/") || fail=1
 
95
  test "$v" = "$my_pwd/$tmp/regfile/more" || fail=1
 
96
 
 
97
  v=$(readlink -m "${p}link2") || fail=1
 
98
  test "$v" = "$my_pwd/$tmp/subdir" || fail=1
 
99
 
 
100
  v=$(readlink -m "${p}./link2/") || fail=1
 
101
  test "$v" = "$my_pwd/$tmp/subdir" || fail=1
 
102
 
 
103
  v=$(readlink -m "${p}link2/more") || fail=1
 
104
  test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
 
105
 
 
106
  v=$(readlink -m "${p}./link2/more/") || fail=1
 
107
  test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1
 
108
 
 
109
  v=$(readlink -m "${p}link2/more/more2") || fail=1
 
110
  test "$v" = "$my_pwd/$tmp/subdir/more/more2" || fail=1
 
111
 
 
112
  v=$(readlink -m "${p}./link2/more/more2/") || fail=1
 
113
  test "$v" = "$my_pwd/$tmp/subdir/more/more2" || fail=1
 
114
 
 
115
  v=$(readlink -m "${p}link3") || fail=1
 
116
  test "$v" = "$my_pwd/$tmp/missing" || fail=1
 
117
 
 
118
  v=$(readlink -m "${p}./link3/") || fail=1
 
119
  test "$v" = "$my_pwd/$tmp/missing" || fail=1
 
120
 
 
121
  v=$(readlink -m "${p}link3/more") || fail=1
 
122
  test "$v" = "$my_pwd/$tmp/missing/more" || fail=1
 
123
 
 
124
  v=$(readlink -m "${p}./link3/more/") || fail=1
 
125
  test "$v" = "$my_pwd/$tmp/missing/more" || fail=1
 
126
 
 
127
  v=$(readlink -m "${p}link4") || fail=1
 
128
  test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1
 
129
 
 
130
  v=$(readlink -m "${p}./link4/") || fail=1
 
131
  test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1
 
132
 
 
133
  v=$(readlink -m "${p}link4/more") || fail=1
 
134
  test "$v" = "$my_pwd/$tmp/subdir/missing/more" || fail=1
 
135
 
 
136
  v=$(readlink -m "${p}./link4/more/") || fail=1
 
137
  test "$v" = "$my_pwd/$tmp/subdir/missing/more" || fail=1
 
138
 
 
139
done
 
140
 
 
141
Exit $fail