CtsKeystoreTestCases 测试--和keybox相关的几条用例

AttestationPerformanceTest

测试方式:adb shell am instrument -r -e class android.keystore.cts.AttestationPerformanceTest -w android.keystore.cts/androidx.test.runner.AndroidJUnitRunner

需要预置keymaster key,同时设备需处于locked状态。

两个fail项:

There were 2 failures:
1) testEcKeyAttestation(android.keystore.cts.AttestationPerformanceTest)
java.security.ProviderException: Failed to generate attestation certificate chain
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.getAttestationChain(AndroidKeyStoreKeyPairGeneratorSpi.java:611)
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.createCertificateChain(AndroidKeyStoreKeyPairGeneratorSpi.java:498)
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.generateKeyPair(AndroidKeyStoreKeyPairGeneratorSpi.java:475)
    at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:727)
    at android.keystore.cts.AttestationPerformanceTest$KeystoreAttestationMeasurable.initialSetUp(AttestationPerformanceTest.java:116)
    at android.keystore.cts.PerformanceTestBase.measure(PerformanceTestBase.java:109)
    at android.keystore.cts.PerformanceTestBase.measure(PerformanceTestBase.java:63)
    at android.keystore.cts.AttestationPerformanceTest.testEcKeyAttestation(AttestationPerformanceTest.java:60)
    at java.lang.reflect.Method.invoke(Native Method)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:52)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at androidx.test.runner.AndroidJUnit4.run(AndroidJUnit4.java:104)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
    at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
    at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2205)
Caused by: android.security.KeyStoreException: Unknown error
    at android.security.KeyStore.getKeyStoreException(KeyStore.java:1301)
    ... 36 more
2) testRsaKeyAttestation(android.keystore.cts.AttestationPerformanceTest)
java.security.ProviderException: Failed to generate attestation certificate chain
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.getAttestationChain(AndroidKeyStoreKeyPairGeneratorSpi.java:611)
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.createCertificateChain(AndroidKeyStoreKeyPairGeneratorSpi.java:498)
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.generateKeyPair(AndroidKeyStoreKeyPairGeneratorSpi.java:475)
    at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:727)
    at android.keystore.cts.AttestationPerformanceTest$KeystoreAttestationMeasurable.initialSetUp(AttestationPerformanceTest.java:116)
    at android.keystore.cts.PerformanceTestBase.measure(PerformanceTestBase.java:109)
    at android.keystore.cts.PerformanceTestBase.measure(PerformanceTestBase.java:63)
    at android.keystore.cts.AttestationPerformanceTest.testRsaKeyAttestation(AttestationPerformanceTest.java:47)
    at java.lang.reflect.Method.invoke(Native Method)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:52)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at androidx.test.runner.AndroidJUnit4.run(AndroidJUnit4.java:104)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
    at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
    at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2205)
Caused by: android.security.KeyStoreException: Unknown error
    at android.security.KeyStore.getKeyStoreException(KeyStore.java:1301)
    ... 36 more

FAILURES!!!
Tests run: 2,  Failures: 2

单独验证:

testRsaKeyAttestation 

>adb shell am instrument -r -e class android.keystore.cts.AttestationPerformanceTest#testRsaKeyAttestation -w android.keystore.cts/androidx.test.runner.AndroidJUnitRunner
INSTRUMENTATION_STATUS: class=android.keystore.cts.AttestationPerformanceTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
android.keystore.cts.AttestationPerformanceTest:
INSTRUMENTATION_STATUS: test=testRsaKeyAttestation
INSTRUMENTATION_STATUS_CODE: 1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS: class=android.keystore.cts.AttestationPerformanceTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=.
INSTRUMENTATION_STATUS: test=testRsaKeyAttestation
INSTRUMENTATION_STATUS_CODE: 0
INSTRUMENTATION_RESULT: stream=

Time: 322.029

OK (1 test)


INSTRUMENTATION_CODE: -1

testEcKeyAttestation 

>adb shell am instrument -r -e class android.keystore.cts.AttestationPerformanceTest#testEcKeyAttestation -w android.keystore.cts/androidx.test.runner.AndroidJUnitRunner
INSTRUMENTATION_STATUS: class=android.keystore.cts.AttestationPerformanceTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
android.keystore.cts.AttestationPerformanceTest:
INSTRUMENTATION_STATUS: test=testEcKeyAttestation
INSTRUMENTATION_STATUS_CODE: 1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_STATUS: class=android.keystore.cts.AttestationPerformanceTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=.
INSTRUMENTATION_STATUS: test=testEcKeyAttestation
INSTRUMENTATION_STATUS_CODE: 0
INSTRUMENTATION_RESULT: stream=

Time: 16.358

OK (1 test)


INSTRUMENTATION_CODE: -1

KeyAttestationTest

4个fail项:

There were 4 failures:
1) testEcAttestation(android.keystore.cts.KeyAttestationTest)
java.lang.Exception: Failed on curve 0 and challege 0
    at android.keystore.cts.KeyAttestationTest.testEcAttestation(KeyAttestationTest.java:184)
    at java.lang.reflect.Method.invoke(Native Method)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:115)
    at androidx.test.internal.runner.junit3.AndroidTestResult.runProtected(AndroidTestResult.java:73)
    at junit.framework.TestResult.run(TestResult.java:118)
    at androidx.test.internal.runner.junit3.AndroidTestResult.run(AndroidTestResult.java:51)
    at junit.framework.TestCase.run(TestCase.java:124)
    at androidx.test.internal.runner.junit3.NonLeakyTestSuite$NonLeakyTest.run(NonLeakyTestSuite.java:62)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at androidx.test.internal.runner.junit3.DelegatingTestSuite.run(DelegatingTestSuite.java:97)
    at androidx.test.internal.runner.junit3.AndroidTestSuite.run(AndroidTestSuite.java:65)
    at androidx.test.internal.runner.junit3.JUnit38ClassRunner.run(JUnit38ClassRunner.java:115)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
    at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
    at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2205)
Caused by: java.security.ProviderException: Failed to generate attestation certificate chain
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.getAttestationChain(AndroidKeyStoreKeyPairGeneratorSpi.java:611)
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.createCertificateChain(AndroidKeyStoreKeyPairGeneratorSpi.java:498)
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.generateKeyPair(AndroidKeyStoreKeyPairGeneratorSpi.java:475)
    at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:727)
    at android.keystore.cts.KeyAttestationTest.generateKeyPair(KeyAttestationTest.java:1140)
    at android.keystore.cts.KeyAttestationTest.testEcAttestation(KeyAttestationTest.java:597)
    at android.keystore.cts.KeyAttestationTest.testEcAttestation(KeyAttestationTest.java:177)
    ... 27 more
Caused by: android.security.KeyStoreException: Unknown error
    at android.security.KeyStore.getKeyStoreException(KeyStore.java:1301)
    ... 34 more
2) testEcAttestation_DeviceLocked(android.keystore.cts.KeyAttestationTest)
java.security.ProviderException: Failed to generate attestation certificate chain
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.getAttestationChain(AndroidKeyStoreKeyPairGeneratorSpi.java:611)
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.createCertificateChain(AndroidKeyStoreKeyPairGeneratorSpi.java:498)
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.generateKeyPair(AndroidKeyStoreKeyPairGeneratorSpi.java:475)
    at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:727)
    at android.keystore.cts.KeyAttestationTest.generateKeyPair(KeyAttestationTest.java:1140)
    at android.keystore.cts.KeyAttestationTest.testEcAttestation_DeviceLocked(KeyAttestationTest.java:267)
    at java.lang.reflect.Method.invoke(Native Method)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:115)
    at androidx.test.internal.runner.junit3.AndroidTestResult.runProtected(AndroidTestResult.java:73)
    at junit.framework.TestResult.run(TestResult.java:118)
    at androidx.test.internal.runner.junit3.AndroidTestResult.run(AndroidTestResult.java:51)
    at junit.framework.TestCase.run(TestCase.java:124)
    at androidx.test.internal.runner.junit3.NonLeakyTestSuite$NonLeakyTest.run(NonLeakyTestSuite.java:62)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at androidx.test.internal.runner.junit3.DelegatingTestSuite.run(DelegatingTestSuite.java:97)
    at androidx.test.internal.runner.junit3.AndroidTestSuite.run(AndroidTestSuite.java:65)
    at androidx.test.internal.runner.junit3.JUnit38ClassRunner.run(JUnit38ClassRunner.java:115)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
    at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
    at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2205)
Caused by: android.security.KeyStoreException: Unknown error
    at android.security.KeyStore.getKeyStoreException(KeyStore.java:1301)
    ... 33 more
3) testRsaAttestation(android.keystore.cts.KeyAttestationTest)
java.lang.Exception: Failed on key size 512 challenge [], purposes [2, 3] and paddings [PKCS1]
    at android.keystore.cts.KeyAttestationTest.testRsaAttestations(KeyAttestationTest.java:503)
    at android.keystore.cts.KeyAttestationTest.testRsaAttestation(KeyAttestationTest.java:361)
    at java.lang.reflect.Method.invoke(Native Method)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:115)
    at androidx.test.internal.runner.junit3.AndroidTestResult.runProtected(AndroidTestResult.java:73)
    at junit.framework.TestResult.run(TestResult.java:118)
    at androidx.test.internal.runner.junit3.AndroidTestResult.run(AndroidTestResult.java:51)
    at junit.framework.TestCase.run(TestCase.java:124)
    at androidx.test.internal.runner.junit3.NonLeakyTestSuite$NonLeakyTest.run(NonLeakyTestSuite.java:62)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at androidx.test.internal.runner.junit3.DelegatingTestSuite.run(DelegatingTestSuite.java:97)
    at androidx.test.internal.runner.junit3.AndroidTestSuite.run(AndroidTestSuite.java:65)
    at androidx.test.internal.runner.junit3.JUnit38ClassRunner.run(JUnit38ClassRunner.java:115)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
    at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
    at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2205)
Caused by: java.security.ProviderException: Failed to generate attestation certificate chain
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.getAttestationChain(AndroidKeyStoreKeyPairGeneratorSpi.java:611)
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.createCertificateChain(AndroidKeyStoreKeyPairGeneratorSpi.java:498)
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.generateKeyPair(AndroidKeyStoreKeyPairGeneratorSpi.java:475)
    at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:727)
    at android.keystore.cts.KeyAttestationTest.generateKeyPair(KeyAttestationTest.java:1140)
    at android.keystore.cts.KeyAttestationTest.testRsaAttestation(KeyAttestationTest.java:543)
    at android.keystore.cts.KeyAttestationTest.testRsaAttestations(KeyAttestationTest.java:495)
    ... 28 more
Caused by: android.security.KeyStoreException: Unknown error
    at android.security.KeyStore.getKeyStoreException(KeyStore.java:1301)
    ... 35 more
4) testRsaAttestation_DeviceLocked(android.keystore.cts.KeyAttestationTest)
java.security.ProviderException: Failed to generate attestation certificate chain
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.getAttestationChain(AndroidKeyStoreKeyPairGeneratorSpi.java:611)
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.createCertificateChain(AndroidKeyStoreKeyPairGeneratorSpi.java:498)
    at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.generateKeyPair(AndroidKeyStoreKeyPairGeneratorSpi.java:475)
    at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:727)
    at android.keystore.cts.KeyAttestationTest.generateKeyPair(KeyAttestationTest.java:1140)
    at android.keystore.cts.KeyAttestationTest.testRsaAttestation_DeviceLocked(KeyAttestationTest.java:441)
    at java.lang.reflect.Method.invoke(Native Method)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:115)
    at androidx.test.internal.runner.junit3.AndroidTestResult.runProtected(AndroidTestResult.java:73)
    at junit.framework.TestResult.run(TestResult.java:118)
    at androidx.test.internal.runner.junit3.AndroidTestResult.run(AndroidTestResult.java:51)
    at junit.framework.TestCase.run(TestCase.java:124)
    at androidx.test.internal.runner.junit3.NonLeakyTestSuite$NonLeakyTest.run(NonLeakyTestSuite.java:62)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at androidx.test.internal.runner.junit3.DelegatingTestSuite.run(DelegatingTestSuite.java:97)
    at androidx.test.internal.runner.junit3.AndroidTestSuite.run(AndroidTestSuite.java:65)
    at androidx.test.internal.runner.junit3.JUnit38ClassRunner.run(JUnit38ClassRunner.java:115)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
    at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
    at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2205)
Caused by: android.security.KeyStoreException: Unknown error
    at android.security.KeyStore.getKeyStoreException(KeyStore.java:1301)
    ... 33 more

FAILURES!!!
Tests run: 13,  Failures: 4

单独验证:

testRsaAttestation_DeviceLocked 

设备需要配置为locked状态

>adb shell am instrument -r -e class android.keystore.cts.KeyAttestationTest#testRsaAttestation_DeviceLocked -w android.keystore.cts/androidx.test.runner.AndroidJUnitRunner
INSTRUMENTATION_STATUS: class=android.keystore.cts.KeyAttestationTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
android.keystore.cts.KeyAttestationTest:
INSTRUMENTATION_STATUS: test=testRsaAttestation_DeviceLocked
INSTRUMENTATION_STATUS_CODE: 1
INSTRUMENTATION_STATUS: class=android.keystore.cts.KeyAttestationTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=.
INSTRUMENTATION_STATUS: test=testRsaAttestation_DeviceLocked
INSTRUMENTATION_STATUS_CODE: 0
INSTRUMENTATION_RESULT: stream=

Time: 8.941

OK (1 test)


INSTRUMENTATION_CODE: -1

testRsaAttestation 

>adb shell am instrument -r -e class android.keystore.cts.KeyAttestationTest#testRsaAttestation -w android.keystore.cts/androidx.test.runner.AndroidJUnitRunner
INSTRUMENTATION_STATUS: class=android.keystore.cts.KeyAttestationTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
android.keystore.cts.KeyAttestationTest:
INSTRUMENTATION_STATUS: test=testRsaAttestation
INSTRUMENTATION_STATUS_CODE: 1
INSTRUMENTATION_STATUS: class=android.keystore.cts.KeyAttestationTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=.
INSTRUMENTATION_STATUS: test=testRsaAttestation
INSTRUMENTATION_STATUS_CODE: 0
INSTRUMENTATION_RESULT: stream=

Time: 208.62

OK (1 test)


INSTRUMENTATION_CODE: -1

testEcAttestation_DeviceLocked 

设备需要配置为locked状态

>adb shell am instrument -r -e class android.keystore.cts.KeyAttestationTest#testEcAttestation_DeviceLocked -w android.keystore.cts/androidx.test.runner.AndroidJUnitRunner
INSTRUMENTATION_STATUS: class=android.keystore.cts.KeyAttestationTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
android.keystore.cts.KeyAttestationTest:
INSTRUMENTATION_STATUS: test=testEcAttestation_DeviceLocked
INSTRUMENTATION_STATUS_CODE: 1
INSTRUMENTATION_STATUS: class=android.keystore.cts.KeyAttestationTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=.
INSTRUMENTATION_STATUS: test=testEcAttestation_DeviceLocked
INSTRUMENTATION_STATUS_CODE: 0
INSTRUMENTATION_RESULT: stream=

Time: 1.091

OK (1 test)


INSTRUMENTATION_CODE: -1

testEcAttestation 

>adb shell am instrument -r -e class android.keystore.cts.KeyAttestationTest#testEcAttestation -w android.keystore.cts/androidx.test.runner.AndroidJUnitRunner
INSTRUMENTATION_STATUS: class=android.keystore.cts.KeyAttestationTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
android.keystore.cts.KeyAttestationTest:
INSTRUMENTATION_STATUS: test=testEcAttestation
INSTRUMENTATION_STATUS_CODE: 1
INSTRUMENTATION_STATUS: class=android.keystore.cts.KeyAttestationTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=.
INSTRUMENTATION_STATUS: test=testEcAttestation
INSTRUMENTATION_STATUS_CODE: 0
INSTRUMENTATION_RESULT: stream=

Time: 85.976

OK (1 test)


INSTRUMENTATION_CODE: -1

 

posted @ 2023-09-11 14:27  xiululu  阅读(241)  评论(0编辑  收藏  举报