1f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson#!/bin/bash 2f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardsonset -e 3f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson 4f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardsonfunction integration_tests() { 5f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson m -j citadel_integration_tests || return 1 6f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson adb shell stop || return 1 7f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson adb sync || return 1 8f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson adb shell start || return 1 9f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson adb exec-out \ 10f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson '/vendor/bin/hw/citadel_integration_tests --release-tests' || return 1 11f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson} 12f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson 13f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson# TODO: add AVB / Weaver / Keymaster VTS / CTS tests with filters here. 14f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson 15f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardsonfunction oem_lock_vts_tests() { 16f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson atest VtsHalOemLockV1_0TargetTest || return 1 17f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson} 18f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson 19f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardsonfunction keymaster_cts_tests() { 20f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson return 0 21f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson} 22f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson 23f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardsonfunction keymaster_vts_tests() { 24f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson return 0 25f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson} 26f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson 27f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardsonfunction weaver_cts_tests() { 28f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson # These CTS tests make a lot of use of Weaver by enrolling and changing 29f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson # credentials. Add omre if you come across them. 30f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson atest com.android.cts.devicepolicy.ManagedProfileTest\#testLockNowWithKeyEviction || return 1 31f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson atest com.android.cts.devicepolicy.DeviceAdminHostSideTestApi24 || return 1 32f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson} 33f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson 34f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardsonfunction weaver_vts_tests() { 35f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson atest VtsHalWeaverV1_0TargetTest || return 1 36f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson} 37f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson 38f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardsonfunction auth_secret_vts_tests() { 39f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson atest VtsHalAuthSecretV1_0TargetTest || return 1 40f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson} 41f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson 42f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardsonfunction pay_cts_tests() { 43f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson : 44f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson # TODO(ngm): uncomment once these are working. 45f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson # runtest --path \ 46f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson # cts/tests/tests/keystore/src/android/keystore/cts/ImportWrappedKeyTest.java || return 1 47f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson} 48f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson 49f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson# TODO: add any other tests 50f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson 51f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardsonif [ -z "${TARGET_PRODUCT:-}" ]; then 52f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson echo "You need to run the Android setup stuff first" 53f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson exit 1 54f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardsonfi 55f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson 56f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardsonfor t in integration_tests \ 57f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson oem_lock_vts_tests \ 58f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson keymaster_cts_tests \ 59f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson keymaster_vts_tests \ 60f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson weaver_cts_tests \ 61f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson weaver_vts_tests \ 62f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson auth_secret_vts_tests \ 63f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson pay_cts_tests; do 64f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson if eval "${t}"; then 65f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson echo "PASS: ${t}" 66f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson else 67f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson echo "FAIL: ${t}" 68f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson exit 1 69f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardson fi 70f6f1a8a7d61ebe6814a8a2fafdf9526569e5242bBill Richardsondone 71