Merge ~morphis/snappy-hwe-snaps/+git/wpa-supplicant:f/snap-setup into ~snappy-hwe-team/snappy-hwe-snaps/+git/wpa-supplicant:master
- Git
- lp:~morphis/snappy-hwe-snaps/+git/wpa-supplicant
- f/snap-setup
- Merge into master
Status: | Merged |
---|---|
Approved by: | Matteo Croce |
Approved revision: | 3b84b80b3fedd9811e9ec19096882175782c8137 |
Merged at revision: | f60d15b1ec9d2de6e33ff64cb43987fb221affa5 |
Proposed branch: | ~morphis/snappy-hwe-snaps/+git/wpa-supplicant:f/snap-setup |
Merge into: | ~snappy-hwe-team/snappy-hwe-snaps/+git/wpa-supplicant:master |
Diff against target: |
585 lines (+501/-0) 14 files modified
.gitignore (+6/-0) MAINTAINERS (+2/-0) bin/wpa.sh (+41/-0) conf/default.conf (+1/-0) run-tests.sh (+76/-0) snap/hooks/configure (+64/-0) snapcraft.yaml (+77/-0) spread.yaml (+75/-0) tests/lib/prepare-each.sh (+39/-0) tests/lib/restore-each.sh (+27/-0) tests/lib/snap-names.sh (+7/-0) tests/lib/utilities.sh (+31/-0) tests/main/configure-hook/task.yaml (+41/-0) tests/main/installation/task.yaml (+14/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
System Enablement Bot | continuous-integration | Approve | |
Konrad ZapaĆowicz (community) | ack | Approve | |
Matteo Croce (community) | Approve | ||
Review via email: mp+319324@code.launchpad.net |
Commit message
Description of the change
Add initial snap build configuration
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:ffc46596cb4
https:/
Executed test runs:
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2a94127c390
https:/
Executed test runs:
FAILURE: https:/
None: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:df6f6456679
https:/
Executed test runs:
FAILURE: https:/
None: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:198ee7d8e58
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:077e0cc78c7
https:/
Executed test runs:
FAILURE: https:/
None: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Jim Hodapp (jhodapp) : | # |
Simon Fels (morphis) : | # |
Jim Hodapp (jhodapp) : | # |
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:34feeb35d5f
https:/
Executed test runs:
FAILURE: https:/
None: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:e4eaf1b2743
https:/
Executed test runs:
FAILURE: https:/
None: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:6c156336217
https:/
Executed test runs:
FAILURE: https:/
None: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:204dae5c56a
https:/
Executed test runs:
FAILURE: https:/
None: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:5b0d364d426
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Matteo Croce (teknoraver) : | # |
Konrad ZapaĆowicz (kzapalowicz) wrote : | # |
looks good
Matteo Croce (teknoraver) : | # |
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3b84b80b3fe
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | diff --git a/.gitignore b/.gitignore |
2 | new file mode 100644 |
3 | index 0000000..2be0dc9 |
4 | --- /dev/null |
5 | +++ b/.gitignore |
6 | @@ -0,0 +1,6 @@ |
7 | +.spread* |
8 | +/parts/ |
9 | +/stage/ |
10 | +/prime/ |
11 | +*.snap |
12 | +.tests-extras |
13 | diff --git a/MAINTAINERS b/MAINTAINERS |
14 | new file mode 100644 |
15 | index 0000000..b9db18f |
16 | --- /dev/null |
17 | +++ b/MAINTAINERS |
18 | @@ -0,0 +1,2 @@ |
19 | +Matteo Croce <matteo.croce@canonical.com> |
20 | +Simon Fels <simon.fels@canonical.com> |
21 | diff --git a/bin/wpa.sh b/bin/wpa.sh |
22 | new file mode 100755 |
23 | index 0000000..6674dee |
24 | --- /dev/null |
25 | +++ b/bin/wpa.sh |
26 | @@ -0,0 +1,41 @@ |
27 | +#!/bin/sh |
28 | +# |
29 | +# Copyright (C) 2017 Canonical Ltd |
30 | +# |
31 | +# This program is free software: you can redistribute it and/or modify |
32 | +# it under the terms of the GNU General Public License version 3 as |
33 | +# published by the Free Software Foundation. |
34 | +# |
35 | +# This program is distributed in the hope that it will be useful, |
36 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
37 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
38 | +# GNU General Public License for more details. |
39 | +# |
40 | +# You should have received a copy of the GNU General Public License |
41 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
42 | + |
43 | +DEBUG=false |
44 | +DRIVER=nl80211 |
45 | +INTERFACE= |
46 | + |
47 | +if [ -e $SNAP_DATA/config.sh ]; then |
48 | + . $SNAP_DATA/config.sh |
49 | +fi |
50 | + |
51 | +EXTRA_ARGS= |
52 | +if [ -n "$INTERFACE" ]; then |
53 | + EXTRA_ARGS="$EXTRA_ARGS -i$INTERFACE -c$SNAP/conf/default.conf" |
54 | +fi |
55 | +if [ "$DEBUG" = "true" ]; then |
56 | + EXTRA_ARGS="$EXTRA_ARGS -ddd -t" |
57 | +fi |
58 | +if [ -n "$DRIVER" ]; then |
59 | + EXTRA_ARGS="$EXTRA_ARGS -D$DRIVER" |
60 | +fi |
61 | + |
62 | +# Cleanup the runtime directory before we start to avoid old |
63 | +# sockets being still there |
64 | +rm -rf $SNAP_DATA/run |
65 | +mkdir -p $SNAP_DATA/run |
66 | + |
67 | +exec $SNAP/bin/wpa_supplicant -u -O $SNAP_DATA/run $EXTRA_ARGS |
68 | diff --git a/conf/default.conf b/conf/default.conf |
69 | new file mode 100644 |
70 | index 0000000..fd69f0b |
71 | --- /dev/null |
72 | +++ b/conf/default.conf |
73 | @@ -0,0 +1 @@ |
74 | +# Empty for now |
75 | diff --git a/run-tests.sh b/run-tests.sh |
76 | new file mode 100755 |
77 | index 0000000..f069bfb |
78 | --- /dev/null |
79 | +++ b/run-tests.sh |
80 | @@ -0,0 +1,76 @@ |
81 | +#!/bin/sh |
82 | +# |
83 | +# Copyright (C) 2016 Canonical Ltd |
84 | +# |
85 | +# This program is free software: you can redistribute it and/or modify |
86 | +# it under the terms of the GNU General Public License version 3 as |
87 | +# published by the Free Software Foundation. |
88 | +# |
89 | +# This program is distributed in the hope that it will be useful, |
90 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
91 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
92 | +# GNU General Public License for more details. |
93 | +# |
94 | +# You should have received a copy of the GNU General Public License |
95 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
96 | + |
97 | +set -e |
98 | + |
99 | +TESTS_EXTRAS_URL="https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/tests-extras" |
100 | +TESTS_EXTRAS_PATH=".tests-extras" |
101 | + |
102 | +show_help() { |
103 | + exec cat <<'EOF' |
104 | +Usage: run-tests.sh [OPTIONS] |
105 | + |
106 | +This is fetch & forget script and what it does is to fetch the |
107 | +tests-extras repository and execute the run-tests.sh script from |
108 | +there passing arguments as-is. |
109 | + |
110 | +When you see this message you don't have the tests-extras repository |
111 | +successfully populated in your workspace yet. Please rerun without |
112 | +specifying --help to proceed with the initial clone of the git repository. |
113 | +EOF |
114 | +} |
115 | + |
116 | +# Clone the tests-extras repository |
117 | +clone_tests_extras() { |
118 | + echo "INFO: Fetching tests-extras scripts into $TESTS_EXTRAS_PATH ..." |
119 | + git clone -b master $TESTS_EXTRAS_URL $TESTS_EXTRAS_PATH >/dev/null 2>&1 |
120 | + if [ $? -ne 0 ]; then |
121 | + echo "ERROR: Failed to fetch the $TESTS_EXTRAS_URL repo, exiting.." |
122 | + exit 1 |
123 | + fi |
124 | +} |
125 | + |
126 | +# Make sure the already cloned tests-extras repository is in a known and update |
127 | +# state before it is going to be used. |
128 | +restore_and_update_tests_extras() { |
129 | + echo "INFO: Restoring and updating $TESTS_EXTRAS_PATH" |
130 | + cd $TESTS_EXTRAS_PATH && git reset --hard && git clean -dfx && git pull |
131 | + cd - |
132 | +} |
133 | + |
134 | +# ============================================================================== |
135 | +# This is fetch & forget script and what it does is to fetch the tests-extras |
136 | +# repo and execute the run-tests.sh script from there passing arguments as-is. |
137 | +# |
138 | +# The tests-extras repository ends up checked out in the snap tree but as a |
139 | +# hidden directory which is re-used since then. |
140 | + |
141 | +[ ! -d "$TESTS_EXTRAS_PATH" ] && [ "$1" = "--help" ] && show_help |
142 | + |
143 | +if [ -d "$TESTS_EXTRAS_PATH" ]; then |
144 | + restore_and_update_tests_extras |
145 | +else |
146 | + clone_tests_extras |
147 | +fi |
148 | + |
149 | +# Any project-specific options for test-runner should be specified in |
150 | +# .tests_config under EXTRA_ARGS |
151 | +if [ -e ".tests_config" ]; then |
152 | + . .tests_config |
153 | +fi |
154 | + |
155 | +echo "INFO: Executing tests runner" |
156 | +cd $TESTS_EXTRAS_PATH && ./tests-runner.sh "$@" "$EXTRA_ARGS" |
157 | diff --git a/snap/hooks/configure b/snap/hooks/configure |
158 | new file mode 100755 |
159 | index 0000000..2efb60b |
160 | --- /dev/null |
161 | +++ b/snap/hooks/configure |
162 | @@ -0,0 +1,64 @@ |
163 | +#!/bin/sh |
164 | +# |
165 | +# This program is free software: you can redistribute it and/or modify |
166 | +# it under the terms of the GNU General Public License version 3 as |
167 | +# published by the Free Software Foundation. |
168 | +# |
169 | +# This program is distributed in the hope that it will be useful, |
170 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
171 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
172 | +# GNU General Public License for more details. |
173 | +# |
174 | +# You should have received a copy of the GNU General Public License |
175 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
176 | + |
177 | +CONF_PATH=$SNAP_DATA/config.sh |
178 | +DEBUG=false |
179 | +INTERFACE= |
180 | +DRIVER=nl80211 |
181 | + |
182 | +for item in debug interface driver ; do |
183 | + value="$(snapctl get $item)" |
184 | + if [ "$item" = "debug" ]; then |
185 | + if [ -z "$value" ] ; then |
186 | + snapctl set debug=false |
187 | + continue |
188 | + fi |
189 | + case "$value" in |
190 | + "true" | "false") |
191 | + ;; |
192 | + *) |
193 | + echo "ERROR: Invalid value '$value' provided for $item" |
194 | + exit 1 |
195 | + ;; |
196 | + esac |
197 | + DEBUG=$value |
198 | + elif [ "$item" = "interface" ]; then |
199 | + if [ -z "$value" ]; then |
200 | + snapctl set interface="" |
201 | + continue |
202 | + fi |
203 | + INTERFACE="$value" |
204 | + elif [ "$item" = "driver" ]; then |
205 | + if [ -z "$value" ] ; then |
206 | + snapctl set driver=nl80211 |
207 | + continue |
208 | + fi |
209 | + case "$value" in |
210 | + "nl80211" | "wext") |
211 | + ;; |
212 | + *) |
213 | + echo "ERROR: Invalid value '$value' provided for $item" |
214 | + exit 1 |
215 | + ;; |
216 | + esac |
217 | + DRIVER="$value" |
218 | + fi |
219 | +done |
220 | + |
221 | +{ |
222 | + echo "# AUTOGENERATED !! DO NOT EDIT !!" |
223 | + echo "DEBUG=$DEBUG" |
224 | + echo "DRIVER=$DRIVER" |
225 | + echo "INTERFACE=$INTERFACE" |
226 | +} > $CONF_PATH |
227 | diff --git a/snapcraft.yaml b/snapcraft.yaml |
228 | new file mode 100644 |
229 | index 0000000..0eb3f20 |
230 | --- /dev/null |
231 | +++ b/snapcraft.yaml |
232 | @@ -0,0 +1,77 @@ |
233 | +name: wpa-supplicant |
234 | +version: 2.4-1-dev |
235 | +summary: WPA supplicant provides client support for WPA and WPA2 (IEEE 802.11i) |
236 | +description: | |
237 | + WPA and WPA2 are methods for securing wireless networks, the former |
238 | + using IEEE 802.1X, and the latter using IEEE 802.11i. This software |
239 | + provides key negotiation with the WPA Authenticator, and controls |
240 | + association with IEEE 802.11i networks. |
241 | + |
242 | + Please find the source of this snap at: |
243 | + |
244 | + https://code.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/wpa-supplicant |
245 | +grade: stable |
246 | +confinement: strict |
247 | + |
248 | +slots: |
249 | + service: |
250 | + interface: dbus |
251 | + bus: system |
252 | + name: fi.w1.wpa_supplicant1 |
253 | + legacy-service: |
254 | + interface: dbus |
255 | + bus: system |
256 | + name: fi.epitest.hostap.WPASupplicant |
257 | + |
258 | +apps: |
259 | + wpa: |
260 | + daemon: simple |
261 | + command: bin/wpa.sh |
262 | + slots: |
263 | + - service |
264 | + - legacy-service |
265 | + plugs: |
266 | + - network-control |
267 | + # FIXME: snapcraft doesn't allow us to specify wpa_cli here and if we do it |
268 | + # fails with an validation error. |
269 | + wpa-cli: |
270 | + command: bin/wpa_cli -p$SNAP_DATA/run |
271 | + plugs: |
272 | + - network |
273 | + aliases: |
274 | + - wpa_cli |
275 | + |
276 | +parts: |
277 | + common: |
278 | + plugin: dump |
279 | + source: . |
280 | + prime: |
281 | + - bin/wpa.sh |
282 | + - conf/default.conf |
283 | + |
284 | + wpa-supplicant: |
285 | + plugin: make |
286 | + source: https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/wpa-supplicant |
287 | + source-type: git |
288 | + source-branch: wpa-supplicant/xenial/2.4 |
289 | + build-packages: |
290 | + - build-essential |
291 | + - libdbus-1-dev |
292 | + - libssl-dev |
293 | + - libncurses5-dev |
294 | + - libpcsclite-dev |
295 | + - libnl-3-dev |
296 | + - libnl-genl-3-dev |
297 | + - libnl-route-3-dev |
298 | + - libpcap-dev |
299 | + - libbsd-dev |
300 | + - libreadline-dev |
301 | + - pkg-config |
302 | + # FIXME needs to be dropped once we don't use the same configuration |
303 | + # anymore as the deb does. |
304 | + - android-headers |
305 | + build: | |
306 | + cp default-config wpa_supplicant/.config |
307 | + cd wpa_supplicant |
308 | + make -j$(nproc) |
309 | + make BINDIR=/bin LIBDIR=/lib DESTDIR=$SNAPCRAFT_PART_INSTALL install |
310 | diff --git a/spread.yaml b/spread.yaml |
311 | new file mode 100644 |
312 | index 0000000..7234733 |
313 | --- /dev/null |
314 | +++ b/spread.yaml |
315 | @@ -0,0 +1,75 @@ |
316 | +# |
317 | +# Copyright (C) 2015, 2016 Canonical Ltd |
318 | +# |
319 | +# This program is free software: you can redistribute it and/or modify |
320 | +# it under the terms of the GNU General Public License version 3 as |
321 | +# published by the Free Software Foundation. |
322 | +# |
323 | +# This program is distributed in the hope that it will be useful, |
324 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
325 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
326 | +# GNU General Public License for more details. |
327 | +# |
328 | +# You should have received a copy of the GNU General Public License |
329 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
330 | + |
331 | +project: wpa-supplicant |
332 | + |
333 | +environment: |
334 | + PROJECT_PATH: /home/wpa-supplicant |
335 | + TESTSLIB: $PROJECT_PATH/tests/lib |
336 | + SNAP_NAME: wpa-supplicant |
337 | + # Allow the host to pass the channel to use for the test rim |
338 | + SNAP_CHANNEL: $(HOST:echo $SNAP_CHANNEL) |
339 | + SNAP_AUTOCONNECT_CORE_PLUGS: network-control |
340 | + SNAP_AUTO_ALIASES: wpa_cli |
341 | + # Set these to different names when you run the tests on hardware where |
342 | + # you need to use different interfaces. |
343 | + HW_WLAN0_NAME: wlan0 |
344 | + HW_WLAN1_NAME: wlan1 |
345 | + |
346 | +backends: |
347 | + qemu: |
348 | + systems: |
349 | + - ubuntu-core-16: |
350 | + username: test |
351 | + password: test |
352 | + external: |
353 | + type: adhoc |
354 | + environment: |
355 | + SPREAD_EXTERNAL_ADDRESS: "$(HOST: echo ${SPREAD_EXTERNAL_ADDRESS:-localhost:8022})" |
356 | + allocate: | |
357 | + ADDRESS $SPREAD_EXTERNAL_ADDRESS |
358 | + systems: |
359 | + - hw-ubuntu-core-16: |
360 | + username: $(HOST:echo $SPREAD_EXTERNAL_USER) |
361 | + password: $(HOST:echo $SPREAD_EXTERNAL_PASSWORD) |
362 | + |
363 | +# Put this somewhere where we have read-write access |
364 | +path: /home/wpa-supplicant |
365 | + |
366 | +exclude: |
367 | + - .git |
368 | + |
369 | +prepare-each: | |
370 | + # Cleanup logs so we can just dump what has happened in the debug-each |
371 | + # step below after a test case ran. |
372 | + journalctl --rotate |
373 | + sleep .1 |
374 | + journalctl --vacuum-time=1ms |
375 | + dmesg -c > /dev/null |
376 | + . $TESTSLIB/prepare-each.sh |
377 | + |
378 | +restore-each: | |
379 | + . $TESTSLIB/restore-each.sh |
380 | + |
381 | +debug-each: | |
382 | + journalctl |
383 | + dmesg | grep DENIED || true |
384 | + |
385 | +suites: |
386 | + tests/main/: |
387 | + summary: Full-system tests for the wpa-supplicant snap |
388 | + systems: |
389 | + - ubuntu-core-16 |
390 | + - hw-ubuntu-core-16 |
391 | diff --git a/tests/lib/prepare-each.sh b/tests/lib/prepare-each.sh |
392 | new file mode 100644 |
393 | index 0000000..19e6b83 |
394 | --- /dev/null |
395 | +++ b/tests/lib/prepare-each.sh |
396 | @@ -0,0 +1,39 @@ |
397 | +#!/bin/bash |
398 | + |
399 | +. $TESTSLIB/utilities.sh |
400 | + |
401 | +if [ "$SPREAD_SYSTEM" = "ubuntu-core-16" ]; then |
402 | + echo "Wait for firstboot change to be ready" |
403 | + while ! snap changes | grep -q "Done"; do |
404 | + snap changes || true |
405 | + snap change 1 || true |
406 | + sleep 1 |
407 | + done |
408 | + |
409 | + echo "Ensure fundamental snaps are still present" |
410 | + . $TESTSLIB/snap-names.sh |
411 | + for name in $gadget_name $kernel_name $core_name; do |
412 | + if ! snap list | grep -q $name ; then |
413 | + echo "Not all fundamental snaps are available, all-snap image not valid" |
414 | + echo "Currently installed snaps:" |
415 | + snap list |
416 | + exit 1 |
417 | + fi |
418 | + done |
419 | + |
420 | + echo "Kernel has a store revision" |
421 | + snap list | grep ^${kernel_name} | grep -E " [0-9]+\s+canonical" |
422 | + |
423 | + install_snap_under_test |
424 | + |
425 | + # Snapshot of the current snapd state for a later restore |
426 | + if [ ! -f $SPREAD_PATH/snapd-state.tar.gz ] ; then |
427 | + systemctl stop snapd.service snapd.socket |
428 | + tar czf $SPREAD_PATH/snapd-state.tar.gz /var/lib/snapd /etc/netplan |
429 | + systemctl start snapd.socket |
430 | + fi |
431 | +fi |
432 | + |
433 | +# For debugging dump all snaps and connected slots/plugs |
434 | +snap list |
435 | +snap interfaces |
436 | diff --git a/tests/lib/restore-each.sh b/tests/lib/restore-each.sh |
437 | new file mode 100644 |
438 | index 0000000..77977d5 |
439 | --- /dev/null |
440 | +++ b/tests/lib/restore-each.sh |
441 | @@ -0,0 +1,27 @@ |
442 | +#!/bin/bash |
443 | + |
444 | +. $TESTSLIB/snap-names.sh |
445 | +. $TESTSLIB/utilities.sh |
446 | + |
447 | +if [ "$SPREAD_SYSTEM" = "hw-ubuntu-core-16" ]; then |
448 | + exit 0 |
449 | +fi |
450 | + |
451 | +# Remove all snaps not being the core, gadget, kernel or snap we're testing |
452 | +for snap in /snap/*; do |
453 | + snap="${snap:6}" |
454 | + case "$snap" in |
455 | + "bin" | "$gadget_name" | "$kernel_name" | "$core_name" ) |
456 | + ;; |
457 | + *) |
458 | + snap remove "$snap" |
459 | + ;; |
460 | + esac |
461 | +done |
462 | + |
463 | +# Ensure we have the same state for snapd as we had before |
464 | +systemctl stop snapd.service snapd.socket |
465 | +rm -rf /var/lib/snapd/* |
466 | +tar xzf $SPREAD_PATH/snapd-state.tar.gz -C / |
467 | +rm -rf /root/.snap |
468 | +systemctl start snapd.service snapd.socket |
469 | diff --git a/tests/lib/snap-names.sh b/tests/lib/snap-names.sh |
470 | new file mode 100644 |
471 | index 0000000..f15b09a |
472 | --- /dev/null |
473 | +++ b/tests/lib/snap-names.sh |
474 | @@ -0,0 +1,7 @@ |
475 | +#!/bin/bash |
476 | +gadget_name=$(snap list | sed -n 's/^\(pc\|pi[23]\|dragonboard\) .*/\1/p') |
477 | +kernel_name=$gadget_name-kernel |
478 | +core_name=$(snap list | awk '/^(ubuntu-)?core / {print $1; exit}') |
479 | +if [ "$kernel_name" = "pi3-kernel" ] ; then |
480 | + kernel_name=pi2-kernel |
481 | +fi |
482 | diff --git a/tests/lib/utilities.sh b/tests/lib/utilities.sh |
483 | new file mode 100644 |
484 | index 0000000..dcca1a5 |
485 | --- /dev/null |
486 | +++ b/tests/lib/utilities.sh |
487 | @@ -0,0 +1,31 @@ |
488 | +#!/bin/sh |
489 | + |
490 | +wait_for_systemd_service() { |
491 | + while ! systemctl status $1 ; do |
492 | + sleep 1 |
493 | + done |
494 | + sleep 1 |
495 | +} |
496 | + |
497 | +install_snap_under_test() { |
498 | + # Stop the system wpa-supplicant which we're going to replace |
499 | + systemctl stop wpa_supplicant |
500 | + if [ -n "$SNAP_CHANNEL" ] ; then |
501 | + # Don't reinstall if we have it installed already installed |
502 | + if ! snap list | grep $SNAP_NAME ; then |
503 | + snap install --$SNAP_CHANNEL $SNAP_NAME |
504 | + fi |
505 | + else |
506 | + snap install --dangerous $PROJECT_PATH/${SNAP_NAME}_*_amd64.snap |
507 | + # As we have a snap which we build locally it's unasserted and therefore |
508 | + # we don't have any snap-declarations in place and need to manually |
509 | + # connect all plugs. |
510 | + for plug in $SNAP_AUTOCONNECT_CORE_PLUGS ; do |
511 | + snap connect $SNAP_NAME:$plug core |
512 | + done |
513 | + # Setup all necessary aliases |
514 | + for alias in $SNAP_AUTO_ALIASES ; do |
515 | + snap alias $SNAP_NAME $alias |
516 | + done |
517 | + fi |
518 | +} |
519 | diff --git a/tests/main/configure-hook/task.yaml b/tests/main/configure-hook/task.yaml |
520 | new file mode 100644 |
521 | index 0000000..1c887ed |
522 | --- /dev/null |
523 | +++ b/tests/main/configure-hook/task.yaml |
524 | @@ -0,0 +1,41 @@ |
525 | +summary: Verify configure hook provides correct default values and applies set ones |
526 | + |
527 | +restore: | |
528 | + rmmod mac80211_hwsim || true |
529 | + |
530 | +execute: | |
531 | + . $TESTSLIB/utilities.sh |
532 | + |
533 | + test "$(snap get wpa-supplicant debug)" = "false" |
534 | + test "$(snap get wpa-supplicant driver)" = "nl80211" |
535 | + test -z "$(snap get wpa-supplicant interface)" |
536 | + |
537 | + test "$(pgrep wpa_supplicant | wc -l)" -eq 1 |
538 | + |
539 | + BASE_WPA_PROCESS_NAME="/snap/wpa-supplicant/.*/bin/wpa_supplicant -u -O /var/snap/wpa-supplicant/.*/run" |
540 | + |
541 | + pgrep -f "$BASE_WPA_PROCESS_NAME -Dnl80211" |
542 | + |
543 | + snap set wpa-supplicant debug=true |
544 | + sudo systemctl restart snap.wpa-supplicant.wpa |
545 | + wait_for_systemd_service snap.wpa-supplicant.wpa |
546 | + # wpa should be now running with -ddd |
547 | + pgrep -f "$BASE_WPA_PROCESS_NAME -ddd -t -Dnl80211" |
548 | + |
549 | + snap set wpa-supplicant driver=wext |
550 | + sudo systemctl restart snap.wpa-supplicant.wpa |
551 | + wait_for_systemd_service snap.wpa-supplicant.wpa |
552 | + pgrep -f "$BASE_WPA_PROCESS_NAME -ddd -t -Dwext" |
553 | + |
554 | + modprobe mac80211_hwsim |
555 | + snap set wpa-supplicant interface=wlan1 |
556 | + sudo systemctl restart snap.wpa-supplicant.wpa |
557 | + wait_for_systemd_service snap.wpa-supplicant.wpa |
558 | + pgrep -f "$BASE_WPA_PROCESS_NAME -iwlan1 -c/snap/wpa-supplicant/.*/conf/default.conf -ddd -t -Dwext" |
559 | + |
560 | + # Verify that invalid values are not possible |
561 | + ! snap set wpa-supplicant debug=12314 |
562 | + ! snap set wpa-supplicant debug="\"/3212as_:;" |
563 | + ! snap set wpa-supplicant driver=nl80211,wext |
564 | + ! snap set wpa-supplicant driver=nl820211 |
565 | + ! snap set wpa-supplicant driver=waxt12 |
566 | diff --git a/tests/main/installation/task.yaml b/tests/main/installation/task.yaml |
567 | new file mode 100644 |
568 | index 0000000..97a6861 |
569 | --- /dev/null |
570 | +++ b/tests/main/installation/task.yaml |
571 | @@ -0,0 +1,14 @@ |
572 | +summary: Verify wpa-supplicant is successfully installed |
573 | + |
574 | +execute: | |
575 | + . $TESTSLIB/utilities.sh |
576 | + |
577 | + # The service should be up and running |
578 | + wait_for_systemd_service snap.wpa-supplicant.wpa |
579 | + |
580 | + # Verify those plugs/slots which should have been automatically connected |
581 | + snap interfaces | grep -Pzq ":network-control +wpa-supplicant" |
582 | + |
583 | + # Both alias and original app should be available |
584 | + test -e /snap/bin/wpa-supplicant.wpa-cli |
585 | + test -e /snap/bin/wpa_cli |
FAILED: Continuous integration, rev:16de7f9c65a 6c598dca3649fdd eae3fb578009c9 /jenkins. canonical. com/system- enablement/ job/generic- build-snap/ 1237/ /jenkins. canonical. com/system- enablement/ job/generic- build-snap- worker/ 285/console /jenkins. canonical. com/system- enablement/ job/generic- update- snap-mp/ 1145/console
https:/
Executed test runs:
FAILURE: https:/
None: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/system- enablement/ job/generic- build-snap/ 1237/rebuild
https:/