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

Commit 15bc4492 authored by Gabriel Biren's avatar Gabriel Biren
Browse files

Add VTS tests for Vendor HAL and Hostapd structures

which were extended to include vendor data.

Bug: 322815584
Test: atest VtsHalWifiRttControllerTargetTest \
            VtsHalWifiNanIfaceTargetTest \
            VtsHalHostapdTargetTest
Change-Id: I7be5207aa5f6e49863ba516bed1cbba3fdfaa271
parent 7c52c76c
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <aidl/android/hardware/wifi/BnWifi.h>
#include <aidl/android/hardware/wifi/BnWifiNanIfaceEventCallback.h>
#include <aidl/android/hardware/wifi/NanBandIndex.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_status.h>
#include <binder/IServiceManager.h>
@@ -60,6 +61,10 @@ using aidl::android::hardware::wifi::NanTxType;

#define TIMEOUT_PERIOD 10

namespace {
const auto& kTestVendorDataOptional = generateOuiKeyedDataListOptional(5);
}

class WifiNanIfaceAidlTest : public testing::TestWithParam<std::string> {
  public:
    void SetUp() override {
@@ -72,6 +77,7 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam<std::string> {
        std::shared_ptr<WifiNanIfaceEventCallback> callback =
                ndk::SharedRefBase::make<WifiNanIfaceEventCallback>(*this);
        EXPECT_TRUE(wifi_nan_iface_->registerEventCallback(callback).isOk());
        EXPECT_TRUE(wifi_nan_iface_->getInterfaceVersion(&interface_version_).isOk());
    }

    void TearDown() override { stopWifiService(getInstanceName()); }
@@ -401,6 +407,7 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam<std::string> {

  protected:
    std::shared_ptr<IWifiNanIface> wifi_nan_iface_;
    int interface_version_;
    uint64_t callback_event_bitmap_;
    uint16_t id_;
    uint8_t session_id_;
@@ -640,6 +647,10 @@ TEST_P(WifiNanIfaceAidlTest, StartPublishRequest) {
    nanPublishRequest.autoAcceptDataPathRequests = false;
    nanPublishRequest.publishType = NanPublishType::UNSOLICITED;
    nanPublishRequest.txType = NanTxType::BROADCAST;
    if (interface_version_ >= 2) {
        LOG(INFO) << "Including vendor data in Publish request";
        nanPublishRequest.vendorData = kTestVendorDataOptional;
    }

    status = wifi_nan_iface_->startPublishRequest(inputCmdId + 1, nanPublishRequest);
    if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) {
+11 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <aidl/Vintf.h>
#include <aidl/android/hardware/wifi/BnWifi.h>
#include <aidl/android/hardware/wifi/BnWifiRttControllerEventCallback.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_status.h>
#include <binder/IServiceManager.h>
@@ -42,6 +43,10 @@ using aidl::android::hardware::wifi::WifiChannelInfo;
using aidl::android::hardware::wifi::WifiChannelWidthInMhz;
using aidl::android::hardware::wifi::WifiStatusCode;

namespace {
const auto& kTestVendorDataOptional = generateOuiKeyedDataListOptional(5);
}

class WifiRttControllerAidlTest : public testing::TestWithParam<std::string> {
  public:
    void SetUp() override {
@@ -50,6 +55,7 @@ class WifiRttControllerAidlTest : public testing::TestWithParam<std::string> {
        stopWifiService(getInstanceName());
        wifi_rtt_controller_ = getWifiRttController();
        ASSERT_NE(nullptr, wifi_rtt_controller_.get());
        ASSERT_TRUE(wifi_rtt_controller_->getInterfaceVersion(&interface_version_).isOk());

        // Check RTT support before we run the test.
        RttCapabilities caps = {};
@@ -82,6 +88,7 @@ class WifiRttControllerAidlTest : public testing::TestWithParam<std::string> {
    }

    std::shared_ptr<IWifiRttController> wifi_rtt_controller_;
    int interface_version_;

  private:
    const char* getInstanceName() { return GetParam().c_str(); }
@@ -226,6 +233,10 @@ TEST_P(WifiRttControllerAidlTest, RangeRequest) {
    config.numRetriesPerRttFrame = 3;
    config.numRetriesPerFtmr = 3;
    config.burstDuration = 9;
    if (interface_version_ >= 2) {
        LOG(INFO) << "Including vendor data in Rtt Config";
        config.vendorData = kTestVendorDataOptional;
    }

    int cmdId = 55;
    std::vector<RttConfig> configs = {config};
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ cc_test {
        "libvndksupport",
    ],
    static_libs: [
        "android.hardware.wifi.hostapd-V1-ndk",
        "android.hardware.wifi.hostapd-V2-ndk",
        "VtsHalWifiV1_0TargetTestUtil",
        "VtsHalWifiV1_5TargetTestUtil",
        "VtsHalWifiV1_6TargetTestUtil",
+19 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ const int kIfaceChannel = 6;
const int kIfaceInvalidChannel = 567;
const std::vector<uint8_t> kTestZeroMacAddr(6, 0x0);
const Ieee80211ReasonCode kTestDisconnectReasonCode = Ieee80211ReasonCode::WLAN_REASON_UNSPECIFIED;
const auto& kTestVendorDataOptional = generateOuiKeyedDataListOptional(5);

inline BandMask operator|(BandMask a, BandMask b) {
    return static_cast<BandMask>(static_cast<int32_t>(a) |
@@ -74,6 +75,7 @@ class HostapdAidl : public testing::TestWithParam<std::string> {
        hostapd = getHostapd(GetParam());
        ASSERT_NE(hostapd, nullptr);
        EXPECT_TRUE(hostapd->setDebugParams(DebugLevel::EXCESSIVE).isOk());
        EXPECT_TRUE(hostapd->getInterfaceVersion(&interface_version_).isOk());

        isAcsSupport = testing::checkSubstringInCommandOutput(
            "/system/bin/cmd wifi get-softap-supported-features",
@@ -98,6 +100,7 @@ class HostapdAidl : public testing::TestWithParam<std::string> {
    bool isAcsSupport;
    bool isWpa3SaeSupport;
    bool isBridgedSupport;
    int interface_version_;

    IfaceParams getIfaceParamsWithoutAcs(std::string iface_name) {
        IfaceParams iface_params;
@@ -342,6 +345,22 @@ TEST_P(HostapdAidl, AddOpenAccessPointWithoutAcs) {
    EXPECT_TRUE(status.isOk());
}

/**
 * Adds an access point with Open network config & ACS disabled.
 * IfaceParams will also include vendor data.
 * Access point creation should pass.
 */
TEST_P(HostapdAidl, AddOpenAccessPointWithVendorData) {
    if (interface_version_ < 2) {
        GTEST_SKIP() << "Vendor data is available in IfaceParams as of Hostapd V2";
    }
    std::string ifname = setupApIfaceAndGetName(false);
    IfaceParams params = getIfaceParamsWithoutAcs(ifname);
    params.vendorData = kTestVendorDataOptional;
    auto status = hostapd->addAccessPoint(params, getOpenNwParams());
    EXPECT_TRUE(status.isOk());
}

/**
 * Adds an access point with SAE Transition network config & ACS disabled.
 * Access point creation should pass.