KeyMint VTS: use GTEST_SKIP for optional fn
When a KeyMint VTS exercises optional functionality, where possible
use GTEST_SKIP() when that functionality is absent, so the test
summary includes information about what is present and what isn't.
This should not affect the overall test result.
Test: VtsAidlKeyMintTargetTest
Change-Id: I62d244d2e4ecc67737906009575e64b50450d4c4
diff --git a/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp b/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp
index d7abf07..6f2f189 100644
--- a/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp
+++ b/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp
@@ -64,7 +64,9 @@
* attestation.
*/
TEST_P(DeviceUniqueAttestationTest, RsaNonStrongBoxUnimplemented) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
vector<uint8_t> key_blob;
vector<KeyCharacteristics> key_characteristics;
@@ -91,7 +93,9 @@
* attestation.
*/
TEST_P(DeviceUniqueAttestationTest, EcdsaNonStrongBoxUnimplemented) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
vector<uint8_t> key_blob;
vector<KeyCharacteristics> key_characteristics;
@@ -117,7 +121,9 @@
* attestation correctly, if implemented.
*/
TEST_P(DeviceUniqueAttestationTest, RsaDeviceUniqueAttestation) {
- if (SecLevel() != SecurityLevel::STRONGBOX) return;
+ if (SecLevel() != SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to non-StrongBox device";
+ }
vector<uint8_t> key_blob;
vector<KeyCharacteristics> key_characteristics;
@@ -174,7 +180,9 @@
* attestation correctly, if implemented.
*/
TEST_P(DeviceUniqueAttestationTest, EcdsaDeviceUniqueAttestation) {
- if (SecLevel() != SecurityLevel::STRONGBOX) return;
+ if (SecLevel() != SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to non-StrongBox device";
+ }
vector<uint8_t> key_blob;
vector<KeyCharacteristics> key_characteristics;
@@ -226,7 +234,9 @@
* local device.
*/
TEST_P(DeviceUniqueAttestationTest, EcdsaDeviceUniqueAttestationID) {
- if (SecLevel() != SecurityLevel::STRONGBOX) return;
+ if (SecLevel() != SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to non-StrongBox device";
+ }
// Collection of valid attestation ID tags.
auto attestation_id_tags = AuthorizationSetBuilder();
@@ -292,7 +302,9 @@
* don't match the local device.
*/
TEST_P(DeviceUniqueAttestationTest, EcdsaDeviceUniqueAttestationMismatchID) {
- if (SecLevel() != SecurityLevel::STRONGBOX) return;
+ if (SecLevel() != SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to non-StrongBox device";
+ }
// Collection of invalid attestation ID tags.
auto attestation_id_tags =