Merge ~kzapalowicz/snappy-hwe-snaps/+git/pulseaudio:feature/spread-tests into ~snappy-hwe-team/snappy-hwe-snaps/+git/pulseaudio:master
- Git
- lp:~kzapalowicz/snappy-hwe-snaps/+git/pulseaudio
- feature/spread-tests
- Merge into master
Status: | Merged |
---|---|
Approved by: | Jim Hodapp |
Approved revision: | 43df266d8212ce435668be736755d5d090aa9c08 |
Merged at revision: | c2bb0f67edc4cf1826c49bb8796823d543ea0c8e |
Proposed branch: | ~kzapalowicz/snappy-hwe-snaps/+git/pulseaudio:feature/spread-tests |
Merge into: | ~snappy-hwe-team/snappy-hwe-snaps/+git/pulseaudio:master |
Diff against target: |
623 lines (+521/-0) 17 files modified
run-tests.sh (+84/-0) 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-each.sh (+6/-0) tests/lib/prepare.sh (+51/-0) tests/lib/restore-each.sh (+22/-0) tests/lib/snap-names.sh (+7/-0) tests/lib/utilities.sh (+9/-0) tests/main/installation/task.yaml (+16/-0) tests/main/modules-loaded/task.yaml (+11/-0) tests/main/pactl/task.yaml (+6/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
System Enablement Bot | continuous-integration | Approve | |
Jim Hodapp (community) | code | Approve | |
Alfonso Sanchez-Beato | Approve | ||
Matteo Croce (community) | Approve | ||
Review via email: mp+311243@code.launchpad.net |
Commit message
This commit adds the spread tests for the PulseAudio snap. Currently it
tests for a correct installation, the ability to use pactl tool and
that some of the standard modules can be loaded.
Description of the change
Add spread tests
This commit adds the spread tests for the PulseAudio snap. Currently it
tests for a correct installation, the ability to use pactl tool and
that some of the standard modules can be loaded.
Matteo Croce (teknoraver) : | # |
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:b29ef956669
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
Couple of comments, see below.
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
Changing to approved because I will be out next week (but please address my comments ;-)
Konrad Zapałowicz (kzapalowicz) : | # |
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:9ee5440d6a6
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:9ee5440d6a6
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Jim Hodapp (jhodapp) wrote : | # |
Looks really good, thanks man!
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:43df266d821
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:43df266d821
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:b29ef956669
https:/
Executed test runs:
SUCCESS: https:/
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/spread.yaml b/spread.yaml |
92 | new file mode 100644 |
93 | index 0000000..0c615ba |
94 | --- /dev/null |
95 | +++ b/spread.yaml |
96 | @@ -0,0 +1,50 @@ |
97 | +# |
98 | +# Copyright (C) 2016 Canonical Ltd |
99 | +# |
100 | +# This program is free software: you can redistribute it and/or modify |
101 | +# it under the terms of the GNU General Public License version 3 as |
102 | +# published by the Free Software Foundation. |
103 | +# |
104 | +# This program is distributed in the hope that it will be useful, |
105 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
106 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
107 | +# GNU General Public License for more details. |
108 | +# |
109 | +# You should have received a copy of the GNU General Public License |
110 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
111 | + |
112 | +project: pulseaudio |
113 | + |
114 | +environment: |
115 | + PROJECT_PATH: /home/pulseaudio |
116 | + TESTSLIB: $PROJECT_PATH/tests/lib |
117 | + SNAP_NAME: pulseaudio |
118 | + # Allow the host to pass the channel to use for the test run |
119 | + SNAP_CHANNEL: $(HOST:echo $SNAP_CHANNEL) |
120 | + |
121 | +backends: |
122 | + qemu: |
123 | + systems: |
124 | + - ubuntu-core-16: |
125 | + username: test |
126 | + password: test |
127 | + |
128 | +# Put this somewhere where we have read-write access |
129 | +path: /home/pulseaudio |
130 | + |
131 | +exclude: |
132 | + - .git |
133 | + |
134 | +prepare: | |
135 | + . $TESTSLIB/prepare-all.sh |
136 | + |
137 | +suites: |
138 | + tests/main/: |
139 | + summary: Full-system tests for PulseAudio |
140 | + systems: |
141 | + - ubuntu-core-16 |
142 | + prepare: | |
143 | + . $TESTSLIB/prepare.sh |
144 | + restore-each: | |
145 | + . $TESTSLIB/restore-each.sh |
146 | + |
147 | diff --git a/tests/image/README.md b/tests/image/README.md |
148 | new file mode 100644 |
149 | index 0000000..b75b66e |
150 | --- /dev/null |
151 | +++ b/tests/image/README.md |
152 | @@ -0,0 +1,7 @@ |
153 | +# Generate user password |
154 | + |
155 | +You can generate the password for the system user assertion via |
156 | + |
157 | +``` |
158 | + $ python3 -c 'import crypt; print(crypt.crypt("test", crypt.mksalt(crypt.METHOD_SHA512)))' |
159 | +``` |
160 | diff --git a/tests/image/create-image.sh b/tests/image/create-image.sh |
161 | new file mode 100755 |
162 | index 0000000..e3c36e0 |
163 | --- /dev/null |
164 | +++ b/tests/image/create-image.sh |
165 | @@ -0,0 +1,157 @@ |
166 | +#!/bin/bash |
167 | +# |
168 | +# Copyright (C) 2016 Canonical Ltd |
169 | +# |
170 | +# This program is free software: you can redistribute it and/or modify |
171 | +# it under the terms of the GNU General Public License version 3 as |
172 | +# published by the Free Software Foundation. |
173 | +# |
174 | +# This program is distributed in the hope that it will be useful, |
175 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
176 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
177 | +# GNU General Public License for more details. |
178 | +# |
179 | +# You should have received a copy of the GNU General Public License |
180 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
181 | + |
182 | +set -e |
183 | + |
184 | +if [ $(id -u) -ne 0 ] ; then |
185 | + echo "ERROR: needs to be executed as root" |
186 | + exit 1 |
187 | +fi |
188 | + |
189 | +channel=candidate |
190 | +if [ ! -z "$1" ] ; then |
191 | + channel=$1 |
192 | +fi |
193 | + |
194 | +snap= |
195 | +if [ ! -z "$2" ] ; then |
196 | + snap=$2 |
197 | +fi |
198 | + |
199 | +model=pc |
200 | +arch=amd64 |
201 | +image_name=ubuntu-core-16.img |
202 | +ubuntu_image_extra_args= |
203 | + |
204 | +if [ ! -z "$snap" ] ; then |
205 | + ubuntu_image_extra_args="--extra-snaps $snap" |
206 | +fi |
207 | + |
208 | +ubuntu-image \ |
209 | + --channel $channel \ |
210 | + -o $image_name \ |
211 | + --image-size 4G \ |
212 | + $ubuntu_image_extra_args \ |
213 | + $model.model |
214 | + |
215 | +kpartx -a $image_name |
216 | +sleep 0.5 |
217 | + |
218 | +loop_path=`findfs LABEL=writable` |
219 | +tmp_mount=`mktemp -d` |
220 | + |
221 | +mount $loop_path $tmp_mount |
222 | + |
223 | +# Migrate all systemd units from core snap into the writable area. This |
224 | +# would be normally done on firstboot by the initramfs but we can't rely |
225 | +# on that because we are adding another file in there and that will |
226 | +# prevent the initramfs from transitioning any files. |
227 | +core_snap=$(find $tmp_mount/system-data/var/lib/snapd/snaps -name "core_*.snap") |
228 | +tmp_core=`mktemp -d` |
229 | +mount $core_snap $tmp_core |
230 | +mkdir -p $tmp_mount/system-data/etc/systemd |
231 | +cp -rav $tmp_core/etc/systemd/* \ |
232 | + $tmp_mount/system-data/etc/systemd/ |
233 | +umount $tmp_core |
234 | +rm -rf $tmp_core |
235 | + |
236 | +# system-user assertion which gives us our test:test user we use to |
237 | +# log into the system |
238 | +mkdir -p $tmp_mount/system-data/var/lib/snapd/seed/assertions |
239 | +cp test-user.assertion $tmp_mount/system-data/var/lib/snapd/seed/assertions |
240 | + |
241 | +# Disable console-conf for the first boot |
242 | +mkdir -p $tmp_mount/system-data/var/lib/console-conf/ |
243 | +touch $tmp_mount/system-data/var/lib/console-conf/complete |
244 | + |
245 | +# Create systemd service which is running on firstboot and sets up |
246 | +# various things for us. |
247 | +mkdir -p $tmp_mount/system-data/etc/systemd/system |
248 | +cat << 'EOF' > $tmp_mount/system-data/etc/systemd/system/devmode-firstboot.service |
249 | +[Unit] |
250 | +Description=Run devmode firstboot setup |
251 | +After=snapd.service snapd.socket |
252 | + |
253 | +[Service] |
254 | +Type=oneshot |
255 | +ExecStart=/writable/system-data/var/lib/devmode-firstboot/run.sh |
256 | +RemainAfterExit=yes |
257 | +TimeoutSec=3min |
258 | +EOF |
259 | + |
260 | +mkdir -p $tmp_mount/system-data/etc/systemd/system/multi-user.target.wants |
261 | +ln -sf /etc/systemd/system/devmode-firstboot.service \ |
262 | + $tmp_mount/system-data/etc/systemd/system/multi-user.target.wants/devmode-firstboot.service |
263 | + |
264 | +mkdir $tmp_mount/system-data/var/lib/devmode-firstboot |
265 | +cat << EOF > $tmp_mount/system-data/var/lib/devmode-firstboot/00-snapd-config.yaml |
266 | +network: |
267 | + version: 2 |
268 | + ethernets: |
269 | + eth0: |
270 | + dhcp4: true |
271 | +EOF |
272 | + |
273 | +cat << 'EOF' > $tmp_mount/system-data/var/lib/devmode-firstboot/run.sh |
274 | +#!/bin/bash |
275 | + |
276 | +set -e |
277 | + |
278 | +# Don't start again if we're already done |
279 | +if [ -e /writable/system-data/var/lib/devmode-firstboot/complete ] ; then |
280 | + exit 0 |
281 | +fi |
282 | + |
283 | +echo "Start devmode-firstboot $(date -Iseconds --utc)" |
284 | + |
285 | +if [ "$(snap managed)" = "true" ]; then |
286 | + echo "System already managed, exiting" |
287 | + exit 0 |
288 | +fi |
289 | + |
290 | +# no changes at all |
291 | +while ! snap changes ; do |
292 | + echo "No changes yet, waiting" |
293 | + sleep 1 |
294 | +done |
295 | + |
296 | +while snap changes | grep -qE '(Do|Doing) .*Initialize system state' ; do |
297 | + echo "Initialize system state is in progress, waiting" |
298 | + sleep 1 |
299 | +done |
300 | + |
301 | +if [ -n "$(snap known system-user)" ]; then |
302 | + echo "Trying to create known user" |
303 | + snap create-user --known --sudoer |
304 | +fi |
305 | + |
306 | +cp /writable/system-data/var/lib/devmode-firstboot/00-snapd-config.yaml /writable/system-data/etc/netplan |
307 | + |
308 | +# Enable console-conf again |
309 | +rm /writable/system-data/var/lib/console-conf/complete |
310 | + |
311 | +# Mark us done |
312 | +touch /writable/system-data/var/lib/devmode-firstboot/complete |
313 | + |
314 | +# Reboot the system as its now prepared for the user |
315 | +reboot |
316 | +EOF |
317 | + |
318 | +chmod +x $tmp_mount/system-data/var/lib/devmode-firstboot/run.sh |
319 | + |
320 | +umount $tmp_mount |
321 | +kpartx -d $image_name |
322 | +rm -rf $tmp_mount |
323 | diff --git a/tests/image/pc-model.json b/tests/image/pc-model.json |
324 | new file mode 100644 |
325 | index 0000000..2eb1411 |
326 | --- /dev/null |
327 | +++ b/tests/image/pc-model.json |
328 | @@ -0,0 +1,11 @@ |
329 | +{ |
330 | + "type": "model", |
331 | + "authority-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf", |
332 | + "brand-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf", |
333 | + "series": "16", |
334 | + "model": "pc", |
335 | + "architecture": "amd64", |
336 | + "gadget": "pc", |
337 | + "kernel": "pc-kernel", |
338 | + "timestamp": "2016-09-09T08:27:36+00:00" |
339 | +} |
340 | diff --git a/tests/image/pc.model b/tests/image/pc.model |
341 | new file mode 100644 |
342 | index 0000000..345b7e4 |
343 | --- /dev/null |
344 | +++ b/tests/image/pc.model |
345 | @@ -0,0 +1,21 @@ |
346 | +type: model |
347 | +authority-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf |
348 | +series: 16 |
349 | +brand-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf |
350 | +model: pc |
351 | +architecture: amd64 |
352 | +gadget: pc |
353 | +kernel: pc-kernel |
354 | +timestamp: 2016-09-09T08:27:36+00:00 |
355 | +sign-key-sha3-384: a4qX7md6GQGNcZc_cmWPBStTq4RNCnGTzF-4usF5wFylQ-xZQej-SD6prx8Yl89O |
356 | + |
357 | +AcLBXAQAAQoABgUCWBBNTwAKCRAVoE002xqmOPH/EACWLf1UeZgICjNbzLI5bO/84LExS8iUjarG |
358 | +S7DRn8Ln5zu44pxz7UXJNjULgnU8yuKVPVWg0ij7DRvaj8tGxOMMAls1fjSRtEYR8oJFsI3jXDGw |
359 | +cLjvJG/crUxV8DgdZFlF02Kb5VtmNDXs1OE3zpPeniG19JYHaf2hDz4SRmWZe4c2MFrAt2UwI/VC |
360 | +o/209Fl3qA8p8x5EYOBycgHooHm3924NTF9mXbKSfLRgGS7YzmN4FXFyiGOTY6CRsp37XnkxGcA1 |
361 | ++lyZz1X97qT/fOGVUFqHDqUZmuCs5sC3+DNonytTgKt5+7S+V+Ai45HEayD5f4gS9uscnTMTwEEJ |
362 | +VgSZRU0My+iJwFlXHaGWQe9eC37YCZ3ahBxc2SpkFffXjYhEMtTtr1vDIYCAhbc2k8aa3hPE2GUg |
363 | +3pv8zs1AuZzSVX+Rp4ysMBqU23UUVP6Bmvr7ZD3E8aEUxE6O/BEA10Km5oZPqpmBfcEVO8a0yZjn |
364 | +YQxn4XzY1Nwq1d0sJIV7FEDsq9dXH9QCa4qsCH3KG3jHv32GapvLf8mpr6HSH+JmPM5kNeVugLVy |
365 | +/RUAFNu+Y4hqhpRNC8fc+UDkVBXsLDqHb5gfXnhbFIH8LvpVFR20SSkg9/Km5xC+7wcey0h8SD6/ |
366 | +Eh70OPLxDkzitEn/1L/0V987dlJnhS4WpqrYfbHYwQ== |
367 | diff --git a/tests/image/test-user-assertion.json b/tests/image/test-user-assertion.json |
368 | new file mode 100644 |
369 | index 0000000..81f6beb |
370 | --- /dev/null |
371 | +++ b/tests/image/test-user-assertion.json |
372 | @@ -0,0 +1,13 @@ |
373 | +{ |
374 | + "type": "system-user", |
375 | + "authority-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf", |
376 | + "brand-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf", |
377 | + "series": ["16"], |
378 | + "models": ["pc"], |
379 | + "name": "Default Test User", |
380 | + "username": "test", |
381 | + "email": "test@localhost", |
382 | + "password": "$6$OCvKy4w/Ppxp7IvC$WPzWiIW.4y18h9htjbOuxLZ.sjQ5M2hoSiEu3FpMU0PMdHQuQdBOqvk8p6DMdS/R/nU/rXidClD23CbSkSgp30", |
383 | + "since": "2016-10-24T07:12:10+00:00", |
384 | + "until": "2017-10-24T07:12:10+00:00" |
385 | +} |
386 | diff --git a/tests/image/test-user.assertion b/tests/image/test-user.assertion |
387 | new file mode 100644 |
388 | index 0000000..7ebb667 |
389 | --- /dev/null |
390 | +++ b/tests/image/test-user.assertion |
391 | @@ -0,0 +1,25 @@ |
392 | +type: system-user |
393 | +authority-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf |
394 | +brand-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf |
395 | +email: test@localhost |
396 | +models: |
397 | + - pc |
398 | +name: Default Test User |
399 | +password: $6$OCvKy4w/Ppxp7IvC$WPzWiIW.4y18h9htjbOuxLZ.sjQ5M2hoSiEu3FpMU0PMdHQuQdBOqvk8p6DMdS/R/nU/rXidClD23CbSkSgp30 |
400 | +series: |
401 | + - 16 |
402 | +since: 2016-10-24T07:12:10+00:00 |
403 | +until: 2017-10-24T07:12:10+00:00 |
404 | +username: test |
405 | +sign-key-sha3-384: a4qX7md6GQGNcZc_cmWPBStTq4RNCnGTzF-4usF5wFylQ-xZQej-SD6prx8Yl89O |
406 | + |
407 | +AcLBXAQAAQoABgUCWBBOJAAKCRAVoE002xqmOKaRD/0cEKWb2nbwhk+BTgOrYZHrwzjbIWTZznDh |
408 | +xCD6JWF/yr9br1vEmRz2zCNPPWZgFH9HaJ+mT/lktWIs7VVMIdwMDWYOR8P9rdWM/Jx6iyB3z0OI |
409 | +YO31zaU4XLyolv/YSj/nFXMMD+jIeE4l8j4AtCSJwd7ZS9Jz8F/RfrD8EpG0JU1F55lq8MC0mjZ4 |
410 | +ul5ws8k9UiP8nA5IAG30NvvReiUGYqtdkO43eQmy88WABL95MbFsbfEk4/VduG0Gt3y/T8vDDcF6 |
411 | +NJEm8L+O9IXnPBAje0Ve0NX3YtOE3CDTkYRKR7xFFJq2cJVCSvf9CsorREg4KyfagIdMKDSa5Tiq |
412 | +FzoAJTfI0ltq5cAnLImtxFKulJ+AnGUNMLrKFr1H0FGtqTZBfs/PcIxy0qY0YDXSF4/9F2PUBdQS |
413 | +tSmN6pT9t1FCGy2Rf5n3QV4e0R2JzS6Kx+vdbPMYqhssQosLU5GwlWj8UbevtphAGf8u8nLBDYWs |
414 | +MNIPi0IrPmzIewZBD05A6a8T+oHZ9dIg5SAnJ4gmz0sCzNDKarvYqLpcU1rZzu78/UypbHXDvBAt |
415 | +gnxYpD6WHR2aHSeyx3WvOp130jFco2/55M0RTEm50isO1uv2DqTn9ULkBdCrG/zOqEmZgY18ds3P |
416 | +yTaAbaIAqUe7scpAHY0a31tfnXq8cRyEX03e9g2Mrg== |
417 | diff --git a/tests/lib/prepare-all.sh b/tests/lib/prepare-all.sh |
418 | new file mode 100644 |
419 | index 0000000..e3178fd |
420 | --- /dev/null |
421 | +++ b/tests/lib/prepare-all.sh |
422 | @@ -0,0 +1,25 @@ |
423 | +#!/bin/bash |
424 | + |
425 | +# We don't have to build a snap when we should use one from a |
426 | +# channel |
427 | +if [ -n "$SNAP_CHANNEL" ] ; then |
428 | + exit 0 |
429 | +fi |
430 | + |
431 | +# Setup classic snap and build the network-manager snap in there |
432 | +snap install --devmode --beta classic |
433 | +cat <<-EOF > /home/test/build-snap.sh |
434 | +#!/bin/sh |
435 | +set -ex |
436 | +apt update |
437 | +apt install -y --force-yes snapcraft |
438 | +cd /home/pulseaudio |
439 | +snapcraft clean |
440 | +snapcraft |
441 | +EOF |
442 | +chmod +x /home/test/build-snap.sh |
443 | +sudo classic /home/test/build-snap.sh |
444 | +snap remove classic |
445 | + |
446 | +# Make sure we have a snap build |
447 | +test -e /home/pulseaudio/pulseaudio_*_amd64.snap |
448 | diff --git a/tests/lib/prepare-each.sh b/tests/lib/prepare-each.sh |
449 | new file mode 100644 |
450 | index 0000000..de6816d |
451 | --- /dev/null |
452 | +++ b/tests/lib/prepare-each.sh |
453 | @@ -0,0 +1,6 @@ |
454 | +SNAP_INSTALL_OPTS= |
455 | +if [ -n "$SNAP_CHANNEL" ] ; then |
456 | + SNAP_INSTALL_OPTS="--$SNAP_CHANNEL" |
457 | +fi |
458 | + |
459 | +snap install $SNAP_INSTALL_OPTS $SNAP_NAME |
460 | diff --git a/tests/lib/prepare.sh b/tests/lib/prepare.sh |
461 | new file mode 100644 |
462 | index 0000000..4b360b5 |
463 | --- /dev/null |
464 | +++ b/tests/lib/prepare.sh |
465 | @@ -0,0 +1,51 @@ |
466 | +#!/bin/bash |
467 | + |
468 | +echo "Wait for firstboot change to be ready" |
469 | +while ! snap changes | grep -q "Done"; do |
470 | + snap changes || true |
471 | + snap change 1 || true |
472 | + sleep 1 |
473 | +done |
474 | + |
475 | +echo "Ensure fundamental snaps are still present" |
476 | +. $TESTSLIB/snap-names.sh |
477 | +for name in $gadget_name $kernel_name $core_name; do |
478 | + if ! snap list | grep -q $name ; then |
479 | + echo "Not all fundamental snaps are available, all-snap image not valid" |
480 | + echo "Currently installed snaps:" |
481 | + snap list |
482 | + exit 1 |
483 | + fi |
484 | +done |
485 | + |
486 | +echo "Kernel has a store revision" |
487 | +snap list | grep ^${kernel_name} | grep -E " [0-9]+\s+canonical" |
488 | + |
489 | +# If we don't install pulseaudio here we get a system |
490 | +# without any network connectivity after reboot. |
491 | +if [ -n "$SNAP_CHANNEL" ] ; then |
492 | + # Don't reinstall if we have it installed already |
493 | + if ! snap list | grep pulseaudio ; then |
494 | + snap install --$SNAP_CHANNEL pulseaudio |
495 | + fi |
496 | + echo "USING-CHANNEL" |
497 | +else |
498 | + echo "INSTALLING-PULSEAUDIO-SNAP" |
499 | + # Install prebuilt pulseaudio snap |
500 | + snap install --dangerous /home/pulseaudio/pulseaudio_*_amd64.snap |
501 | + # As we have a snap which we build locally its unasserted and therefor |
502 | + # we don't have any snap-declarations in place and need to manually |
503 | + # connect all plugs. |
504 | + snap connect pulseaudio:client pulseaudio:service |
505 | +fi |
506 | + |
507 | +# Snapshot of the current snapd state for a later restore |
508 | +if [ ! -f $SPREAD_PATH/snapd-state.tar.gz ] ; then |
509 | + systemctl stop snapd.service snapd.socket |
510 | + tar czf $SPREAD_PATH/snapd-state.tar.gz /var/lib/snapd |
511 | + systemctl start snapd.socket |
512 | +fi |
513 | + |
514 | +# For debugging dump all snaps and connected slots/plugs |
515 | +snap list |
516 | +snap interfaces |
517 | diff --git a/tests/lib/restore-each.sh b/tests/lib/restore-each.sh |
518 | new file mode 100644 |
519 | index 0000000..541ba8c |
520 | --- /dev/null |
521 | +++ b/tests/lib/restore-each.sh |
522 | @@ -0,0 +1,22 @@ |
523 | +#!/bin/bash |
524 | + |
525 | +. $TESTSLIB/snap-names.sh |
526 | + |
527 | +# Remove all snaps not being the core, gadget, kernel or snap we're testing |
528 | +for snap in /snap/*; do |
529 | + snap="${snap:6}" |
530 | + case "$snap" in |
531 | + "bin" | "$gadget_name" | "$kernel_name" | "$core_name" | "$SNAP_NAME") |
532 | + ;; |
533 | + *) |
534 | + snap remove "$snap" |
535 | + ;; |
536 | + esac |
537 | +done |
538 | + |
539 | +# Ensure we have the same state for snapd as we had before |
540 | +systemctl stop snapd.service snapd.socket |
541 | +rm -rf /var/lib/snapd/* |
542 | +tar xzf $SPREAD_PATH/snapd-state.tar.gz -C / |
543 | +rm -rf /root/.snap |
544 | +systemctl start snapd.service snapd.socket |
545 | diff --git a/tests/lib/snap-names.sh b/tests/lib/snap-names.sh |
546 | new file mode 100644 |
547 | index 0000000..f15b09a |
548 | --- /dev/null |
549 | +++ b/tests/lib/snap-names.sh |
550 | @@ -0,0 +1,7 @@ |
551 | +#!/bin/bash |
552 | +gadget_name=$(snap list | sed -n 's/^\(pc\|pi[23]\|dragonboard\) .*/\1/p') |
553 | +kernel_name=$gadget_name-kernel |
554 | +core_name=$(snap list | awk '/^(ubuntu-)?core / {print $1; exit}') |
555 | +if [ "$kernel_name" = "pi3-kernel" ] ; then |
556 | + kernel_name=pi2-kernel |
557 | +fi |
558 | diff --git a/tests/lib/utilities.sh b/tests/lib/utilities.sh |
559 | new file mode 100644 |
560 | index 0000000..977d045 |
561 | --- /dev/null |
562 | +++ b/tests/lib/utilities.sh |
563 | @@ -0,0 +1,9 @@ |
564 | +#!/bin/sh |
565 | + |
566 | +wait_for_pulseaudio() { |
567 | + while ! systemctl status snap.pulseaudio.pulseaudio ; do |
568 | + sleep 1 |
569 | + done |
570 | + sleep 1 |
571 | +} |
572 | + |
573 | diff --git a/tests/main/installation/task.yaml b/tests/main/installation/task.yaml |
574 | new file mode 100644 |
575 | index 0000000..2d9fb0d |
576 | --- /dev/null |
577 | +++ b/tests/main/installation/task.yaml |
578 | @@ -0,0 +1,16 @@ |
579 | +summary: Test pulseaudio snap installation was successful |
580 | + |
581 | +execute: | |
582 | + . $TESTSLIB/utilities.sh |
583 | + |
584 | + # Service should be up an running |
585 | + wait_for_pulseaudio |
586 | + systemctl status snap.pulseaudio.pulseaudio | grep -Pzq ': active' |
587 | + |
588 | + # pactl should be able to reach PulseAudio |
589 | + /snap/bin/pulseaudio.pactl list | grep -Pzq 'Module' |
590 | + |
591 | + # Ensure all necessary plugs/slots are connected |
592 | + snap interfaces | grep -Pzq "pulseaudio:service +pulseaudio:client" |
593 | + snap interfaces | grep -P "\-\ +pulseaudio:home" |
594 | + |
595 | diff --git a/tests/main/modules-loaded/task.yaml b/tests/main/modules-loaded/task.yaml |
596 | new file mode 100644 |
597 | index 0000000..e9ee7dd |
598 | --- /dev/null |
599 | +++ b/tests/main/modules-loaded/task.yaml |
600 | @@ -0,0 +1,11 @@ |
601 | +summary: Test for common PuleAudio modules being loaded |
602 | + |
603 | +execute: | |
604 | + # Check for some obvious PulseAudio modules |
605 | + /snap/bin/pulseaudio.pactl list short | grep -Pzq 'module-device-restore' |
606 | + /snap/bin/pulseaudio.pactl list short | grep -Pzq 'module-stream-restore' |
607 | + /snap/bin/pulseaudio.pactl list short | grep -Pzq 'module-card-restore' |
608 | + /snap/bin/pulseaudio.pactl list short | grep -Pzq 'module-switch-on-port-available' |
609 | + /snap/bin/pulseaudio.pactl list short | grep -Pzq 'module-rescue-streams' |
610 | + /snap/bin/pulseaudio.pactl list short | grep -Pzq 'module-suspend-on-idle' |
611 | + |
612 | diff --git a/tests/main/pactl/task.yaml b/tests/main/pactl/task.yaml |
613 | new file mode 100644 |
614 | index 0000000..01f93d0 |
615 | --- /dev/null |
616 | +++ b/tests/main/pactl/task.yaml |
617 | @@ -0,0 +1,6 @@ |
618 | +summary: Test pactl is working |
619 | + |
620 | +execute: | |
621 | + # Does it even work? |
622 | + /snap/bin/pulseaudio.pactl info | grep -Pzq 'Server Name: pulseaudio' |
623 | + |
PASSED: Continuous integration, rev:b29ef956669 4cd79b72f8a880f 75b1eb58d743cd /jenkins. canonical. com/system- enablement/ job/generic- build-snap/ 314/ /jenkins. canonical. com/system- enablement/ job/generic- update- snap-mp/ 216/console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/system- enablement/ job/generic- build-snap/ 314/rebuild
https:/