Merge ~alfonsosanchezbeato/snappy-hwe-snaps/+git/modem-manager:move-to-mm-1.6 into ~snappy-hwe-team/snappy-hwe-snaps/+git/modem-manager:master
- Git
- lp:~alfonsosanchezbeato/snappy-hwe-snaps/+git/modem-manager
- move-to-mm-1.6
- Merge into master
Status: | Merged |
---|---|
Approved by: | Simon Fels |
Approved revision: | 4b2b29f6baaf6452d5f28ba2fd2fe8e6fcf35099 |
Merged at revision: | ab97434adef3adf88ce9b095fa4c32e6f84c9407 |
Proposed branch: | ~alfonsosanchezbeato/snappy-hwe-snaps/+git/modem-manager:move-to-mm-1.6 |
Merge into: | ~snappy-hwe-team/snappy-hwe-snaps/+git/modem-manager:master |
Diff against target: |
737 lines (+593/-8) 16 files modified
run-tests.sh (+84/-0) snapcraft.yaml (+73/-8) spread.yaml (+50/-0) tests/image/README.md (+7/-0) tests/image/create-image.sh (+157/-0) tests/image/pc-model.json (+11/-0) tests/image/pc.model (+21/-0) tests/image/test-user-assertion.json (+13/-0) tests/image/test-user.assertion (+25/-0) tests/lib/prepare-all.sh (+25/-0) tests/lib/prepare.sh (+49/-0) tests/lib/restore-each.sh (+31/-0) tests/lib/snap-names.sh (+7/-0) tests/lib/utilities.sh (+14/-0) tests/main/installation/task.yaml (+13/-0) tests/main/network-manager-autoconn/task.yaml (+13/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Simon Fels | Approve | ||
System Enablement Bot | continuous-integration | Approve | |
Konrad Zapałowicz (community) | code | Approve | |
Review via email: mp+310532@code.launchpad.net |
Commit message
Update to modem-manager upstream 1.6.2
Description of the change
Update to modem-manager upstream 1.6.2
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:ce38705a18b
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Simon Fels (morphis) wrote : | # |
See comments inline.
Alfonso Sanchez-Beato (alfonsosanchezbeato) : | # |
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:1139799d008
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:1139799d008
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:df7522d5c40
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:df7522d5c40
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Konrad Zapałowicz (kzapalowicz) wrote : | # |
lgtm
Matteo Croce (teknoraver) wrote : | # |
use #!/bin/sh if a script is POSIX
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:ef2538d4310
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
@matteo, comments addressed.
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:ef2538d4310
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Simon Fels (morphis) wrote : | # |
See comments inline
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
@morphis, comments addressed.
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4b2b29f6baa
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4b2b29f6baa
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | diff --git a/run-tests.sh b/run-tests.sh |
2 | new file mode 100755 |
3 | index 0000000..f2e9079 |
4 | --- /dev/null |
5 | +++ b/run-tests.sh |
6 | @@ -0,0 +1,84 @@ |
7 | +#!/bin/sh |
8 | +# |
9 | +# Copyright (C) 2016 Canonical Ltd |
10 | +# |
11 | +# This program is free software: you can redistribute it and/or modify |
12 | +# it under the terms of the GNU General Public License version 3 as |
13 | +# published by the Free Software Foundation. |
14 | +# |
15 | +# This program is distributed in the hope that it will be useful, |
16 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | +# GNU General Public License for more details. |
19 | +# |
20 | +# You should have received a copy of the GNU General Public License |
21 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | + |
23 | +set -ex |
24 | + |
25 | +image_name=ubuntu-core-16.img |
26 | +channel=candidate |
27 | +spread_opts= |
28 | +force_new_image=0 |
29 | +test_from_channel=0 |
30 | + |
31 | +show_help() { |
32 | + echo "Usage: run-tests.sh [OPTIONS]" |
33 | + echo |
34 | + echo "optional arguments:" |
35 | + echo " --help Show this help message and exit" |
36 | + echo " --channel=<channel> Select another channel to build the base image from (default: $channel)" |
37 | + echo " --debug Enable verbose debugging output" |
38 | + echo " --test-from-channel Pull snap from the specified channel instead of building it from source" |
39 | + echo " --force-new-image Force generating a new image used for testing" |
40 | +} |
41 | + |
42 | +while [ -n "$1" ]; do |
43 | + case "$1" in |
44 | + --help) |
45 | + show_help |
46 | + exit |
47 | + ;; |
48 | + --channel=*) |
49 | + channel=${1#*=} |
50 | + shift |
51 | + ;; |
52 | + --test-from-channel) |
53 | + test_from_channel=1 |
54 | + shift |
55 | + ;; |
56 | + --debug) |
57 | + spread_opts="$spread_opts -vv -debug" |
58 | + shift |
59 | + ;; |
60 | + --force-new-image) |
61 | + force_new_image=1 |
62 | + shift |
63 | + ;; |
64 | + *) |
65 | + echo "Unknown command: $1" |
66 | + exit 1 |
67 | + ;; |
68 | + esac |
69 | +done |
70 | + |
71 | +SPREAD_QEMU_PATH="$HOME/.spread/qemu" |
72 | +if [ `which spread` = /snap/bin/spread ] ; then |
73 | + current_version=`readlink /snap/spread/current` |
74 | + SPREAD_QEMU_PATH="$HOME/snap/spread/$current_version/.spread/qemu/" |
75 | +fi |
76 | + |
77 | +# Make sure we have a base image we use for testing |
78 | +if [ ! -e $SPREAD_QEMU_PATH/$image_name ] || [ $force_new_image -eq 1 ] ; then |
79 | + echo "INFO: Creating new qemu test image ..." |
80 | + (cd tests/image ; sudo ./create-image.sh $channel) |
81 | + mkdir -p $SPREAD_QEMU_PATH |
82 | + mv tests/image/ubuntu-core-16.img $SPREAD_QEMU_PATH/$image_name |
83 | +fi |
84 | + |
85 | +# We currently only run spread tests but we could do other things |
86 | +# here as well like running our snap-lintian tool etc. |
87 | +if [ $test_from_channel -eq 1 ] ; then |
88 | + export SNAP_CHANNEL=$channel |
89 | +fi |
90 | +spread $spread_opts |
91 | diff --git a/snapcraft.yaml b/snapcraft.yaml |
92 | index aa73a6e..f8dfd22 100644 |
93 | --- a/snapcraft.yaml |
94 | +++ b/snapcraft.yaml |
95 | @@ -1,5 +1,5 @@ |
96 | name: modem-manager |
97 | -version: 1.4.0-1 |
98 | +version: 1.6.2-1 |
99 | summary: ModemManager is a service which controls mobile broadband |
100 | description: | |
101 | ModemManager is a DBus-activated daemon which controls mobile broadband |
102 | @@ -31,12 +31,58 @@ parts: |
103 | bin/modemmanager: bin/modemmanager |
104 | data/copyright: usr/share/doc/modem-manager/copyright |
105 | |
106 | + libmbim: |
107 | + plugin: autotools |
108 | + |
109 | + source: https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/modem-manager |
110 | + source-type: git |
111 | + source-branch: libmbim/xenial/1.14.0 |
112 | + |
113 | + configflags: |
114 | + - --with-udev |
115 | + - --libexecdir=/usr/lib/libmbim |
116 | + |
117 | + build-packages: |
118 | + - libglib2.0-dev |
119 | + - libgudev-1.0-dev |
120 | + |
121 | + filesets: |
122 | + wanted: |
123 | + - lib/libmbim-glib.so* |
124 | + |
125 | + snap: |
126 | + - $wanted |
127 | + |
128 | + libqmi: |
129 | + after: [ libmbim ] |
130 | + plugin: autotools |
131 | + |
132 | + source: https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/modem-manager |
133 | + source-type: git |
134 | + source-branch: libqmi/xenial/1.16.2 |
135 | + |
136 | + configflags: |
137 | + - --enable-mbim-qmux |
138 | + - --libexecdir=/usr/lib/libqmi |
139 | + |
140 | + build-packages: |
141 | + - intltool |
142 | + - libglib2.0-dev |
143 | + |
144 | + filesets: |
145 | + wanted: |
146 | + - lib/libqmi-glib.so* |
147 | + |
148 | + snap: |
149 | + - $wanted |
150 | + |
151 | modemmanager: |
152 | + after: [ libmbim, libqmi ] |
153 | plugin: autotools |
154 | |
155 | source: https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/modem-manager |
156 | source-type: git |
157 | - source-branch: modem-manager/1.4.0 |
158 | + source-branch: modem-manager/xenial/1.6.2 |
159 | |
160 | configflags: |
161 | - --prefix=/usr |
162 | @@ -44,7 +90,7 @@ parts: |
163 | - --libexecdir=/usr/lib/ModemManager |
164 | - --sysconfdir=/etc |
165 | - --enable-gtk-doc=no |
166 | - - --with-polkit=none |
167 | + - --with-polkit=no |
168 | - --enable-vala=no |
169 | |
170 | build-packages: |
171 | @@ -54,14 +100,12 @@ parts: |
172 | - libdbus-1-dev |
173 | - libiw-dev |
174 | - libglib2.0-dev |
175 | - - libmbim-glib-dev |
176 | - libnl-3-dev |
177 | - libnl-route-3-dev |
178 | - libnl-genl-3-dev |
179 | - libnss3-dev |
180 | - libgnutls28-dev |
181 | - libgcrypt11-dev |
182 | - - libqmi-glib-dev |
183 | - libxml-parser-perl |
184 | - uuid-dev |
185 | - libsystemd-dev |
186 | @@ -89,7 +133,28 @@ parts: |
187 | - libgirepository1.0-dev |
188 | - libglib2.0-dev |
189 | - libgudev-1.0-dev |
190 | - - libqmi-glib-dev |
191 | - - libmbim-glib-dev |
192 | - libglib2.0-doc |
193 | - - libqmi-utils |
194 | + |
195 | + filesets: |
196 | + wanted: |
197 | + - usr/bin/mmcli |
198 | + - usr/sbin/ModemManager |
199 | + - usr/lib/ModemManager/ |
200 | + - usr/lib/x86_64-linux-gnu/libgudev-1.0.so* |
201 | + - usr/lib/libmm-glib.so* |
202 | + - usr/share/doc/libgudev-1.0-0/ |
203 | + # Following libraries could also be pulled from core |
204 | + - usr/lib/x86_64-linux-gnu/libgmodule-2.0.so* |
205 | + - usr/lib/x86_64-linux-gnu/libgio-2.0.so* |
206 | + - usr/lib/x86_64-linux-gnu/libgobject-2.0.so* |
207 | + - usr/lib/x86_64-linux-gnu/libglib-2.0.so* |
208 | + - usr/lib/x86_64-linux-gnu/libffi.so* |
209 | + - usr/lib/x86_64-linux-gnu/libpcre.so* |
210 | + - lib/x86_64-linux-gnu/libglib-2.0.so* |
211 | + - lib/x86_64-linux-gnu/libpcre.so* |
212 | + - usr/share/doc/libglib2.0-* |
213 | + - usr/share/doc/libffi6/ |
214 | + - usr/share/doc/libpcre* |
215 | + |
216 | + snap: |
217 | + - $wanted |
218 | diff --git a/spread.yaml b/spread.yaml |
219 | new file mode 100644 |
220 | index 0000000..8cc5661 |
221 | --- /dev/null |
222 | +++ b/spread.yaml |
223 | @@ -0,0 +1,50 @@ |
224 | +# |
225 | +# Copyright (C) 2016 Canonical Ltd |
226 | +# |
227 | +# This program is free software: you can redistribute it and/or modify |
228 | +# it under the terms of the GNU General Public License version 3 as |
229 | +# published by the Free Software Foundation. |
230 | +# |
231 | +# This program is distributed in the hope that it will be useful, |
232 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
233 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
234 | +# GNU General Public License for more details. |
235 | +# |
236 | +# You should have received a copy of the GNU General Public License |
237 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
238 | + |
239 | + |
240 | +project: modem-manager |
241 | + |
242 | +environment: |
243 | + PROJECT_PATH: /home/modem-manager |
244 | + TESTSLIB: $PROJECT_PATH/tests/lib |
245 | + SNAP_NAME: modem-manager |
246 | + # Allow the host to pass the channel to use for the test run |
247 | + SNAP_CHANNEL: $(HOST:echo $SNAP_CHANNEL) |
248 | + |
249 | +backends: |
250 | + qemu: |
251 | + systems: |
252 | + - ubuntu-core-16: |
253 | + username: test |
254 | + password: test |
255 | + |
256 | +# Put this somewhere where we have read-write access |
257 | +path: /home/modem-manager |
258 | + |
259 | +exclude: |
260 | + - .git |
261 | + |
262 | +prepare: | |
263 | + . $TESTSLIB/prepare-all.sh |
264 | + |
265 | +suites: |
266 | + tests/main/: |
267 | + summary: Full-system tests for ModemManager |
268 | + systems: |
269 | + - ubuntu-core-16 |
270 | + prepare: | |
271 | + . $TESTSLIB/prepare.sh |
272 | + restore-each: | |
273 | + . $TESTSLIB/restore-each.sh |
274 | diff --git a/tests/image/README.md b/tests/image/README.md |
275 | new file mode 100644 |
276 | index 0000000..b75b66e |
277 | --- /dev/null |
278 | +++ b/tests/image/README.md |
279 | @@ -0,0 +1,7 @@ |
280 | +# Generate user password |
281 | + |
282 | +You can generate the password for the system user assertion via |
283 | + |
284 | +``` |
285 | + $ python3 -c 'import crypt; print(crypt.crypt("test", crypt.mksalt(crypt.METHOD_SHA512)))' |
286 | +``` |
287 | diff --git a/tests/image/create-image.sh b/tests/image/create-image.sh |
288 | new file mode 100755 |
289 | index 0000000..4e81fc7 |
290 | --- /dev/null |
291 | +++ b/tests/image/create-image.sh |
292 | @@ -0,0 +1,157 @@ |
293 | +#!/bin/sh |
294 | +# |
295 | +# Copyright (C) 2016 Canonical Ltd |
296 | +# |
297 | +# This program is free software: you can redistribute it and/or modify |
298 | +# it under the terms of the GNU General Public License version 3 as |
299 | +# published by the Free Software Foundation. |
300 | +# |
301 | +# This program is distributed in the hope that it will be useful, |
302 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
303 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
304 | +# GNU General Public License for more details. |
305 | +# |
306 | +# You should have received a copy of the GNU General Public License |
307 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
308 | + |
309 | +set -e |
310 | + |
311 | +if [ $UID -ne 0 ] ; then |
312 | + echo "ERROR: needs to be executed as root" |
313 | + exit 1 |
314 | +fi |
315 | + |
316 | +channel=candidate |
317 | +if [ ! -z "$1" ] ; then |
318 | + channel=$1 |
319 | +fi |
320 | + |
321 | +snap= |
322 | +if [ ! -z "$2" ] ; then |
323 | + snap=$2 |
324 | +fi |
325 | + |
326 | +model=pc |
327 | +arch=amd64 |
328 | +image_name=ubuntu-core-16.img |
329 | +ubuntu_image_extra_args= |
330 | + |
331 | +if [ ! -z "$snap" ] ; then |
332 | + ubuntu_image_extra_args="--extra-snaps $snap" |
333 | +fi |
334 | + |
335 | +ubuntu-image \ |
336 | + --channel $channel \ |
337 | + -o $image_name \ |
338 | + --image-size 4G \ |
339 | + $ubuntu_image_extra_args \ |
340 | + $model.model |
341 | + |
342 | +kpartx -a $image_name |
343 | +sleep 0.5 |
344 | + |
345 | +loop_path=`findfs LABEL=writable` |
346 | +tmp_mount=`mktemp -d` |
347 | + |
348 | +mount $loop_path $tmp_mount |
349 | + |
350 | +# Migrate all systemd units from core snap into the writable area. This |
351 | +# would be normally done on firstboot by the initramfs but we can't rely |
352 | +# on that because we are adding another file in there and that will |
353 | +# prevent the initramfs from transitioning any files. |
354 | +core_snap=$(find $tmp_mount/system-data/var/lib/snapd/snaps -name "core_*.snap") |
355 | +tmp_core=`mktemp -d` |
356 | +mount $core_snap $tmp_core |
357 | +mkdir -p $tmp_mount/system-data/etc/systemd |
358 | +cp -rav $tmp_core/etc/systemd/* \ |
359 | + $tmp_mount/system-data/etc/systemd/ |
360 | +umount $tmp_core |
361 | +rm -rf $tmp_core |
362 | + |
363 | +# system-user assertion which gives us our test:test user we use to |
364 | +# log into the system |
365 | +mkdir -p $tmp_mount/system-data/var/lib/snapd/seed/assertions |
366 | +cp test-user.assertion $tmp_mount/system-data/var/lib/snapd/seed/assertions |
367 | + |
368 | +# Disable console-conf for the first boot |
369 | +mkdir -p $tmp_mount/system-data/var/lib/console-conf/ |
370 | +touch $tmp_mount/system-data/var/lib/console-conf/complete |
371 | + |
372 | +# Create systemd service which is running on firstboot and sets up |
373 | +# various things for us. |
374 | +mkdir -p $tmp_mount/system-data/etc/systemd/system |
375 | +cat << 'EOF' > $tmp_mount/system-data/etc/systemd/system/devmode-firstboot.service |
376 | +[Unit] |
377 | +Description=Run devmode firstboot setup |
378 | +After=snapd.service snapd.socket |
379 | + |
380 | +[Service] |
381 | +Type=oneshot |
382 | +ExecStart=/writable/system-data/var/lib/devmode-firstboot/run.sh |
383 | +RemainAfterExit=yes |
384 | +TimeoutSec=3min |
385 | +EOF |
386 | + |
387 | +mkdir -p $tmp_mount/system-data/etc/systemd/system/multi-user.target.wants |
388 | +ln -sf /etc/systemd/system/devmode-firstboot.service \ |
389 | + $tmp_mount/system-data/etc/systemd/system/multi-user.target.wants/devmode-firstboot.service |
390 | + |
391 | +mkdir $tmp_mount/system-data/var/lib/devmode-firstboot |
392 | +cat << EOF > $tmp_mount/system-data/var/lib/devmode-firstboot/00-snapd-config.yaml |
393 | +network: |
394 | + version: 2 |
395 | + ethernets: |
396 | + eth0: |
397 | + dhcp4: true |
398 | +EOF |
399 | + |
400 | +cat << 'EOF' > $tmp_mount/system-data/var/lib/devmode-firstboot/run.sh |
401 | +#!/bin/sh |
402 | + |
403 | +set -e |
404 | + |
405 | +# Don't start again if we're already done |
406 | +if [ -e /writable/system-data/var/lib/devmode-firstboot/complete ] ; then |
407 | + exit 0 |
408 | +fi |
409 | + |
410 | +echo "Start devmode-firstboot $(date -Iseconds --utc)" |
411 | + |
412 | +if [ "$(snap managed)" = "true" ]; then |
413 | + echo "System already managed, exiting" |
414 | + exit 0 |
415 | +fi |
416 | + |
417 | +# no changes at all |
418 | +while ! snap changes ; do |
419 | + echo "No changes yet, waiting" |
420 | + sleep 1 |
421 | +done |
422 | + |
423 | +while snap changes | grep -qE '(Do|Doing) .*Initialize system state' ; do |
424 | + echo "Initialize system state is in progress, waiting" |
425 | + sleep 1 |
426 | +done |
427 | + |
428 | +if [ -n "$(snap known system-user)" ]; then |
429 | + echo "Trying to create known user" |
430 | + snap create-user --known --sudoer |
431 | +fi |
432 | + |
433 | +cp /writable/system-data/var/lib/devmode-firstboot/00-snapd-config.yaml /writable/system-data/etc/netplan |
434 | + |
435 | +# Enable console-conf again |
436 | +rm /writable/system-data/var/lib/console-conf/complete |
437 | + |
438 | +# Mark us done |
439 | +touch /writable/system-data/var/lib/devmode-firstboot/complete |
440 | + |
441 | +# Reboot the system as its now prepared for the user |
442 | +reboot |
443 | +EOF |
444 | + |
445 | +chmod +x $tmp_mount/system-data/var/lib/devmode-firstboot/run.sh |
446 | + |
447 | +umount $tmp_mount |
448 | +kpartx -d $image_name |
449 | +rm -rf $tmp_mount |
450 | diff --git a/tests/image/pc-model.json b/tests/image/pc-model.json |
451 | new file mode 100644 |
452 | index 0000000..2eb1411 |
453 | --- /dev/null |
454 | +++ b/tests/image/pc-model.json |
455 | @@ -0,0 +1,11 @@ |
456 | +{ |
457 | + "type": "model", |
458 | + "authority-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf", |
459 | + "brand-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf", |
460 | + "series": "16", |
461 | + "model": "pc", |
462 | + "architecture": "amd64", |
463 | + "gadget": "pc", |
464 | + "kernel": "pc-kernel", |
465 | + "timestamp": "2016-09-09T08:27:36+00:00" |
466 | +} |
467 | diff --git a/tests/image/pc.model b/tests/image/pc.model |
468 | new file mode 100644 |
469 | index 0000000..345b7e4 |
470 | --- /dev/null |
471 | +++ b/tests/image/pc.model |
472 | @@ -0,0 +1,21 @@ |
473 | +type: model |
474 | +authority-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf |
475 | +series: 16 |
476 | +brand-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf |
477 | +model: pc |
478 | +architecture: amd64 |
479 | +gadget: pc |
480 | +kernel: pc-kernel |
481 | +timestamp: 2016-09-09T08:27:36+00:00 |
482 | +sign-key-sha3-384: a4qX7md6GQGNcZc_cmWPBStTq4RNCnGTzF-4usF5wFylQ-xZQej-SD6prx8Yl89O |
483 | + |
484 | +AcLBXAQAAQoABgUCWBBNTwAKCRAVoE002xqmOPH/EACWLf1UeZgICjNbzLI5bO/84LExS8iUjarG |
485 | +S7DRn8Ln5zu44pxz7UXJNjULgnU8yuKVPVWg0ij7DRvaj8tGxOMMAls1fjSRtEYR8oJFsI3jXDGw |
486 | +cLjvJG/crUxV8DgdZFlF02Kb5VtmNDXs1OE3zpPeniG19JYHaf2hDz4SRmWZe4c2MFrAt2UwI/VC |
487 | +o/209Fl3qA8p8x5EYOBycgHooHm3924NTF9mXbKSfLRgGS7YzmN4FXFyiGOTY6CRsp37XnkxGcA1 |
488 | ++lyZz1X97qT/fOGVUFqHDqUZmuCs5sC3+DNonytTgKt5+7S+V+Ai45HEayD5f4gS9uscnTMTwEEJ |
489 | +VgSZRU0My+iJwFlXHaGWQe9eC37YCZ3ahBxc2SpkFffXjYhEMtTtr1vDIYCAhbc2k8aa3hPE2GUg |
490 | +3pv8zs1AuZzSVX+Rp4ysMBqU23UUVP6Bmvr7ZD3E8aEUxE6O/BEA10Km5oZPqpmBfcEVO8a0yZjn |
491 | +YQxn4XzY1Nwq1d0sJIV7FEDsq9dXH9QCa4qsCH3KG3jHv32GapvLf8mpr6HSH+JmPM5kNeVugLVy |
492 | +/RUAFNu+Y4hqhpRNC8fc+UDkVBXsLDqHb5gfXnhbFIH8LvpVFR20SSkg9/Km5xC+7wcey0h8SD6/ |
493 | +Eh70OPLxDkzitEn/1L/0V987dlJnhS4WpqrYfbHYwQ== |
494 | diff --git a/tests/image/test-user-assertion.json b/tests/image/test-user-assertion.json |
495 | new file mode 100644 |
496 | index 0000000..81f6beb |
497 | --- /dev/null |
498 | +++ b/tests/image/test-user-assertion.json |
499 | @@ -0,0 +1,13 @@ |
500 | +{ |
501 | + "type": "system-user", |
502 | + "authority-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf", |
503 | + "brand-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf", |
504 | + "series": ["16"], |
505 | + "models": ["pc"], |
506 | + "name": "Default Test User", |
507 | + "username": "test", |
508 | + "email": "test@localhost", |
509 | + "password": "$6$OCvKy4w/Ppxp7IvC$WPzWiIW.4y18h9htjbOuxLZ.sjQ5M2hoSiEu3FpMU0PMdHQuQdBOqvk8p6DMdS/R/nU/rXidClD23CbSkSgp30", |
510 | + "since": "2016-10-24T07:12:10+00:00", |
511 | + "until": "2017-10-24T07:12:10+00:00" |
512 | +} |
513 | diff --git a/tests/image/test-user.assertion b/tests/image/test-user.assertion |
514 | new file mode 100644 |
515 | index 0000000..7ebb667 |
516 | --- /dev/null |
517 | +++ b/tests/image/test-user.assertion |
518 | @@ -0,0 +1,25 @@ |
519 | +type: system-user |
520 | +authority-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf |
521 | +brand-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf |
522 | +email: test@localhost |
523 | +models: |
524 | + - pc |
525 | +name: Default Test User |
526 | +password: $6$OCvKy4w/Ppxp7IvC$WPzWiIW.4y18h9htjbOuxLZ.sjQ5M2hoSiEu3FpMU0PMdHQuQdBOqvk8p6DMdS/R/nU/rXidClD23CbSkSgp30 |
527 | +series: |
528 | + - 16 |
529 | +since: 2016-10-24T07:12:10+00:00 |
530 | +until: 2017-10-24T07:12:10+00:00 |
531 | +username: test |
532 | +sign-key-sha3-384: a4qX7md6GQGNcZc_cmWPBStTq4RNCnGTzF-4usF5wFylQ-xZQej-SD6prx8Yl89O |
533 | + |
534 | +AcLBXAQAAQoABgUCWBBOJAAKCRAVoE002xqmOKaRD/0cEKWb2nbwhk+BTgOrYZHrwzjbIWTZznDh |
535 | +xCD6JWF/yr9br1vEmRz2zCNPPWZgFH9HaJ+mT/lktWIs7VVMIdwMDWYOR8P9rdWM/Jx6iyB3z0OI |
536 | +YO31zaU4XLyolv/YSj/nFXMMD+jIeE4l8j4AtCSJwd7ZS9Jz8F/RfrD8EpG0JU1F55lq8MC0mjZ4 |
537 | +ul5ws8k9UiP8nA5IAG30NvvReiUGYqtdkO43eQmy88WABL95MbFsbfEk4/VduG0Gt3y/T8vDDcF6 |
538 | +NJEm8L+O9IXnPBAje0Ve0NX3YtOE3CDTkYRKR7xFFJq2cJVCSvf9CsorREg4KyfagIdMKDSa5Tiq |
539 | +FzoAJTfI0ltq5cAnLImtxFKulJ+AnGUNMLrKFr1H0FGtqTZBfs/PcIxy0qY0YDXSF4/9F2PUBdQS |
540 | +tSmN6pT9t1FCGy2Rf5n3QV4e0R2JzS6Kx+vdbPMYqhssQosLU5GwlWj8UbevtphAGf8u8nLBDYWs |
541 | +MNIPi0IrPmzIewZBD05A6a8T+oHZ9dIg5SAnJ4gmz0sCzNDKarvYqLpcU1rZzu78/UypbHXDvBAt |
542 | +gnxYpD6WHR2aHSeyx3WvOp130jFco2/55M0RTEm50isO1uv2DqTn9ULkBdCrG/zOqEmZgY18ds3P |
543 | +yTaAbaIAqUe7scpAHY0a31tfnXq8cRyEX03e9g2Mrg== |
544 | diff --git a/tests/lib/prepare-all.sh b/tests/lib/prepare-all.sh |
545 | new file mode 100644 |
546 | index 0000000..38bfb5b |
547 | --- /dev/null |
548 | +++ b/tests/lib/prepare-all.sh |
549 | @@ -0,0 +1,25 @@ |
550 | +#!/bin/sh |
551 | + |
552 | +# We don't have to build a snap when we should use one from a |
553 | +# channel |
554 | +if [ -n "$SNAP_CHANNEL" ] ; then |
555 | + exit 0 |
556 | +fi |
557 | + |
558 | +# Setup classic snap and build the modem-manager snap in there |
559 | +snap install --devmode --beta classic |
560 | +cat <<-EOF > /home/test/build-snap.sh |
561 | +#!/bin/sh |
562 | +set -ex |
563 | +apt update |
564 | +apt install -y --force-yes snapcraft |
565 | +cd /home/modem-manager |
566 | +snapcraft clean |
567 | +snapcraft |
568 | +EOF |
569 | +chmod +x /home/test/build-snap.sh |
570 | +sudo classic /home/test/build-snap.sh |
571 | +snap remove classic |
572 | + |
573 | +# Make sure we have a snap build |
574 | +test -e /home/modem-manager/modem-manager_*_amd64.snap |
575 | diff --git a/tests/lib/prepare.sh b/tests/lib/prepare.sh |
576 | new file mode 100644 |
577 | index 0000000..8956644 |
578 | --- /dev/null |
579 | +++ b/tests/lib/prepare.sh |
580 | @@ -0,0 +1,49 @@ |
581 | +#!/bin/sh |
582 | + |
583 | +echo "Wait for firstboot change to be ready" |
584 | +while ! snap changes | grep -q "Done"; do |
585 | + snap changes || true |
586 | + snap change 1 || true |
587 | + sleep 1 |
588 | +done |
589 | + |
590 | +echo "Ensure fundamental snaps are still present" |
591 | +. $TESTSLIB/snap-names.sh |
592 | +for name in $gadget_name $kernel_name $core_name; do |
593 | + if ! snap list | grep -q $name ; then |
594 | + echo "Not all fundamental snaps are available, all-snap image not valid" |
595 | + echo "Currently installed snaps:" |
596 | + snap list |
597 | + exit 1 |
598 | + fi |
599 | +done |
600 | + |
601 | +echo "Kernel has a store revision" |
602 | +snap list | grep ^${kernel_name} | grep -E " [0-9]+\s+canonical" |
603 | + |
604 | +# If we don't install modem-manager here we get a system |
605 | +# without any network connectivity after reboot. |
606 | +if [ -n "$SNAP_CHANNEL" ] ; then |
607 | + # Don't reinstall if we have it installed already |
608 | + if ! snap list | grep modem-manager ; then |
609 | + snap install --$SNAP_CHANNEL modem-manager |
610 | + fi |
611 | +else |
612 | + # Install prebuilt modem-manager snap |
613 | + snap install --dangerous /home/modem-manager/modem-manager_*_amd64.snap |
614 | + # As we have a snap which we build locally its unasserted and therefore |
615 | + # we don't have any snap-declarations in place and need to manually |
616 | + # connect all plugs. |
617 | + sudo snap connect modem-manager:mmcli modem-manager:service |
618 | +fi |
619 | + |
620 | +# Snapshot of the current snapd state for a later restore |
621 | +if [ ! -f $SPREAD_PATH/snapd-state.tar.gz ] ; then |
622 | + systemctl stop snapd.service snapd.socket |
623 | + tar czf $SPREAD_PATH/snapd-state.tar.gz /var/lib/snapd /etc/netplan |
624 | + systemctl start snapd.socket |
625 | +fi |
626 | + |
627 | +# For debugging dump all snaps and connected slots/plugs |
628 | +snap list |
629 | +snap interfaces |
630 | diff --git a/tests/lib/restore-each.sh b/tests/lib/restore-each.sh |
631 | new file mode 100644 |
632 | index 0000000..a7662cc |
633 | --- /dev/null |
634 | +++ b/tests/lib/restore-each.sh |
635 | @@ -0,0 +1,31 @@ |
636 | +#!/bin/sh |
637 | + |
638 | +. $TESTSLIB/snap-names.sh |
639 | + |
640 | +# Remove all snaps not being the core, gadget, kernel or snap we're testing |
641 | +for snap in /snap/*; do |
642 | + snap="${snap:6}" |
643 | + case "$snap" in |
644 | + "bin" | "$gadget_name" | "$kernel_name" | "$core_name" | "$SNAP_NAME" ) |
645 | + ;; |
646 | + *) |
647 | + snap remove "$snap" |
648 | + ;; |
649 | + esac |
650 | +done |
651 | + |
652 | +# Cleanup all configuration files from ModemManager so that we have |
653 | +# a fresh start for the next test |
654 | +rm -rf /var/snap/modem-manager/common/* |
655 | +rm -rf /var/snap/modem-manager/current/* |
656 | +systemctl stop snap.modem-manager.modemmanager |
657 | + |
658 | +# Ensure we have the same state for snapd as we had before |
659 | +systemctl stop snapd.service snapd.socket |
660 | +rm -rf /var/lib/snapd/* |
661 | +$(cd / && tar xzf $SPREAD_PATH/snapd-state.tar.gz) |
662 | +rm -rf /root/.snap |
663 | +systemctl start snapd.service snapd.socket |
664 | + |
665 | +# Bringup ModemManager again now that the system is restored |
666 | +systemctl start snap.modem-manager.modemmanager |
667 | diff --git a/tests/lib/snap-names.sh b/tests/lib/snap-names.sh |
668 | new file mode 100644 |
669 | index 0000000..71c9628 |
670 | --- /dev/null |
671 | +++ b/tests/lib/snap-names.sh |
672 | @@ -0,0 +1,7 @@ |
673 | +#!/bin/sh |
674 | +gadget_name=$(snap list | sed -n 's/^\(pc\|pi[23]\|dragonboard\) .*/\1/p') |
675 | +kernel_name=$gadget_name-kernel |
676 | +core_name=$(snap list | awk '/^(ubuntu-)?core / {print $1; exit}') |
677 | +if [ "$kernel_name" = "pi3-kernel" ] ; then |
678 | + kernel_name=pi2-kernel |
679 | +fi |
680 | diff --git a/tests/lib/utilities.sh b/tests/lib/utilities.sh |
681 | new file mode 100644 |
682 | index 0000000..aaf51f0 |
683 | --- /dev/null |
684 | +++ b/tests/lib/utilities.sh |
685 | @@ -0,0 +1,14 @@ |
686 | +#!/bin/sh |
687 | + |
688 | +wait_for_modem_manager() { |
689 | + while ! systemctl status snap.modem-manager.modemmanager ; do |
690 | + sleep 1 |
691 | + done |
692 | + sleep 1 |
693 | +} |
694 | + |
695 | +stop_after_first_reboot() { |
696 | + if [ $SPREAD_REBOOT -eq 1 ] ; then |
697 | + exit 0 |
698 | + fi |
699 | +} |
700 | diff --git a/tests/main/installation/task.yaml b/tests/main/installation/task.yaml |
701 | new file mode 100644 |
702 | index 0000000..ae90c54 |
703 | --- /dev/null |
704 | +++ b/tests/main/installation/task.yaml |
705 | @@ -0,0 +1,13 @@ |
706 | +summary: Test modem-manager snap installation was successful |
707 | + |
708 | +execute: | |
709 | + . $TESTSLIB/utilities.sh |
710 | + |
711 | + # Service should be up an running |
712 | + wait_for_modem_manager |
713 | + |
714 | + # .. and mmcli should be able to reach ModemManager |
715 | + /snap/bin/modem-manager.mmcli -L |
716 | + |
717 | + # Ensure all necessary plugs/slots are connected |
718 | + snap interfaces | grep -Pzq "modem-manager:service +modem-manager:mmcli" |
719 | diff --git a/tests/main/network-manager-autoconn/task.yaml b/tests/main/network-manager-autoconn/task.yaml |
720 | new file mode 100644 |
721 | index 0000000..7092b7f |
722 | --- /dev/null |
723 | +++ b/tests/main/network-manager-autoconn/task.yaml |
724 | @@ -0,0 +1,13 @@ |
725 | +summary: Test modem-manager snap installation was successful |
726 | + |
727 | +execute: | |
728 | + . $TESTSLIB/utilities.sh |
729 | + |
730 | + # Service should be up an running |
731 | + wait_for_modem_manager |
732 | + |
733 | + snap install network-manager |
734 | + |
735 | + # Ensure all necessary plugs/slots are connected |
736 | + snap interfaces | grep -Ezq "modem-manager:service .*modem-manager:mmcli" |
737 | + snap interfaces | grep -Ezq "modem-manager:service .*network-manager:modem-manager" |
PLEASE DO NOT MERGE YET (not until A release)