From bd5a47d5ddb8229c77860331dd1b4d02cf1d3fa3 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Sun, 16 Aug 2020 11:56:42 -0700 Subject: [PATCH] wifi: Added capability check in RTT tests Added test for 2 sided RTT. Added RTT measurement type capability check in range request tests. Bug: 163327074 Test: vts test - VtsHalWifiRttV1_4TargetTest Change-Id: I546806605b6b3ecd124068fc81b9fb275b745f45 (cherry picked from commit d85edb7f66f542558583cd4893ee96a9d13ee913) --- .../wifi_rtt_controller_hidl_test.cpp | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/wifi/1.4/vts/functional/wifi_rtt_controller_hidl_test.cpp b/wifi/1.4/vts/functional/wifi_rtt_controller_hidl_test.cpp index a099c8afd5..3efb8f4c66 100644 --- a/wifi/1.4/vts/functional/wifi_rtt_controller_hidl_test.cpp +++ b/wifi/1.4/vts/functional/wifi_rtt_controller_hidl_test.cpp @@ -147,6 +147,51 @@ TEST_P(WifiRttControllerHidlTest, RegisterEventCallback_1_4) { EXPECT_EQ(WifiStatusCode::SUCCESS, status.code); } +/* + * Request2SidedRangeMeasurement + * This test case tests the two sided ranging - 802.11mc FTM protocol. + */ +TEST_P(WifiRttControllerHidlTest, Request2SidedRangeMeasurement) { + std::pair status_and_caps; + + // Get the Capabilities + status_and_caps = HIDL_INVOKE(wifi_rtt_controller_, getCapabilities_1_4); + EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code); + if (!status_and_caps.second.rttFtmSupported) { + GTEST_SKIP() + << "Skipping two sided RTT since driver/fw doesn't support"; + } + std::vector configs; + RttConfig config; + int cmdId = 55; + // Set the config with test data + for (int i = 0; i < 6; i++) { + config.addr[i] = i; + } + config.type = RttType::TWO_SIDED; + config.peer = RttPeerType::AP; + config.channel.width = WifiChannelWidthInMhz::WIDTH_80; + config.channel.centerFreq = 5180; + config.channel.centerFreq0 = 5210; + config.channel.centerFreq1 = 0; + config.bw = RttBw::BW_20MHZ; + config.preamble = RttPreamble::HT; + config.mustRequestLci = false; + config.mustRequestLcr = false; + config.burstPeriod = 0; + config.numBurst = 0; + config.numFramesPerBurst = 8; + config.numRetriesPerRttFrame = 0; + config.numRetriesPerFtmr = 0; + config.burstDuration = 9; + // Insert config in the vector + configs.push_back(config); + + // Invoke the call + const auto& status = + HIDL_INVOKE(wifi_rtt_controller_, rangeRequest_1_4, cmdId, configs); + EXPECT_EQ(WifiStatusCode::SUCCESS, status.code); +} /* * rangeRequest_1_4 */ @@ -156,6 +201,10 @@ TEST_P(WifiRttControllerHidlTest, RangeRequest_1_4) { // Get the Capabilities status_and_caps = HIDL_INVOKE(wifi_rtt_controller_, getCapabilities_1_4); EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code); + if (!status_and_caps.second.rttOneSidedSupported) { + GTEST_SKIP() + << "Skipping one sided RTT since driver/fw doesn't support"; + } // Get the highest support preamble int preamble = 1; status_and_caps.second.preambleSupport >>= 1;