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
diff --git a/wifi/supplicant/1.0/vts/functional/Android.bp b/wifi/supplicant/1.0/vts/functional/Android.bp
index 332ee4a..8013906 100644
--- a/wifi/supplicant/1.0/vts/functional/Android.bp
+++ b/wifi/supplicant/1.0/vts/functional/Android.bp
@@ -46,6 +46,8 @@
"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 52f77a1..5467e02 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 <VtsCoreUtil.h>
#include <android/hardware/wifi/1.0/IWifi.h>
#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
+#include <android/hardware/wifi/supplicant/1.3/ISupplicantStaNetwork.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
@@ -93,6 +94,11 @@
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 @@
});
}
+ sp<::android::hardware::wifi::supplicant::V1_3::ISupplicantStaNetwork>
+ v1_3 = nullptr;
bool isP2pOn_ = false;
sp<ISupplicant> supplicant_;
// ISupplicantStaNetwork object used for all tests in this fixture.
@@ -221,6 +229,9 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
ISupplicant::descriptor))),
- android::hardware::PrintInstanceTupleNameToString<>);
\ No newline at end of file
+ android::hardware::PrintInstanceTupleNameToString<>);