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

Commit c124b39f authored by Les Lee's avatar Les Lee Committed by Android (Google) Code Review
Browse files

Merge "vts: Use shell command to get softap feature"

parents b1674a01 9be5a79a
Loading
Loading
Loading
Loading
+26 −13
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@
 * limitations under the License.
 */

#include <VtsCoreUtil.h>

#include <android-base/logging.h>
#include <cutils/properties.h>

@@ -62,11 +64,19 @@ class HostapdHidlTest
                                          hostapd_instance_name_);
        hostapd_ = IHostapd::getService(hostapd_instance_name_);
        ASSERT_NE(hostapd_.get(), nullptr);
        isAcsSupport_ = testing::checkSubstringInCommandOutput(
            "/system/bin/cmd wifi get-softap-supported-features",
            "wifi_softap_acs_supported");
        isWpa3SaeSupport_ = testing::checkSubstringInCommandOutput(
            "/system/bin/cmd wifi get-softap-supported-features",
            "wifi_softap_wpa3_sae_supported");
    }

    virtual void TearDown() override { stopHostapd(hostapd_instance_name_); }

   protected:
    bool isWpa3SaeSupport_ = false;
    bool isAcsSupport_ = false;
    std::string getPrimaryWlanIfaceName() {
        std::array<char, PROPERTY_VALUE_MAX> buffer;
        auto res = property_get("ro.vendor.wifi.sap.interface", buffer.data(),
@@ -208,10 +218,10 @@ class HostapdHidlTest
 * Access point creation should pass.
 */
TEST_P(HostapdHidlTest, AddPskAccessPointWithAcs) {
    if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                              getIfaceParamsWithAcs(), getPskNwParams());
    // TODO: b/140172237, fix this in R.
    // EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}

/**
@@ -219,11 +229,11 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcs) {
 * Access point creation should pass.
 */
TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndFreqRange) {
    if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
    auto status =
        HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                    getIfaceParamsWithAcsAndFreqRange(), getPskNwParams());
    // TODO: b/140172237, fix this in R
    // EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}

/**
@@ -231,11 +241,11 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndFreqRange) {
 * Access point creation should fail.
 */
TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidFreqRange) {
    if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                              getIfaceParamsWithAcsAndInvalidFreqRange(),
                              getPskNwParams());
    // TODO: b/140172237, fix this in R
    // EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
    EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}

/**
@@ -243,10 +253,10 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidFreqRange) {
 * Access point creation should pass.
 */
TEST_P(HostapdHidlTest, AddOpenAccessPointWithAcs) {
    if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                              getIfaceParamsWithAcs(), getOpenNwParams());
    // TODO: b/140172237, fix this in R
    // EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}

/**
@@ -274,6 +284,7 @@ TEST_P(HostapdHidlTest, AddOpenAccessPointWithoutAcs) {
 * Access point creation should pass.
 */
TEST_P(HostapdHidlTest, AddSaeTransitionAccessPointWithoutAcs) {
    if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
    auto status =
        HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(),
                    getSaeTransitionNwParams());
@@ -285,6 +296,7 @@ TEST_P(HostapdHidlTest, AddSaeTransitionAccessPointWithoutAcs) {
 * Access point creation should pass.
 */
TEST_P(HostapdHidlTest, AddSAEAccessPointWithoutAcs) {
    if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                              getIfaceParamsWithoutAcs(), getSaeNwParams());
    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
@@ -295,16 +307,15 @@ TEST_P(HostapdHidlTest, AddSAEAccessPointWithoutAcs) {
 * Access point creation & removal should pass.
 */
TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) {
    if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
    auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
                                  getIfaceParamsWithAcs(), getPskNwParams());
    // TODO: b/140172237, fix this in R
    /*
    EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code);
    auto status =
        HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
    EXPECT_EQ(android::hardware::wifi::hostapd::V1_0::HostapdStatusCode::SUCCESS,
    EXPECT_EQ(
        android::hardware::wifi::hostapd::V1_0::HostapdStatusCode::SUCCESS,
        status.code);
    */
}

/**
@@ -349,6 +360,7 @@ TEST_P(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) {
 * Access point creation should fail.
 */
TEST_P(HostapdHidlTest, AddInvalidSaeTransitionAccessPointWithoutAcs) {
    if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
    auto status =
        HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(),
                    getInvalidSaeTransitionNwParams());
@@ -360,6 +372,7 @@ TEST_P(HostapdHidlTest, AddInvalidSaeTransitionAccessPointWithoutAcs) {
 * Access point creation should fail.
 */
TEST_P(HostapdHidlTest, AddInvalidSaeAccessPointWithoutAcs) {
    if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
    auto status =
        HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(),
                    getInvalidSaeNwParams());