From 6e58a649e8a9e9e6e919ec4f9600d92464ce4f05 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Fri, 7 Feb 2020 12:01:16 -0800 Subject: [PATCH] wifi: Fix for VtsHalWifiSupplicantV1_0TargetTest failures Since some of the APIs are overridden by an upgraded API in newer HAL, Check the return value of such deprecated APIs and if it's FAILURE_UNKNOWN, don't proceed and consider it as pass. Bug: 147821406 Bug: 146991831 Bug: 149045565 Test: atest VtsHalWifiSupplicantV1_0TargetTest Test: atest VtsHalWifiSupplicantV1_1TargetTest Test: atest VtsHalWifiSupplicantV1_2TargetTest Change-Id: I28c4431bfeaaa7a628be71f41f8299a85fed7eed --- wifi/supplicant/1.0/vts/functional/Android.bp | 2 ++ .../supplicant_sta_network_hidl_test.cpp | 34 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/wifi/supplicant/1.0/vts/functional/Android.bp b/wifi/supplicant/1.0/vts/functional/Android.bp index 332ee4aff3..80139060f1 100644 --- a/wifi/supplicant/1.0/vts/functional/Android.bp +++ b/wifi/supplicant/1.0/vts/functional/Android.bp @@ -46,6 +46,8 @@ cc_test { "VtsHalWifiSupplicantV1_0TargetTestUtil", "android.hardware.wifi.supplicant@1.0", "android.hardware.wifi.supplicant@1.1", + "android.hardware.wifi.supplicant@1.2", + "android.hardware.wifi.supplicant@1.3", "android.hardware.wifi@1.0", "libgmock", "libwifi-system", diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp index 52f77a1002..5467e02799 100644 --- a/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp +++ b/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -93,6 +94,11 @@ class SupplicantStaNetworkHidlTest EXPECT_TRUE(turnOnExcessiveLogging(supplicant_)); sta_network_ = createSupplicantStaNetwork(supplicant_); ASSERT_NE(sta_network_.get(), nullptr); + /* variable used to check if the underlying HAL version is 1.3 or + * higher. This is to skip tests which are using deprecated methods. + */ + v1_3 = ::android::hardware::wifi::supplicant::V1_3:: + ISupplicantStaNetwork::castFrom(sta_network_); ssid_.assign(kTestSsidStr, kTestSsidStr + strlen(kTestSsidStr)); } @@ -114,6 +120,8 @@ class SupplicantStaNetworkHidlTest }); } + sp<::android::hardware::wifi::supplicant::V1_3::ISupplicantStaNetwork> + v1_3 = nullptr; bool isP2pOn_ = false; sp supplicant_; // ISupplicantStaNetwork object used for all tests in this fixture. @@ -221,6 +229,9 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetBssid) { * SetGetKeyMgmt */ TEST_P(SupplicantStaNetworkHidlTest, SetGetKeyMgmt) { + if (v1_3 != nullptr) { + GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher"; + } sta_network_->setKeyMgmt(kTestKeyMgmt, [](const SupplicantStatus& status) { EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); }); @@ -235,6 +246,9 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetKeyMgmt) { * SetGetProto */ TEST_P(SupplicantStaNetworkHidlTest, SetGetProto) { + if (v1_3 != nullptr) { + GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher"; + } sta_network_->setProto(kTestProto, [](const SupplicantStatus& status) { EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); }); @@ -262,6 +276,9 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetAuthAlg) { * SetGetGroupCipher */ TEST_P(SupplicantStaNetworkHidlTest, SetGetGroupCipher) { + if (v1_3 != nullptr) { + GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher"; + } sta_network_->setGroupCipher( kTestGroupCipher, [](const SupplicantStatus& status) { EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); @@ -277,6 +294,9 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetGroupCipher) { * SetGetPairwiseCipher */ TEST_P(SupplicantStaNetworkHidlTest, SetGetPairwiseCipher) { + if (v1_3 != nullptr) { + GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher"; + } sta_network_->setPairwiseCipher( kTestPairwiseCipher, [](const SupplicantStatus& status) { EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); @@ -627,6 +647,9 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetEapEngineID) { * Enable */ TEST_P(SupplicantStaNetworkHidlTest, Enable) { + if (v1_3 != nullptr) { + GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher"; + } // wpa_supplicant doesn't perform any connection initiation // unless atleast the Ssid and Ket mgmt params are set. sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) { @@ -654,6 +677,9 @@ TEST_P(SupplicantStaNetworkHidlTest, Enable) { * Disable */ TEST_P(SupplicantStaNetworkHidlTest, Disable) { + if (v1_3 != nullptr) { + GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher"; + } // wpa_supplicant doesn't perform any connection initiation // unless atleast the Ssid and Ket mgmt params are set. sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) { @@ -677,6 +703,9 @@ TEST_P(SupplicantStaNetworkHidlTest, Disable) { * Select. */ TEST_P(SupplicantStaNetworkHidlTest, Select) { + if (v1_3 != nullptr) { + GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher"; + } // wpa_supplicant doesn't perform any connection initiation // unless atleast the Ssid and Ket mgmt params are set. sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) { @@ -788,6 +817,9 @@ TEST_P(SupplicantStaNetworkHidlTest, SetProactiveKeyCaching) { * GetWpsNfcConfigurationToken */ TEST_P(SupplicantStaNetworkHidlTest, GetWpsNfcConfigurationToken) { + if (v1_3 != nullptr) { + GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher"; + } ASSERT_EQ(SupplicantStatusCode::SUCCESS, HIDL_INVOKE(sta_network_, setSsid, ssid_).code); ASSERT_EQ(SupplicantStatusCode::SUCCESS, @@ -808,4 +840,4 @@ INSTANTIATE_TEST_CASE_P( android::hardware::getAllHalInstanceNames(IWifi::descriptor)), testing::ValuesIn(android::hardware::getAllHalInstanceNames( ISupplicant::descriptor))), - android::hardware::PrintInstanceTupleNameToString<>); \ No newline at end of file + android::hardware::PrintInstanceTupleNameToString<>);