wifi: Fix for VtsHalWifiSupplicantV1_2TargetTest failures

Check the return value of deprecated APIs and if it's
FAILURE_UNKNOWN, don't proceed and consider it as pass.

Bug: 147434122
Test: atest VtsHalWifiSupplicantV1_2TargetTest
Change-Id: Ib6cfb70c514f10faa54ca11011657528374175e6
This commit is contained in:
Sunil Ravi
2020-01-29 20:45:09 -08:00
parent ac8337ddb4
commit 8d343bdfc0
2 changed files with 55 additions and 15 deletions

View File

@@ -111,9 +111,14 @@ class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBase {
// If DPP is not supported, we just pass the test.
sta_iface_->getKeyMgmtCapabilities(
[&](const SupplicantStatus& status, uint32_t keyMgmtMaskInternal) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
// Since getKeyMgmtCapabilities() is overridden by an
// upgraded API in newer HAL versions, allow for
// FAILURE_UNKNOWN and return DPP is not supported.
if (status.code != SupplicantStatusCode::FAILURE_UNKNOWN) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
keyMgmtMask = keyMgmtMaskInternal;
keyMgmtMask = keyMgmtMaskInternal;
}
});
if (!(keyMgmtMask & ISupplicantStaNetwork::KeyMgmtMask::DPP)) {
@@ -268,8 +273,12 @@ TEST_P(SupplicantStaIfaceHidlTest, RegisterCallback_1_2) {
* GetKeyMgmtCapabilities
*/
TEST_P(SupplicantStaIfaceHidlTest, GetKeyMgmtCapabilities) {
sta_iface_->getKeyMgmtCapabilities(
[&](const SupplicantStatus& status, uint32_t keyMgmtMask) {
sta_iface_->getKeyMgmtCapabilities([&](const SupplicantStatus& status,
uint32_t keyMgmtMask) {
// Since this API is overridden by an upgraded API in newer HAL
// versions, allow FAILURE_UNKNOWN to indicate that the test is no
// longer supported on newer HAL.
if (status.code != SupplicantStatusCode::FAILURE_UNKNOWN) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
// Even though capabilities vary, these two are always set in HAL
@@ -277,7 +286,8 @@ TEST_P(SupplicantStaIfaceHidlTest, GetKeyMgmtCapabilities) {
EXPECT_TRUE(keyMgmtMask & ISupplicantStaNetwork::KeyMgmtMask::NONE);
EXPECT_TRUE(keyMgmtMask &
ISupplicantStaNetwork::KeyMgmtMask::IEEE8021X);
});
}
});
}
/*
@@ -455,4 +465,4 @@ INSTANTIATE_TEST_CASE_P(
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
android::hardware::wifi::supplicant::V1_2::ISupplicant::
descriptor))),
android::hardware::PrintInstanceTupleNameToString<>);
android::hardware::PrintInstanceTupleNameToString<>);

View File

@@ -112,13 +112,23 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetKeyMgmt_1_2) {
uint32_t keyMgmt = (uint32_t)ISupplicantStaNetwork::KeyMgmtMask::SAE;
sta_network_->setKeyMgmt_1_2(keyMgmt, [](const SupplicantStatus &status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
// Since this API is overridden by an upgraded API in newer HAL
// versions, allow FAILURE_UNKNOWN to indicate that the test is no
// longer supported on newer HALs.
if (status.code != SupplicantStatusCode::FAILURE_UNKNOWN) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
}
});
sta_network_->getKeyMgmt_1_2(
[&keyMgmt](const SupplicantStatus &status, uint32_t keyMgmtOut) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
EXPECT_EQ(keyMgmtOut, keyMgmt);
// Since this API is overridden by an upgraded API in newer HAL
// versions, allow FAILURE_UNKNOWN to indicate that the test is no
// longer supported on newer HALs.
if (status.code != SupplicantStatusCode::FAILURE_UNKNOWN) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
EXPECT_EQ(keyMgmtOut, keyMgmt);
}
});
}
@@ -131,14 +141,24 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetGroupCipher_1_2) {
sta_network_->setGroupCipher_1_2(
groupCipher, [](const SupplicantStatus &status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
// Since this API is overridden by an upgraded API in newer HAL
// versions, allow FAILURE_UNKNOWN to indicate that the test is no
// longer supported on newer HALs.
if (status.code != SupplicantStatusCode::FAILURE_UNKNOWN) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
}
});
sta_network_->getGroupCipher_1_2(
[&groupCipher](const SupplicantStatus &status,
uint32_t groupCipherOut) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
EXPECT_EQ(groupCipherOut, groupCipher);
// Since this API is overridden by an upgraded API in newer HAL
// versions, allow FAILURE_UNKNOWN to indicate that the test is no
// longer supported on newer HALs.
if (status.code != SupplicantStatusCode::FAILURE_UNKNOWN) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
EXPECT_EQ(groupCipherOut, groupCipher);
}
});
}
@@ -151,14 +171,24 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetPairwiseCipher_1_2) {
sta_network_->setPairwiseCipher_1_2(
pairwiseCipher, [](const SupplicantStatus &status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
// Since this API is overridden by an upgraded API in newer HAL
// versions, allow FAILURE_UNKNOWN to indicate that the test is no
// longer supported on newer HALs.
if (status.code != SupplicantStatusCode::FAILURE_UNKNOWN) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
}
});
sta_network_->getPairwiseCipher_1_2(
[&pairwiseCipher](const SupplicantStatus &status,
uint32_t pairwiseCipherOut) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
EXPECT_EQ(pairwiseCipherOut, pairwiseCipher);
// Since this API is overridden by an upgraded API in newer HAL
// versions, allow FAILURE_UNKNOWN to indicate that the test is no
// longer supported on newer HALs.
if (status.code != SupplicantStatusCode::FAILURE_UNKNOWN) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
EXPECT_EQ(pairwiseCipherOut, pairwiseCipher);
}
});
}