From 521e69e069a5c6dd1e73c2eecfe4602131ad268b Mon Sep 17 00:00:00 2001 From: Hassen KETATNI Date: Fri, 2 Apr 2021 11:52:11 +0100 Subject: [PATCH] Fix SetCountryCode test when US is not supported SupplicantStaIfaceHidlTest.SetCountryCode(default,default)_32bit fails when US countrycode is not supported on the device. The test will read the value of "ro.boot.wificountrycode" and set it to the countrycode. When the property is not defined on the device, US will be set by default. Bug: SupplicantStaIfaceHidlTest.SetCountryCode(default,default)_32bit fails Bug id https://issuetracker.google.com/182296217 Test: Module VtsHalWifiSupplicantV1_0Host passes successfully Change-Id: Iec2991223c6857d65b2ecc4337e920d5b823dd3d Signed-off-by: Hassen KETATNI --- .../1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp index e4fe52ca7e..bdca32c515 100644 --- a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp +++ b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp @@ -25,6 +25,7 @@ #include "supplicant_hidl_call_util.h" #include "supplicant_hidl_test_utils.h" +#include using ::android::sp; using ::android::hardware::hidl_array; @@ -61,7 +62,7 @@ constexpr char kTestRadioWorkName[] = "TestRadioWork"; constexpr uint32_t kTestRadioWorkFrequency = 2412; constexpr uint32_t kTestRadioWorkTimeout = 8; constexpr uint32_t kTestRadioWorkId = 16; -constexpr int8_t kTestCountryCode[] = {'U', 'S'}; +int8_t kTestCountryCode[] = {'U', 'S'}; constexpr uint8_t kTestWpsDeviceType[] = {[0 ... 7] = 0x01}; constexpr uint16_t kTestWpsConfigMethods = 0xffff; } // namespace @@ -454,6 +455,10 @@ TEST_P(SupplicantStaIfaceHidlTest, SetSuspendModeEnabled) { * SetCountryCode. */ TEST_P(SupplicantStaIfaceHidlTest, SetCountryCode) { + std::array buffer; + property_get("ro.boot.wificountrycode", buffer.data(), "US"); + kTestCountryCode[0] = buffer.data()[0]; + kTestCountryCode[1] = buffer.data()[1]; sta_iface_->setCountryCode( kTestCountryCode, [](const SupplicantStatus& status) { EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);