Merge ~alfonsosanchezbeato/snappy-hwe-snaps/+git/modem-manager:move-to-mm-1.6 into ~snappy-hwe-team/snappy-hwe-snaps/+git/modem-manager:master

Proposed by Alfonso Sanchez-Beato
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)
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

To post a comment you must log in.
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

PLEASE DO NOT MERGE YET (not until A release)

Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Simon Fels (morphis) wrote :

See comments inline.

review: Needs Fixing
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) :
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote :

lgtm

review: Approve (code)
Revision history for this message
Matteo Croce (teknoraver) wrote :

use #!/bin/sh if a script is POSIX

Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

@matteo, comments addressed.

Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Simon Fels (morphis) wrote :

See comments inline

review: Needs Fixing
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

@morphis, comments addressed.

Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Simon Fels (morphis) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/run-tests.sh b/run-tests.sh
0new file mode 1007550new file mode 100755
index 0000000..f2e9079
--- /dev/null
+++ b/run-tests.sh
@@ -0,0 +1,84 @@
1#!/bin/sh
2#
3# Copyright (C) 2016 Canonical Ltd
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 3 as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17set -ex
18
19image_name=ubuntu-core-16.img
20channel=candidate
21spread_opts=
22force_new_image=0
23test_from_channel=0
24
25show_help() {
26 echo "Usage: run-tests.sh [OPTIONS]"
27 echo
28 echo "optional arguments:"
29 echo " --help Show this help message and exit"
30 echo " --channel=<channel> Select another channel to build the base image from (default: $channel)"
31 echo " --debug Enable verbose debugging output"
32 echo " --test-from-channel Pull snap from the specified channel instead of building it from source"
33 echo " --force-new-image Force generating a new image used for testing"
34}
35
36while [ -n "$1" ]; do
37 case "$1" in
38 --help)
39 show_help
40 exit
41 ;;
42 --channel=*)
43 channel=${1#*=}
44 shift
45 ;;
46 --test-from-channel)
47 test_from_channel=1
48 shift
49 ;;
50 --debug)
51 spread_opts="$spread_opts -vv -debug"
52 shift
53 ;;
54 --force-new-image)
55 force_new_image=1
56 shift
57 ;;
58 *)
59 echo "Unknown command: $1"
60 exit 1
61 ;;
62 esac
63done
64
65SPREAD_QEMU_PATH="$HOME/.spread/qemu"
66if [ `which spread` = /snap/bin/spread ] ; then
67 current_version=`readlink /snap/spread/current`
68 SPREAD_QEMU_PATH="$HOME/snap/spread/$current_version/.spread/qemu/"
69fi
70
71# Make sure we have a base image we use for testing
72if [ ! -e $SPREAD_QEMU_PATH/$image_name ] || [ $force_new_image -eq 1 ] ; then
73 echo "INFO: Creating new qemu test image ..."
74 (cd tests/image ; sudo ./create-image.sh $channel)
75 mkdir -p $SPREAD_QEMU_PATH
76 mv tests/image/ubuntu-core-16.img $SPREAD_QEMU_PATH/$image_name
77fi
78
79# We currently only run spread tests but we could do other things
80# here as well like running our snap-lintian tool etc.
81if [ $test_from_channel -eq 1 ] ; then
82 export SNAP_CHANNEL=$channel
83fi
84spread $spread_opts
diff --git a/snapcraft.yaml b/snapcraft.yaml
index aa73a6e..f8dfd22 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -1,5 +1,5 @@
1name: modem-manager1name: modem-manager
2version: 1.4.0-12version: 1.6.2-1
3summary: ModemManager is a service which controls mobile broadband3summary: ModemManager is a service which controls mobile broadband
4description: |4description: |
5 ModemManager is a DBus-activated daemon which controls mobile broadband5 ModemManager is a DBus-activated daemon which controls mobile broadband
@@ -31,12 +31,58 @@ parts:
31 bin/modemmanager: bin/modemmanager31 bin/modemmanager: bin/modemmanager
32 data/copyright: usr/share/doc/modem-manager/copyright32 data/copyright: usr/share/doc/modem-manager/copyright
3333
34 libmbim:
35 plugin: autotools
36
37 source: https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/modem-manager
38 source-type: git
39 source-branch: libmbim/xenial/1.14.0
40
41 configflags:
42 - --with-udev
43 - --libexecdir=/usr/lib/libmbim
44
45 build-packages:
46 - libglib2.0-dev
47 - libgudev-1.0-dev
48
49 filesets:
50 wanted:
51 - lib/libmbim-glib.so*
52
53 snap:
54 - $wanted
55
56 libqmi:
57 after: [ libmbim ]
58 plugin: autotools
59
60 source: https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/modem-manager
61 source-type: git
62 source-branch: libqmi/xenial/1.16.2
63
64 configflags:
65 - --enable-mbim-qmux
66 - --libexecdir=/usr/lib/libqmi
67
68 build-packages:
69 - intltool
70 - libglib2.0-dev
71
72 filesets:
73 wanted:
74 - lib/libqmi-glib.so*
75
76 snap:
77 - $wanted
78
34 modemmanager:79 modemmanager:
80 after: [ libmbim, libqmi ]
35 plugin: autotools81 plugin: autotools
3682
37 source: https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/modem-manager83 source: https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/modem-manager
38 source-type: git84 source-type: git
39 source-branch: modem-manager/1.4.085 source-branch: modem-manager/xenial/1.6.2
4086
41 configflags:87 configflags:
42 - --prefix=/usr88 - --prefix=/usr
@@ -44,7 +90,7 @@ parts:
44 - --libexecdir=/usr/lib/ModemManager90 - --libexecdir=/usr/lib/ModemManager
45 - --sysconfdir=/etc91 - --sysconfdir=/etc
46 - --enable-gtk-doc=no92 - --enable-gtk-doc=no
47 - --with-polkit=none93 - --with-polkit=no
48 - --enable-vala=no94 - --enable-vala=no
4995
50 build-packages:96 build-packages:
@@ -54,14 +100,12 @@ parts:
54 - libdbus-1-dev100 - libdbus-1-dev
55 - libiw-dev101 - libiw-dev
56 - libglib2.0-dev102 - libglib2.0-dev
57 - libmbim-glib-dev
58 - libnl-3-dev103 - libnl-3-dev
59 - libnl-route-3-dev104 - libnl-route-3-dev
60 - libnl-genl-3-dev105 - libnl-genl-3-dev
61 - libnss3-dev106 - libnss3-dev
62 - libgnutls28-dev107 - libgnutls28-dev
63 - libgcrypt11-dev108 - libgcrypt11-dev
64 - libqmi-glib-dev
65 - libxml-parser-perl109 - libxml-parser-perl
66 - uuid-dev110 - uuid-dev
67 - libsystemd-dev111 - libsystemd-dev
@@ -89,7 +133,28 @@ parts:
89 - libgirepository1.0-dev133 - libgirepository1.0-dev
90 - libglib2.0-dev134 - libglib2.0-dev
91 - libgudev-1.0-dev135 - libgudev-1.0-dev
92 - libqmi-glib-dev
93 - libmbim-glib-dev
94 - libglib2.0-doc136 - libglib2.0-doc
95 - libqmi-utils137
138 filesets:
139 wanted:
140 - usr/bin/mmcli
141 - usr/sbin/ModemManager
142 - usr/lib/ModemManager/
143 - usr/lib/x86_64-linux-gnu/libgudev-1.0.so*
144 - usr/lib/libmm-glib.so*
145 - usr/share/doc/libgudev-1.0-0/
146 # Following libraries could also be pulled from core
147 - usr/lib/x86_64-linux-gnu/libgmodule-2.0.so*
148 - usr/lib/x86_64-linux-gnu/libgio-2.0.so*
149 - usr/lib/x86_64-linux-gnu/libgobject-2.0.so*
150 - usr/lib/x86_64-linux-gnu/libglib-2.0.so*
151 - usr/lib/x86_64-linux-gnu/libffi.so*
152 - usr/lib/x86_64-linux-gnu/libpcre.so*
153 - lib/x86_64-linux-gnu/libglib-2.0.so*
154 - lib/x86_64-linux-gnu/libpcre.so*
155 - usr/share/doc/libglib2.0-*
156 - usr/share/doc/libffi6/
157 - usr/share/doc/libpcre*
158
159 snap:
160 - $wanted
diff --git a/spread.yaml b/spread.yaml
96new file mode 100644161new file mode 100644
index 0000000..8cc5661
--- /dev/null
+++ b/spread.yaml
@@ -0,0 +1,50 @@
1#
2# Copyright (C) 2016 Canonical Ltd
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License version 3 as
6# published by the Free Software Foundation.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16
17project: modem-manager
18
19environment:
20 PROJECT_PATH: /home/modem-manager
21 TESTSLIB: $PROJECT_PATH/tests/lib
22 SNAP_NAME: modem-manager
23 # Allow the host to pass the channel to use for the test run
24 SNAP_CHANNEL: $(HOST:echo $SNAP_CHANNEL)
25
26backends:
27 qemu:
28 systems:
29 - ubuntu-core-16:
30 username: test
31 password: test
32
33# Put this somewhere where we have read-write access
34path: /home/modem-manager
35
36exclude:
37 - .git
38
39prepare: |
40 . $TESTSLIB/prepare-all.sh
41
42suites:
43 tests/main/:
44 summary: Full-system tests for ModemManager
45 systems:
46 - ubuntu-core-16
47 prepare: |
48 . $TESTSLIB/prepare.sh
49 restore-each: |
50 . $TESTSLIB/restore-each.sh
diff --git a/tests/image/README.md b/tests/image/README.md
0new file mode 10064451new file mode 100644
index 0000000..b75b66e
--- /dev/null
+++ b/tests/image/README.md
@@ -0,0 +1,7 @@
1# Generate user password
2
3You can generate the password for the system user assertion via
4
5```
6 $ python3 -c 'import crypt; print(crypt.crypt("test", crypt.mksalt(crypt.METHOD_SHA512)))'
7```
diff --git a/tests/image/create-image.sh b/tests/image/create-image.sh
0new file mode 1007558new file mode 100755
index 0000000..4e81fc7
--- /dev/null
+++ b/tests/image/create-image.sh
@@ -0,0 +1,157 @@
1#!/bin/sh
2#
3# Copyright (C) 2016 Canonical Ltd
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 3 as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17set -e
18
19if [ $UID -ne 0 ] ; then
20 echo "ERROR: needs to be executed as root"
21 exit 1
22fi
23
24channel=candidate
25if [ ! -z "$1" ] ; then
26 channel=$1
27fi
28
29snap=
30if [ ! -z "$2" ] ; then
31 snap=$2
32fi
33
34model=pc
35arch=amd64
36image_name=ubuntu-core-16.img
37ubuntu_image_extra_args=
38
39if [ ! -z "$snap" ] ; then
40 ubuntu_image_extra_args="--extra-snaps $snap"
41fi
42
43ubuntu-image \
44 --channel $channel \
45 -o $image_name \
46 --image-size 4G \
47 $ubuntu_image_extra_args \
48 $model.model
49
50kpartx -a $image_name
51sleep 0.5
52
53loop_path=`findfs LABEL=writable`
54tmp_mount=`mktemp -d`
55
56mount $loop_path $tmp_mount
57
58# Migrate all systemd units from core snap into the writable area. This
59# would be normally done on firstboot by the initramfs but we can't rely
60# on that because we are adding another file in there and that will
61# prevent the initramfs from transitioning any files.
62core_snap=$(find $tmp_mount/system-data/var/lib/snapd/snaps -name "core_*.snap")
63tmp_core=`mktemp -d`
64mount $core_snap $tmp_core
65mkdir -p $tmp_mount/system-data/etc/systemd
66cp -rav $tmp_core/etc/systemd/* \
67 $tmp_mount/system-data/etc/systemd/
68umount $tmp_core
69rm -rf $tmp_core
70
71# system-user assertion which gives us our test:test user we use to
72# log into the system
73mkdir -p $tmp_mount/system-data/var/lib/snapd/seed/assertions
74cp test-user.assertion $tmp_mount/system-data/var/lib/snapd/seed/assertions
75
76# Disable console-conf for the first boot
77mkdir -p $tmp_mount/system-data/var/lib/console-conf/
78touch $tmp_mount/system-data/var/lib/console-conf/complete
79
80# Create systemd service which is running on firstboot and sets up
81# various things for us.
82mkdir -p $tmp_mount/system-data/etc/systemd/system
83cat << 'EOF' > $tmp_mount/system-data/etc/systemd/system/devmode-firstboot.service
84[Unit]
85Description=Run devmode firstboot setup
86After=snapd.service snapd.socket
87
88[Service]
89Type=oneshot
90ExecStart=/writable/system-data/var/lib/devmode-firstboot/run.sh
91RemainAfterExit=yes
92TimeoutSec=3min
93EOF
94
95mkdir -p $tmp_mount/system-data/etc/systemd/system/multi-user.target.wants
96ln -sf /etc/systemd/system/devmode-firstboot.service \
97 $tmp_mount/system-data/etc/systemd/system/multi-user.target.wants/devmode-firstboot.service
98
99mkdir $tmp_mount/system-data/var/lib/devmode-firstboot
100cat << EOF > $tmp_mount/system-data/var/lib/devmode-firstboot/00-snapd-config.yaml
101network:
102 version: 2
103 ethernets:
104 eth0:
105 dhcp4: true
106EOF
107
108cat << 'EOF' > $tmp_mount/system-data/var/lib/devmode-firstboot/run.sh
109#!/bin/sh
110
111set -e
112
113# Don't start again if we're already done
114if [ -e /writable/system-data/var/lib/devmode-firstboot/complete ] ; then
115 exit 0
116fi
117
118echo "Start devmode-firstboot $(date -Iseconds --utc)"
119
120if [ "$(snap managed)" = "true" ]; then
121 echo "System already managed, exiting"
122 exit 0
123fi
124
125# no changes at all
126while ! snap changes ; do
127 echo "No changes yet, waiting"
128 sleep 1
129done
130
131while snap changes | grep -qE '(Do|Doing) .*Initialize system state' ; do
132 echo "Initialize system state is in progress, waiting"
133 sleep 1
134done
135
136if [ -n "$(snap known system-user)" ]; then
137 echo "Trying to create known user"
138 snap create-user --known --sudoer
139fi
140
141cp /writable/system-data/var/lib/devmode-firstboot/00-snapd-config.yaml /writable/system-data/etc/netplan
142
143# Enable console-conf again
144rm /writable/system-data/var/lib/console-conf/complete
145
146# Mark us done
147touch /writable/system-data/var/lib/devmode-firstboot/complete
148
149# Reboot the system as its now prepared for the user
150reboot
151EOF
152
153chmod +x $tmp_mount/system-data/var/lib/devmode-firstboot/run.sh
154
155umount $tmp_mount
156kpartx -d $image_name
157rm -rf $tmp_mount
diff --git a/tests/image/pc-model.json b/tests/image/pc-model.json
0new file mode 100644158new file mode 100644
index 0000000..2eb1411
--- /dev/null
+++ b/tests/image/pc-model.json
@@ -0,0 +1,11 @@
1{
2 "type": "model",
3 "authority-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf",
4 "brand-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf",
5 "series": "16",
6 "model": "pc",
7 "architecture": "amd64",
8 "gadget": "pc",
9 "kernel": "pc-kernel",
10 "timestamp": "2016-09-09T08:27:36+00:00"
11}
diff --git a/tests/image/pc.model b/tests/image/pc.model
0new file mode 10064412new file mode 100644
index 0000000..345b7e4
--- /dev/null
+++ b/tests/image/pc.model
@@ -0,0 +1,21 @@
1type: model
2authority-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf
3series: 16
4brand-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf
5model: pc
6architecture: amd64
7gadget: pc
8kernel: pc-kernel
9timestamp: 2016-09-09T08:27:36+00:00
10sign-key-sha3-384: a4qX7md6GQGNcZc_cmWPBStTq4RNCnGTzF-4usF5wFylQ-xZQej-SD6prx8Yl89O
11
12AcLBXAQAAQoABgUCWBBNTwAKCRAVoE002xqmOPH/EACWLf1UeZgICjNbzLI5bO/84LExS8iUjarG
13S7DRn8Ln5zu44pxz7UXJNjULgnU8yuKVPVWg0ij7DRvaj8tGxOMMAls1fjSRtEYR8oJFsI3jXDGw
14cLjvJG/crUxV8DgdZFlF02Kb5VtmNDXs1OE3zpPeniG19JYHaf2hDz4SRmWZe4c2MFrAt2UwI/VC
15o/209Fl3qA8p8x5EYOBycgHooHm3924NTF9mXbKSfLRgGS7YzmN4FXFyiGOTY6CRsp37XnkxGcA1
16+lyZz1X97qT/fOGVUFqHDqUZmuCs5sC3+DNonytTgKt5+7S+V+Ai45HEayD5f4gS9uscnTMTwEEJ
17VgSZRU0My+iJwFlXHaGWQe9eC37YCZ3ahBxc2SpkFffXjYhEMtTtr1vDIYCAhbc2k8aa3hPE2GUg
183pv8zs1AuZzSVX+Rp4ysMBqU23UUVP6Bmvr7ZD3E8aEUxE6O/BEA10Km5oZPqpmBfcEVO8a0yZjn
19YQxn4XzY1Nwq1d0sJIV7FEDsq9dXH9QCa4qsCH3KG3jHv32GapvLf8mpr6HSH+JmPM5kNeVugLVy
20/RUAFNu+Y4hqhpRNC8fc+UDkVBXsLDqHb5gfXnhbFIH8LvpVFR20SSkg9/Km5xC+7wcey0h8SD6/
21Eh70OPLxDkzitEn/1L/0V987dlJnhS4WpqrYfbHYwQ==
diff --git a/tests/image/test-user-assertion.json b/tests/image/test-user-assertion.json
0new file mode 10064422new file mode 100644
index 0000000..81f6beb
--- /dev/null
+++ b/tests/image/test-user-assertion.json
@@ -0,0 +1,13 @@
1{
2 "type": "system-user",
3 "authority-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf",
4 "brand-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf",
5 "series": ["16"],
6 "models": ["pc"],
7 "name": "Default Test User",
8 "username": "test",
9 "email": "test@localhost",
10 "password": "$6$OCvKy4w/Ppxp7IvC$WPzWiIW.4y18h9htjbOuxLZ.sjQ5M2hoSiEu3FpMU0PMdHQuQdBOqvk8p6DMdS/R/nU/rXidClD23CbSkSgp30",
11 "since": "2016-10-24T07:12:10+00:00",
12 "until": "2017-10-24T07:12:10+00:00"
13}
diff --git a/tests/image/test-user.assertion b/tests/image/test-user.assertion
0new file mode 10064414new file mode 100644
index 0000000..7ebb667
--- /dev/null
+++ b/tests/image/test-user.assertion
@@ -0,0 +1,25 @@
1type: system-user
2authority-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf
3brand-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf
4email: test@localhost
5models:
6 - pc
7name: Default Test User
8password: $6$OCvKy4w/Ppxp7IvC$WPzWiIW.4y18h9htjbOuxLZ.sjQ5M2hoSiEu3FpMU0PMdHQuQdBOqvk8p6DMdS/R/nU/rXidClD23CbSkSgp30
9series:
10 - 16
11since: 2016-10-24T07:12:10+00:00
12until: 2017-10-24T07:12:10+00:00
13username: test
14sign-key-sha3-384: a4qX7md6GQGNcZc_cmWPBStTq4RNCnGTzF-4usF5wFylQ-xZQej-SD6prx8Yl89O
15
16AcLBXAQAAQoABgUCWBBOJAAKCRAVoE002xqmOKaRD/0cEKWb2nbwhk+BTgOrYZHrwzjbIWTZznDh
17xCD6JWF/yr9br1vEmRz2zCNPPWZgFH9HaJ+mT/lktWIs7VVMIdwMDWYOR8P9rdWM/Jx6iyB3z0OI
18YO31zaU4XLyolv/YSj/nFXMMD+jIeE4l8j4AtCSJwd7ZS9Jz8F/RfrD8EpG0JU1F55lq8MC0mjZ4
19ul5ws8k9UiP8nA5IAG30NvvReiUGYqtdkO43eQmy88WABL95MbFsbfEk4/VduG0Gt3y/T8vDDcF6
20NJEm8L+O9IXnPBAje0Ve0NX3YtOE3CDTkYRKR7xFFJq2cJVCSvf9CsorREg4KyfagIdMKDSa5Tiq
21FzoAJTfI0ltq5cAnLImtxFKulJ+AnGUNMLrKFr1H0FGtqTZBfs/PcIxy0qY0YDXSF4/9F2PUBdQS
22tSmN6pT9t1FCGy2Rf5n3QV4e0R2JzS6Kx+vdbPMYqhssQosLU5GwlWj8UbevtphAGf8u8nLBDYWs
23MNIPi0IrPmzIewZBD05A6a8T+oHZ9dIg5SAnJ4gmz0sCzNDKarvYqLpcU1rZzu78/UypbHXDvBAt
24gnxYpD6WHR2aHSeyx3WvOp130jFco2/55M0RTEm50isO1uv2DqTn9ULkBdCrG/zOqEmZgY18ds3P
25yTaAbaIAqUe7scpAHY0a31tfnXq8cRyEX03e9g2Mrg==
diff --git a/tests/lib/prepare-all.sh b/tests/lib/prepare-all.sh
0new file mode 10064426new file mode 100644
index 0000000..38bfb5b
--- /dev/null
+++ b/tests/lib/prepare-all.sh
@@ -0,0 +1,25 @@
1#!/bin/sh
2
3# We don't have to build a snap when we should use one from a
4# channel
5if [ -n "$SNAP_CHANNEL" ] ; then
6 exit 0
7fi
8
9# Setup classic snap and build the modem-manager snap in there
10snap install --devmode --beta classic
11cat <<-EOF > /home/test/build-snap.sh
12#!/bin/sh
13set -ex
14apt update
15apt install -y --force-yes snapcraft
16cd /home/modem-manager
17snapcraft clean
18snapcraft
19EOF
20chmod +x /home/test/build-snap.sh
21sudo classic /home/test/build-snap.sh
22snap remove classic
23
24# Make sure we have a snap build
25test -e /home/modem-manager/modem-manager_*_amd64.snap
diff --git a/tests/lib/prepare.sh b/tests/lib/prepare.sh
0new file mode 10064426new file mode 100644
index 0000000..8956644
--- /dev/null
+++ b/tests/lib/prepare.sh
@@ -0,0 +1,49 @@
1#!/bin/sh
2
3echo "Wait for firstboot change to be ready"
4while ! snap changes | grep -q "Done"; do
5 snap changes || true
6 snap change 1 || true
7 sleep 1
8done
9
10echo "Ensure fundamental snaps are still present"
11. $TESTSLIB/snap-names.sh
12for name in $gadget_name $kernel_name $core_name; do
13 if ! snap list | grep -q $name ; then
14 echo "Not all fundamental snaps are available, all-snap image not valid"
15 echo "Currently installed snaps:"
16 snap list
17 exit 1
18 fi
19done
20
21echo "Kernel has a store revision"
22snap list | grep ^${kernel_name} | grep -E " [0-9]+\s+canonical"
23
24# If we don't install modem-manager here we get a system
25# without any network connectivity after reboot.
26if [ -n "$SNAP_CHANNEL" ] ; then
27 # Don't reinstall if we have it installed already
28 if ! snap list | grep modem-manager ; then
29 snap install --$SNAP_CHANNEL modem-manager
30 fi
31else
32 # Install prebuilt modem-manager snap
33 snap install --dangerous /home/modem-manager/modem-manager_*_amd64.snap
34 # As we have a snap which we build locally its unasserted and therefore
35 # we don't have any snap-declarations in place and need to manually
36 # connect all plugs.
37 sudo snap connect modem-manager:mmcli modem-manager:service
38fi
39
40# Snapshot of the current snapd state for a later restore
41if [ ! -f $SPREAD_PATH/snapd-state.tar.gz ] ; then
42 systemctl stop snapd.service snapd.socket
43 tar czf $SPREAD_PATH/snapd-state.tar.gz /var/lib/snapd /etc/netplan
44 systemctl start snapd.socket
45fi
46
47# For debugging dump all snaps and connected slots/plugs
48snap list
49snap interfaces
diff --git a/tests/lib/restore-each.sh b/tests/lib/restore-each.sh
0new file mode 10064450new file mode 100644
index 0000000..a7662cc
--- /dev/null
+++ b/tests/lib/restore-each.sh
@@ -0,0 +1,31 @@
1#!/bin/sh
2
3. $TESTSLIB/snap-names.sh
4
5# Remove all snaps not being the core, gadget, kernel or snap we're testing
6for snap in /snap/*; do
7 snap="${snap:6}"
8 case "$snap" in
9 "bin" | "$gadget_name" | "$kernel_name" | "$core_name" | "$SNAP_NAME" )
10 ;;
11 *)
12 snap remove "$snap"
13 ;;
14 esac
15done
16
17# Cleanup all configuration files from ModemManager so that we have
18# a fresh start for the next test
19rm -rf /var/snap/modem-manager/common/*
20rm -rf /var/snap/modem-manager/current/*
21systemctl stop snap.modem-manager.modemmanager
22
23# Ensure we have the same state for snapd as we had before
24systemctl stop snapd.service snapd.socket
25rm -rf /var/lib/snapd/*
26$(cd / && tar xzf $SPREAD_PATH/snapd-state.tar.gz)
27rm -rf /root/.snap
28systemctl start snapd.service snapd.socket
29
30# Bringup ModemManager again now that the system is restored
31systemctl start snap.modem-manager.modemmanager
diff --git a/tests/lib/snap-names.sh b/tests/lib/snap-names.sh
0new file mode 10064432new file mode 100644
index 0000000..71c9628
--- /dev/null
+++ b/tests/lib/snap-names.sh
@@ -0,0 +1,7 @@
1#!/bin/sh
2gadget_name=$(snap list | sed -n 's/^\(pc\|pi[23]\|dragonboard\) .*/\1/p')
3kernel_name=$gadget_name-kernel
4core_name=$(snap list | awk '/^(ubuntu-)?core / {print $1; exit}')
5if [ "$kernel_name" = "pi3-kernel" ] ; then
6 kernel_name=pi2-kernel
7fi
diff --git a/tests/lib/utilities.sh b/tests/lib/utilities.sh
0new file mode 1006448new file mode 100644
index 0000000..aaf51f0
--- /dev/null
+++ b/tests/lib/utilities.sh
@@ -0,0 +1,14 @@
1#!/bin/sh
2
3wait_for_modem_manager() {
4 while ! systemctl status snap.modem-manager.modemmanager ; do
5 sleep 1
6 done
7 sleep 1
8}
9
10stop_after_first_reboot() {
11 if [ $SPREAD_REBOOT -eq 1 ] ; then
12 exit 0
13 fi
14}
diff --git a/tests/main/installation/task.yaml b/tests/main/installation/task.yaml
0new file mode 10064415new file mode 100644
index 0000000..ae90c54
--- /dev/null
+++ b/tests/main/installation/task.yaml
@@ -0,0 +1,13 @@
1summary: Test modem-manager snap installation was successful
2
3execute: |
4 . $TESTSLIB/utilities.sh
5
6 # Service should be up an running
7 wait_for_modem_manager
8
9 # .. and mmcli should be able to reach ModemManager
10 /snap/bin/modem-manager.mmcli -L
11
12 # Ensure all necessary plugs/slots are connected
13 snap interfaces | grep -Pzq "modem-manager:service +modem-manager:mmcli"
diff --git a/tests/main/network-manager-autoconn/task.yaml b/tests/main/network-manager-autoconn/task.yaml
0new file mode 10064414new file mode 100644
index 0000000..7092b7f
--- /dev/null
+++ b/tests/main/network-manager-autoconn/task.yaml
@@ -0,0 +1,13 @@
1summary: Test modem-manager snap installation was successful
2
3execute: |
4 . $TESTSLIB/utilities.sh
5
6 # Service should be up an running
7 wait_for_modem_manager
8
9 snap install network-manager
10
11 # Ensure all necessary plugs/slots are connected
12 snap interfaces | grep -Ezq "modem-manager:service .*modem-manager:mmcli"
13 snap interfaces | grep -Ezq "modem-manager:service .*network-manager:modem-manager"

Subscribers

People subscribed via source and target branches