• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2set -e
3
4source build/envsetup.sh
5
6function integration_tests() {
7    m -j citadel_integration_tests || return 1
8    adb shell stop || return 1
9    adb sync || return 1
10    adb shell start || return 1
11    adb shell \
12        /vendor/bin/hw/citadel_integration_tests --release-tests || return 1
13}
14
15# TODO: add AVB / Weaver / Keymaster VTS / CTS tests with filters here.
16
17function oem_lock_vts_tests() {
18    atest VtsHalOemLockV1_0TargetTest || return 1
19}
20
21function keymaster_cts_tests() {
22    atest CtsKeystoreTestCases || return 1
23}
24
25function keymaster_vts_tests() {
26    m -j VtsHalKeymasterV4_0TargetTest || return 1
27    adb sync data || return 1
28    adb shell \
29        /data/nativetest64/VtsHalKeymasterV4_0TargetTest/VtsHalKeymasterV4_0TargetTest \
30        --verbose \
31        --hal_service_instance=android.hardware.keymaster@4.0::IKeymasterDevice/strongbox || return 1
32}
33
34function weaver_cts_tests() {
35  # These CTS tests make a lot of use of Weaver by enrolling and changing
36  # credentials. Add omre if you come across them.
37  atest com.android.cts.devicepolicy.ManagedProfileTest\#testLockNowWithKeyEviction || return 1
38  atest com.android.cts.devicepolicy.DeviceAdminHostSideTestApi24 || return 1
39}
40
41function weaver_vts_tests() {
42    atest VtsHalWeaverV1_0TargetTest || return 1
43}
44
45function auth_secret_vts_tests() {
46    atest VtsHalAuthSecretV1_0TargetTest || return 1
47}
48
49function pay_cts_tests() {
50    runtest --path \
51            cts/tests/tests/keystore/src/android/keystore/cts/ImportWrappedKeyTest.java || return 1
52}
53
54# TODO: add any other tests
55
56if [ -z "${TARGET_PRODUCT:-}" ]; then
57  echo "You need to run the Android setup stuff first"
58  exit 1
59fi
60
61adb root && adb remount
62
63# keymaster tests need to run before integration tests, which mess
64# with factory reset, and break keymaster on-boot info.
65for t in \
66             keymaster_vts_tests \
67             keymaster_cts_tests \
68             pay_cts_tests \
69             integration_tests \
70             oem_lock_vts_tests \
71             weaver_cts_tests \
72             weaver_vts_tests \
73             auth_secret_vts_tests; do
74    if eval "${t}"; then
75        echo "PASS: ${t}"
76    else
77        echo "FAIL: ${t}"
78        exit 1
79    fi
80done
81
82# TODO: factory reset the device to original state.
83