Merge "Wifi: omit FILS related vts tests if not supported" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-03-03 15:48:41 +00:00
committed by Android (Google) Code Review
4 changed files with 37 additions and 48 deletions

View File

@@ -21,6 +21,8 @@
#include "supplicant_hidl_test_utils_1_3.h"
using ::android::sp;
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
using ::android::hardware::wifi::supplicant::V1_3::ISupplicant;
using ::android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface;
using ::android::hardware::wifi::supplicant::V1_3::ISupplicantStaNetwork;
@@ -43,3 +45,15 @@ sp<ISupplicant> getSupplicant_1_3(const std::string& supplicant_instance_name,
return ISupplicant::castFrom(
getSupplicant(supplicant_instance_name, isP2pOn));
}
bool isFilsSupported(sp<ISupplicantStaIface> sta_iface) {
uint32_t keyMgmtMask = 0;
sta_iface->getKeyMgmtCapabilities_1_3(
[&](const SupplicantStatus& status, uint32_t keyMgmtMaskInternal) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
keyMgmtMask = keyMgmtMaskInternal;
});
return (keyMgmtMask & (ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA256 |
ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA384));
}

View File

@@ -31,4 +31,7 @@ createSupplicantStaNetwork_1_3(
supplicant);
android::sp<android::hardware::wifi::supplicant::V1_3::ISupplicant>
getSupplicant_1_3(const std::string& supplicant_instance_name, bool isP2pOn);
bool isFilsSupported(
android::sp<android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface>
sta_iface);
#endif /* SUPPLICANT_HIDL_TEST_UTILS_1_3_H */

View File

@@ -517,7 +517,10 @@ TEST_P(SupplicantStaIfaceHidlTest, StartDppConfiguratorInitiator) {
* FilsHlpAddRequest
*/
TEST_P(SupplicantStaIfaceHidlTest, FilsHlpAddRequest) {
uint32_t keyMgmtMask = 0;
if (!isFilsSupported(sta_iface_)) {
GTEST_SKIP()
<< "Skipping test since driver/supplicant doesn't support FILS";
}
uint8_t destMacAddr[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55};
std::vector<uint8_t> pktBuffer = {
0x08, 0x00, 0x45, 0x10, 0x01, 0x3a, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
@@ -548,22 +551,9 @@ TEST_P(SupplicantStaIfaceHidlTest, FilsHlpAddRequest) {
0x63, 0x70, 0x2d, 0x52, 0x37, 0x0a, 0x01, 0x03, 0x06, 0x0f, 0x1a, 0x1c,
0x33, 0x3a, 0x3b, 0x2b, 0xff, 0x00};
sta_iface_->getKeyMgmtCapabilities_1_3(
[&](const SupplicantStatus& status, uint32_t keyMgmtMaskInternal) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
keyMgmtMask = keyMgmtMaskInternal;
});
SupplicantStatusCode expectedStatusCode =
(keyMgmtMask & (ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA256 |
ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA384))
? SupplicantStatusCode::SUCCESS
: SupplicantStatusCode::FAILURE_UNKNOWN;
sta_iface_->filsHlpAddRequest(
destMacAddr, pktBuffer,
[expectedStatusCode](const SupplicantStatus& status) {
EXPECT_EQ(expectedStatusCode, status.code);
destMacAddr, pktBuffer, [](const SupplicantStatus& status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
});
}
@@ -571,23 +561,14 @@ TEST_P(SupplicantStaIfaceHidlTest, FilsHlpAddRequest) {
* FilsHlpFlushRequest
*/
TEST_P(SupplicantStaIfaceHidlTest, FilsHlpFlushRequest) {
uint32_t keyMgmtMask = 0;
sta_iface_->getKeyMgmtCapabilities_1_3(
[&](const SupplicantStatus& status, uint32_t keyMgmtMaskInternal) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
keyMgmtMask = keyMgmtMaskInternal;
});
if (!isFilsSupported(sta_iface_)) {
GTEST_SKIP()
<< "Skipping test since driver/supplicant doesn't support FILS";
}
SupplicantStatusCode expectedStatusCode =
(keyMgmtMask & (ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA256 |
ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA384))
? SupplicantStatusCode::SUCCESS
: SupplicantStatusCode::FAILURE_UNKNOWN;
sta_iface_->filsHlpFlushRequest(
[expectedStatusCode](const SupplicantStatus& status) {
EXPECT_EQ(expectedStatusCode, status.code);
});
sta_iface_->filsHlpFlushRequest([](const SupplicantStatus& status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
});
}
INSTANTIATE_TEST_CASE_P(
PerInstance, SupplicantStaIfaceHidlTest,

View File

@@ -290,23 +290,14 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetWapiCertSuite) {
* SetEapErp
*/
TEST_P(SupplicantStaNetworkHidlTest, SetEapErp) {
uint32_t keyMgmtMask = 0;
sta_iface_->getKeyMgmtCapabilities_1_3(
[&](const SupplicantStatus &status, uint32_t keyMgmtMaskInternal) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
keyMgmtMask = keyMgmtMaskInternal;
});
if (!isFilsSupported(sta_iface_)) {
GTEST_SKIP()
<< "Skipping test since driver/supplicant doesn't support FILS";
}
SupplicantStatusCode expectedStatusCode =
(keyMgmtMask & (ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA256 |
ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA384))
? SupplicantStatusCode::SUCCESS
: SupplicantStatusCode::FAILURE_UNKNOWN;
sta_network_->setEapErp(
true, [expectedStatusCode](const SupplicantStatus &status) {
EXPECT_EQ(expectedStatusCode, status.code);
});
sta_network_->setEapErp(true, [](const SupplicantStatus &status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
});
}
INSTANTIATE_TEST_CASE_P(
PerInstance, SupplicantStaNetworkHidlTest,