Wifi: omit FILS related vts tests if not supported

Supplicant FILS operation is independent from driver key management
driver support, i.e. even FILS is not supported in driver,
these APIs still could be used. These APIs are controlled by supplicant
CONFIG_FILS directly. To avoid inconsistent capability check, omit FILS
vts tests if any of driver and supplicant does not support it.

Bug: 149042449
Test: atest VtsHalWifiSupplicantV1_3TargetTest
Change-Id: Ia0cdaac282f9ec6e9450d72795ed6461433bdf3b
This commit is contained in:
Jimmy Chen
2020-03-02 16:19:20 +08:00
parent 74a1dce5bd
commit 54cae11b79
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,