~ubuntu-branches/ubuntu/wily/ifupdown/wily

« back to all changes in this revision

Viewing changes to debian/testbuild-hurd

  • Committer: Stéphane Graber
  • Date: 2012-06-28 22:21:45 UTC
  • Revision ID: stgraber@ubuntu.com-20120628222145-kob4o7w7li0y35al
Tags: 0.7ubuntu1
* Resynchronise with Debian experimental.  Remaining changes:
  (LP: #298488, LP: #663352)
  - ifupdown.nw: Use 100 as default route metric unless an explicit metric
    parameter is set in /etc/network/interface.
  - If the /etc/NetworkManager/NetworkManager.conf file is present
    but doesn't have the "ifupdown:managed" the previous upload instructed
    the iniparser to return -1, which evaluates to TRUE. We instead instruct
    it to return 0, as we shouldn't prevent ifupdown from managing the
    interfaces in that case, as NM won't either. (LP: #281984)
  - debian/postinst: If the loopback interface is missing from the config
    in /etc/network/interfaces, add it on upgrade.
  - Add jobs and hooks for upstart.
* Cherry-pick commit 011d5904c09d from upstream, fixing cases where the
  error messages wouldn't be triggered (caused test failure).
* Cherry-pick commit 7c1a226cc995 from upstream, adds support for two
  options on dhcpv6 (accept_ra and autoconf) (LP: #1013597)
* Cherry-pick commit 5af7e814faee from upstream, fixing a failure in the
  example script generate-interfaces.pl (LP: #286808)
* Cherry-pick commit a1f8efc4d93f from upstream, add --no-scripts as a
  parameter to ifup/ifdown, allowing the user to bypass the the scripts
  in /etc/network/if-*.d/ (LP: #258782)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
 
 
3
rm -rf tests/
 
4
mkdir tests
 
5
cat >tests/testcase.1 <<EOF
 
6
# RUN: -a
 
7
auto eth0
 
8
iface eth0 inet static
 
9
  address 1.2.3.4
 
10
  netmask 255.255.255.0
 
11
  up echo hi
 
12
  post-up echo hello
 
13
EOF
 
14
cat >tests/up.1 <<EOF
 
15
====stdout====
 
16
====stderr====
 
17
run-parts --verbose /etc/network/if-pre-up.d
 
18
Configuring interface eth0=eth0 (inet)
 
19
run-parts --verbose /etc/network/if-pre-up.d
 
20
 
 
21
inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0           --up
 
22
 
 
23
echo hi
 
24
echo hello
 
25
run-parts --verbose /etc/network/if-up.d
 
26
run-parts --verbose /etc/network/if-up.d
 
27
EOF
 
28
 
 
29
cat >tests/testcase.2 <<EOF
 
30
# RUN: -a
 
31
auto eth0 eth1 eth2
 
32
auto eth3 eth4 eth5
 
33
allow-hotplug eth6
 
34
iface eth0 inet static
 
35
  address 1.2.3.4
 
36
  netmask 255.255.255.0
 
37
iface eth1 inet static
 
38
  address 1.3.4.5
 
39
  netmask 255.255.255.0
 
40
iface eth2 inet static
 
41
  address 1.4.5.6
 
42
  netmask 255.255.255.0
 
43
iface eth3 inet static
 
44
  address 1.5.6.7
 
45
  netmask 255.255.255.0
 
46
iface eth4 inet static
 
47
  address 1.7.8.9
 
48
  netmask 255.255.255.0
 
49
iface eth5 inet static
 
50
  address 1.8.9.10
 
51
  netmask 255.255.255.0
 
52
iface eth6 inet static
 
53
  address 1.11.12.13
 
54
  netmask 255.255.255.0
 
55
iface eth7 inet static
 
56
  address 1.14.15.16
 
57
  netmask 255.255.255.0
 
58
EOF
 
59
cat >tests/up.2 <<EOF
 
60
====stdout====
 
61
====stderr====
 
62
run-parts --verbose /etc/network/if-pre-up.d
 
63
Configuring interface eth0=eth0 (inet)
 
64
run-parts --verbose /etc/network/if-pre-up.d
 
65
 
 
66
inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0           --up
 
67
 
 
68
run-parts --verbose /etc/network/if-up.d
 
69
Configuring interface eth1=eth1 (inet)
 
70
run-parts --verbose /etc/network/if-pre-up.d
 
71
 
 
72
inetutils-ifconfig --interface eth1 --address 1.3.4.5 --netmask 255.255.255.0           --up
 
73
 
 
74
run-parts --verbose /etc/network/if-up.d
 
75
Configuring interface eth2=eth2 (inet)
 
76
run-parts --verbose /etc/network/if-pre-up.d
 
77
 
 
78
inetutils-ifconfig --interface eth2 --address 1.4.5.6 --netmask 255.255.255.0           --up
 
79
 
 
80
run-parts --verbose /etc/network/if-up.d
 
81
Configuring interface eth3=eth3 (inet)
 
82
run-parts --verbose /etc/network/if-pre-up.d
 
83
 
 
84
inetutils-ifconfig --interface eth3 --address 1.5.6.7 --netmask 255.255.255.0           --up
 
85
 
 
86
run-parts --verbose /etc/network/if-up.d
 
87
Configuring interface eth4=eth4 (inet)
 
88
run-parts --verbose /etc/network/if-pre-up.d
 
89
 
 
90
inetutils-ifconfig --interface eth4 --address 1.7.8.9 --netmask 255.255.255.0           --up
 
91
 
 
92
run-parts --verbose /etc/network/if-up.d
 
93
Configuring interface eth5=eth5 (inet)
 
94
run-parts --verbose /etc/network/if-pre-up.d
 
95
 
 
96
inetutils-ifconfig --interface eth5 --address 1.8.9.10 --netmask 255.255.255.0           --up
 
97
 
 
98
run-parts --verbose /etc/network/if-up.d
 
99
run-parts --verbose /etc/network/if-up.d
 
100
EOF
 
101
 
 
102
cat >tests/testcase.3 <<EOF
 
103
# RUN: -a
 
104
auto eth0
 
105
iface eth0 inet static
 
106
  address 1.2.3.4
 
107
  netmask 255.255.255.0
 
108
iface eth0 inet6 static
 
109
  address 3ffe:ffff:100:f101::1
 
110
  netmask 64
 
111
EOF
 
112
cat >tests/up.3 <<EOF
 
113
====stdout====
 
114
====stderr====
 
115
run-parts --verbose /etc/network/if-pre-up.d
 
116
Configuring interface eth0=eth0 (inet)
 
117
run-parts --verbose /etc/network/if-pre-up.d
 
118
 
 
119
inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0           --up
 
120
 
 
121
run-parts --verbose /etc/network/if-up.d
 
122
Configuring interface eth0=eth0 (inet6)
 
123
run-parts --verbose /etc/network/if-pre-up.d
 
124
FIXME: Add proper commands here for ipv6
 
125
 
 
126
 
 
127
run-parts --verbose /etc/network/if-up.d
 
128
run-parts --verbose /etc/network/if-up.d
 
129
EOF
 
130
 
 
131
cat >tests/testcase.4 <<EOF
 
132
# RUN: eth0=work
 
133
mapping eth0
 
134
  script tests/map.eth0.work
 
135
iface work inet static
 
136
  address 1.2.3.4
 
137
  netmask 255.255.255.0
 
138
  up echo hi
 
139
  post-up echo hello
 
140
EOF
 
141
cat >tests/up.4 <<EOF
 
142
====stdout====
 
143
====stderr====
 
144
Configuring interface eth0=work (inet)
 
145
run-parts --verbose /etc/network/if-pre-up.d
 
146
 
 
147
inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0           --up
 
148
 
 
149
echo hi
 
150
echo hello
 
151
run-parts --verbose /etc/network/if-up.d
 
152
EOF
 
153
 
 
154
cat >tests/testcase.5 <<EOF
 
155
# RUN: -a
 
156
auto eth0
 
157
iface eth0 inet static
 
158
  address 1.2.3.4
 
159
  netmask 255.255.255.0
 
160
  hwaddress ether 00:DE:AD:00:BE:AF
 
161
EOF
 
162
cat >tests/up.5 <<EOF
 
163
====stdout====
 
164
====stderr====
 
165
run-parts --verbose /etc/network/if-pre-up.d
 
166
Configuring interface eth0=eth0 (inet)
 
167
run-parts --verbose /etc/network/if-pre-up.d
 
168
Warning: Option hwaddress: 00:DE:AD:00:BE:AF not yet supported
 
169
inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0           --up
 
170
 
 
171
run-parts --verbose /etc/network/if-up.d
 
172
run-parts --verbose /etc/network/if-up.d
 
173
EOF
 
174
 
 
175
cat >tests/testcase.6 <<EOF
 
176
# RUN: -a
 
177
auto eth0
 
178
iface eth0 inet static
 
179
  address 1.2.3.4
 
180
  netmask 255.255.255.0
 
181
  hwaddress 00:DE:AD:00:BE:AF
 
182
EOF
 
183
cat >tests/up.6 <<EOF
 
184
====stdout====
 
185
====stderr====
 
186
run-parts --verbose /etc/network/if-pre-up.d
 
187
Configuring interface eth0=eth0 (inet)
 
188
run-parts --verbose /etc/network/if-pre-up.d
 
189
Warning: Option hwaddress: 00:DE:AD:00:BE:AF not yet supported
 
190
inetutils-ifconfig --interface eth0 --address 1.2.3.4 --netmask 255.255.255.0           --up
 
191
 
 
192
run-parts --verbose /etc/network/if-up.d
 
193
run-parts --verbose /etc/network/if-up.d
 
194
EOF
 
195
 
 
196
cat >tests/testcase.7 <<EOF
 
197
# RUN: -a
 
198
auto eth0 eth0.1 tunnel
 
199
iface eth0 inet static
 
200
  address 1.2.3.4
 
201
  netmask 255.255.255.0
 
202
iface eth0 inet6 static
 
203
  address 3ffe:ffff:100:f101::1
 
204
  netmask 64
 
205
  privext 2
 
206
  accept_ra 0
 
207
iface eth0.1 inet6 static
 
208
  address 3ffe:ffff:120:f101::1
 
209
  netmask 64
 
210
iface tunnel inet6 6to4
 
211
  local 1.2.3.4
 
212
EOF
 
213
cat >tests/up.7 <<EOF
 
214
====stdout====
 
215
====stderr====
 
216
Configuring interface eth0=eth0 (inet)
 
217
run-parts --verbose /etc/network/if-pre-up.d
 
218
ip addr add 1.2.3.4/255.255.255.0        dev eth0
 
219
ip link set dev eth0   up
 
220
 
 
221
run-parts --verbose /etc/network/if-up.d
 
222
Configuring interface eth0=eth0 (inet6)
 
223
run-parts --verbose /etc/network/if-pre-up.d
 
224
modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
 
225
sysctl net.ipv6.conf.eth0.use_tempaddr=2 
 
226
sysctl net.ipv6.conf.eth0.accept_ra=0
 
227
sysctl net.ipv6.conf.eth0.autoconf=0
 
228
 
 
229
ip link set dev eth0    up
 
230
ip -6 addr add 3ffe:ffff:100:f101::1/64 dev eth0
 
231
 
 
232
run-parts --verbose /etc/network/if-up.d
 
233
Configuring interface eth0.1=eth0.1 (inet6)
 
234
run-parts --verbose /etc/network/if-pre-up.d
 
235
modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
 
236
 
 
237
 
 
238
sysctl net.ipv6.conf.eth0/1.autoconf=0
 
239
 
 
240
ip link set dev eth0.1   up
 
241
ip -6 addr add 3ffe:ffff:120:f101::1/64 dev eth0.1
 
242
 
 
243
run-parts --verbose /etc/network/if-up.d
 
244
Configuring interface tunnel=tunnel (inet6)
 
245
run-parts --verbose /etc/network/if-pre-up.d
 
246
modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
 
247
ip tunnel add tunnel mode sit remote any local 1.2.3.4        
 
248
ip link set tunnel up 
 
249
ip addr add 2002:0102:0304::1/16 dev tunnel
 
250
ip route add 2000::/3 via ::192.88.99.1 dev tunnel
 
251
run-parts --verbose /etc/network/if-up.d
 
252
EOF
 
253
 
 
254
# Note: Testcase 7 is not run on GNU/Hurd, tunnel is not yet implemented.
 
255
result=true
 
256
for test in 1 2 3 4 5 6; do
 
257
        args="$(cat tests/testcase.$test | sed -n 's/^# RUN: //p')"
 
258
        ./ifup -nv --force -i tests/testcase.$test $args \
 
259
                >tests/up-res-out.$test 2>tests/up-res-err.$test || 
 
260
                true
 
261
        (echo "====stdout===="; cat tests/up-res-out.$test
 
262
         echo "====stderr===="; cat tests/up-res-err.$test) > tests/up-res.$test
 
263
 
 
264
        echo "Testcase $test: $args"
 
265
        
 
266
        if diff -ub tests/up.$test tests/up-res.$test; then
 
267
                echo "(okay)"
 
268
        else
 
269
                echo "(failed)"
 
270
                result=false
 
271
        fi
 
272
        echo "=========="
 
273
done
 
274
 
 
275
if $result; then
 
276
        echo "(okay overall)"
 
277
        exit 0
 
278
else
 
279
        echo "(failed overall)"
 
280
        exit 1
 
281
fi