• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2018 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5#  You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# This file lists projects with optional hosttests and unittests to run for
16# those projects in the following format:
17# [
18#     # Add projects to, or remove projects from, list of projects to build.
19#     # Does not affect builds where the project list is passed on the command
20#     # line.
21#     build(
22#         # List of projects that this build entry applies to. Required.
23#         projects=[
24#             "<project>",
25#             ...
26#         ]
27#         # If enabled is set to True or ommitted, add projects to list of
28#         # projects to build. If enabled is set to False, remove projects from
29#         # list of projects to build.
30#         enabled=<True|False>
31#     ),
32#     ...
33#     # Specify tests to run for specific projects.
34#     testmap(
35#         # List of projects that this testmap entry applies to. Required.
36#         projects=[
37#             "<project>",
38#             ...
39#         ]
40#         # List of host-tests to run. Optional
41#         tests=[
42#             # Run a program on the host
43#             hosttest("some_host_binary"),
44#             # Run test on device or in emulator. Porttests run in one of two
45#             # contexts:
46#             # 1. In a minimal
47#             #    bootloader environment (when porttest is nested within
48#             #    in a boottests element), or
49#             # 2. with a full Android userspace present (when nested within an
50#             #    androidporttests element).
51#             porttest("port.under.test"),
52#             # Run a shell command inside Android
53#             androidtest(name="test_name", command="command to run"),
54#             # Run a sequence of test and commands in the given order
55#             # Ensure that test environment is rebooted before second port test
56#             compositetest(name="testname", sequence=[
57#                 hosttest("some_host_binary"),
58#                 porttest("port.under.test"),
59#                 # a reboot may only be requested inside composite tests
60#                 reboot(),
61#                 porttest("another.port.under.test"),
62#                 ...
63#              ]
64#            ...
65#         ],
66#     ),
67#     ...
68#     # Include another configuration file. If optional is True, and the file
69#     # does not exist, the include statement is ignored.
70#     include(<file>, optional=<True|False>),
71# ]
72
73[
74    testmap(
75        projects=[
76            "qemu-generic-arm64-test-debug-release",
77            "qemu-generic-arm32-test-debug-release",
78        ],
79        tests=[
80            boottests([
81                include("trusty/user/base/build-config-usertests-release"),
82            ]),
83        ],
84    ),
85
86    testmap(
87        projects=[
88            "qemu-generic-arm64-gicv3-hafnium-test-debug",
89        ],
90        tests=[
91            # TODO(b/122357282): the Hafnium build should run all the tests,
92            # but currently it does not even boot. When that is fixed,
93            # we should just move qemu-generic-arm64-gicv3-hafnium-test-debug
94            # below to the full testmap.
95            #
96            # For now, we're adding a placeholder test so we can get some
97            # build artifacts.
98            hosttest("avb_test"),
99        ],
100    ),
101
102
103    testmap(
104        projects=[
105            "generic-arm64-test-debug",
106        ],
107        tests=[
108            hosttest("avb_test"),
109            hosttest("cbor_test"),
110            hosttest("mock_storage_test"),
111            hosttest("storage_block_test"),
112            hosttest("storage_host_test"),
113            hosttests([
114                include("trusty/kernel/build-config-kerneltests"),
115                include("trusty/user/base/build-config-usertests"),
116            ]),
117        ],
118    ),
119    include("../../proprietary/scripts/build-config", optional=True),
120    testmap(
121        projects=[
122            "qemu-generic-arm32-gicv3-test-debug",
123            "qemu-generic-arm32-test-debug",
124            "qemu-generic-arm64-fuzz-test-debug",
125            "qemu-generic-arm64-gicv3-spd-ffa-test-debug",
126            "qemu-generic-arm64-gicv3-spd-noffa-test-debug",
127            "qemu-generic-arm64-gicv3-test-debug",
128            "qemu-generic-arm64-test-debug",
129            "qemu-generic-arm64u32-test-debug",
130        ],
131        tests=[
132            # Boot tests (test-runner + kernel only)
133            boottests([
134                include("trusty/kernel/build-config-kerneltests"),
135                include("trusty/user/base/build-config-usertests"),
136                include("trusty/user/app/sample/build-config-boottests"),
137            ]),
138            # Android shell port tests - same as above, but triggered with
139            # Linux + android userspace present
140            androidporttests([
141                include("trusty/kernel/build-config-kerneltests"),
142                include("trusty/user/base/build-config-usertests"),
143
144                # Test automatic clearing of td filesystem when userdata is cleared
145                # - Stage 1
146                # -- Wipe user-data and reboot
147                # -- Create a valid filesystem (with both superblocks written)
148                #
149                # - Stage 2
150                # -- Wipe user-data and reboot
151                # -- Create a valid filesystem (with a single committed superblock)
152                # -- Reboot (keep all data)
153                # -- Check that filesystem is accessible (with a small uncommitted
154                #    transaction to more avoid super block updates)
155                #
156                #    If only one super block was written, it could have used the
157                #    wrong version. If the new filesystem always writes superblock
158                #    version 1, then it will fail if the old version was 2 or 3 as
159                #    those two starting points have version 2 in the first
160                #    superblock. Stage one will leave the filesystem at version 2 if
161                #    b/190109878 has not been fixed or at version 3 if it has been
162                #    partially fixed.
163                #
164                # - Stage 3
165                # -- Wipe user-data and reboot
166                # -- Write to the filesystem without commiting anything
167                # -- Reboot (Should trigger cleanup path for b/190109878
168                #    bugfix as generated initial superblock is not needed)
169                #
170                # - Stage 4
171                # -- Write a large transaction to the filesystem without commiting
172                #    anything
173                # -- Reboot
174                # -- Check that filesystem is accessible. If superblock was not
175                #    written (b/190109878) this step would fail as the data file is
176                #    no longer empty, but the old super blocks refer to data in the
177                #    previous deleted file.
178                # -- Trigger cleanup in test app.
179                compositetest(
180                    name="storage-td-clear-test",
181                    sequence=[
182                        print("[ -------- ] Stage 1 - 2 commit setup"),
183                        reboot(mode=RebootMode.FACTORY_RESET),
184                        porttest("com.android.storage-unittest.td.init"),
185                        porttest("com.android.storage-unittest.td.init"),
186                        print("[ -------- ] Stage 2 - 1 commit setup"),
187                        reboot(mode=RebootMode.FACTORY_RESET),
188                        porttest("com.android.storage-unittest.td.init"),
189                        reboot(mode=RebootMode.REGULAR),
190                        porttest("com.android.storage-unittest.td.initnocommitsmall"),
191                        print("[ -------- ] Stage 3 - no commit small"),
192                        reboot(mode=RebootMode.FACTORY_RESET),
193                        porttest("com.android.storage-unittest.td.initnocommitsmall"),
194                        reboot(mode=RebootMode.REGULAR),
195                        print("[ -------- ] Stage 4 - no commit large"),
196                        porttest("com.android.storage-unittest.td.initnocommitlarge"),
197                        reboot(mode=RebootMode.REGULAR),
198                        porttest("com.android.storage-unittest.td.initnocommitsmall"),
199                        porttest("com.android.storage-unittest.td.initnocommitcleanup"),
200                    ]
201                ).needs(storage_full=True),
202            ]),
203
204            # Trusty linux driver tests. Unbind and bind to trigger remove and
205            # probe function.
206            androidtest(name="irq-driver",
207                        command="TRUSTY_DEV=$(basename /sys/bus/platform/devices/"
208                                "?(*:)trusty?(-core):irq)"
209                                "&&"
210                                "echo $TRUSTY_DEV >"
211                                "/sys/bus/platform/drivers/trusty-irq/unbind"
212                                "&&"
213                                "echo $TRUSTY_DEV >"
214                                "/sys/bus/platform/drivers/trusty-irq/bind"),
215
216            androidtest(name="log-driver",
217                        # logd currently goes into a busy loop if the trusty
218                        # log driver starts returning errors from poll and
219                        # read. Additionally, the trusty-log driver does not
220                        # wake up any waiters in unbind. This happens later
221                        # when there is output from trusty ready for them to
222                        # read. Stop logd while unbinding to work around these
223                        # bugs for now and avoid filling the kernel log with
224                        # error messages. (b/397453308)
225                        command="TRUSTY_DEV=$(basename /sys/bus/platform/devices/"
226                                "?(*:)trusty?(-core):log)"
227                                "&&"
228                                "stop logd"
229                                "&&"
230                                "echo $TRUSTY_DEV >"
231                                "/sys/bus/platform/drivers/trusty-log/unbind"
232                                "&&"
233                                "echo $TRUSTY_DEV >"
234                                "/sys/bus/platform/drivers/trusty-log/bind"
235                                "&&"
236                                "start logd"),
237
238            androidtest(name="virtio-driver",
239                        # virtio remove currently hangs (bug: 142275662).
240                        # Disable test until fixed
241                        enabled=False,
242                        command="TRUSTY_DEV=$(basename /sys/bus/platform/devices/"
243                                "?(*:)trusty?(-core):virtio)"
244                                "&&"
245                                "echo $TRUSTY_DEV >"
246                                "/sys/bus/platform/drivers/trusty-virtio/unbind"
247                                "&&"
248                                "echo $TRUSTY_DEV >"
249                                "/sys/bus/platform/drivers/trusty-virtio/bind"),
250
251            androidtest(name="trusty-driver",
252                        # virtio remove currently hangs (bug: 142275662).
253                        # Disable affected test until fixed
254                        enabled=False,
255                        command="TRUSTY_DEV=$(basename /sys/bus/platform/devices/"
256                                "?(*:)trusty?(-core))"
257                                "&&"
258                                "echo $TRUSTY_DEV >"
259                                "$(echo /sys/bus/platform/drivers/trusty?(-core)/unbind)"
260                                "&&"
261                                "echo $TRUSTY_DEV >"
262                                "$(echo /sys/bus/platform/drivers/trusty?(-core)/bind)"),
263
264            # test that trusty driver started and got a version string
265            androidtest(name="trusty-driver-version",
266                        command="TRUSTY_VERSION=$(cat /sys/bus/platform/"
267                                "devices/?(*:)trusty?(-core)/trusty_version)"
268                                "&&"
269                                "echo Trusty version: ${TRUSTY_VERSION}"
270                                "&&"
271                                "if [[ \"${TRUSTY_VERSION}\" != \"Project:\"* ]];"
272                                "then "
273                                "echo Unexpected trusty version string;"
274                                "exit 1;"
275                                "fi"),
276
277            # Check whether the kernel has been tainted, ignoring
278            # certain causes like out-of-tree and unsigned modules.
279            androidtest(name="untainted-linux",
280                        command="TAINTED=$(cat /proc/sys/kernel/tainted)"
281                                "&&"
282                                "if (( ${TAINTED} & ~0x3000 ));"
283                                "then "
284                                "echo Linux kernel tainted ${TAINTED};"
285                                "exit 1;"
286                                "fi"),
287
288            # stdcall test with shared memory buffers.
289            # Each test run takes up to 4 arguments:
290            # <obj_size>,<obj_count=1>,<repeat_share=1>,<repeat_access=3>
291            #
292            # Test single 4K shared memory object.
293            # Test 10 8MB objects, shared twice, each accessed twice. (8MB non-
294            # contiguous object is large enough to need several 4KB messages to
295            # describe)
296            # Test sharing 2 8MB objects 100 times without accessing it.
297            # Test 10 4K shared memory objects, shared 10 times, each accessed
298            # 10 times.
299            androidtest(name="stdcalltest",
300                        command="echo '0x1000 "
301                                "0x800000,10,2,2 "
302                                "0x800000,2,100,0 "
303                                "0x1000,10,10,10' >"
304                                "$(echo /sys/bus/platform/devices/"
305                                "?(*:)trusty?(-core):test/trusty_test_run)"),
306
307            androidtest(name="fpsimdtest",
308                        command="echo 'fpsimd:1000' >"
309                                "$(echo /sys/bus/platform/devices/"
310                                "?(*:)trusty?(-core):test/trusty_test_run)"),
311
312            # TIPC tests
313            androidtest(name="tipc:ta2ta",
314                        command="/data/nativetest64/vendor/tipc-test/tipc-test "
315                                "-t ta2ta-ipc"),
316
317            # TIPC linux to trusty echo test
318            androidtest(name="tipc:echo",
319                        command="/data/nativetest64/vendor/tipc-test/tipc-test "
320                                "-t echo -r 100"),
321
322            # TIPC linux to trusty echo test repeat so 16 bit virtio index wraps
323            # Timeout is set to 15 minutes due to b/258851590.
324            androidtest(name="tipc:echo-long",
325                        command="/data/nativetest64/vendor/tipc-test/tipc-test "
326                                "-t echo -r 65537",
327                        timeout=(15 * 60)),
328
329            # NS shares NS memory with S
330            androidtest(name="tipc:send-fd",
331                        command="/data/nativetest64/vendor/tipc-test/tipc-test "
332                                "-t send-fd"),
333
334            # Storage proxy restart test. The keymaster storage wrapper keeps a
335            # persistent connection to the storage server. Test that this
336            # connection gets re-established when the storage proxy restarts.
337            androidtest(name="storage-proxy-restart",
338                        command="/vendor/bin/trusty-ut-ctrl "
339                                "com.android.keymaster-unittest"
340                                "&&"
341                                "stop storageproxyd"
342                                "&&"
343                                "("
344                                "sleep 5"
345                                "&&"
346                                "start storageproxyd"
347                                "&"
348                                "/vendor/bin/trusty-ut-ctrl "
349                                "com.android.keymaster-unittest"
350                                "&&"
351                                "wait"
352                                ")"
353                                "&&"
354                                "/vendor/bin/trusty-ut-ctrl "
355                                "com.android.keymaster-unittest"),
356
357            # Test that storage sessions behave correctly when proxy restarts
358            androidtest(
359                name="com.android.storage-reconnect-test.tp.reconnect",
360                command="/vendor/bin/trusty-ut-ctrl "
361                        "com.android.storage-reconnect-test.tp.before "
362                        "&&"
363                        "stop storageproxyd"
364                        "&&"
365                        "/vendor/bin/trusty-ut-ctrl "
366                        "com.android.storage-reconnect-test.tp.during "
367                        "&&"
368                        "start storageproxyd"
369                        "&&"
370                        "/vendor/bin/trusty-ut-ctrl "
371                        "com.android.storage-reconnect-test.tp.after "),
372            androidtest(
373                name="com.android.storage-reconnect-test.td.reconnect",
374                command="/vendor/bin/trusty-ut-ctrl "
375                        "com.android.storage-reconnect-test.td.before "
376                        "&&"
377                        "stop storageproxyd"
378                        "&&"
379                        "/vendor/bin/trusty-ut-ctrl "
380                        "com.android.storage-reconnect-test.td.during "
381                        "&&"
382                        "start storageproxyd"
383                        "&&"
384                        "/vendor/bin/trusty-ut-ctrl "
385                        "com.android.storage-reconnect-test.td.after "),
386            androidtest(
387                name="com.android.storage-reconnect-test.tdp.reconnect",
388                command="/vendor/bin/trusty-ut-ctrl "
389                        "com.android.storage-reconnect-test.tdp.before "
390                        "&&"
391                        "stop storageproxyd"
392                        "&&"
393                        "/vendor/bin/trusty-ut-ctrl "
394                        "com.android.storage-reconnect-test.tdp.during "
395                        "&&"
396                        "start storageproxyd"
397                        "&&"
398                        "/vendor/bin/trusty-ut-ctrl "
399                        "com.android.storage-reconnect-test.tdp.after "),
400
401            # Test confirmation UI
402            androidtest(name="vts:confirmationui@1.0",
403                        command="/data/nativetest64/"
404                                "VtsHalConfirmationUIV1_0TargetTest/"
405                                "VtsHalConfirmationUIV1_0TargetTest"),
406
407            # Test gatekeeper
408            androidtest(name="vts:gatekeeper@1.0",
409                        command="/data/nativetest64/"
410                                "VtsHalGatekeeperV1_0TargetTest/"
411                                "VtsHalGatekeeperV1_0TargetTest"),
412
413            # Test RKP
414            # TODO(b/235265072): re-enable once Android changes propagate to
415            # Trusty repo.
416            #androidtest(name="vts:rkp",
417            #            command="if [ \"`getprop ro.boot.verifiedbootstate`\" != \"fake\" ]; then "
418            #                    "setprop ro.boot.verifiedbootstate fake; "
419            #                    "fi "
420            #                    "&&"
421            #                    "/data/nativetest64/"
422            #                    "VtsHalRemotelyProvisionedComponentTargetTest/"
423            #                    "VtsHalRemotelyProvisionedComponentTargetTest"
424            #                    " --gtest_filter=\""
425            #                    "-"
426            #                    # We can not satisfy the requirements of
427            #                    # prodMode attestation.
428            #                    "*.generateAndUseEcdsaP256Key_prodMode/*:"
429            #                    # TODO:
430            #                    # bootloader/test-runner/test-runner.c in
431            #                    # trusty/external/trusty needs to properly set
432            #                    # the boot flags for the following tests to pass
433            #                    "*.EmptyRequest_testMode/*:"
434            #                    "*.NewKeyPerCallInTestMode/*:"
435            #                    "*.NonEmptyRequest_testMode/*"
436            #                    "\""),
437
438            # Test keymint attestation key provisioning
439            androidtest(name="keymint-set-attestation-keys",
440                        command="/vendor/bin/"
441                                "trusty_keymaster_set_attestation_key "
442                                "/vendor/etc/"
443                                "keymaster_soft_attestation_keys.xml"),
444
445            # Test keymint wrapped attestation key provisioning
446            androidtest(name="keymint-wrapped-vts",
447                        command="/vendor/bin/"
448                                "trusty_keymaster_set_attestation_key "
449                                "/vendor/etc/"
450                                "keymaster_soft_wrapped_attestation_keys.xml"
451                                "&&"
452                                "if [ \"`getprop ro.boot.verifiedbootstate`\" != \"fake\" ]; then "
453                                "setprop ro.boot.verifiedbootstate fake; "
454                                "fi "
455                                "&&"
456                                "/data/nativetest64/"
457                                "VtsAidlKeyMintTargetTest/"
458                                "VtsAidlKeyMintTargetTest"
459                                " --gtest_filter=\""
460                                "*/AttestKeyTest.*:"
461                                "-"
462                                "*/AttestKeyTest.AllRsaSizes*:"
463                                "*/AttestKeyTest.RsaAttestedAttestKeys*:"
464                                "*/AttestKeyTest.RsaAttestKeyChaining*:"
465                                "*/AttestKeyTest.EcAttestKeyChaining*:"
466                                "*/AttestKeyTest.AlternateAttestKeyChaining*:"
467                                "*/AttestKeyTest.AllEcCurves*:"
468                                "*/AttestKeyTest.EcdsaAttestationID*"
469                                "\""),
470
471            # Test keymint
472            #
473            # ClearOperationsTest.TooManyOperations is excluded from testing
474            # because KM4 VTS leaks operation slots on Trusty (b/146083990).
475            #
476            # EarlyBootKeyTest.UseEarlyBootKeyFailure and
477            # EarlyBootKeyTest.ImportEarlyBootKeyFailure test cases are exluded
478            # because keystore (not present on Trusty emulator image) is needed
479            # to propagate earlyBootEnded signal.
480            #
481            # TODO(b/208872187): Remove --skip_boot_pl_check once we have boot
482            # patchlevel configured.
483            androidtest(name="vts:keymint",
484                        command="if [ \"`getprop ro.boot.verifiedbootstate`\" != \"fake\" ]; then "
485                                "setprop ro.boot.verifiedbootstate fake; "
486                                "fi "
487                                "&&"
488                                "/data/nativetest64/"
489                                "VtsAidlKeyMintTargetTest/"
490                                "VtsAidlKeyMintTargetTest"
491                                " --skip_boot_pl_check"
492                                " --gtest_filter=\""
493                                "-"
494                                "*/ClearOperationsTest.TooManyOperations/*:"
495                                "*/EarlyBootKeyTest.UseEarlyBootKeyFailure/*:"
496                                "*/EarlyBootKeyTest.ImportEarlyBootKeyFailure/*:"
497                                "*SecureElementProvisioningTest.TeeOnly*:"
498                                "*/AttestKeyTest.AllRsaSizes*:"
499                                "*/AttestKeyTest.RsaAttestedAttestKeys*:"
500                                "*/AttestKeyTest.RsaAttestKeyChaining*:"
501                                "*/AttestKeyTest.EcAttestKeyChaining*:"
502                                "*/AttestKeyTest.AlternateAttestKeyChaining*:"
503                                "*/AttestKeyTest.AllEcCurves*:"
504                                "*/AttestKeyTest.EcdsaAttestationID*:"
505                                "*/NewKeyGenerationTest.RsaWithAttestation*:"
506                                "*/NewKeyGenerationTest.RsaEncryptionWithAttestation*:"
507                                "*/NewKeyGenerationTest.LimitedUsageRsaWithAttestation*:"
508                                "*/NewKeyGenerationTest.EcdsaAttestation*:"
509                                "*/NewKeyGenerationTest.EcdsaAttestationCurve25519*:"
510                                "*/NewKeyGenerationTest.EcdsaAttestationTags*:"
511                                "*/NewKeyGenerationTest.EcdsaAttestationIdTags*:"
512                                "*/NewKeyGenerationTest.EcdsaAttestationUniqueId*:"
513                                "*/NewKeyGenerationTest.EcdsaAttestationTagNoApplicationId*:"
514                                "*/NewKeyGenerationTest.AttestationApplicationIDLengthProperlyEncoded*:"
515                                "*/BootloaderStateTest.VbStateIsUnverified*:"
516                                "*/BootloaderStateTest.VbmetaDigest*:"
517                                "*InstanceTest.AidlVersionInFeature*:"
518                                "*InstanceTest.FeatureVersionInAidl*:"
519                                "\"",
520                        timeout=(60 * 60)),
521
522            # Busy test validating that linux acts upon the
523            # trusty thread priority or the high-priority workqueue setting
524            androidtest(name="busy-test-high-to-low-priority-workqueue",
525                        command="nice -n -20 top -b -m 5 -n 11 -d 2 &"
526                                "echo 0 >/sys/module/trusty_core/parameters/use_high_wq"
527                                ";"
528                                "timeout 10 trusty-ut-ctrl com.android.kernel.busy-test"
529                                ";"
530                                "echo 1 > /sys/module/trusty_core/parameters/use_high_wq"
531                                ";"
532                                "timeout 10 trusty-ut-ctrl com.android.kernel.busy-test"
533                                ";"
534                                "echo 0 >/sys/module/trusty_core/parameters/use_high_wq"
535                                "&&"
536                                "wait"),
537
538            # Test Binder RPC between Android and Trusty
539            androidtest(name="binder-rpc-to-trusty-test",
540                        enabled=False,
541                        command="/data/nativetest64/vendor/"
542                                "binderRpcToTrustyTest/"
543                                "binderRpcToTrustyTest64"),
544        ],
545    ),
546]
547