mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
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 test cases are not changed.
Change-Id: Iaef7e8eefa8fcfde0ff8030cba1f9753a28eac61
Merged-In: Iaae71e0abacd28275d86a19264813ff209ddb79c
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -54,13 +54,13 @@ void RadioHidlTest::notify() {
|
||||
cv.notify_one();
|
||||
}
|
||||
|
||||
std::cv_status RadioHidlTest::wait() {
|
||||
std::cv_status RadioHidlTest::wait(int sec) {
|
||||
std::unique_lock<std::mutex> 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;
|
||||
}
|
||||
|
||||
@@ -456,7 +456,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();
|
||||
@@ -474,4 +474,4 @@ class RadioHidlEnvironment : public ::testing::Environment {
|
||||
public:
|
||||
virtual void SetUp() {}
|
||||
virtual void TearDown() {}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user