Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

system-hardware-interfaces: Commit

system/hardware/interfaces


Commit MetaInfo

Revisiónc4cd8ed446dbde39df701dab0525e5ef5b9824ec (tree)
Tiempo2019-07-03 05:58:39
AutorBranden Archer <brarcher@goog...>
CommiterBranden Archer

Log Message

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

on a GSI user build with rootable adb

Bug: 135421408

Change-Id: I4f7d29389dc170966e76a6661854cc92d0ea6e7f
Merged-In: Ie52e916a658b09eea66ffd9c5f2ac704656f4f3f

Cambiar Resumen

Diferencia incremental

--- a/wifi/keystore/1.0/vts/functional/VtsHalWifiKeystoreV1_0TargetTest.cpp
+++ b/wifi/keystore/1.0/vts/functional/VtsHalWifiKeystoreV1_0TargetTest.cpp
@@ -21,6 +21,7 @@
2121 #include <android/system/wifi/keystore/1.0/IKeystore.h>
2222 #include <binder/IServiceManager.h>
2323 #include <binder/ProcessState.h>
24+#include <cutils/properties.h>
2425 #include <keymasterV4_0/authorization_set.h>
2526 #include <keystore/keystore_promises.h>
2627 #include <private/android_filesystem_config.h>
@@ -70,6 +71,18 @@ class WifiKeystoreHalTest : public Test {
7071
7172 void TearDown() override { resetState(); }
7273
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+
7386 /**
7487 * Resets the relevant state of the system between tests
7588 */
@@ -237,6 +250,10 @@ TEST_F(WifiKeystoreHalTest, Sign_empty_key_name) {
237250 }
238251
239252 TEST_F(WifiKeystoreHalTest, Sign_empty_data) {
253+ if (!isDebuggableBuild()) {
254+ GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys";
255+ }
256+
240257 IKeystore::KeystoreStatusCode statusCode;
241258
242259 auto callback = [&statusCode](IKeystore::KeystoreStatusCode status,
@@ -255,6 +272,10 @@ TEST_F(WifiKeystoreHalTest, Sign_empty_data) {
255272 }
256273
257274 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+
258279 IKeystore::KeystoreStatusCode statusCode;
259280
260281 auto callback = [&statusCode](IKeystore::KeystoreStatusCode status,
@@ -274,6 +295,10 @@ TEST_F(WifiKeystoreHalTest, Sign_wrong_key_purpose) {
274295 }
275296
276297 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+
277302 IKeystore::KeystoreStatusCode statusCode;
278303
279304 auto callback = [&statusCode](IKeystore::KeystoreStatusCode status,
@@ -295,6 +320,10 @@ TEST_F(WifiKeystoreHalTest, Sign_wrong_key_type) {
295320 }
296321
297322 TEST_F(WifiKeystoreHalTest, Sign_success) {
323+ if (!isDebuggableBuild()) {
324+ GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys";
325+ }
326+
298327 IKeystore::KeystoreStatusCode statusCode;
299328
300329 auto callback = [&statusCode](IKeystore::KeystoreStatusCode status,
@@ -364,6 +393,10 @@ TEST_F(WifiKeystoreHalTest, GetBlob_missing_key) {
364393 }
365394
366395 TEST_F(WifiKeystoreHalTest, GetBlob_wrong_user) {
396+ if (!isDebuggableBuild()) {
397+ GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys";
398+ }
399+
367400 IKeystore::KeystoreStatusCode statusCode;
368401
369402 auto callback = [&statusCode](IKeystore::KeystoreStatusCode status,
@@ -383,6 +416,10 @@ TEST_F(WifiKeystoreHalTest, GetBlob_wrong_user) {
383416 }
384417
385418 TEST_F(WifiKeystoreHalTest, GetBlob_success) {
419+ if (!isDebuggableBuild()) {
420+ GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys";
421+ }
422+
386423 IKeystore::KeystoreStatusCode statusCode;
387424
388425 auto callback = [&statusCode](IKeystore::KeystoreStatusCode status,
@@ -449,6 +486,10 @@ TEST_F(WifiKeystoreHalTest, GetPublicKey_wrong_key_name) {
449486 }
450487
451488 TEST_F(WifiKeystoreHalTest, GetPublicKey_wrong_user) {
489+ if (!isDebuggableBuild()) {
490+ GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys";
491+ }
492+
452493 IKeystore::KeystoreStatusCode statusCode;
453494
454495 auto callback = [&statusCode](IKeystore::KeystoreStatusCode status,
@@ -472,6 +513,10 @@ TEST_F(WifiKeystoreHalTest, GetPublicKey_wrong_user) {
472513 }
473514
474515 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+
475520 IKeystore::KeystoreStatusCode statusCode;
476521
477522 auto callback = [&statusCode](IKeystore::KeystoreStatusCode status,
@@ -494,6 +539,10 @@ TEST_F(WifiKeystoreHalTest, GetPublicKey_wrong_key_type) {
494539 }
495540
496541 TEST_F(WifiKeystoreHalTest, GetPublicKey_success) {
542+ if (!isDebuggableBuild()) {
543+ GTEST_SKIP() << "Device not running a debuggable build, cannot make test keys";
544+ }
545+
497546 IKeystore::KeystoreStatusCode statusCode;
498547
499548 auto callback = [&statusCode](IKeystore::KeystoreStatusCode status,
Show on old repository browser