mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Merge "[vts-core] add VtsHalRadioConfigV1_*TargetTest to vts-core"
This commit is contained in:
@@ -29,5 +29,5 @@ cc_test {
|
||||
"android.hardware.radio.config@1.1",
|
||||
],
|
||||
header_libs: ["radio.util.header@1.0"],
|
||||
test_suites: ["general-tests"],
|
||||
test_suites: ["general-tests", "vts-core"],
|
||||
}
|
||||
|
||||
@@ -16,11 +16,7 @@
|
||||
|
||||
#include <radio_config_hidl_hal_utils.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::AddGlobalTestEnvironment(RadioConfigHidlEnvironment::Instance());
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
RadioConfigHidlEnvironment::Instance()->init(&argc, argv);
|
||||
int status = RUN_ALL_TESTS();
|
||||
LOG(INFO) << "Test result = " << status;
|
||||
return status;
|
||||
}
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, RadioConfigHidlTest,
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(IRadioConfig::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
* Test IRadioConfig.getModemsConfig()
|
||||
*/
|
||||
TEST_F(RadioConfigHidlTest, getModemsConfig) {
|
||||
TEST_P(RadioConfigHidlTest, getModemsConfig) {
|
||||
serial = GetRandomSerialNumber();
|
||||
Return<void> res = radioConfig->getModemsConfig(serial);
|
||||
ASSERT_OK(res);
|
||||
@@ -37,7 +37,7 @@ TEST_F(RadioConfigHidlTest, getModemsConfig) {
|
||||
/*
|
||||
* Test IRadioConfig.setModemsConfig()
|
||||
*/
|
||||
TEST_F(RadioConfigHidlTest, setModemsConfig_invalidArgument) {
|
||||
TEST_P(RadioConfigHidlTest, setModemsConfig_invalidArgument) {
|
||||
serial = GetRandomSerialNumber();
|
||||
ModemsConfig* mConfig = new ModemsConfig();
|
||||
Return<void> res = radioConfig->setModemsConfig(serial, *mConfig);
|
||||
@@ -55,7 +55,7 @@ TEST_F(RadioConfigHidlTest, setModemsConfig_invalidArgument) {
|
||||
/*
|
||||
* Test IRadioConfig.setModemsConfig()
|
||||
*/
|
||||
TEST_F(RadioConfigHidlTest, setModemsConfig_goodRequest) {
|
||||
TEST_P(RadioConfigHidlTest, setModemsConfig_goodRequest) {
|
||||
serial = GetRandomSerialNumber();
|
||||
ModemsConfig* mConfig = new ModemsConfig();
|
||||
mConfig->numOfLiveModems = 1;
|
||||
@@ -73,7 +73,7 @@ TEST_F(RadioConfigHidlTest, setModemsConfig_goodRequest) {
|
||||
/*
|
||||
* Test IRadioConfig.getPhoneCapability()
|
||||
*/
|
||||
TEST_F(RadioConfigHidlTest, getPhoneCapability) {
|
||||
TEST_P(RadioConfigHidlTest, getPhoneCapability) {
|
||||
serial = GetRandomSerialNumber();
|
||||
Return<void> res = radioConfig->getPhoneCapability(serial);
|
||||
ASSERT_OK(res);
|
||||
@@ -99,7 +99,7 @@ TEST_F(RadioConfigHidlTest, getPhoneCapability) {
|
||||
/*
|
||||
* Test IRadioConfig.getPhoneCapability()
|
||||
*/
|
||||
TEST_F(RadioConfigHidlTest, setPreferredDataModem) {
|
||||
TEST_P(RadioConfigHidlTest, setPreferredDataModem) {
|
||||
serial = GetRandomSerialNumber();
|
||||
Return<void> res = radioConfig->getPhoneCapability(serial);
|
||||
ASSERT_OK(res);
|
||||
@@ -141,7 +141,7 @@ TEST_F(RadioConfigHidlTest, setPreferredDataModem) {
|
||||
/*
|
||||
* Test IRadioConfig.getPhoneCapability()
|
||||
*/
|
||||
TEST_F(RadioConfigHidlTest, setPreferredDataModem_invalidArgument) {
|
||||
TEST_P(RadioConfigHidlTest, setPreferredDataModem_invalidArgument) {
|
||||
serial = GetRandomSerialNumber();
|
||||
uint8_t modemId = -1;
|
||||
Return<void> res = radioConfig->setPreferredDataModem(serial, modemId);
|
||||
|
||||
@@ -17,14 +17,10 @@
|
||||
#include <radio_config_hidl_hal_utils.h>
|
||||
|
||||
void RadioConfigHidlTest::SetUp() {
|
||||
radioConfig = ::testing::VtsHalHidlTargetTestBase::getService<IRadioConfig>(
|
||||
RadioConfigHidlEnvironment::Instance()->getServiceName<IRadioConfig>(
|
||||
hidl_string(RADIO_SERVICE_NAME)));
|
||||
radioConfig = IRadioConfig::getService(GetParam());
|
||||
if (radioConfig == NULL) {
|
||||
sleep(60);
|
||||
radioConfig = ::testing::VtsHalHidlTargetTestBase::getService<IRadioConfig>(
|
||||
RadioConfigHidlEnvironment::Instance()->getServiceName<IRadioConfig>(
|
||||
hidl_string(RADIO_SERVICE_NAME)));
|
||||
radioConfig = IRadioConfig::getService(GetParam());
|
||||
}
|
||||
ASSERT_NE(nullptr, radioConfig.get());
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <VtsHalHidlTargetTestEnvBase.h>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
@@ -25,6 +23,9 @@
|
||||
#include <android/hardware/radio/config/1.1/IRadioConfig.h>
|
||||
#include <android/hardware/radio/config/1.1/IRadioConfigResponse.h>
|
||||
#include <android/hardware/radio/config/1.1/types.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "vts_test_util.h"
|
||||
|
||||
@@ -73,22 +74,8 @@ class RadioConfigResponse : public IRadioConfigResponse {
|
||||
Return<void> setModemsConfigResponse(const RadioResponseInfo& info);
|
||||
};
|
||||
|
||||
// Test environment for Radio HIDL HAL.
|
||||
class RadioConfigHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
|
||||
public:
|
||||
// get the test environment singleton
|
||||
static RadioConfigHidlEnvironment* Instance() {
|
||||
static RadioConfigHidlEnvironment* instance = new RadioConfigHidlEnvironment;
|
||||
return instance;
|
||||
}
|
||||
virtual void registerTestServices() override { registerTestService<IRadioConfig>(); }
|
||||
|
||||
private:
|
||||
RadioConfigHidlEnvironment() {}
|
||||
};
|
||||
|
||||
// The main test class for Radio config HIDL.
|
||||
class RadioConfigHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class RadioConfigHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
protected:
|
||||
std::mutex mtx_;
|
||||
std::condition_variable cv_;
|
||||
|
||||
@@ -31,5 +31,5 @@ cc_test {
|
||||
"android.hardware.radio.config@1.2",
|
||||
],
|
||||
header_libs: ["radio.util.header@1.0"],
|
||||
test_suites: ["general-tests"],
|
||||
test_suites: ["general-tests", "vts-core"],
|
||||
}
|
||||
|
||||
@@ -16,11 +16,7 @@
|
||||
|
||||
#include <radio_config_hidl_hal_utils.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::AddGlobalTestEnvironment(RadioConfigHidlEnvironment::Instance());
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
RadioConfigHidlEnvironment::Instance()->init(&argc, argv);
|
||||
int status = RUN_ALL_TESTS();
|
||||
LOG(INFO) << "Test result = " << status;
|
||||
return status;
|
||||
}
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, RadioConfigHidlTest,
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(IRadioConfig::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
* Test IRadioConfig.getSimSlotsStatus()
|
||||
*/
|
||||
TEST_F(RadioConfigHidlTest, getSimSlotsStatus) {
|
||||
TEST_P(RadioConfigHidlTest, getSimSlotsStatus) {
|
||||
const int serial = GetRandomSerialNumber();
|
||||
Return<void> res = radioConfig->getSimSlotsStatus(serial);
|
||||
ASSERT_OK(res);
|
||||
|
||||
@@ -17,14 +17,10 @@
|
||||
#include <radio_config_hidl_hal_utils.h>
|
||||
|
||||
void RadioConfigHidlTest::SetUp() {
|
||||
radioConfig = ::testing::VtsHalHidlTargetTestBase::getService<IRadioConfig>(
|
||||
RadioConfigHidlEnvironment::Instance()->getServiceName<IRadioConfig>(
|
||||
hidl_string(RADIO_SERVICE_NAME)));
|
||||
radioConfig = IRadioConfig::getService(GetParam());
|
||||
if (radioConfig == NULL) {
|
||||
sleep(60);
|
||||
radioConfig = ::testing::VtsHalHidlTargetTestBase::getService<IRadioConfig>(
|
||||
RadioConfigHidlEnvironment::Instance()->getServiceName<IRadioConfig>(
|
||||
hidl_string(RADIO_SERVICE_NAME)));
|
||||
radioConfig = IRadioConfig::getService(GetParam());
|
||||
}
|
||||
ASSERT_NE(nullptr, radioConfig.get());
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <VtsHalHidlTargetTestEnvBase.h>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
@@ -27,6 +25,9 @@
|
||||
#include <android/hardware/radio/config/1.2/IRadioConfigIndication.h>
|
||||
#include <android/hardware/radio/config/1.2/IRadioConfigResponse.h>
|
||||
#include <android/hardware/radio/config/1.2/types.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "vts_test_util.h"
|
||||
|
||||
@@ -112,7 +113,7 @@ class RadioConfigHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase
|
||||
};
|
||||
|
||||
// The main test class for Radio config HIDL.
|
||||
class RadioConfigHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class RadioConfigHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
protected:
|
||||
std::mutex mtx_;
|
||||
std::condition_variable cv_;
|
||||
|
||||
Reference in New Issue
Block a user