Merge ~alfonsosanchezbeato/snappy-hwe-snaps/+git/pulseaudio:fix-tests into ~snappy-hwe-team/snappy-hwe-snaps/+git/pulseaudio:master
- Git
- lp:~alfonsosanchezbeato/snappy-hwe-snaps/+git/pulseaudio
- fix-tests
- Merge into master
Status: | Merged |
---|---|
Approved by: | Alfonso Sanchez-Beato |
Approved revision: | c6c785b2fc77ca90f2ea59fc9307c907b425cbc9 |
Merged at revision: | cc080fd62696da35441f72194d97e84575888e19 |
Proposed branch: | ~alfonsosanchezbeato/snappy-hwe-snaps/+git/pulseaudio:fix-tests |
Merge into: | ~snappy-hwe-team/snappy-hwe-snaps/+git/pulseaudio:master |
Diff against target: |
325 lines (+87/-111) 8 files modified
dev/null (+0/-8) run-tests.sh (+51/-33) snapcraft.yaml (+1/-0) tests/lib/prepare-all.sh (+3/-42) tests/lib/prepare.sh (+8/-9) tests/lib/restore-each.sh (+4/-3) tests/lib/utilities.sh (+17/-14) tests/main/pactl-connects-to-server/task.yaml (+3/-2) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
System Enablement Bot | continuous-integration | Approve | |
Review via email: mp+387378@code.launchpad.net |
Commit message
tests: fix ancillary scripts
run-tests.sh: update to latest template
Description of the change
tests: fix ancillary scripts
run-tests.sh: update to latest template
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:78254fff87a
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Successfully build documentation, rev: 91f5885f1e9b428
Generated documentation is available at https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:91f5885f1e9
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Successfully build documentation, rev: c6c785b2fc77ca9
Generated documentation is available at https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:c6c785b2fc7
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
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 | index 0b0679d..7f827b6 100755 | |||
3 | --- a/run-tests.sh | |||
4 | +++ b/run-tests.sh | |||
5 | @@ -1,4 +1,4 @@ | |||
7 | 1 | #!/bin/sh | 1 | #!/bin/bash |
8 | 2 | # | 2 | # |
9 | 3 | # Copyright (C) 2016 Canonical Ltd | 3 | # Copyright (C) 2016 Canonical Ltd |
10 | 4 | # | 4 | # |
11 | @@ -16,64 +16,82 @@ | |||
12 | 16 | 16 | ||
13 | 17 | set -e | 17 | set -e |
14 | 18 | 18 | ||
17 | 19 | TESTS_EXTRAS_URL="https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/tests-extras" | 19 | TESTS_EXTRAS_URL="https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/stack-snaps-tools" |
18 | 20 | TESTS_EXTRAS_PATH=".tests-extras" | 20 | TESTS_EXTRAS_PATH="tests-extras" |
19 | 21 | 21 | ||
20 | 22 | # Display help. | ||
21 | 23 | # This has to be in sync with the tests-extras/test-runner.sh script | ||
22 | 24 | # functionalities as the parameters to this one are passed directly there | ||
23 | 25 | # this function will quit the script because of the 'exec' keyword | ||
24 | 26 | show_help() { | 22 | show_help() { |
25 | 27 | exec cat <<'EOF' | 23 | exec cat <<'EOF' |
26 | 28 | Usage: run-tests.sh [OPTIONS] | 24 | Usage: run-tests.sh [OPTIONS] |
27 | 29 | 25 | ||
28 | 30 | This is fetch & forget script and what it does is to fetch the | 26 | This is fetch & forget script and what it does is to fetch the |
30 | 31 | tests-extras repository and execute the run-tests.sh script from | 27 | stack-snaps-tools repository and execute the run-tests.sh script from |
31 | 32 | there passing arguments as-is. | 28 | there passing arguments as-is. |
32 | 33 | 29 | ||
40 | 34 | optional arguments: | 30 | When you see this message you don't have the tests-extras folder |
41 | 35 | --help Show this help message and exit | 31 | successfully populated in your workspace yet. Please rerun without |
42 | 36 | --channel Select another channel to build the base image from (default: stable) | 32 | specifying --help to proceed with the initial clone of the git repository. |
36 | 37 | --snap Extra snap to install | ||
37 | 38 | --debug Enable verbose debugging output | ||
38 | 39 | --test-from-channel Pull network-manager snap from the specified channel instead of building it from source | ||
39 | 40 | --force-new-image Force generating a new image used for testing | ||
43 | 41 | EOF | 33 | EOF |
44 | 42 | } | 34 | } |
45 | 43 | 35 | ||
47 | 44 | # Clone the tests-extras repository | 36 | # Clone the stack-snaps-tools repository |
48 | 45 | clone_tests_extras() { | 37 | clone_tests_extras() { |
55 | 46 | echo "INFO: Fetching tests-extras scripts into $TESTS_EXTRAS_PATH ..." | 38 | echo "INFO: Fetching stack-snaps-tools scripts into $TESTS_EXTRAS_PATH ..." |
56 | 47 | git clone -b master $TESTS_EXTRAS_URL $TESTS_EXTRAS_PATH >/dev/null 2>&1 | 39 | if ! git clone -b master $TESTS_EXTRAS_URL $TESTS_EXTRAS_PATH >/dev/null 2>&1; then |
57 | 48 | if [ $? -ne 0 ]; then | 40 | echo "ERROR: Failed to fetch the $TESTS_EXTRAS_URL repo, exiting.." |
58 | 49 | echo "ERROR: Failed to fetch the $TESTS_EXTRAS_URL repo, exiting.." | 41 | exit 1 |
59 | 50 | exit 1 | 42 | fi |
54 | 51 | fi | ||
60 | 52 | } | 43 | } |
61 | 53 | 44 | ||
63 | 54 | # Make sure the already cloned tests-extras repository is in a known and update | 45 | # Make sure the already cloned stack-snaps-tools repository is in a known and update |
64 | 55 | # state before it is going to be used. | 46 | # state before it is going to be used. |
65 | 56 | restore_and_update_tests_extras() { | 47 | restore_and_update_tests_extras() { |
69 | 57 | echo "INFO: Restoring and updating $TESTS_EXTRAS_PATH" | 48 | echo "INFO: Restoring and updating $TESTS_EXTRAS_PATH" |
70 | 58 | cd $TESTS_EXTRAS_PATH && git reset --hard && git clean -dfx && git pull | 49 | cd $TESTS_EXTRAS_PATH && git reset --hard && git clean -dfx && git pull |
71 | 59 | cd - | 50 | cd - |
72 | 60 | } | 51 | } |
73 | 61 | 52 | ||
74 | 62 | # ============================================================================== | 53 | # ============================================================================== |
76 | 63 | # This is fetch & forget script and what it does is to fetch the tests-extras | 54 | # This is fetch & forget script and what it does is to fetch the stack-snaps-tools |
77 | 64 | # repo and execute the run-tests.sh script from there passing arguments as-is. | 55 | # repo and execute the run-tests.sh script from there passing arguments as-is. |
78 | 65 | # | 56 | # |
80 | 66 | # The tests-extras repository ends up checked out in the snap tree but as a | 57 | # The stack-snaps-tools repository ends up checked out in the snap tree but as a |
81 | 67 | # hidden directory which is re-used since then. | 58 | # hidden directory which is re-used since then. |
82 | 68 | 59 | ||
85 | 69 | # Display help w/o fetching anything and exit | 60 | # Find snap to use in the tests |
86 | 70 | [ "$1" = "--help" ] && show_help | 61 | snaps=$(find . -maxdepth 1 -type f -name \ |
87 | 62 | "*_*_$(dpkg-architecture -q DEB_HOST_ARCH).snap") | ||
88 | 63 | while read -r snap_file; do | ||
89 | 64 | if [ -n "$snap" ]; then | ||
90 | 65 | printf "More than one snap revision in the folder\n" | ||
91 | 66 | exit 1 | ||
92 | 67 | fi | ||
93 | 68 | snap=$PWD/${snap_file#*/} | ||
94 | 69 | done < <(printf "%s\n" "$snaps") | ||
95 | 70 | |||
96 | 71 | [ ! -d "$TESTS_EXTRAS_PATH" ] && [ "$1" = "--help" ] && show_help | ||
97 | 71 | 72 | ||
98 | 72 | if [ -d "$TESTS_EXTRAS_PATH" ]; then | 73 | if [ -d "$TESTS_EXTRAS_PATH" ]; then |
100 | 73 | restore_and_update_tests_extras | 74 | restore_and_update_tests_extras |
101 | 74 | else | 75 | else |
103 | 75 | clone_tests_extras | 76 | clone_tests_extras |
104 | 77 | fi | ||
105 | 78 | |||
106 | 79 | # Any project-specific options for test-runner should be specified in | ||
107 | 80 | # .tests_config under EXTRA_ARGS | ||
108 | 81 | if [ -f ".tests_config" ]; then | ||
109 | 82 | # shellcheck disable=SC1091 | ||
110 | 83 | . .tests_config | ||
111 | 76 | fi | 84 | fi |
112 | 77 | 85 | ||
113 | 86 | # Get backends | ||
114 | 87 | backends="--backends=" | ||
115 | 88 | separator="" | ||
116 | 89 | while read -r be; do | ||
117 | 90 | backends=$backends$separator${be##*.} | ||
118 | 91 | separator=, | ||
119 | 92 | done < <(yq r spread.yaml --printMode p 'backends.qemu.systems[*].*') | ||
120 | 93 | |||
121 | 78 | echo "INFO: Executing tests runner" | 94 | echo "INFO: Executing tests runner" |
123 | 79 | cd $TESTS_EXTRAS_PATH && ./tests-runner.sh "$@" | 95 | # shellcheck disable=SC2086 |
124 | 96 | cd $TESTS_EXTRAS_PATH && | ||
125 | 97 | ./tests-runner.sh "$@" --snap="$snap" "$backends" $EXTRA_ARGS | ||
126 | diff --git a/snapcraft.yaml b/snapcraft.yaml | |||
127 | index b4bf686..5015ebb 100644 | |||
128 | --- a/snapcraft.yaml | |||
129 | +++ b/snapcraft.yaml | |||
130 | @@ -129,6 +129,7 @@ parts: | |||
131 | 129 | - --disable-systemd-login | 129 | - --disable-systemd-login |
132 | 130 | - --without-caps | 130 | - --without-caps |
133 | 131 | - --disable-webrtc-aec | 131 | - --disable-webrtc-aec |
134 | 132 | - --disable-dbus | ||
135 | 132 | - --disable-oss-output | 133 | - --disable-oss-output |
136 | 133 | - --disable-oss-wrapper | 134 | - --disable-oss-wrapper |
137 | 134 | - --disable-jack | 135 | - --disable-jack |
138 | diff --git a/tests/lib/prepare-all.sh b/tests/lib/prepare-all.sh | |||
139 | index 00819cf..08ae20a 100644 | |||
140 | --- a/tests/lib/prepare-all.sh | |||
141 | +++ b/tests/lib/prepare-all.sh | |||
142 | @@ -1,43 +1,4 @@ | |||
144 | 1 | #!/bin/bash | 1 | #!/bin/bash -x |
145 | 2 | 2 | ||
187 | 3 | # We don't have to build a snap when we should use one from a | 3 | # Nothing to do here for the moment |
188 | 4 | # channel | 4 | exit 0 |
148 | 5 | if [ -n "$SNAP_CHANNEL" ] ; then | ||
149 | 6 | exit 0 | ||
150 | 7 | fi | ||
151 | 8 | |||
152 | 9 | # Setup classic snap and build the pulseaudio snap in there | ||
153 | 10 | snap install --devmode --beta classic | ||
154 | 11 | cat <<-EOF > /home/test/build-snap.sh | ||
155 | 12 | #!/bin/sh | ||
156 | 13 | set -ex | ||
157 | 14 | |||
158 | 15 | export DEBIAN_FRONTEND=noninteractive | ||
159 | 16 | |||
160 | 17 | # If there is a snap prebuilt for us, lets take that one to speed things up. | ||
161 | 18 | if [ -e $PROJECT_PATH/${SNAP_NAME}_*_${SNAP_ARCH}.snap ] ; then | ||
162 | 19 | exit 0 | ||
163 | 20 | fi | ||
164 | 21 | |||
165 | 22 | # FIXME: Enable propose for now until problems with conflicting systemd | ||
166 | 23 | # packages between the Ubuntu Core image ppa and the archive are fixed. | ||
167 | 24 | echo "deb http://archive.ubuntu.com/ubuntu/ xenial-proposed restricted main universe" > /etc/apt/sources.list.d/ubuntu-proposed.list | ||
168 | 25 | echo "deb http://ppa.launchpad.net/snappy-dev/image/ubuntu xenial main" > /etc/apt/sources.list.d/ubuntu-image-ppa.list | ||
169 | 26 | |||
170 | 27 | # Ensure we have the latest updates installed as the core snap | ||
171 | 28 | # may be a bit out of date. | ||
172 | 29 | apt update | ||
173 | 30 | apt -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' full-upgrade -y --force-yes | ||
174 | 31 | |||
175 | 32 | apt install -y --force-yes snapcraft | ||
176 | 33 | cd /home/pulseaudio | ||
177 | 34 | snapcraft clean | ||
178 | 35 | snapcraft | ||
179 | 36 | EOF | ||
180 | 37 | |||
181 | 38 | chmod +x /home/test/build-snap.sh | ||
182 | 39 | sudo classic /home/test/build-snap.sh | ||
183 | 40 | snap remove classic | ||
184 | 41 | |||
185 | 42 | # Make sure we have a snap build | ||
186 | 43 | test -e /home/pulseaudio/${SNAP_NAME}*_${SNAP_ARCH}.snap | ||
189 | diff --git a/tests/lib/prepare.sh b/tests/lib/prepare.sh | |||
190 | index e14a9b2..fc90454 100644 | |||
191 | --- a/tests/lib/prepare.sh | |||
192 | +++ b/tests/lib/prepare.sh | |||
193 | @@ -1,6 +1,7 @@ | |||
195 | 1 | #!/bin/bash | 1 | #!/bin/bash -ex |
196 | 2 | 2 | ||
198 | 3 | . $TESTSLIB/utilities.sh | 3 | # shellcheck source=tests/lib/utilities.sh |
199 | 4 | . "$TESTSLIB"/utilities.sh | ||
200 | 4 | 5 | ||
201 | 5 | echo "Wait for firstboot change to be ready" | 6 | echo "Wait for firstboot change to be ready" |
202 | 6 | while ! snap changes | grep -q "Done"; do | 7 | while ! snap changes | grep -q "Done"; do |
203 | @@ -10,9 +11,10 @@ while ! snap changes | grep -q "Done"; do | |||
204 | 10 | done | 11 | done |
205 | 11 | 12 | ||
206 | 12 | echo "Ensure fundamental snaps are still present" | 13 | echo "Ensure fundamental snaps are still present" |
210 | 13 | . $TESTSLIB/snap-names.sh | 14 | # shellcheck source=tests/lib/snap-names.sh |
211 | 14 | for name in $gadget_name $kernel_name $core_name; do | 15 | . "$TESTSLIB"/snap-names.sh |
212 | 15 | if ! snap list | grep -q $name ; then | 16 | for name in "$gadget_name" "$kernel_name" "$core_name"; do |
213 | 17 | if ! snap list | grep -q "$name" ; then | ||
214 | 16 | echo "Not all fundamental snaps are available, all-snap image not valid" | 18 | echo "Not all fundamental snaps are available, all-snap image not valid" |
215 | 17 | echo "Currently installed snaps:" | 19 | echo "Currently installed snaps:" |
216 | 18 | snap list | 20 | snap list |
217 | @@ -20,9 +22,6 @@ for name in $gadget_name $kernel_name $core_name; do | |||
218 | 20 | fi | 22 | fi |
219 | 21 | done | 23 | done |
220 | 22 | 24 | ||
221 | 23 | echo "Kernel has a store revision" | ||
222 | 24 | snap list | grep ^${kernel_name} | grep -E " [0-9]+\s+canonical" | ||
223 | 25 | |||
224 | 26 | install_snap_under_test | 25 | install_snap_under_test |
225 | 27 | 26 | ||
226 | 28 | # Snapshot of the current snapd state for a later restore | 27 | # Snapshot of the current snapd state for a later restore |
227 | @@ -34,4 +33,4 @@ fi | |||
228 | 34 | 33 | ||
229 | 35 | # For debugging dump all snaps and connected slots/plugs | 34 | # For debugging dump all snaps and connected slots/plugs |
230 | 36 | snap list | 35 | snap list |
232 | 37 | snap interfaces | 36 | snap connections --all |
233 | diff --git a/tests/lib/restore-each.sh b/tests/lib/restore-each.sh | |||
234 | index 541ba8c..9427aa8 100644 | |||
235 | --- a/tests/lib/restore-each.sh | |||
236 | +++ b/tests/lib/restore-each.sh | |||
237 | @@ -1,12 +1,13 @@ | |||
239 | 1 | #!/bin/bash | 1 | #!/bin/bash -ex |
240 | 2 | 2 | ||
242 | 3 | . $TESTSLIB/snap-names.sh | 3 | # shellcheck source=tests/lib/snap-names.sh |
243 | 4 | . "$TESTSLIB"/snap-names.sh | ||
244 | 4 | 5 | ||
245 | 5 | # Remove all snaps not being the core, gadget, kernel or snap we're testing | 6 | # Remove all snaps not being the core, gadget, kernel or snap we're testing |
246 | 6 | for snap in /snap/*; do | 7 | for snap in /snap/*; do |
247 | 7 | snap="${snap:6}" | 8 | snap="${snap:6}" |
248 | 8 | case "$snap" in | 9 | case "$snap" in |
250 | 9 | "bin" | "$gadget_name" | "$kernel_name" | "$core_name" | "$SNAP_NAME") | 10 | README | bin | "$gadget_name" | "$kernel_name" | core* | snapd | "$SNAP_NAME") |
251 | 10 | ;; | 11 | ;; |
252 | 11 | *) | 12 | *) |
253 | 12 | snap remove "$snap" | 13 | snap remove "$snap" |
254 | diff --git a/tests/lib/utilities.sh b/tests/lib/utilities.sh | |||
255 | index 08c0b8c..afc319d 100644 | |||
256 | --- a/tests/lib/utilities.sh | |||
257 | +++ b/tests/lib/utilities.sh | |||
258 | @@ -12,23 +12,26 @@ install_snap_under_test() { | |||
259 | 12 | # without any network connectivity after reboot. | 12 | # without any network connectivity after reboot. |
260 | 13 | if [ -n "$SNAP_CHANNEL" ] ; then | 13 | if [ -n "$SNAP_CHANNEL" ] ; then |
261 | 14 | # Don't reinstall if we have it installed already | 14 | # Don't reinstall if we have it installed already |
264 | 15 | if ! snap list | grep $SNAP_NAME ; then | 15 | if ! snap list | grep "$SNAP_NAME"; then |
265 | 16 | snap install --$SNAP_CHANNEL $SNAP_NAME | 16 | snap install --"$SNAP_CHANNEL" "$SNAP_NAME" |
266 | 17 | fi | 17 | fi |
267 | 18 | else | 18 | else |
268 | 19 | # Install first from store to avoid error when performing the connection | 19 | # Install first from store to avoid error when performing the connection |
270 | 20 | snap install $SNAP_NAME | 20 | sleep 3 |
271 | 21 | snap install "$SNAP_NAME" | ||
272 | 22 | sleep 3 | ||
273 | 21 | # Install prebuilt snap | 23 | # Install prebuilt snap |
285 | 22 | snap install --dangerous ${PROJECT_PATH}/${SNAP_NAME}_*_${SNAP_ARCH}.snap | 24 | snap install --dangerous "$PROJECT_PATH"/"$SNAP_NAME"_*_"$SNAP_ARCH".snap |
286 | 23 | fi | 25 | sleep 3 |
287 | 24 | if [ -n "$SNAP_AUTO_ALIASES" ]; then | 26 | if [ -n "$SNAP_AUTO_ALIASES" ]; then |
288 | 25 | snapd_version=$(snap version | awk '/^snapd / {print $2; exit}') | 27 | snapd_version=$(snap version | awk '/^snapd / {print $2; exit}') |
289 | 26 | for alias in $SNAP_AUTO_ALIASES ; do | 28 | for alias in $SNAP_AUTO_ALIASES ; do |
290 | 27 | target=$SNAP_NAME.$alias | 29 | target="$SNAP_NAME".$alias |
291 | 28 | if dpkg --compare-versions $snapd_version lt 2.25 ; then | 30 | if dpkg --compare-versions "$snapd_version" lt 2.25 ; then |
292 | 29 | target=$SNAP_NAME | 31 | target="$SNAP_NAME" |
293 | 30 | fi | 32 | fi |
294 | 31 | snap alias $target $alias | 33 | snap alias "$target" "$alias" |
295 | 32 | done | 34 | done |
296 | 35 | fi | ||
297 | 33 | fi | 36 | fi |
298 | 34 | } | 37 | } |
299 | diff --git a/tests/main/module-loading-disabled/task.yaml b/tests/main/module-loading-disabled/task.yaml | |||
300 | 35 | deleted file mode 100644 | 38 | deleted file mode 100644 |
301 | index 5ee9b43..0000000 | |||
302 | --- a/tests/main/module-loading-disabled/task.yaml | |||
303 | +++ /dev/null | |||
304 | @@ -1,8 +0,0 @@ | |||
305 | 1 | summary: Verify module loading is disabled | ||
306 | 2 | |||
307 | 3 | description: | | ||
308 | 4 | As we're running pulseaudio in system mode (see https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/) | ||
309 | 5 | for more details we have module loading disabled to prevent any client from loading malicious code into the daemon. | ||
310 | 6 | |||
311 | 7 | execute: | | ||
312 | 8 | ! /snap/bin/pactl load-module module-null-sink | ||
313 | diff --git a/tests/main/pactl-connects-to-server/task.yaml b/tests/main/pactl-connects-to-server/task.yaml | |||
314 | index 41dee48..f547f73 100644 | |||
315 | --- a/tests/main/pactl-connects-to-server/task.yaml | |||
316 | +++ b/tests/main/pactl-connects-to-server/task.yaml | |||
317 | @@ -1,5 +1,6 @@ | |||
318 | 1 | summary: Test pactl is working | 1 | summary: Test pactl is working |
319 | 2 | 2 | ||
320 | 3 | execute: | | 3 | execute: | |
323 | 4 | # Does it even work? | 4 | sleep 3 |
324 | 5 | /snap/bin/pactl info | grep -Pzq 'Server Name: pulseaudio' | 5 | # Does it even work? |
325 | 6 | /snap/bin/pactl info | grep -Pzq 'Server Name: pulseaudio' |
PASSED: Successfully build documentation, rev: 78254fff87a3aff 9aff0efe5817b78 b082bc73cf
Generated documentation is available at https:/ /jenkins. canonical. com/system- enablement/ job/snappy- hwe-snaps- snap-docs/ 1344/