summaryrefslogtreecommitdiff
path: root/scripts/test-map
blob: 6458ed89bf0031b1842f7adaeecdcc1bb19dec87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This file lists projects with optional hosttests and unittests to run for
# those projects in the following format:
# [
#     # Add projects to, or remove projects from, list of projects to build.
#     # Does not affect builds where the project list is passed on the command
#     # line.
#     build(
#         # List of projects that this build entry applies to. Required.
#         projects=[
#             "<project>",
#             ...
#         ]
#         # If enabled is set to True or ommitted, add projects to list of
#         # projects to build. If enabled is set to False, remove projects from
#         # list of projects to build.
#         enabled=<True|False>
#     ),
#     ...
#     # Specify tests to run for specific projects.
#     testmap(
#         # List of projects that this testmap entry applies to. Required.
#         projects=[
#             "<project>",
#             ...
#         ]
#         # List of host-tests to run. Optional
#         tests=[
#             # Run a program on the host
#             hosttest("some_host_binary"),
#             # Use test-runner to activate a Trusty IPC port
#             boottest("port.under.test"),
#             # Use Android to activate a Trusty IPC port
#             androidport("port.under.test"),
#             # Run a shell command inside Android
#             androidtest(name="test_name", command="command to run"),
#             ...
#         ],
#     ),
#     ...
#     # Include another configuration file. If optional is True, and the file
#     # does not exist, the include statement is ignored.
#     include(<file>, optional=<True|False>),
# ]

[
    testmap(
        projects=[
            "generic-arm64-test-debug",
        ],
        tests=[
            hosttest("avb_test"),
            hosttest("keymaster_test"),
            hosttest("mock_storage_test"),
            hosttest("storage_test"),
            hosttests([
                include("trusty/kernel/build-config-kerneltests"),
                include("trusty/user/base/build-config-usertests"),
            ]),
        ],
    ),
    include("../../proprietary/scripts/build-config", optional=True),
    testmap(
        projects=[
            "qemu-generic-arm32-gicv3-test-debug",
            "qemu-generic-arm32-test-debug",
            "qemu-generic-arm64-fuzz-test-debug",
            "qemu-generic-arm64-gicv3-test-debug",
            "qemu-generic-arm64-test-debug",
            "qemu-generic-arm64u32-test-debug",
        ],
        tests=[
            # Boot tests (test-runner + kernel only)
            boottests([
                include("trusty/kernel/build-config-kerneltests"),
                include("trusty/user/base/build-config-usertests"),
            ]),
            # Android shell port tests - same as above, but triggered with
            # Linux + android userspace present
            androidporttests([
                include("trusty/kernel/build-config-kerneltests"),
                include("trusty/user/base/build-config-usertests"),
            ]),

            # Trusty linux driver tests. Unbind and bind to trigger remove and
            # probe function.
            androidtest(name="irq-driver",
                        command="echo 'trusty:irq' >"
                                "/sys/bus/platform/drivers/trusty-irq/unbind"
                                "&&"
                                "echo 'trusty:irq' >"
                                "/sys/bus/platform/drivers/trusty-irq/bind"),

            androidtest(name="log-driver",
                        command="echo 'trusty:log' >"
                                "/sys/bus/platform/drivers/trusty-log/unbind"
                                "&&"
                                "echo 'trusty:log' >"
                                "/sys/bus/platform/drivers/trusty-log/bind"),

            androidtest(name="virtio-driver",
                        # virtio remove currently hangs (bug: 142275662).
                        # Disable test until fixed
                        enabled=False,
                        command="echo 'trusty:virtio' >"
                                "/sys/bus/platform/drivers/trusty-virtio/unbind"
                                "&&"
                                "echo 'trusty:virtio' >"
                                "/sys/bus/platform/drivers/trusty-virtio/bind"),

            androidtest(name="trusty-driver",
                        # virtio remove currently hangs (bug: 142275662).
                        # Disable affected test until fixed
                        enabled=False,
                        command="echo trusty >"
                                "/sys/bus/platform/drivers/trusty/unbind"
                                "&&"
                                "echo trusty >"
                                "/sys/bus/platform/drivers/trusty/bind"),

            # test that trusty driver started and got a version string
            androidtest(name="trusty-driver-version",
                        command="TRUSTY_VERSION=$(cat /sys/bus/platform/"
                                "devices/trusty/trusty_version)"
                                "&&"
                                "echo Trusty version: ${TRUSTY_VERSION}"
                                "&&"
                                "if [[ \"${TRUSTY_VERSION}\" != \"Project:\"* ]];"
                                "then "
                                "echo Unexpected trusty version string;"
                                "exit 1;"
                                "fi"),

            androidtest(name="untainted-linux",
                        command="TAINTED=$(cat /proc/sys/kernel/tainted)"
                                "&&"
                                "if [[ \"${TAINTED}\" != \"0\" ]];"
                                "then "
                                "echo Linux kernel tainted ${TAINTED};"
                                "exit 1;"
                                "fi"),

            # stdcall test with shared memory buffers.
            # Each test run takes up to 4 arguments:
            # <obj_size>,<obj_count=1>,<repeat_share=1>,<repeat_access=3>
            #
            # Test single 4K shared memory object.
            # Test 10 8MB objects, shared twice, each accessed twice. (8MB non-
            # contiguous object is large enough to need several 4KB messages to
            # describe)
            # Test sharing 2 8MB objects 100 times without accessing it.
            # Test 10 4K shared memory objects, shared 10 times, each accessed
            # 10 times.
            androidtest(name="stdcalltest",
                        command="echo '0x1000 "
                                "0x800000,10,2,2 "
                                "0x800000,2,100,0 "
                                "0x1000,10,10,10' >"
                                "'/sys/devices/platform/trusty/"
                                "trusty:test/trusty_test_run'"),

            # TIPC tests
            androidtest(name="tipc:ta2ta",
                        command="/data/nativetest64/vendor/tipc-test/tipc-test "
                                "-t ta2ta-ipc"),

            # TIPC linux to trusty echo test
            androidtest(name="tipc:echo",
                        command="/data/nativetest64/vendor/tipc-test/tipc-test "
                                "-t echo -r 100"),

            # TIPC linux to trusty echo test repeat so 16 bit virtio index wraps
            androidtest(name="tipc:echo-long",
                        command="/data/nativetest64/vendor/tipc-test/tipc-test "
                                "-t echo -r 70000"),

            # NS shares NS memory with S
            androidtest(name="tipc:send-fd",
                        command="/data/nativetest64/vendor/tipc-test/tipc-test "
                                "-t send-fd"),

            # Storage proxy restart test. The keymaster storage wrapper keeps a
            # persistent connection to the storage server. Test that this
            # connection gets re-established when the storage proxy restarts.
            androidtest(name="storage-proxy-restart",
                        command="/vendor/bin/trusty-ut-ctrl "
                                "com.android.keymaster-unittest"
                                "&&"
                                "stop storageproxyd"
                                "&&"
                                "killall storageproxyd"
                                "&&"
                                "("
                                "sleep 5"
                                "&&"
                                "start storageproxyd"
                                "&"
                                "/vendor/bin/trusty-ut-ctrl "
                                "com.android.keymaster-unittest"
                                "&&"
                                "wait"
                                ")"
                                "&&"
                                "/vendor/bin/trusty-ut-ctrl "
                                "com.android.keymaster-unittest"),

            # Test automatic clearing of tp filesystem when userdata is cleared
            # - Stage 1
            # -- Simulate user-data wipe (by removing data/vendor/ss/0 and
            #    restarting storageproxyd)
            # -- Create a valid filesystem (with both superblocks written)
            #
            # - Stage 2
            # -- Simulate user-data wipe
            # -- Create a valid filesystem (with a single committed superblock)
            # -- Simulate reboot (by restarting storageproxyd)
            # -- Check that filesystem is accessible (with a small uncommitted
            #    transaction to more avoid super block updates)
            #
            #    If only one super block was written, it could have used the
            #    wrong version. If the new filesystem always writes superblock
            #    version 1, then it will fail if the old version was 2 or 3 as
            #    those two starting points have version 2 in the first
            #    superblock. Stage one will leave the filesystem at version 2 if
            #    b/190109878 has not been fixed or at version 3 if it has been
            #    partially fixed.
            #
            # - Stage 3
            # -- Simulate user-data wipe
            # -- Write to the filesystem without commiting anything
            # -- Simulate reboot (Should trigger cleanup path for b/190109878
            #    bugfix as generated initial superblock is not needed)
            #
            # - Stage 4
            # -- Write a large transaction to the filesystem without commiting
            #    anything
            # -- Simulate reboot
            # -- Check that filesystem is accessible. If superblock was not
            #    written (b/190109878) this step would fail as the data file is
            #    no longer empty, but the old super blocks refer to data in the
            #    previous deleted file.
            # -- Trigger cleanup in test app.
            androidtest(name="storage-tp-clear-test",
                        command="function storage-unittest { "
                                "/vendor/bin/trusty-ut-ctrl "
                                "com.android.storage-unittest.$1"
                                ";}"
                                "&&"
                                "function stop-storageproxyd { "
                                "stop storageproxyd"
                                "&&"
                                "killall storageproxyd"
                                ";}"
                                "&&"
                                "function wipe-restart-storageproxyd { "
                                "echo '[ -------- ] wipe-restart-storageproxyd'"
                                "&&"
                                "stop-storageproxyd"
                                "&&"
                                "rm /data/vendor/ss/0"
                                "&&"
                                "start storageproxyd"
                                ";}"
                                "&&"
                                "function restart-storageproxyd { "
                                "echo '[ -------- ] restart-storageproxyd'"
                                "&&"
                                "stop-storageproxyd"
                                "&&"
                                "start storageproxyd"
                                ";}"
                                "&&"
                                "echo '[ -------- ] Stage 1 - 2 commit setup'"
                                "&&"
                                "wipe-restart-storageproxyd"
                                "&&"
                                "storage-unittest td.init"
                                "&&"
                                "storage-unittest td.init"
                                "&&"
                                "echo '[ -------- ] Stage 2 - 1 commit setup'"
                                "&&"
                                "wipe-restart-storageproxyd"
                                "&&"
                                "storage-unittest td.init"
                                "&&"
                                "restart-storageproxyd"
                                "&&"
                                "storage-unittest td.initnocommitsmall"
                                "&&"
                                "echo '[ -------- ] Stage 3 - no commit small'"
                                "&&"
                                "wipe-restart-storageproxyd"
                                "&&"
                                "storage-unittest td.initnocommitsmall"
                                "&&"
                                "restart-storageproxyd"
                                "&&"
                                "echo '[ -------- ] Stage 4 - no commit large'"
                                "&&"
                                "storage-unittest td.initnocommitlarge"
                                "&&"
                                "restart-storageproxyd"
                                "&&"
                                "storage-unittest td.initnocommitsmall"
                                "&&"
                                "storage-unittest td.initnocommitcleanup"),

            # Test keymaster attestation key provisioning
            androidtest(name="keymaster-set-attestation-keys",
                        command="/vendor/bin/"
                                "trusty_keymaster_set_attestation_key "
                                "/vendor/etc/"
                                "keymaster_soft_attestation_keys.xml"),

            # Test keymaster attestation
            androidtest(name="vts:keymaster-attestation@4.0",
                        command="setprop ro.boot.verifiedbootstate fake"
                                "&&"
                                "/data/nativetest64/"
                                "VtsHalKeymasterV4_0TargetTest/"
                                "VtsHalKeymasterV4_0TargetTest"
                                " --gtest_filter=\""
                                "*/AttestationTest.RsaAttestation/*:"
                                "*/AttestationTest.EcAttestation/*:"
                                "*/AttestationTest.AttestationApplication"
                                "IDLengthProperlyEncoded/*"
                                "\""),

            # Test keymaster wrapped attestation key provisioning
            androidtest(name="keymaster-wrapped-vts",
                        command="/vendor/bin/"
                                "trusty_keymaster_set_attestation_key "
                                "/vendor/etc/"
                                "keymaster_soft_wrapped_attestation_keys.xml"
                                "&&"
                                "setprop ro.boot.verifiedbootstate fake"
                                "&&"
                                "/data/nativetest64/"
                                "VtsHalKeymasterV4_0TargetTest/"
                                "VtsHalKeymasterV4_0TargetTest"
                                " --gtest_filter=\""
                                "*/AttestationTest.RsaAttestation/*:"
                                "*/AttestationTest.EcAttestation/*:"
                                "*/AttestationTest.AttestationApplication"
                                "IDLengthProperlyEncoded/*"
                                "\""),

            # VTS
            androidtest(name="vts:confirmationui@1.0",
                        command="/data/nativetest64/"
                                "VtsHalConfirmationUIV1_0TargetTest/"
                                "VtsHalConfirmationUIV1_0TargetTest"),
            androidtest(name="vts:gatekeeper@1.0",
                        command="/data/nativetest64/"
                                "VtsHalGatekeeperV1_0TargetTest/"
                                "VtsHalGatekeeperV1_0TargetTest"),
            # VerificationTokenTest.TestCreation and
            # VerificationTokenTest.MacChangesOnChangingTimestamp *should* pass,
            # but do timing measurements such that the emulator won't always
            # pass.
            #
            # These tests should pass *most* of the time on the emulator, but
            # are too flaky to have on in presubmit.
            #
            # If we test on real devices, these tests should be *on*.
            #
            # ClearOperationsTest.TooManyOperations is excluded from testing
            # because KM4 VTS leaks operation slots on Trusty (b/146083990).
            #
            # AttestationTest.RsaAttestation, AttestationTest.EcAttestation, and
            # AttestationTest.AttestationApplicationIDLengthProperlyEncoded are
            # excluded from testing, since attestation is not set on the
            # emulator.
            androidtest(name="vts:keymaster@4.0",
                        command="/data/nativetest64/"
                                "VtsHalKeymasterV4_0TargetTest/"
                                "VtsHalKeymasterV4_0TargetTest"
                                " --gtest_filter="
                                "\"-*/VerificationTokenTest.TestCreation/*:"
                                "*/VerificationTokenTest."
                                "MacChangesOnChangingTimestamp/*:"
                                "*/ClearOperationsTest.TooManyOperations/*:"
                                "*/AttestationTest.RsaAttestation/*:"
                                "*/AttestationTest.EcAttestation/*:"
                                "*/AttestationTest.AttestationApplication"
                                "IDLengthProperlyEncoded/*\"",
                        timeout=(60 * 60)),
        ],
    ),
]