system/hardware/interfaces-mnstshlylh
Revision | dbdc57870f03266af00a54d4491c9a7e51055986 (tree) |
---|---|
Zeit | 2019-07-02 05:17:30 |
Autor | Branden Archer <brarcher@goog...> |
Commiter | Branden Archer |
Relax testing under GSI
VTS testing on GSI images will no longer occur on userdebug
builds. Instead, a user build is used with a boot image containing
a rootable adb. There is a change in Keystore that allows root to
create test keys on debuggable builds specifically for this VTS test.
Without that change the positive test cases will fail, as the test
keys cannot be generated.
To allow this test to continue working when run against GSI builds,
the parts of the test which require debuggable builds are skipped.
Test: build/test VtsHalWifiKeystoreV1_0TargetTest
Bug: 135421408
Change-Id: Ie52e916a658b09eea66ffd9c5f2ac704656f4f3f
@@ -21,6 +21,7 @@ | ||
21 | 21 | #include <android/system/wifi/keystore/1.0/IKeystore.h> |
22 | 22 | #include <binder/IServiceManager.h> |
23 | 23 | #include <binder/ProcessState.h> |
24 | +#include <cutils/properties.h> | |
24 | 25 | #include <keymasterV4_0/authorization_set.h> |
25 | 26 | #include <keystore/keystore_promises.h> |
26 | 27 | #include <private/android_filesystem_config.h> |
@@ -70,6 +71,18 @@ class WifiKeystoreHalTest : public Test { | ||
70 | 71 | |
71 | 72 | void TearDown() override { resetState(); } |
72 | 73 | |
74 | + bool isDebuggableBuild() { | |
75 | + char value[PROPERTY_VALUE_MAX] = {0}; | |
76 | + property_get("ro.system.build.type", value, ""); | |
77 | + if (strcmp(value, "userdebug") == 0) { | |
78 | + return true; | |
79 | + } | |
80 | + if (strcmp(value, "eng") == 0) { | |
81 | + return true; | |
82 | + } | |
83 | + return false; | |
84 | + } | |
85 | + | |
73 | 86 | /** |
74 | 87 | * Resets the relevant state of the system between tests |
75 | 88 | */ |
@@ -237,6 +250,10 @@ TEST_F(WifiKeystoreHalTest, Sign_empty_key_name) { | ||
237 | 250 | } |
238 | 251 | |
239 | 252 | TEST_F(WifiKeystoreHalTest, Sign_empty_data) { |
253 | + if (!isDebuggableBuild()) { | |
254 | + GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys"; | |
255 | + } | |
256 | + | |
240 | 257 | IKeystore::KeystoreStatusCode statusCode; |
241 | 258 | |
242 | 259 | auto callback = [&statusCode](IKeystore::KeystoreStatusCode status, |
@@ -255,6 +272,10 @@ TEST_F(WifiKeystoreHalTest, Sign_empty_data) { | ||
255 | 272 | } |
256 | 273 | |
257 | 274 | TEST_F(WifiKeystoreHalTest, Sign_wrong_key_purpose) { |
275 | + if (!isDebuggableBuild()) { | |
276 | + GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys"; | |
277 | + } | |
278 | + | |
258 | 279 | IKeystore::KeystoreStatusCode statusCode; |
259 | 280 | |
260 | 281 | auto callback = [&statusCode](IKeystore::KeystoreStatusCode status, |
@@ -274,6 +295,10 @@ TEST_F(WifiKeystoreHalTest, Sign_wrong_key_purpose) { | ||
274 | 295 | } |
275 | 296 | |
276 | 297 | TEST_F(WifiKeystoreHalTest, Sign_wrong_key_type) { |
298 | + if (!isDebuggableBuild()) { | |
299 | + GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys"; | |
300 | + } | |
301 | + | |
277 | 302 | IKeystore::KeystoreStatusCode statusCode; |
278 | 303 | |
279 | 304 | auto callback = [&statusCode](IKeystore::KeystoreStatusCode status, |
@@ -295,6 +320,10 @@ TEST_F(WifiKeystoreHalTest, Sign_wrong_key_type) { | ||
295 | 320 | } |
296 | 321 | |
297 | 322 | TEST_F(WifiKeystoreHalTest, Sign_success) { |
323 | + if (!isDebuggableBuild()) { | |
324 | + GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys"; | |
325 | + } | |
326 | + | |
298 | 327 | IKeystore::KeystoreStatusCode statusCode; |
299 | 328 | |
300 | 329 | auto callback = [&statusCode](IKeystore::KeystoreStatusCode status, |
@@ -364,6 +393,10 @@ TEST_F(WifiKeystoreHalTest, GetBlob_missing_key) { | ||
364 | 393 | } |
365 | 394 | |
366 | 395 | TEST_F(WifiKeystoreHalTest, GetBlob_wrong_user) { |
396 | + if (!isDebuggableBuild()) { | |
397 | + GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys"; | |
398 | + } | |
399 | + | |
367 | 400 | IKeystore::KeystoreStatusCode statusCode; |
368 | 401 | |
369 | 402 | auto callback = [&statusCode](IKeystore::KeystoreStatusCode status, |
@@ -383,6 +416,10 @@ TEST_F(WifiKeystoreHalTest, GetBlob_wrong_user) { | ||
383 | 416 | } |
384 | 417 | |
385 | 418 | TEST_F(WifiKeystoreHalTest, GetBlob_success) { |
419 | + if (!isDebuggableBuild()) { | |
420 | + GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys"; | |
421 | + } | |
422 | + | |
386 | 423 | IKeystore::KeystoreStatusCode statusCode; |
387 | 424 | |
388 | 425 | auto callback = [&statusCode](IKeystore::KeystoreStatusCode status, |
@@ -449,6 +486,10 @@ TEST_F(WifiKeystoreHalTest, GetPublicKey_wrong_key_name) { | ||
449 | 486 | } |
450 | 487 | |
451 | 488 | TEST_F(WifiKeystoreHalTest, GetPublicKey_wrong_user) { |
489 | + if (!isDebuggableBuild()) { | |
490 | + GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys"; | |
491 | + } | |
492 | + | |
452 | 493 | IKeystore::KeystoreStatusCode statusCode; |
453 | 494 | |
454 | 495 | auto callback = [&statusCode](IKeystore::KeystoreStatusCode status, |
@@ -472,6 +513,10 @@ TEST_F(WifiKeystoreHalTest, GetPublicKey_wrong_user) { | ||
472 | 513 | } |
473 | 514 | |
474 | 515 | TEST_F(WifiKeystoreHalTest, GetPublicKey_wrong_key_type) { |
516 | + if (!isDebuggableBuild()) { | |
517 | + GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys"; | |
518 | + } | |
519 | + | |
475 | 520 | IKeystore::KeystoreStatusCode statusCode; |
476 | 521 | |
477 | 522 | auto callback = [&statusCode](IKeystore::KeystoreStatusCode status, |
@@ -494,6 +539,10 @@ TEST_F(WifiKeystoreHalTest, GetPublicKey_wrong_key_type) { | ||
494 | 539 | } |
495 | 540 | |
496 | 541 | TEST_F(WifiKeystoreHalTest, GetPublicKey_success) { |
542 | + if (!isDebuggableBuild()) { | |
543 | + GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys"; | |
544 | + } | |
545 | + | |
497 | 546 | IKeystore::KeystoreStatusCode statusCode; |
498 | 547 | |
499 | 548 | auto callback = [&statusCode](IKeystore::KeystoreStatusCode status, |