From 6429f0677f87c5657802d26345dc3334ab26e33a Mon Sep 17 00:00:00 2001 From: Iris Chang Date: Mon, 6 Nov 2017 10:40:22 +0800 Subject: [PATCH] VTS: fix RadioHidlTest.getAvailableNetworks issue Analysis: VtsHalRadioV1_0Target's timeout is too short for getAvailableNetworks, because this request duration depends on NW environment or frequency. Suggested solution: Add a timeout parameter to wait() and default timeout value is 5 minutes in order to avoid timeout fail due to NW environment. Bug: 68834032 Test: getAvailableNetworks can be passed after we apply this patch and test result for all other telephony 1.0 and 1.1 test cases are not changed. Change-Id: Iaae71e0abacd28275d86a19264813ff209ddb79c --- radio/1.0/vts/functional/radio_hidl_hal_misc.cpp | 2 +- radio/1.0/vts/functional/radio_hidl_hal_test.cpp | 4 ++-- radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h | 4 ++-- radio/1.1/vts/functional/radio_hidl_hal_test.cpp | 4 ++-- radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp index 0507cc98f5..4f729f1611 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp @@ -142,7 +142,7 @@ TEST_F(RadioHidlTest, getAvailableNetworks) { int serial = GetRandomSerialNumber(); radio->getAvailableNetworks(serial); - EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(std::cv_status::no_timeout, wait(300)); EXPECT_EQ(serial, radioRsp->rspInfo.serial); ASSERT_TRUE(radioRsp->rspInfo.type == RadioResponseType::SOLICITED || radioRsp->rspInfo.type == RadioResponseType::SOLICITED_ACK_EXP); diff --git a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp index ed2c6bb6ab..b5f036ea67 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp @@ -51,13 +51,13 @@ void RadioHidlTest::notify() { cv.notify_one(); } -std::cv_status RadioHidlTest::wait() { +std::cv_status RadioHidlTest::wait(int sec) { std::unique_lock lock(mtx); std::cv_status status = std::cv_status::no_timeout; auto now = std::chrono::system_clock::now(); while (count == 0) { - status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD)); + status = cv.wait_until(lock, now + std::chrono::seconds(sec)); if (status == std::cv_status::timeout) { return status; } diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h index b60887c74b..2a7487fc61 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h +++ b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h @@ -527,7 +527,7 @@ class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase { void notify(); /* Test code calls this function to wait for response */ - std::cv_status wait(); + std::cv_status wait(int sec = TIMEOUT_PERIOD); /* Used for checking General Errors */ bool CheckGeneralError(); @@ -538,4 +538,4 @@ class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase { sp radio; sp radioRsp; sp radioInd; -}; \ No newline at end of file +}; diff --git a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp index e0b1ad4bc9..f03db20182 100644 --- a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp @@ -52,13 +52,13 @@ void RadioHidlTest_v1_1::notify() { cv.notify_one(); } -std::cv_status RadioHidlTest_v1_1::wait() { +std::cv_status RadioHidlTest_v1_1::wait(int sec) { std::unique_lock lock(mtx); std::cv_status status = std::cv_status::no_timeout; auto now = std::chrono::system_clock::now(); while (count == 0) { - status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD)); + status = cv.wait_until(lock, now + std::chrono::seconds(sec)); if (status == std::cv_status::timeout) { return status; } diff --git a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h index 3e31459169..523b9babe5 100644 --- a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h +++ b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h @@ -550,7 +550,7 @@ class RadioHidlTest_v1_1 : public ::testing::VtsHalHidlTargetTestBase { void notify(); /* Test code calls this function to wait for response */ - std::cv_status wait(); + std::cv_status wait(int sec = TIMEOUT_PERIOD); /* Used for checking General Errors */ bool CheckGeneralError(); @@ -561,4 +561,4 @@ class RadioHidlTest_v1_1 : public ::testing::VtsHalHidlTargetTestBase { sp<::android::hardware::radio::V1_1::IRadio> radio_v1_1; sp radioRsp_v1_1; sp radioInd_v1_1; -}; \ No newline at end of file +};