diff options
author | Jimmy Chen <jimmycmchen@google.com> | 2020-03-02 16:19:20 +0800 |
---|---|---|
committer | Jimmy Chen <jimmycmchen@google.com> | 2020-03-03 14:12:10 +0800 |
commit | 54cae11b79229afc47486e4703da13e553d286ce (patch) | |
tree | 1444698916763c141ae7c05db0dbe4c0f94b6b4c | |
parent | 74a1dce5bd400003749ca8bfc7b85cb84f88bc16 (diff) |
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
4 files changed, 37 insertions, 48 deletions
diff --git a/wifi/supplicant/1.3/vts/functional/supplicant_hidl_test_utils_1_3.cpp b/wifi/supplicant/1.3/vts/functional/supplicant_hidl_test_utils_1_3.cpp index 7ea54620da..dbf2b91fe7 100644 --- a/wifi/supplicant/1.3/vts/functional/supplicant_hidl_test_utils_1_3.cpp +++ b/wifi/supplicant/1.3/vts/functional/supplicant_hidl_test_utils_1_3.cpp @@ -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)); +} diff --git a/wifi/supplicant/1.3/vts/functional/supplicant_hidl_test_utils_1_3.h b/wifi/supplicant/1.3/vts/functional/supplicant_hidl_test_utils_1_3.h index f8dca138fd..69fc598593 100644 --- a/wifi/supplicant/1.3/vts/functional/supplicant_hidl_test_utils_1_3.h +++ b/wifi/supplicant/1.3/vts/functional/supplicant_hidl_test_utils_1_3.h @@ -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 */ diff --git a/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp index f7019d27f5..3754520eeb 100644 --- a/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp +++ b/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp @@ -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; - }); - - SupplicantStatusCode expectedStatusCode = - (keyMgmtMask & (ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA256 | - ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA384)) - ? SupplicantStatusCode::SUCCESS - : SupplicantStatusCode::FAILURE_UNKNOWN; + if (!isFilsSupported(sta_iface_)) { + GTEST_SKIP() + << "Skipping test since driver/supplicant doesn't support FILS"; + } - 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, diff --git a/wifi/supplicant/1.3/vts/functional/supplicant_sta_network_hidl_test.cpp b/wifi/supplicant/1.3/vts/functional/supplicant_sta_network_hidl_test.cpp index 6be24bc0cc..9c40de1cb3 100644 --- a/wifi/supplicant/1.3/vts/functional/supplicant_sta_network_hidl_test.cpp +++ b/wifi/supplicant/1.3/vts/functional/supplicant_sta_network_hidl_test.cpp @@ -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; - }); - - SupplicantStatusCode expectedStatusCode = - (keyMgmtMask & (ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA256 | - ISupplicantStaNetwork::KeyMgmtMask::FILS_SHA384)) - ? SupplicantStatusCode::SUCCESS - : SupplicantStatusCode::FAILURE_UNKNOWN; + if (!isFilsSupported(sta_iface_)) { + GTEST_SKIP() + << "Skipping test since driver/supplicant doesn't support FILS"; + } - 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, |