Clean up VtsHalRadioTargetTest
Refactor class design so RadioServiceTest extends TestWithParam and
each individual radio service test extends RadioServiceTest.
Move setup and teardown logic common to all classes to RadioServiceTest.
Add logs to print when each test starts/finishes to help debug issues.
Remove unused imports and fix some typos.
Change unique_lock to lock_guard in notify to prevent MTE errors.
Test: atest VtsHalRadioTargetTest on fullmte build
Bug: 263940636
Change-Id: I2f6844f07d4518c00d47f98e5e15bea0a809fa84
diff --git a/radio/aidl/vts/radio_modem_test.cpp b/radio/aidl/vts/radio_modem_test.cpp
index 67747a8..c48a461 100644
--- a/radio/aidl/vts/radio_modem_test.cpp
+++ b/radio/aidl/vts/radio_modem_test.cpp
@@ -15,7 +15,6 @@
*/
#include <aidl/android/hardware/radio/config/IRadioConfig.h>
-#include <android-base/logging.h>
#include <android/binder_manager.h>
#include "radio_modem_utils.h"
@@ -23,6 +22,7 @@
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
void RadioModemTest::SetUp() {
+ RadioServiceTest::SetUp();
std::string serviceName = GetParam();
if (!isServiceValidForDeviceConfiguration(serviceName)) {
@@ -37,8 +37,6 @@
radioRsp_modem = ndk::SharedRefBase::make<RadioModemResponse>(*this);
ASSERT_NE(nullptr, radioRsp_modem.get());
- count_ = 0;
-
radioInd_modem = ndk::SharedRefBase::make<RadioModemIndication>(*this);
ASSERT_NE(nullptr, radioInd_modem.get());
@@ -154,7 +152,6 @@
* Test IRadioModem.getBasebandVersion() for the response returned.
*/
TEST_P(RadioModemTest, getBasebandVersion) {
- LOG(DEBUG) << "getBasebandVersion";
serial = GetRandomSerialNumber();
radio_modem->getBasebandVersion(serial);
@@ -165,14 +162,12 @@
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
}
- LOG(DEBUG) << "getBasebandVersion finished";
}
/*
* Test IRadioModem.getDeviceIdentity() for the response returned.
*/
TEST_P(RadioModemTest, getDeviceIdentity) {
- LOG(DEBUG) << "getDeviceIdentity";
serial = GetRandomSerialNumber();
radio_modem->getDeviceIdentity(serial);
@@ -184,7 +179,6 @@
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
{RadioError::NONE, RadioError::EMPTY_RECORD}));
}
- LOG(DEBUG) << "getDeviceIdentity finished";
}
/*
@@ -198,7 +192,6 @@
ALOGI("Skipped the test since getImei is not supported on version < 2");
GTEST_SKIP();
}
- LOG(DEBUG) << "getImei";
serial = GetRandomSerialNumber();
radio_modem->getImei(serial);
@@ -210,14 +203,12 @@
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
{RadioError::NONE, RadioError::EMPTY_RECORD}));
}
- LOG(DEBUG) << "getImei finished";
}
/*
* Test IRadioModem.nvReadItem() for the response returned.
*/
TEST_P(RadioModemTest, nvReadItem) {
- LOG(DEBUG) << "nvReadItem";
serial = GetRandomSerialNumber();
radio_modem->nvReadItem(serial, NvItem::LTE_BAND_ENABLE_25);
@@ -229,14 +220,12 @@
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
CHECK_GENERAL_ERROR));
}
- LOG(DEBUG) << "nvReadItem finished";
}
/*
* Test IRadioModem.nvWriteItem() for the response returned.
*/
TEST_P(RadioModemTest, nvWriteItem) {
- LOG(DEBUG) << "nvWriteItem";
serial = GetRandomSerialNumber();
NvWriteItem item;
memset(&item, 0, sizeof(item));
@@ -251,14 +240,12 @@
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
CHECK_GENERAL_ERROR));
}
- LOG(DEBUG) << "nvWriteItem finished";
}
/*
* Test IRadioModem.nvWriteCdmaPrl() for the response returned.
*/
TEST_P(RadioModemTest, nvWriteCdmaPrl) {
- LOG(DEBUG) << "nvWriteCdmaPrl";
serial = GetRandomSerialNumber();
std::vector<uint8_t> prl = {1, 2, 3, 4, 5};
@@ -271,14 +258,12 @@
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
CHECK_GENERAL_ERROR));
}
- LOG(DEBUG) << "nvWriteCdmaPrl finished";
}
/*
* Test IRadioModem.nvResetConfig() for the response returned.
*/
TEST_P(RadioModemTest, nvResetConfig) {
- LOG(DEBUG) << "nvResetConfig";
serial = GetRandomSerialNumber();
radio_modem->nvResetConfig(serial, ResetNvType::FACTORY_RESET);
@@ -292,14 +277,12 @@
}
// wait until modem reset finishes
sleep(10);
- LOG(DEBUG) << "nvResetConfig finished";
}
/*
* Test IRadioModem.getHardwareConfig() for the response returned.
*/
TEST_P(RadioModemTest, getHardwareConfig) {
- LOG(DEBUG) << "getHardwareConfig";
serial = GetRandomSerialNumber();
radio_modem->getHardwareConfig(serial);
@@ -311,7 +294,6 @@
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE},
CHECK_GENERAL_ERROR));
}
- LOG(DEBUG) << "getHardwareConfig finished";
}
/*
@@ -337,7 +319,6 @@
* Test IRadioModem.getRadioCapability() for the response returned.
*/
TEST_P(RadioModemTest, getRadioCapability) {
- LOG(DEBUG) << "getRadioCapability";
serial = GetRandomSerialNumber();
radio_modem->getRadioCapability(serial);
@@ -348,14 +329,12 @@
if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error);
}
- LOG(DEBUG) << "getRadioCapability finished";
}
/*
* Test IRadioModem.setRadioCapability() for the response returned.
*/
TEST_P(RadioModemTest, setRadioCapability) {
- LOG(DEBUG) << "setRadioCapability";
serial = GetRandomSerialNumber();
RadioCapability rc;
memset(&rc, 0, sizeof(rc));
@@ -371,14 +350,12 @@
{RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE},
CHECK_GENERAL_ERROR));
}
- LOG(DEBUG) << "setRadioCapability finished";
}
/*
* Test IRadioModem.getModemActivityInfo() for the response returned.
*/
TEST_P(RadioModemTest, getModemActivityInfo) {
- LOG(DEBUG) << "getModemActivityInfo";
serial = GetRandomSerialNumber();
radio_modem->getModemActivityInfo(serial);
@@ -390,14 +367,12 @@
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}
- LOG(DEBUG) << "getModemActivityInfo finished";
}
/*
* Test IRadioModem.sendDeviceState() for the response returned.
*/
TEST_P(RadioModemTest, sendDeviceState) {
- LOG(DEBUG) << "sendDeviceState";
serial = GetRandomSerialNumber();
radio_modem->sendDeviceState(serial, DeviceStateType::POWER_SAVE_MODE, true);
@@ -411,5 +386,4 @@
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}
- LOG(DEBUG) << "sendDeviceState finished";
}