diff options
5 files changed, 29 insertions, 82 deletions
diff --git a/security/secureclock/aidl/vts/functional/Android.bp b/security/secureclock/aidl/vts/functional/Android.bp index 6dfa4175c7..56c8e1d361 100644 --- a/security/secureclock/aidl/vts/functional/Android.bp +++ b/security/secureclock/aidl/vts/functional/Android.bp @@ -39,11 +39,11 @@ cc_test { shared_libs: [ "libbinder_ndk", "libcrypto", - "libkeymint", ], static_libs: [ "android.hardware.security.keymint-V1-ndk_platform", "android.hardware.security.secureclock-V1-ndk_platform", + "libkeymint", ], test_suites: [ "general-tests", diff --git a/security/secureclock/aidl/vts/functional/AndroidTest.xml b/security/secureclock/aidl/vts/functional/AndroidTest.xml deleted file mode 100644 index 4861c7c7af..0000000000 --- a/security/secureclock/aidl/vts/functional/AndroidTest.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2020 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<configuration description="Runs VtsAidlSecureClockTargetTest."> - <option name="test-suite-tag" value="apct" /> - <option name="test-suite-tag" value="apct-native" /> - - <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"> - </target_preparer> - - <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> - <option name="cleanup" value="true" /> - <option name="push" - value="VtsAidlSecureClockTargetTest->/data/local/tmp/VtsAidlSecureClockTargetTest" /> - </target_preparer> - - <test class="com.android.tradefed.testtype.GTest" > - <option name="native-test-device-path" value="/data/local/tmp" /> - <option name="module-name" value="VtsAidlSecureClockTargetTest" /> - <option name="native-test-timeout" value="900000"/> - </test> -</configuration> diff --git a/security/sharedsecret/aidl/vts/functional/Android.bp b/security/sharedsecret/aidl/vts/functional/Android.bp index 1bc5bebc91..d3747fc071 100644 --- a/security/sharedsecret/aidl/vts/functional/Android.bp +++ b/security/sharedsecret/aidl/vts/functional/Android.bp @@ -39,11 +39,11 @@ cc_test { shared_libs: [ "libbinder_ndk", "libcrypto", - "libkeymint", ], static_libs: [ "android.hardware.security.keymint-V1-ndk_platform", "android.hardware.security.sharedsecret-V1-ndk_platform", + "libkeymint", ], test_suites: [ "general-tests", diff --git a/security/sharedsecret/aidl/vts/functional/AndroidTest.xml b/security/sharedsecret/aidl/vts/functional/AndroidTest.xml deleted file mode 100644 index c6697bcda5..0000000000 --- a/security/sharedsecret/aidl/vts/functional/AndroidTest.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2020 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<configuration description="Runs VtsAidlSharedSecretTargetTest."> - <option name="test-suite-tag" value="apct" /> - <option name="test-suite-tag" value="apct-native" /> - - <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"> - </target_preparer> - - <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> - <option name="cleanup" value="true" /> - <option name="push" - value="VtsAidlSharedSecretTargetTest->/data/local/tmp/VtsAidlSharedSecretTargetTest" /> - </target_preparer> - - <test class="com.android.tradefed.testtype.GTest" > - <option name="native-test-device-path" value="/data/local/tmp" /> - <option name="module-name" value="VtsAidlSharedSecretTargetTest" /> - <option name="native-test-timeout" value="900000"/> - </test> -</configuration> diff --git a/security/sharedsecret/aidl/vts/functional/SharedSecretAidlTest.cpp b/security/sharedsecret/aidl/vts/functional/SharedSecretAidlTest.cpp index 83f6ef39db..842612087f 100644 --- a/security/sharedsecret/aidl/vts/functional/SharedSecretAidlTest.cpp +++ b/security/sharedsecret/aidl/vts/functional/SharedSecretAidlTest.cpp @@ -114,14 +114,14 @@ class SharedSecretAidlTest : public ::testing::Test { const vector<shared_ptr<ISharedSecret>>& allSharedSecrets() { return allSharedSecrets_; } static void SetUpTestCase() { - if (allSharedSecrets_.empty()) { - auto names = ::android::getAidlHalInstanceNames(ISharedSecret::descriptor); - for (const auto& name : names) { - auto servicePtr = getSharedSecretService(name.c_str()); - if (servicePtr != nullptr) allSharedSecrets_.push_back(std::move(servicePtr)); - } + ASSERT_TRUE(allSharedSecrets_.empty()) << "The Shared Secret vector is not empty."; + auto names = ::android::getAidlHalInstanceNames(ISharedSecret::descriptor); + for (const auto& name : names) { + auto servicePtr = getSharedSecretService(name.c_str()); + if (servicePtr != nullptr) allSharedSecrets_.push_back(std::move(servicePtr)); } } + static void TearDownTestCase() {} void SetUp() override {} void TearDown() override {} @@ -134,6 +134,9 @@ vector<shared_ptr<ISharedSecret>> SharedSecretAidlTest::allSharedSecrets_; TEST_F(SharedSecretAidlTest, GetParameters) { auto sharedSecrets = allSharedSecrets(); + if (sharedSecrets.empty()) { + GTEST_SKIP() << "Skipping the test because no shared secret service is found."; + } for (auto sharedSecret : sharedSecrets) { auto result1 = getSharedSecretParameters(sharedSecret); EXPECT_EQ(ErrorCode::OK, result1.error); @@ -148,14 +151,18 @@ TEST_F(SharedSecretAidlTest, GetParameters) { } TEST_F(SharedSecretAidlTest, ComputeSharedSecret) { + auto sharedSecrets = allSharedSecrets(); + if (sharedSecrets.empty()) { + GTEST_SKIP() << "Skipping the test as no shared secret service is found."; + } auto params = getAllSharedSecretParameters(); - ASSERT_EQ(allSharedSecrets().size(), params.size()) + ASSERT_EQ(sharedSecrets.size(), params.size()) << "One or more shared secret services failed to provide parameters."; auto nonces = copyNonces(params); - EXPECT_EQ(allSharedSecrets().size(), nonces.size()); + EXPECT_EQ(sharedSecrets.size(), nonces.size()); std::sort(nonces.begin(), nonces.end()); std::unique(nonces.begin(), nonces.end()); - EXPECT_EQ(allSharedSecrets().size(), nonces.size()); + EXPECT_EQ(sharedSecrets.size(), nonces.size()); auto responses = computeAllSharedSecrets(params); ASSERT_GT(responses.size(), 0U); @@ -163,7 +170,7 @@ TEST_F(SharedSecretAidlTest, ComputeSharedSecret) { // Do it a second time. Should get the same answers. params = getAllSharedSecretParameters(); - ASSERT_EQ(allSharedSecrets().size(), params.size()) + ASSERT_EQ(sharedSecrets.size(), params.size()) << "One or more shared secret services failed to provide parameters."; responses = computeAllSharedSecrets(params); @@ -188,10 +195,14 @@ inline final_action<F> finally(const F& f) { } TEST_F(SharedSecretAidlTest, ComputeSharedSecretCorruptNonce) { + auto sharedSecrets = allSharedSecrets(); + if (sharedSecrets.empty()) { + GTEST_SKIP() << "Skipping the test as no shared secret service is found."; + } auto fixup_hmac = finally([&]() { computeAllSharedSecrets(getAllSharedSecretParameters()); }); auto params = getAllSharedSecretParameters(); - ASSERT_EQ(allSharedSecrets().size(), params.size()) + ASSERT_EQ(sharedSecrets.size(), params.size()) << "One or more shared secret services failed to provide parameters."; // All should be well in the normal case @@ -224,9 +235,13 @@ TEST_F(SharedSecretAidlTest, ComputeSharedSecretCorruptNonce) { } TEST_F(SharedSecretAidlTest, ComputeSharedSecretCorruptSeed) { + auto sharedSecrets = allSharedSecrets(); + if (sharedSecrets.empty()) { + GTEST_SKIP() << "Skipping the test as no shared secret service is found."; + } auto fixup_hmac = finally([&]() { computeAllSharedSecrets(getAllSharedSecretParameters()); }); auto params = getAllSharedSecretParameters(); - ASSERT_EQ(allSharedSecrets().size(), params.size()) + ASSERT_EQ(sharedSecrets.size(), params.size()) << "One or more shared secret service failed to provide parameters."; // All should be well in the normal case |