Merge ~ssweeny/snappy-hwe-snaps/+git/tpm2:aliases into ~snappy-hwe-team/snappy-hwe-snaps/+git/tpm2:master
- Git
- lp:~ssweeny/snappy-hwe-snaps/+git/tpm2
- aliases
- Merge into master
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Tony Espy | ||||
Approved revision: | 593064ecf212a1a441c3e70d2001e260262ede41 | ||||
Merged at revision: | 076274ee827a0c09baf03e0c81ad6ad47ade8e9f | ||||
Proposed branch: | ~ssweeny/snappy-hwe-snaps/+git/tpm2:aliases | ||||
Merge into: | ~snappy-hwe-team/snappy-hwe-snaps/+git/tpm2:master | ||||
Diff against target: |
751 lines (+173/-110) 8 files modified
dev/null (+0/-25) run-tests.sh (+55/-60) snapcraft.yaml (+35/-3) spread.yaml (+4/-1) tests/lib/prepare-all.sh (+3/-3) tests/lib/prepare.sh (+4/-18) tests/lib/utilities.sh (+39/-0) tests/main/installation/task.yaml (+33/-0) |
||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
System Enablement Bot | continuous-integration | Approve | |
Tony Espy | Approve | ||
Jim Hodapp (community) | Approve | ||
Simon Fels | Needs Fixing | ||
Review via email: mp+316649@code.launchpad.net |
Commit message
Enable aliases for all tools
Description of the change
Enable aliases for all tools
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
Simon Fels (morphis) wrote : | # |
Needs spread tests.
Jim Hodapp (jhodapp) wrote : | # |
Scott, feel free to push back against this if you feel it's too much scope-creep, but could you add a basic index.md file located at docs/index.md to this MR just explaining the very basics of what tpm is, what tpm2 gives you specifically, and a very basic how to use the snap? We need to start adding the basic doc structure to all of our snaps that are missing them today.
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:956c3eb22ab
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:40ccf539a51
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Scott Sweeny (ssweeny) wrote : | # |
> Scott, feel free to push back against this if you feel it's too much scope-
> creep, but could you add a basic index.md file located at docs/index.md to
> this MR just explaining the very basics of what tpm is, what tpm2 gives you
> specifically, and a very basic how to use the snap? We need to start adding
> the basic doc structure to all of our snaps that are missing them today.
Jim,
I think adding those docs are a great idea... for a card in the backlog :)
Jim Hodapp (jhodapp) wrote : | # |
Fair enough. :) Would you mind adding one to the backlog?
Jim Hodapp (jhodapp) wrote : | # |
Looks good overall, a few comments inline below.
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:6e30d2903e9
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Tony Espy (awe) wrote : | # |
Two minor fixes needed...
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:593064ecf21
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 | index 1d58d86..bc4b987 100755 | |||
3 | --- a/run-tests.sh | |||
4 | +++ b/run-tests.sh | |||
5 | @@ -1,6 +1,6 @@ | |||
7 | 1 | #!/bin/bash | 1 | #!/bin/sh |
8 | 2 | # | 2 | # |
10 | 3 | # Copyright (C) 2016 Canonical Ltd | 3 | # Copyright (C) 2017 Canonical Ltd |
11 | 4 | # | 4 | # |
12 | 5 | # This program is free software: you can redistribute it and/or modify | 5 | # This program is free software: you can redistribute it and/or modify |
13 | 6 | # it under the terms of the GNU General Public License version 3 as | 6 | # it under the terms of the GNU General Public License version 3 as |
14 | @@ -16,69 +16,64 @@ | |||
15 | 16 | 16 | ||
16 | 17 | set -e | 17 | set -e |
17 | 18 | 18 | ||
23 | 19 | image_name=ubuntu-core-16.img | 19 | TESTS_EXTRAS_URL="https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/tests-extras" |
24 | 20 | channel=candidate | 20 | TESTS_EXTRAS_PATH=".tests-extras" |
20 | 21 | spread_opts= | ||
21 | 22 | force_new_image=0 | ||
22 | 23 | test_from_channel=0 | ||
25 | 24 | 21 | ||
26 | 22 | # Display help. | ||
27 | 23 | # This has to be in sync with the tests-extras/test-runner.sh script | ||
28 | 24 | # functionalities as the parameters to this one are passed directly there | ||
29 | 25 | # this function will quit the script because of the 'exec' keyword | ||
30 | 25 | show_help() { | 26 | show_help() { |
39 | 26 | echo "Usage: run-tests.sh [OPTIONS]" | 27 | exec cat <<'EOF' |
40 | 27 | echo | 28 | Usage: run-tests.sh [OPTIONS] |
41 | 28 | echo "optional arguments:" | 29 | |
42 | 29 | echo " --help Show this help message and exit" | 30 | This is fetch & forget script and what it does is to fetch the |
43 | 30 | echo " --channel Select another channel to build the base image from (default: $channel)" | 31 | tests-extras repository and execute the run-tests.sh script from |
44 | 31 | echo " --debug Enable verbose debugging output" | 32 | there passing arguments as-is. |
45 | 32 | echo " --test-from-channel Pull tpm2 snap from the specified channel instead of building it from source" | 33 | |
46 | 33 | echo " --force-new-image Force generating a new image used for testing" | 34 | optional arguments: |
47 | 35 | --help Show this help message and exit | ||
48 | 36 | --channel Select another channel to build the base image from (default: stable) | ||
49 | 37 | --snap Extra snap to install | ||
50 | 38 | --debug Enable verbose debugging output | ||
51 | 39 | --test-from-channel Pull tpm2 snap from the specified channel instead of building it from source | ||
52 | 40 | --force-new-image Force generating a new image used for testing | ||
53 | 41 | EOF | ||
54 | 34 | } | 42 | } |
55 | 35 | 43 | ||
84 | 36 | while [ -n "$1" ]; do | 44 | # Clone the tests-extras repository |
85 | 37 | case "$1" in | 45 | clone_tests_extras() { |
86 | 38 | --help) | 46 | echo "INFO: Fetching tests-extras scripts into $TESTS_EXTRAS_PATH ..." |
87 | 39 | show_help | 47 | git clone -b master $TESTS_EXTRAS_URL $TESTS_EXTRAS_PATH >/dev/null 2>&1 |
88 | 40 | exit | 48 | if [ $? -ne 0 ]; then |
89 | 41 | ;; | 49 | echo "ERROR: Failed to fetch the $TESTS_EXTRAS_URL repo, exiting.." |
90 | 42 | --channel=*) | 50 | exit 1 |
91 | 43 | channel=${1#*=} | 51 | fi |
92 | 44 | shift | 52 | } |
65 | 45 | ;; | ||
66 | 46 | --test-from-channel) | ||
67 | 47 | test_from_channel=1 | ||
68 | 48 | shift | ||
69 | 49 | ;; | ||
70 | 50 | --debug) | ||
71 | 51 | spread_opts="$spread_opts -vv -debug" | ||
72 | 52 | shift | ||
73 | 53 | ;; | ||
74 | 54 | --force-new-image) | ||
75 | 55 | force_new_image=1 | ||
76 | 56 | shift | ||
77 | 57 | ;; | ||
78 | 58 | *) | ||
79 | 59 | echo "Unknown command: $1" | ||
80 | 60 | exit 1 | ||
81 | 61 | ;; | ||
82 | 62 | esac | ||
83 | 63 | done | ||
93 | 64 | 53 | ||
99 | 65 | SPREAD_QEMU_PATH="$HOME/.spread/qemu" | 54 | # Make sure the already cloned tests-extras repository is in a known and updated |
100 | 66 | if [ `which spread` = /snap/bin/spread ] ; then | 55 | # state before it is going to be used. |
101 | 67 | current_version=`readlink /snap/spread/current` | 56 | restore_and_update_tests_extras() { |
102 | 68 | SPREAD_QEMU_PATH="$HOME/snap/spread/$current_version/.spread/qemu/" | 57 | echo "INFO: Restoring and updating $TESTS_EXTRAS_PATH" |
103 | 69 | fi | 58 | cd $TESTS_EXTRAS_PATH && git reset --hard && git clean -dfx && git pull |
104 | 59 | cd - | ||
105 | 60 | } | ||
106 | 70 | 61 | ||
114 | 71 | # Make sure we have a base image we use for testing | 62 | # ============================================================================== |
115 | 72 | if [ ! -e $SPREAD_QEMU_PATH/$image_name ] || [ $force_new_image -eq 1 ] ; then | 63 | # This is fetch & forget script and what it does is to fetch the tests-extras |
116 | 73 | echo "INFO: Creating new qemu test image ..." | 64 | # repo and execute the run-tests.sh script from there passing arguments as-is. |
117 | 74 | (cd tests/image ; sudo ./create-image.sh $channel) | 65 | # |
118 | 75 | mkdir -p $SPREAD_QEMU_PATH | 66 | # The tests-extras repository ends up checked out in the snap tree but as a |
119 | 76 | mv tests/image/ubuntu-core-16.img $SPREAD_QEMU_PATH/$image_name | 67 | # hidden directory which is re-used since then. |
113 | 77 | fi | ||
120 | 78 | 68 | ||
125 | 79 | # We currently only run spread tests but we could do other things | 69 | # Display help w/o fetching anything and exit |
126 | 80 | # here as well like running our snap-lintian tool etc. | 70 | [ "$1" = "--help" ] && show_help |
127 | 81 | if [ $test_from_channel -eq 1 ] ; then | 71 | |
128 | 82 | export SNAP_CHANNEL=$channel | 72 | if [ -d "$TESTS_EXTRAS_PATH" ]; then |
129 | 73 | restore_and_update_tests_extras | ||
130 | 74 | else | ||
131 | 75 | clone_tests_extras | ||
132 | 83 | fi | 76 | fi |
134 | 84 | spread $spread_opts | 77 | |
135 | 78 | echo "INFO: Executing tests runner" | ||
136 | 79 | cd $TESTS_EXTRAS_PATH && ./tests-runner.sh "$@" | ||
137 | diff --git a/snapcraft.yaml b/snapcraft.yaml | |||
138 | index 6c30e14..a7c3720 100644 | |||
139 | --- a/snapcraft.yaml | |||
140 | +++ b/snapcraft.yaml | |||
141 | @@ -6,6 +6,7 @@ description: | | |||
142 | 6 | into a wide range of todays devices. Please find the source | 6 | into a wide range of todays devices. Please find the source |
143 | 7 | code at: https://code.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/tpm2 | 7 | code at: https://code.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/tpm2 |
144 | 8 | confinement: strict | 8 | confinement: strict |
145 | 9 | grade: stable | ||
146 | 9 | 10 | ||
147 | 10 | apps: | 11 | apps: |
148 | 11 | resourcemgr: | 12 | resourcemgr: |
149 | @@ -15,100 +16,131 @@ apps: | |||
150 | 15 | activatecredential: | 16 | activatecredential: |
151 | 16 | command: sbin/tpm2_activatecredential | 17 | command: sbin/tpm2_activatecredential |
152 | 17 | plugs: [network] | 18 | plugs: [network] |
153 | 19 | aliases: [tpm2_activatecredential] | ||
154 | 18 | akparse: | 20 | akparse: |
155 | 19 | command: sbin/tpm2_akparse | 21 | command: sbin/tpm2_akparse |
156 | 22 | aliases: [tpm2_akparse] | ||
157 | 20 | certify: | 23 | certify: |
158 | 21 | command: sbin/tpm2_certify | 24 | command: sbin/tpm2_certify |
159 | 22 | plugs: [network] | 25 | plugs: [network] |
160 | 26 | aliases: [tpm2_certify] | ||
161 | 23 | create: | 27 | create: |
162 | 24 | command: sbin/tpm2_create | 28 | command: sbin/tpm2_create |
163 | 25 | plugs: [network] | 29 | plugs: [network] |
164 | 30 | aliases: [tpm2_create] | ||
165 | 26 | createprimary: | 31 | createprimary: |
166 | 27 | command: sbin/tpm2_createprimary | 32 | command: sbin/tpm2_createprimary |
167 | 28 | plugs: [network] | 33 | plugs: [network] |
168 | 34 | aliases: [tpm2_createprimary] | ||
169 | 29 | encryptdecrypt: | 35 | encryptdecrypt: |
170 | 30 | command: sbin/tpm2_encryptdecrypt | 36 | command: sbin/tpm2_encryptdecrypt |
171 | 31 | plugs: [network] | 37 | plugs: [network] |
172 | 38 | aliases: [tpm2_encryptdecrypt] | ||
173 | 32 | evictcontrol: | 39 | evictcontrol: |
174 | 33 | command: sbin/tpm2_evictcontrol | 40 | command: sbin/tpm2_evictcontrol |
175 | 34 | plugs: [network] | 41 | plugs: [network] |
176 | 42 | aliases: [tpm2_evictcontrol] | ||
177 | 35 | getmanufec: | 43 | getmanufec: |
178 | 36 | command: sbin/tpm2_getmanufec | 44 | command: sbin/tpm2_getmanufec |
179 | 37 | plugs: [network] | 45 | plugs: [network] |
180 | 46 | aliases: [tpm2_getmanufec] | ||
181 | 38 | getpubak: | 47 | getpubak: |
182 | 39 | command: sbin/tpm2_getpubak | 48 | command: sbin/tpm2_getpubak |
183 | 40 | plugs: [network] | 49 | plugs: [network] |
184 | 50 | aliases: [tpm2_getpubak] | ||
185 | 41 | getpubek: | 51 | getpubek: |
186 | 42 | command: sbin/tpm2_getpubek | 52 | command: sbin/tpm2_getpubek |
187 | 43 | plugs: [network] | 53 | plugs: [network] |
188 | 54 | aliases: [tpm2_getpubek] | ||
189 | 44 | getrandom: | 55 | getrandom: |
190 | 45 | command: sbin/tpm2_getrandom | 56 | command: sbin/tpm2_getrandom |
191 | 46 | plugs: [network] | 57 | plugs: [network] |
192 | 58 | aliases: [tpm2_getrandom] | ||
193 | 47 | hash: | 59 | hash: |
194 | 48 | command: sbin/tpm2_hash | 60 | command: sbin/tpm2_hash |
195 | 49 | plugs: [network] | 61 | plugs: [network] |
196 | 62 | aliases: [tpm2_hash] | ||
197 | 50 | hmac: | 63 | hmac: |
198 | 51 | command: sbin/tpm2_hmac | 64 | command: sbin/tpm2_hmac |
199 | 52 | plugs: [network] | 65 | plugs: [network] |
200 | 66 | aliases: [tpm2_hmac] | ||
201 | 53 | listpcrs: | 67 | listpcrs: |
202 | 54 | command: sbin/tpm2_listpcrs | 68 | command: sbin/tpm2_listpcrs |
203 | 55 | plugs: [network] | 69 | plugs: [network] |
204 | 70 | aliases: [tpm2_listpcrs] | ||
205 | 56 | load: | 71 | load: |
206 | 57 | command: sbin/tpm2_load | 72 | command: sbin/tpm2_load |
207 | 58 | plugs: [network] | 73 | plugs: [network] |
208 | 74 | aliases: [tpm2_load] | ||
209 | 59 | loadexternal: | 75 | loadexternal: |
210 | 60 | command: sbin/tpm2_loadexternal | 76 | command: sbin/tpm2_loadexternal |
211 | 61 | plugs: [network] | 77 | plugs: [network] |
212 | 78 | aliases: [tpm2_loadexternal] | ||
213 | 62 | makecredential: | 79 | makecredential: |
214 | 63 | command: sbin/tpm2_makecredential | 80 | command: sbin/tpm2_makecredential |
215 | 64 | plugs: [network] | 81 | plugs: [network] |
216 | 82 | aliases: [tpm2_makecredential] | ||
217 | 65 | nvdefine: | 83 | nvdefine: |
218 | 66 | command: sbin/tpm2_nvdefine | 84 | command: sbin/tpm2_nvdefine |
219 | 67 | plugs: [network] | 85 | plugs: [network] |
220 | 86 | aliases: [tpm2_nvdefine] | ||
221 | 68 | nvlist: | 87 | nvlist: |
222 | 69 | command: sbin/tpm2_nvlist | 88 | command: sbin/tpm2_nvlist |
223 | 70 | plugs: [network] | 89 | plugs: [network] |
224 | 90 | aliases: [tpm2_nvlist] | ||
225 | 71 | nvread: | 91 | nvread: |
226 | 72 | command: sbin/tpm2_nvread | 92 | command: sbin/tpm2_nvread |
227 | 73 | plugs: [network] | 93 | plugs: [network] |
228 | 94 | aliases: [tpm2_nvread] | ||
229 | 74 | nvrelease: | 95 | nvrelease: |
230 | 75 | command: sbin/tpm2_nvrelease | 96 | command: sbin/tpm2_nvrelease |
231 | 76 | plugs: [network] | 97 | plugs: [network] |
232 | 98 | aliases: [tpm2_nvrelease] | ||
233 | 77 | nvwrite: | 99 | nvwrite: |
234 | 78 | command: sbin/tpm2_nvwrite | 100 | command: sbin/tpm2_nvwrite |
235 | 79 | plugs: [network] | 101 | plugs: [network] |
236 | 102 | aliases: [tpm2_nvwrite] | ||
237 | 80 | quote: | 103 | quote: |
238 | 81 | command: sbin/tpm2_quote | 104 | command: sbin/tpm2_quote |
239 | 82 | plugs: [network] | 105 | plugs: [network] |
240 | 106 | aliases: [tpm2_quote] | ||
241 | 83 | rc-decode: | 107 | rc-decode: |
242 | 84 | command: sbin/tpm2_rc_decode | 108 | command: sbin/tpm2_rc_decode |
243 | 109 | aliases: [tpm2_rc_decode] | ||
244 | 85 | readpublic: | 110 | readpublic: |
245 | 86 | command: sbin/tpm2_readpublic | 111 | command: sbin/tpm2_readpublic |
246 | 87 | plugs: [network] | 112 | plugs: [network] |
247 | 113 | aliases: [tpm2_readpublic] | ||
248 | 88 | rsadecrypt: | 114 | rsadecrypt: |
249 | 89 | command: sbin/tpm2_rsadecrypt | 115 | command: sbin/tpm2_rsadecrypt |
250 | 90 | plugs: [network] | 116 | plugs: [network] |
251 | 117 | aliases: [tpm2_rsadecrypt] | ||
252 | 91 | rsaencrypt: | 118 | rsaencrypt: |
253 | 92 | command: sbin/tpm2_rsaencrypt | 119 | command: sbin/tpm2_rsaencrypt |
254 | 93 | plugs: [network] | 120 | plugs: [network] |
255 | 121 | aliases: [tpm2_rsaencrypt] | ||
256 | 94 | sign: | 122 | sign: |
257 | 95 | command: sbin/tpm2_sign | 123 | command: sbin/tpm2_sign |
258 | 96 | plugs: [network] | 124 | plugs: [network] |
259 | 125 | aliases: [tpm2_sign] | ||
260 | 97 | takeownership: | 126 | takeownership: |
261 | 98 | command: sbin/tpm2_takeownership | 127 | command: sbin/tpm2_takeownership |
262 | 99 | plugs: [network] | 128 | plugs: [network] |
263 | 129 | aliases: [tpm2_takeownership] | ||
264 | 100 | unseal: | 130 | unseal: |
265 | 101 | command: sbin/tpm2_unseal | 131 | command: sbin/tpm2_unseal |
266 | 102 | plugs: [network] | 132 | plugs: [network] |
267 | 133 | aliases: [tpm2_unseal] | ||
268 | 103 | verifysignature: | 134 | verifysignature: |
269 | 104 | command: sbin/tpm2_verifysignature | 135 | command: sbin/tpm2_verifysignature |
270 | 105 | plugs: [network] | 136 | plugs: [network] |
271 | 137 | aliases: [tpm2_verifysignature] | ||
272 | 106 | 138 | ||
273 | 107 | parts: | 139 | parts: |
274 | 108 | common: | 140 | common: |
275 | 109 | plugin: dump | 141 | plugin: dump |
276 | 110 | source: . | 142 | source: . |
278 | 111 | snap: | 143 | prime: |
279 | 112 | - copyright.tpm2-tss | 144 | - copyright.tpm2-tss |
280 | 113 | - copyright.tpm2-tools | 145 | - copyright.tpm2-tools |
281 | 114 | tpm2-tss: | 146 | tpm2-tss: |
282 | @@ -123,7 +155,7 @@ parts: | |||
283 | 123 | - gcc | 155 | - gcc |
284 | 124 | - g++ | 156 | - g++ |
285 | 125 | - libc6-dev | 157 | - libc6-dev |
287 | 126 | snap: | 158 | prime: |
288 | 127 | - -include | 159 | - -include |
289 | 128 | tpm2-tools: | 160 | tpm2-tools: |
290 | 129 | plugin: autotools | 161 | plugin: autotools |
291 | @@ -144,7 +176,7 @@ parts: | |||
292 | 144 | - libcurl4-openssl-dev | 176 | - libcurl4-openssl-dev |
293 | 145 | - libssl-dev | 177 | - libssl-dev |
294 | 146 | - libtool | 178 | - libtool |
296 | 147 | snap: | 179 | prime: |
297 | 148 | - -include | 180 | - -include |
298 | 149 | after: | 181 | after: |
299 | 150 | - tpm2-tss | 182 | - tpm2-tss |
300 | diff --git a/spread.yaml b/spread.yaml | |||
301 | index 77659ce..0b5f803 100644 | |||
302 | --- a/spread.yaml | |||
303 | +++ b/spread.yaml | |||
304 | @@ -1,5 +1,5 @@ | |||
305 | 1 | # | 1 | # |
307 | 2 | # Copyright (C) 2016 Canonical Ltd | 2 | # Copyright (C) 2017 Canonical Ltd |
308 | 3 | # | 3 | # |
309 | 4 | # This program is free software: you can redistribute it and/or modify | 4 | # This program is free software: you can redistribute it and/or modify |
310 | 5 | # it under the terms of the GNU General Public License version 3 as | 5 | # it under the terms of the GNU General Public License version 3 as |
311 | @@ -20,8 +20,11 @@ environment: | |||
312 | 20 | PROJECT_PATH: /home/tpm2 | 20 | PROJECT_PATH: /home/tpm2 |
313 | 21 | TESTSLIB: $PROJECT_PATH/tests/lib | 21 | TESTSLIB: $PROJECT_PATH/tests/lib |
314 | 22 | SNAP_NAME: tpm2 | 22 | SNAP_NAME: tpm2 |
315 | 23 | SNAP_ARCH: amd64 | ||
316 | 23 | # Allow the host to pass the channel to use for the test run | 24 | # Allow the host to pass the channel to use for the test run |
317 | 24 | SNAP_CHANNEL: $(HOST:echo $SNAP_CHANNEL) | 25 | SNAP_CHANNEL: $(HOST:echo $SNAP_CHANNEL) |
318 | 26 | SNAP_AUTOCONNECT_CORE_PLUGS: network network-bind tpm | ||
319 | 27 | SNAP_AUTO_ALIASES: tpm2_activatecredential tpm2_akparse tpm2_certify tpm2_create tpm2_createprimary tpm2_encryptdecrypt tpm2_evictcontrol tpm2_getmanufec tpm2_getpubak tpm2_getpubek tpm2_getrandom tpm2_hash tpm2_hmac tpm2_listpcrs tpm2_load tpm2_loadexternal tpm2_makecredential tpm2_nvdefine tpm2_nvlist tpm2_nvread tpm2_nvrelease tpm2_nvwrite tpm2_quote tpm2_rc_decode tpm2_readpublic tpm2_rsadecrypt tpm2_rsaencrypt tpm2_sign tpm2_takeownership tpm2_unseal tpm2_verifysignature | ||
320 | 25 | 28 | ||
321 | 26 | backends: | 29 | backends: |
322 | 27 | qemu: | 30 | qemu: |
323 | diff --git a/tests/image/.create-image.sh.swp b/tests/image/.create-image.sh.swp | |||
324 | 28 | deleted file mode 100644 | 31 | deleted file mode 100644 |
325 | index e94bc8c..0000000 | |||
326 | 29 | Binary files a/tests/image/.create-image.sh.swp and /dev/null differ | 32 | Binary files a/tests/image/.create-image.sh.swp and /dev/null differ |
327 | diff --git a/tests/image/README.md b/tests/image/README.md | |||
328 | 30 | deleted file mode 100644 | 33 | deleted file mode 100644 |
329 | index b75b66e..0000000 | |||
330 | --- a/tests/image/README.md | |||
331 | +++ /dev/null | |||
332 | @@ -1,7 +0,0 @@ | |||
333 | 1 | # Generate user password | ||
334 | 2 | |||
335 | 3 | You can generate the password for the system user assertion via | ||
336 | 4 | |||
337 | 5 | ``` | ||
338 | 6 | $ python3 -c 'import crypt; print(crypt.crypt("test", crypt.mksalt(crypt.METHOD_SHA512)))' | ||
339 | 7 | ``` | ||
340 | diff --git a/tests/image/create-image.sh b/tests/image/create-image.sh | |||
341 | 8 | deleted file mode 100755 | 0 | deleted file mode 100755 |
342 | index 0875b55..0000000 | |||
343 | --- a/tests/image/create-image.sh | |||
344 | +++ /dev/null | |||
345 | @@ -1,156 +0,0 @@ | |||
346 | 1 | #!/bin/bash | ||
347 | 2 | # | ||
348 | 3 | # Copyright (C) 2016 Canonical Ltd | ||
349 | 4 | # | ||
350 | 5 | # This program is free software: you can redistribute it and/or modify | ||
351 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
352 | 7 | # published by the Free Software Foundation. | ||
353 | 8 | # | ||
354 | 9 | # This program is distributed in the hope that it will be useful, | ||
355 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
356 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
357 | 12 | # GNU General Public License for more details. | ||
358 | 13 | # | ||
359 | 14 | # You should have received a copy of the GNU General Public License | ||
360 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
361 | 16 | |||
362 | 17 | set -e | ||
363 | 18 | |||
364 | 19 | if [ $(id -u) -ne 0 ] ; then | ||
365 | 20 | echo "ERROR: needs to be executed as root" | ||
366 | 21 | exit 1 | ||
367 | 22 | fi | ||
368 | 23 | |||
369 | 24 | channel=candidate | ||
370 | 25 | if [ ! -z "$1" ] ; then | ||
371 | 26 | channel=$1 | ||
372 | 27 | fi | ||
373 | 28 | |||
374 | 29 | snap= | ||
375 | 30 | if [ ! -z "$2" ] ; then | ||
376 | 31 | snap=$2 | ||
377 | 32 | fi | ||
378 | 33 | |||
379 | 34 | model=pc | ||
380 | 35 | arch=amd64 | ||
381 | 36 | image_name=ubuntu-core-16.img | ||
382 | 37 | ubuntu_image_extra_args= | ||
383 | 38 | |||
384 | 39 | if [ ! -z "$snap" ] ; then | ||
385 | 40 | ubuntu_image_extra_args="--extra-snaps $snap" | ||
386 | 41 | fi | ||
387 | 42 | |||
388 | 43 | ubuntu-image \ | ||
389 | 44 | --channel $channel \ | ||
390 | 45 | -o $image_name \ | ||
391 | 46 | $ubuntu_image_extra_args \ | ||
392 | 47 | $model.model | ||
393 | 48 | |||
394 | 49 | kpartx -a $image_name | ||
395 | 50 | sleep 0.5 | ||
396 | 51 | |||
397 | 52 | loop_path=`findfs LABEL=writable` | ||
398 | 53 | tmp_mount=`mktemp -d` | ||
399 | 54 | |||
400 | 55 | mount $loop_path $tmp_mount | ||
401 | 56 | |||
402 | 57 | # Migrate all systemd units from core snap into the writable area. This | ||
403 | 58 | # would be normally done on firstboot by the initramfs but we can't rely | ||
404 | 59 | # on that because we are adding another file in there and that will | ||
405 | 60 | # prevent the initramfs from transitioning any files. | ||
406 | 61 | core_snap=$(find $tmp_mount/system-data/var/lib/snapd/snaps -name "core_*.snap") | ||
407 | 62 | tmp_core=`mktemp -d` | ||
408 | 63 | mount $core_snap $tmp_core | ||
409 | 64 | mkdir -p $tmp_mount/system-data/etc/systemd | ||
410 | 65 | cp -rav $tmp_core/etc/systemd/* \ | ||
411 | 66 | $tmp_mount/system-data/etc/systemd/ | ||
412 | 67 | umount $tmp_core | ||
413 | 68 | rm -rf $tmp_core | ||
414 | 69 | |||
415 | 70 | # system-user assertion which gives us our test:test user we use to | ||
416 | 71 | # log into the system | ||
417 | 72 | mkdir -p $tmp_mount/system-data/var/lib/snapd/seed/assertions | ||
418 | 73 | cp test-user.assertion $tmp_mount/system-data/var/lib/snapd/seed/assertions | ||
419 | 74 | |||
420 | 75 | # Disable console-conf for the first boot | ||
421 | 76 | mkdir -p $tmp_mount/system-data/var/lib/console-conf/ | ||
422 | 77 | touch $tmp_mount/system-data/var/lib/console-conf/complete | ||
423 | 78 | |||
424 | 79 | # Create systemd service which is running on firstboot and sets up | ||
425 | 80 | # various things for us. | ||
426 | 81 | mkdir -p $tmp_mount/system-data/etc/systemd/system | ||
427 | 82 | cat << 'EOF' > $tmp_mount/system-data/etc/systemd/system/devmode-firstboot.service | ||
428 | 83 | [Unit] | ||
429 | 84 | Description=Run devmode firstboot setup | ||
430 | 85 | After=snapd.service snapd.socket | ||
431 | 86 | |||
432 | 87 | [Service] | ||
433 | 88 | Type=oneshot | ||
434 | 89 | ExecStart=/writable/system-data/var/lib/devmode-firstboot/run.sh | ||
435 | 90 | RemainAfterExit=yes | ||
436 | 91 | TimeoutSec=3min | ||
437 | 92 | EOF | ||
438 | 93 | |||
439 | 94 | mkdir -p $tmp_mount/system-data/etc/systemd/system/multi-user.target.wants | ||
440 | 95 | ln -sf /etc/systemd/system/devmode-firstboot.service \ | ||
441 | 96 | $tmp_mount/system-data/etc/systemd/system/multi-user.target.wants/devmode-firstboot.service | ||
442 | 97 | |||
443 | 98 | mkdir $tmp_mount/system-data/var/lib/devmode-firstboot | ||
444 | 99 | cat << EOF > $tmp_mount/system-data/var/lib/devmode-firstboot/00-snapd-config.yaml | ||
445 | 100 | network: | ||
446 | 101 | version: 2 | ||
447 | 102 | ethernets: | ||
448 | 103 | eth0: | ||
449 | 104 | dhcp4: true | ||
450 | 105 | EOF | ||
451 | 106 | |||
452 | 107 | cat << 'EOF' > $tmp_mount/system-data/var/lib/devmode-firstboot/run.sh | ||
453 | 108 | #!/bin/bash | ||
454 | 109 | |||
455 | 110 | set -e | ||
456 | 111 | |||
457 | 112 | # Don't start again if we're already done | ||
458 | 113 | if [ -e /writable/system-data/var/lib/devmode-firstboot/complete ] ; then | ||
459 | 114 | exit 0 | ||
460 | 115 | fi | ||
461 | 116 | |||
462 | 117 | echo "Start devmode-firstboot $(date -Iseconds --utc)" | ||
463 | 118 | |||
464 | 119 | if [ "$(snap managed)" = "true" ]; then | ||
465 | 120 | echo "System already managed, exiting" | ||
466 | 121 | exit 0 | ||
467 | 122 | fi | ||
468 | 123 | |||
469 | 124 | # no changes at all | ||
470 | 125 | while ! snap changes ; do | ||
471 | 126 | echo "No changes yet, waiting" | ||
472 | 127 | sleep 1 | ||
473 | 128 | done | ||
474 | 129 | |||
475 | 130 | while snap changes | grep -qE '(Do|Doing) .*Initialize system state' ; do | ||
476 | 131 | echo "Initialize system state is in progress, waiting" | ||
477 | 132 | sleep 1 | ||
478 | 133 | done | ||
479 | 134 | |||
480 | 135 | if [ -n "$(snap known system-user)" ]; then | ||
481 | 136 | echo "Trying to create known user" | ||
482 | 137 | snap create-user --known --sudoer | ||
483 | 138 | fi | ||
484 | 139 | |||
485 | 140 | cp /writable/system-data/var/lib/devmode-firstboot/00-snapd-config.yaml /writable/system-data/etc/netplan | ||
486 | 141 | |||
487 | 142 | # Enable console-conf again | ||
488 | 143 | rm /writable/system-data/var/lib/console-conf/complete | ||
489 | 144 | |||
490 | 145 | # Mark us done | ||
491 | 146 | touch /writable/system-data/var/lib/devmode-firstboot/complete | ||
492 | 147 | |||
493 | 148 | # Reboot the system as its now prepared for the user | ||
494 | 149 | reboot | ||
495 | 150 | EOF | ||
496 | 151 | |||
497 | 152 | chmod +x $tmp_mount/system-data/var/lib/devmode-firstboot/run.sh | ||
498 | 153 | |||
499 | 154 | umount $tmp_mount | ||
500 | 155 | kpartx -d $image_name | ||
501 | 156 | rm -rf $tmp_mount | ||
502 | diff --git a/tests/image/pc-model.json b/tests/image/pc-model.json | |||
503 | 157 | deleted file mode 100644 | 0 | deleted file mode 100644 |
504 | index 2eb1411..0000000 | |||
505 | --- a/tests/image/pc-model.json | |||
506 | +++ /dev/null | |||
507 | @@ -1,11 +0,0 @@ | |||
508 | 1 | { | ||
509 | 2 | "type": "model", | ||
510 | 3 | "authority-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf", | ||
511 | 4 | "brand-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf", | ||
512 | 5 | "series": "16", | ||
513 | 6 | "model": "pc", | ||
514 | 7 | "architecture": "amd64", | ||
515 | 8 | "gadget": "pc", | ||
516 | 9 | "kernel": "pc-kernel", | ||
517 | 10 | "timestamp": "2016-09-09T08:27:36+00:00" | ||
518 | 11 | } | ||
519 | diff --git a/tests/image/pc.model b/tests/image/pc.model | |||
520 | 12 | deleted file mode 100644 | 0 | deleted file mode 100644 |
521 | index 345b7e4..0000000 | |||
522 | --- a/tests/image/pc.model | |||
523 | +++ /dev/null | |||
524 | @@ -1,21 +0,0 @@ | |||
525 | 1 | type: model | ||
526 | 2 | authority-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf | ||
527 | 3 | series: 16 | ||
528 | 4 | brand-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf | ||
529 | 5 | model: pc | ||
530 | 6 | architecture: amd64 | ||
531 | 7 | gadget: pc | ||
532 | 8 | kernel: pc-kernel | ||
533 | 9 | timestamp: 2016-09-09T08:27:36+00:00 | ||
534 | 10 | sign-key-sha3-384: a4qX7md6GQGNcZc_cmWPBStTq4RNCnGTzF-4usF5wFylQ-xZQej-SD6prx8Yl89O | ||
535 | 11 | |||
536 | 12 | AcLBXAQAAQoABgUCWBBNTwAKCRAVoE002xqmOPH/EACWLf1UeZgICjNbzLI5bO/84LExS8iUjarG | ||
537 | 13 | S7DRn8Ln5zu44pxz7UXJNjULgnU8yuKVPVWg0ij7DRvaj8tGxOMMAls1fjSRtEYR8oJFsI3jXDGw | ||
538 | 14 | cLjvJG/crUxV8DgdZFlF02Kb5VtmNDXs1OE3zpPeniG19JYHaf2hDz4SRmWZe4c2MFrAt2UwI/VC | ||
539 | 15 | o/209Fl3qA8p8x5EYOBycgHooHm3924NTF9mXbKSfLRgGS7YzmN4FXFyiGOTY6CRsp37XnkxGcA1 | ||
540 | 16 | +lyZz1X97qT/fOGVUFqHDqUZmuCs5sC3+DNonytTgKt5+7S+V+Ai45HEayD5f4gS9uscnTMTwEEJ | ||
541 | 17 | VgSZRU0My+iJwFlXHaGWQe9eC37YCZ3ahBxc2SpkFffXjYhEMtTtr1vDIYCAhbc2k8aa3hPE2GUg | ||
542 | 18 | 3pv8zs1AuZzSVX+Rp4ysMBqU23UUVP6Bmvr7ZD3E8aEUxE6O/BEA10Km5oZPqpmBfcEVO8a0yZjn | ||
543 | 19 | YQxn4XzY1Nwq1d0sJIV7FEDsq9dXH9QCa4qsCH3KG3jHv32GapvLf8mpr6HSH+JmPM5kNeVugLVy | ||
544 | 20 | /RUAFNu+Y4hqhpRNC8fc+UDkVBXsLDqHb5gfXnhbFIH8LvpVFR20SSkg9/Km5xC+7wcey0h8SD6/ | ||
545 | 21 | Eh70OPLxDkzitEn/1L/0V987dlJnhS4WpqrYfbHYwQ== | ||
546 | diff --git a/tests/image/test-user-assertion.json b/tests/image/test-user-assertion.json | |||
547 | 22 | deleted file mode 100644 | 0 | deleted file mode 100644 |
548 | index 81f6beb..0000000 | |||
549 | --- a/tests/image/test-user-assertion.json | |||
550 | +++ /dev/null | |||
551 | @@ -1,13 +0,0 @@ | |||
552 | 1 | { | ||
553 | 2 | "type": "system-user", | ||
554 | 3 | "authority-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf", | ||
555 | 4 | "brand-id": "4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf", | ||
556 | 5 | "series": ["16"], | ||
557 | 6 | "models": ["pc"], | ||
558 | 7 | "name": "Default Test User", | ||
559 | 8 | "username": "test", | ||
560 | 9 | "email": "test@localhost", | ||
561 | 10 | "password": "$6$OCvKy4w/Ppxp7IvC$WPzWiIW.4y18h9htjbOuxLZ.sjQ5M2hoSiEu3FpMU0PMdHQuQdBOqvk8p6DMdS/R/nU/rXidClD23CbSkSgp30", | ||
562 | 11 | "since": "2016-10-24T07:12:10+00:00", | ||
563 | 12 | "until": "2017-10-24T07:12:10+00:00" | ||
564 | 13 | } | ||
565 | diff --git a/tests/image/test-user.assertion b/tests/image/test-user.assertion | |||
566 | 14 | deleted file mode 100644 | 0 | deleted file mode 100644 |
567 | index 7ebb667..0000000 | |||
568 | --- a/tests/image/test-user.assertion | |||
569 | +++ /dev/null | |||
570 | @@ -1,25 +0,0 @@ | |||
571 | 1 | type: system-user | ||
572 | 2 | authority-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf | ||
573 | 3 | brand-id: 4BKZlf4WMNBKgQfij0rftmp5BzDdVhlf | ||
574 | 4 | email: test@localhost | ||
575 | 5 | models: | ||
576 | 6 | - pc | ||
577 | 7 | name: Default Test User | ||
578 | 8 | password: $6$OCvKy4w/Ppxp7IvC$WPzWiIW.4y18h9htjbOuxLZ.sjQ5M2hoSiEu3FpMU0PMdHQuQdBOqvk8p6DMdS/R/nU/rXidClD23CbSkSgp30 | ||
579 | 9 | series: | ||
580 | 10 | - 16 | ||
581 | 11 | since: 2016-10-24T07:12:10+00:00 | ||
582 | 12 | until: 2017-10-24T07:12:10+00:00 | ||
583 | 13 | username: test | ||
584 | 14 | sign-key-sha3-384: a4qX7md6GQGNcZc_cmWPBStTq4RNCnGTzF-4usF5wFylQ-xZQej-SD6prx8Yl89O | ||
585 | 15 | |||
586 | 16 | AcLBXAQAAQoABgUCWBBOJAAKCRAVoE002xqmOKaRD/0cEKWb2nbwhk+BTgOrYZHrwzjbIWTZznDh | ||
587 | 17 | xCD6JWF/yr9br1vEmRz2zCNPPWZgFH9HaJ+mT/lktWIs7VVMIdwMDWYOR8P9rdWM/Jx6iyB3z0OI | ||
588 | 18 | YO31zaU4XLyolv/YSj/nFXMMD+jIeE4l8j4AtCSJwd7ZS9Jz8F/RfrD8EpG0JU1F55lq8MC0mjZ4 | ||
589 | 19 | ul5ws8k9UiP8nA5IAG30NvvReiUGYqtdkO43eQmy88WABL95MbFsbfEk4/VduG0Gt3y/T8vDDcF6 | ||
590 | 20 | NJEm8L+O9IXnPBAje0Ve0NX3YtOE3CDTkYRKR7xFFJq2cJVCSvf9CsorREg4KyfagIdMKDSa5Tiq | ||
591 | 21 | FzoAJTfI0ltq5cAnLImtxFKulJ+AnGUNMLrKFr1H0FGtqTZBfs/PcIxy0qY0YDXSF4/9F2PUBdQS | ||
592 | 22 | tSmN6pT9t1FCGy2Rf5n3QV4e0R2JzS6Kx+vdbPMYqhssQosLU5GwlWj8UbevtphAGf8u8nLBDYWs | ||
593 | 23 | MNIPi0IrPmzIewZBD05A6a8T+oHZ9dIg5SAnJ4gmz0sCzNDKarvYqLpcU1rZzu78/UypbHXDvBAt | ||
594 | 24 | gnxYpD6WHR2aHSeyx3WvOp130jFco2/55M0RTEm50isO1uv2DqTn9ULkBdCrG/zOqEmZgY18ds3P | ||
595 | 25 | yTaAbaIAqUe7scpAHY0a31tfnXq8cRyEX03e9g2Mrg== | ||
596 | diff --git a/tests/lib/prepare-all.sh b/tests/lib/prepare-all.sh | |||
597 | index 80be76f..cdb1b80 100644 | |||
598 | --- a/tests/lib/prepare-all.sh | |||
599 | +++ b/tests/lib/prepare-all.sh | |||
600 | @@ -6,14 +6,14 @@ if [ -n "$SNAP_CHANNEL" ] ; then | |||
601 | 6 | exit 0 | 6 | exit 0 |
602 | 7 | fi | 7 | fi |
603 | 8 | 8 | ||
605 | 9 | # Setup classic snap and build the tpm2 snap in there | 9 | # Set up classic snap and build the tpm2 snap in there |
606 | 10 | snap install --devmode --beta classic | 10 | snap install --devmode --beta classic |
607 | 11 | cat <<-EOF > /home/test/build-snap.sh | 11 | cat <<-EOF > /home/test/build-snap.sh |
608 | 12 | #!/bin/sh | 12 | #!/bin/sh |
609 | 13 | set -ex | 13 | set -ex |
610 | 14 | apt update | 14 | apt update |
611 | 15 | apt install -y --force-yes snapcraft | 15 | apt install -y --force-yes snapcraft |
613 | 16 | cd /home/tpm2 | 16 | cd ${PROJECT_PATH} |
614 | 17 | snapcraft clean | 17 | snapcraft clean |
615 | 18 | snapcraft | 18 | snapcraft |
616 | 19 | EOF | 19 | EOF |
617 | @@ -22,4 +22,4 @@ sudo classic /home/test/build-snap.sh | |||
618 | 22 | snap remove classic | 22 | snap remove classic |
619 | 23 | 23 | ||
620 | 24 | # Make sure we have a snap build | 24 | # Make sure we have a snap build |
622 | 25 | test -e /home/tpm2/tpm2_*_amd64.snap | 25 | test -e ${PROJECT_PATH}/${SNAP_NAME}_*_${SNAP_ARCH}.snap |
623 | diff --git a/tests/lib/prepare.sh b/tests/lib/prepare.sh | |||
624 | index 2fd3d79..e14a9b2 100644 | |||
625 | --- a/tests/lib/prepare.sh | |||
626 | +++ b/tests/lib/prepare.sh | |||
627 | @@ -1,5 +1,7 @@ | |||
628 | 1 | #!/bin/bash | 1 | #!/bin/bash |
629 | 2 | 2 | ||
630 | 3 | . $TESTSLIB/utilities.sh | ||
631 | 4 | |||
632 | 3 | echo "Wait for firstboot change to be ready" | 5 | echo "Wait for firstboot change to be ready" |
633 | 4 | while ! snap changes | grep -q "Done"; do | 6 | while ! snap changes | grep -q "Done"; do |
634 | 5 | snap changes || true | 7 | snap changes || true |
635 | @@ -21,28 +23,12 @@ done | |||
636 | 21 | echo "Kernel has a store revision" | 23 | echo "Kernel has a store revision" |
637 | 22 | snap list | grep ^${kernel_name} | grep -E " [0-9]+\s+canonical" | 24 | snap list | grep ^${kernel_name} | grep -E " [0-9]+\s+canonical" |
638 | 23 | 25 | ||
656 | 24 | # If we don't install tpm2 here we get a system | 26 | install_snap_under_test |
640 | 25 | # without any network connectivity after reboot. | ||
641 | 26 | if [ -n "$SNAP_CHANNEL" ] ; then | ||
642 | 27 | # Don't reinstall if we have it installed already | ||
643 | 28 | if ! snap list | grep tpm2 ; then | ||
644 | 29 | snap install --$SNAP_CHANNEL tpm2 | ||
645 | 30 | fi | ||
646 | 31 | else | ||
647 | 32 | # Install prebuilt tpm2 snap | ||
648 | 33 | snap install --dangerous /home/tpm2/tpm2_*_amd64.snap | ||
649 | 34 | # As we have a snap which we build locally its unasserted and therefor | ||
650 | 35 | # we don't have any snap-declarations in place and need to manually | ||
651 | 36 | # connect all plugs. | ||
652 | 37 | snap connect tpm2:tpm core:tpm | ||
653 | 38 | snap connect tpm2:network core:network | ||
654 | 39 | snap connect tpm2:network-bind core:network-bind | ||
655 | 40 | fi | ||
657 | 41 | 27 | ||
658 | 42 | # Snapshot of the current snapd state for a later restore | 28 | # Snapshot of the current snapd state for a later restore |
659 | 43 | if [ ! -f $SPREAD_PATH/snapd-state.tar.gz ] ; then | 29 | if [ ! -f $SPREAD_PATH/snapd-state.tar.gz ] ; then |
660 | 44 | systemctl stop snapd.service snapd.socket | 30 | systemctl stop snapd.service snapd.socket |
662 | 45 | tar czf $SPREAD_PATH/snapd-state.tar.gz /var/lib/snapd /etc/netplan | 31 | tar czf $SPREAD_PATH/snapd-state.tar.gz /var/lib/snapd |
663 | 46 | systemctl start snapd.socket | 32 | systemctl start snapd.socket |
664 | 47 | fi | 33 | fi |
665 | 48 | 34 | ||
666 | diff --git a/tests/lib/utilities.sh b/tests/lib/utilities.sh | |||
667 | 49 | new file mode 100644 | 35 | new file mode 100644 |
668 | index 0000000..03e29dc | |||
669 | --- /dev/null | |||
670 | +++ b/tests/lib/utilities.sh | |||
671 | @@ -0,0 +1,39 @@ | |||
672 | 1 | #!/bin/sh | ||
673 | 2 | |||
674 | 3 | wait_for_systemd_service() { | ||
675 | 4 | while ! systemctl status $1 ; do | ||
676 | 5 | sleep 1 | ||
677 | 6 | done | ||
678 | 7 | sleep 1 | ||
679 | 8 | } | ||
680 | 9 | |||
681 | 10 | wait_for_systemd_service_exit() { | ||
682 | 11 | while systemctl status $1 ; do | ||
683 | 12 | sleep 1 | ||
684 | 13 | done | ||
685 | 14 | sleep 1 | ||
686 | 15 | } | ||
687 | 16 | |||
688 | 17 | install_snap_under_test() { | ||
689 | 18 | # If we don't install the snap here we get a system | ||
690 | 19 | # without any network connectivity after reboot. | ||
691 | 20 | if [ -n "$SNAP_CHANNEL" ] ; then | ||
692 | 21 | # Don't reinstall if we have it installed already | ||
693 | 22 | if ! snap list | grep $SNAP_NAME ; then | ||
694 | 23 | snap install --$SNAP_CHANNEL $SNAP_NAME | ||
695 | 24 | fi | ||
696 | 25 | else | ||
697 | 26 | # Install prebuilt snap | ||
698 | 27 | snap install --dangerous ${PROJECT_PATH}/${SNAP_NAME}_*_${SNAP_ARCH}.snap | ||
699 | 28 | # As we have a snap which we build locally it's unasserted and therefore | ||
700 | 29 | # we don't have any snap-declarations in place and need to manually | ||
701 | 30 | # connect all plugs. | ||
702 | 31 | for plug in $SNAP_AUTOCONNECT_CORE_PLUGS ; do | ||
703 | 32 | snap connect ${SNAP_NAME}:${plug} core | ||
704 | 33 | done | ||
705 | 34 | # Setup all necessary aliases | ||
706 | 35 | for alias in $SNAP_AUTO_ALIASES ; do | ||
707 | 36 | snap alias $SNAP_NAME $alias | ||
708 | 37 | done | ||
709 | 38 | fi | ||
710 | 39 | } | ||
711 | diff --git a/tests/main/installation/task.yaml b/tests/main/installation/task.yaml | |||
712 | index aaddf25..f47e701 100644 | |||
713 | --- a/tests/main/installation/task.yaml | |||
714 | +++ b/tests/main/installation/task.yaml | |||
715 | @@ -5,3 +5,36 @@ execute: | | |||
716 | 5 | snap interfaces | grep -Pzq ":tpm +tpm2" | 5 | snap interfaces | grep -Pzq ":tpm +tpm2" |
717 | 6 | snap interfaces | grep -Pzq ":network +tpm2" | 6 | snap interfaces | grep -Pzq ":network +tpm2" |
718 | 7 | snap interfaces | grep -Pzq ":network-bind +tpm2" | 7 | snap interfaces | grep -Pzq ":network-bind +tpm2" |
719 | 8 | |||
720 | 9 | # Verify aliases are set up | ||
721 | 10 | test -x /snap/bin/tpm2_activatecredential | ||
722 | 11 | test -x /snap/bin/tpm2_akparse | ||
723 | 12 | test -x /snap/bin/tpm2_certify | ||
724 | 13 | test -x /snap/bin/tpm2_create | ||
725 | 14 | test -x /snap/bin/tpm2_createprimary | ||
726 | 15 | test -x /snap/bin/tpm2_encryptdecrypt | ||
727 | 16 | test -x /snap/bin/tpm2_evictcontrol | ||
728 | 17 | test -x /snap/bin/tpm2_getmanufec | ||
729 | 18 | test -x /snap/bin/tpm2_getpubak | ||
730 | 19 | test -x /snap/bin/tpm2_getpubek | ||
731 | 20 | test -x /snap/bin/tpm2_getrandom | ||
732 | 21 | test -x /snap/bin/tpm2_hash | ||
733 | 22 | test -x /snap/bin/tpm2_hmac | ||
734 | 23 | test -x /snap/bin/tpm2_listpcrs | ||
735 | 24 | test -x /snap/bin/tpm2_load | ||
736 | 25 | test -x /snap/bin/tpm2_loadexternal | ||
737 | 26 | test -x /snap/bin/tpm2_makecredential | ||
738 | 27 | test -x /snap/bin/tpm2_nvdefine | ||
739 | 28 | test -x /snap/bin/tpm2_nvlist | ||
740 | 29 | test -x /snap/bin/tpm2_nvread | ||
741 | 30 | test -x /snap/bin/tpm2_nvrelease | ||
742 | 31 | test -x /snap/bin/tpm2_nvwrite | ||
743 | 32 | test -x /snap/bin/tpm2_quote | ||
744 | 33 | test -x /snap/bin/tpm2_rc_decode | ||
745 | 34 | test -x /snap/bin/tpm2_readpublic | ||
746 | 35 | test -x /snap/bin/tpm2_rsadecrypt | ||
747 | 36 | test -x /snap/bin/tpm2_rsaencrypt | ||
748 | 37 | test -x /snap/bin/tpm2_sign | ||
749 | 38 | test -x /snap/bin/tpm2_takeownership | ||
750 | 39 | test -x /snap/bin/tpm2_unseal | ||
751 | 40 | test -x /snap/bin/tpm2_verifysignature |
FAILED: Continuous integration, rev:be6844ffc26 db60cc653f31bcc 3ae15c5697b37a /jenkins. canonical. com/system- enablement/ job/generic- build-snap/ 870/ /jenkins. canonical. com/system- enablement/ job/generic- run-snap- spread- tests/581/ console /jenkins. canonical. com/system- enablement/ job/generic- update- snap-mp/ 778/console
https:/
Executed test runs:
FAILURE: https:/
None: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/system- enablement/ job/generic- build-snap/ 870/rebuild
https:/