Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54cae11b authored by Jimmy Chen's avatar Jimmy Chen
Browse files

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
parent 74a1dce5
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,8 @@
#include "supplicant_hidl_test_utils_1_3.h"
#include "supplicant_hidl_test_utils_1_3.h"


using ::android::sp;
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::ISupplicant;
using ::android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface;
using ::android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface;
using ::android::hardware::wifi::supplicant::V1_3::ISupplicantStaNetwork;
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(
    return ISupplicant::castFrom(
        getSupplicant(supplicant_instance_name, isP2pOn));
        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));
}
+3 −0
Original line number Original line Diff line number Diff line
@@ -31,4 +31,7 @@ createSupplicantStaNetwork_1_3(
        supplicant);
        supplicant);
android::sp<android::hardware::wifi::supplicant::V1_3::ISupplicant>
android::sp<android::hardware::wifi::supplicant::V1_3::ISupplicant>
getSupplicant_1_3(const std::string& supplicant_instance_name, bool isP2pOn);
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 */
#endif /* SUPPLICANT_HIDL_TEST_UTILS_1_3_H */
+13 −32
Original line number Original line Diff line number Diff line
@@ -517,7 +517,10 @@ TEST_P(SupplicantStaIfaceHidlTest, StartDppConfiguratorInitiator) {
 * FilsHlpAddRequest
 * FilsHlpAddRequest
 */
 */
TEST_P(SupplicantStaIfaceHidlTest, 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};
    uint8_t destMacAddr[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55};
    std::vector<uint8_t> pktBuffer = {
    std::vector<uint8_t> pktBuffer = {
        0x08, 0x00, 0x45, 0x10, 0x01, 0x3a, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
        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,
        0x63, 0x70, 0x2d, 0x52, 0x37, 0x0a, 0x01, 0x03, 0x06, 0x0f, 0x1a, 0x1c,
        0x33, 0x3a, 0x3b, 0x2b, 0xff, 0x00};
        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(
    sta_iface_->filsHlpAddRequest(
        destMacAddr, pktBuffer,
        destMacAddr, pktBuffer, [](const SupplicantStatus& status) {
        [expectedStatusCode](const SupplicantStatus& status) {
            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
            EXPECT_EQ(expectedStatusCode, status.code);
        });
        });
}
}


@@ -571,22 +561,13 @@ TEST_P(SupplicantStaIfaceHidlTest, FilsHlpAddRequest) {
 * FilsHlpFlushRequest
 * FilsHlpFlushRequest
 */
 */
TEST_P(SupplicantStaIfaceHidlTest, FilsHlpFlushRequest) {
TEST_P(SupplicantStaIfaceHidlTest, FilsHlpFlushRequest) {
    uint32_t keyMgmtMask = 0;
    if (!isFilsSupported(sta_iface_)) {
    sta_iface_->getKeyMgmtCapabilities_1_3(
        GTEST_SKIP()
        [&](const SupplicantStatus& status, uint32_t keyMgmtMaskInternal) {
            << "Skipping test since driver/supplicant doesn't support FILS";
            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_->filsHlpFlushRequest(
    sta_iface_->filsHlpFlushRequest([](const SupplicantStatus& status) {
        [expectedStatusCode](const SupplicantStatus& status) {
        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
            EXPECT_EQ(expectedStatusCode, status.code);
    });
    });
}
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P(
+7 −16
Original line number Original line Diff line number Diff line
@@ -290,22 +290,13 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetWapiCertSuite) {
 * SetEapErp
 * SetEapErp
 */
 */
TEST_P(SupplicantStaNetworkHidlTest, SetEapErp) {
TEST_P(SupplicantStaNetworkHidlTest, SetEapErp) {
    uint32_t keyMgmtMask = 0;
    if (!isFilsSupported(sta_iface_)) {
    sta_iface_->getKeyMgmtCapabilities_1_3(
        GTEST_SKIP()
        [&](const SupplicantStatus &status, uint32_t keyMgmtMaskInternal) {
            << "Skipping test since driver/supplicant doesn't support FILS";
            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_network_->setEapErp(
    sta_network_->setEapErp(true, [](const SupplicantStatus &status) {
        true, [expectedStatusCode](const SupplicantStatus &status) {
        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
            EXPECT_EQ(expectedStatusCode, status.code);
    });
    });
}
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P(