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

Commit 496a29e1 authored by lesl's avatar lesl
Browse files

vts: bypass test for deprecated API addAccessPoint

BUG:123325192

Test: build - make vts
Test: atest VtsHalWifiHostapdV1_0Target
Test: vts-tradefed run commandAndExit vts-hal --skip-all-system-status-check \
      --primary-abi-only --skip-preconditions --module \
      VtsHalWifiHostapdV1_0Target -l INFO

Change-Id: Ia91d650ed8603fc62114eb00cae482de2a5f93fa
parent 3e5e3115
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ cc_library_static {
    static_libs: [
        "VtsHalWifiV1_0TargetTestUtil",
        "android.hardware.wifi.hostapd@1.0",
        "android.hardware.wifi.hostapd@1.1",
        "android.hardware.wifi@1.0",
        "libcrypto",
        "libgmock",
@@ -43,6 +44,7 @@ cc_test {
        "VtsHalWifiV1_0TargetTestUtil",
        "VtsHalWifiHostapdV1_0TargetTestUtil",
        "android.hardware.wifi.hostapd@1.0",
        "android.hardware.wifi.hostapd@1.1",
        "android.hardware.wifi@1.0",
        "libcrypto",
        "libgmock",
+49 −32
Original line number Diff line number Diff line
@@ -138,59 +138,71 @@ TEST(HostapdHidlTestNoFixture, Create) {
 * Access point creation should pass.
 */
TEST_F(HostapdHidlTest, AddPskAccessPointWithAcs) {
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithAcs(),
                              getPskNwParams());
    if (!is_1_1(hostapd_)) {
        auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
                                  getIfaceParamsWithAcs(), getPskNwParams());
        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
    }
}

/**
 * Adds an access point with Open network config & ACS enabled.
 * Access point creation should pass.
 */
TEST_F(HostapdHidlTest, AddOpenAccessPointWithAcs) {
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithAcs(),
                              getOpenNwParams());
    if (!is_1_1(hostapd_)) {
        auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
                                  getIfaceParamsWithAcs(), getOpenNwParams());
        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
    }
}

/**
 * Adds an access point with PSK network config & ACS disabled.
 * Access point creation should pass.
 */
TEST_F(HostapdHidlTest, AddPskAccessPointWithoutAcs) {
    if (!is_1_1(hostapd_)) {
        auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
                                  getIfaceParamsWithoutAcs(), getPskNwParams());
        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
    }
}

/**
 * Adds an access point with Open network config & ACS disabled.
 * Access point creation should pass.
 */
TEST_F(HostapdHidlTest, AddOpenAccessPointWithoutAcs) {
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
                              getIfaceParamsWithoutAcs(), getOpenNwParams());
    if (!is_1_1(hostapd_)) {
        auto status =
            HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithoutAcs(),
                        getOpenNwParams());
        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
    }
}

/**
 * Adds & then removes an access point with PSK network config & ACS enabled.
 * Access point creation & removal should pass.
 */
TEST_F(HostapdHidlTest, RemoveAccessPointWithAcs) {
    auto status = HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithAcs(),
                              getPskNwParams());
    if (!is_1_1(hostapd_)) {
        auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
                                  getIfaceParamsWithAcs(), getPskNwParams());
        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
        status =
            HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
    }
}

/**
 * Adds & then removes an access point with PSK network config & ACS disabled.
 * Access point creation & removal should pass.
 */
TEST_F(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
    if (!is_1_1(hostapd_)) {
        auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
                                  getIfaceParamsWithoutAcs(), getPskNwParams());
        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
@@ -198,28 +210,33 @@ TEST_F(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
            HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
    }
}

/**
 * Adds an access point with invalid channel.
 * Access point creation should fail.
 */
TEST_F(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) {
    if (!is_1_1(hostapd_)) {
        auto status =
            HIDL_INVOKE(hostapd_, addAccessPoint,
                        getIfaceParamsWithInvalidChannel(), getPskNwParams());
        EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
    }
}

/**
 * Adds an access point with invalid PSK network config.
 * Access point creation should fail.
 */
TEST_F(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) {
    if (!is_1_1(hostapd_)) {
        auto status =
            HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithoutAcs(),
                        getInvalidPskNwParams());
        EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
    }
}

/*
 * Terminate
+6 −0
Original line number Diff line number Diff line
@@ -130,6 +130,12 @@ void startHostapdAndWaitForHidlService() {
    ASSERT_TRUE(notification_listener->waitForHidlService(200, service_name));
}

bool is_1_1(const sp<IHostapd>& hostapd) {
    sp<::android::hardware::wifi::hostapd::V1_1::IHostapd> hostapd_1_1 =
        ::android::hardware::wifi::hostapd::V1_1::IHostapd::castFrom(hostapd);
    return hostapd_1_1.get() != nullptr;
}

sp<IHostapd> getHostapd() {
    return ::testing::VtsHalHidlTargetTestBase::getService<IHostapd>(
        gEnv->getServiceName<IHostapd>());
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#define HOSTAPD_HIDL_TEST_UTILS_H

#include <android/hardware/wifi/hostapd/1.0/IHostapd.h>
#include <android/hardware/wifi/hostapd/1.1/IHostapd.h>

#include <VtsHalHidlTargetTestEnvBase.h>

@@ -34,6 +35,8 @@ void startHostapdAndWaitForHidlService();
// These helper functions should be modified to return vectors if we support
// multiple instances.
android::sp<android::hardware::wifi::hostapd::V1_0::IHostapd> getHostapd();
bool is_1_1(const android::sp<android::hardware::wifi::hostapd::V1_0::IHostapd>&
                hostapd);

class WifiHostapdHidlEnvironment
    : public ::testing::VtsHalHidlTargetTestEnvBase {