wifi: Support use "non-primy interface when testing hostapd Hal
In current android design, the general use case is the interface is
removed after terminate() call.
But the VTS kill the hostapd immediately it causes terminate doesn't
work normally.
Add sleep 3 seconds to allow terminate processing.
Another test case is considered to check hostapd died because any reason.
(for instance: NPE crash)
But the interface handling in android design is control in framework and WiFiHal.
Case 1. Native crash will be handled in framework and clean the interface for
the recovery.
Case 2. VTS use "stopHAL" to clean "primy interface".
It will cause clean up fail if OEM use "non-primy interface" for the SoftAp.
But it is not requirement in hostapd HAL. Verify terminate is good in
VtsHalWifiHostapd.
Bug: 177483254
Bug: 177389456
Test: atest -c VtsHalWifiHostapdV1_3TargetTest
Change-Id: I39f6ee92b1354ab2cebbe2fe6e9873e62d850c42
diff --git a/wifi/hostapd/1.3/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.3/vts/functional/hostapd_hidl_test.cpp
index 4e63c56..fe9a183 100644
--- a/wifi/hostapd/1.3/vts/functional/hostapd_hidl_test.cpp
+++ b/wifi/hostapd/1.3/vts/functional/hostapd_hidl_test.cpp
@@ -81,10 +81,9 @@
virtual void TearDown() override {
HIDL_INVOKE_VOID_WITHOUT_ARGUMENTS(hostapd_, terminate);
- stopHostapd(wifi_instance_name_);
- // Wait 3 seconds to allow driver processing load/unload between two
- // test cases.
+ // Wait 3 seconds to allow terminate processing before kill hostapd.
sleep(3);
+ stopHostapd(wifi_instance_name_);
}
protected:
@@ -106,16 +105,6 @@
return status_and_name.second;
}
- // TODO: b/177483254, remove it after fix wlan1 failure case.
- std::string getPrimaryWlanIfaceName() {
- std::array<char, PROPERTY_VALUE_MAX> buffer;
- auto res = property_get("ro.vendor.wifi.sap.interface", buffer.data(),
- nullptr);
- if (res > 0) return buffer.data();
- property_get("wifi.interface", buffer.data(), "wlan0");
- return buffer.data();
- }
-
IHostapd::IfaceParams getIfaceParamsWithoutAcs(std::string iface_name) {
::android::hardware::wifi::hostapd::V1_0::IHostapd::IfaceParams
iface_params;
@@ -334,9 +323,7 @@
*/
TEST_P(HostapdHidlTest, AddPskAccessPointWithAcs) {
if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithAcs(ifname), getPskNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
@@ -348,9 +335,7 @@
*/
TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndFreqRange) {
if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithAcsAndFreqRange(ifname),
getPskNwParams());
@@ -363,9 +348,7 @@
*/
TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidFreqRange) {
if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithAcsAndInvalidFreqRange(ifname),
getPskNwParams());
@@ -378,9 +361,7 @@
*/
TEST_P(HostapdHidlTest, AddOpenAccessPointWithAcs) {
if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithAcs(ifname), getOpenNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
@@ -391,9 +372,7 @@
* Access point creation should pass.
*/
TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcs) {
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithoutAcs(ifname), getPskNwParams());
@@ -405,9 +384,7 @@
* Access point creation should pass.
*/
TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcsAndNonMetered) {
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithoutAcs(ifname),
getPskNwParamsWithNonMetered());
@@ -419,9 +396,7 @@
* Access point creation should pass.
*/
TEST_P(HostapdHidlTest, AddOpenAccessPointWithoutAcs) {
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithoutAcs(ifname), getOpenNwParams());
@@ -434,9 +409,7 @@
*/
TEST_P(HostapdHidlTest, AddSaeTransitionAccessPointWithoutAcs) {
if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithoutAcs(ifname),
getSaeTransitionNwParams());
@@ -449,9 +422,7 @@
*/
TEST_P(HostapdHidlTest, AddSAEAccessPointWithoutAcs) {
if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithoutAcs(ifname), getSaeNwParams());
@@ -464,9 +435,7 @@
*/
TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) {
if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support";
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status_1_2 =
HIDL_INVOKE(hostapd_, addAccessPoint_1_3, getIfaceParamsWithAcs(ifname),
getPskNwParams());
@@ -482,9 +451,7 @@
* Access point creation & removal should pass.
*/
TEST_P(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status_1_2 =
HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithoutAcs(ifname), getPskNwParams());
@@ -500,9 +467,7 @@
* Access point creation should fail.
*/
TEST_P(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) {
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithInvalidChannel(ifname), getPskNwParams());
@@ -514,9 +479,7 @@
* Access point creation should fail.
*/
TEST_P(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) {
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithoutAcs(ifname), getInvalidPskNwParams());
@@ -529,9 +492,7 @@
*/
TEST_P(HostapdHidlTest, AddInvalidSaeTransitionAccessPointWithoutAcs) {
if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithoutAcs(ifname),
getInvalidSaeTransitionNwParams());
@@ -544,9 +505,7 @@
*/
TEST_P(HostapdHidlTest, AddInvalidSaeAccessPointWithoutAcs) {
if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support";
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithoutAcs(ifname), getInvalidSaeNwParams());
@@ -558,9 +517,7 @@
* when hotspot interface available.
*/
TEST_P(HostapdHidlTest, DisconnectClientWhenIfacAvailable) {
- // TODO: Use setupApIfaceAndGetName after fixing b/177483254
- // std::string ifname = setupApIfaceAndGetName(false);
- std::string ifname = getPrimaryWlanIfaceName();
+ std::string ifname = setupApIfaceAndGetName(false);
auto status_1_2 =
HIDL_INVOKE(hostapd_, addAccessPoint_1_3,
getIfaceParamsWithoutAcs(ifname), getOpenNwParams());