mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:23:37 +00:00
Merge "[vts-core] add VtsHalRadioConfigV1_0TargetTest to vts-core"
This commit is contained in:
@@ -29,5 +29,5 @@ cc_test {
|
||||
"android.hardware.radio.config@1.0",
|
||||
],
|
||||
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);
|
||||
@@ -38,7 +38,7 @@ TEST_F(RadioConfigHidlTest, getSimSlotsStatus) {
|
||||
/*
|
||||
* Test IRadioConfig.setSimSlotsMapping()
|
||||
*/
|
||||
TEST_F(RadioConfigHidlTest, setSimSlotsMapping) {
|
||||
TEST_P(RadioConfigHidlTest, setSimSlotsMapping) {
|
||||
const int serial = GetRandomSerialNumber();
|
||||
android::hardware::hidl_vec<uint32_t> mapping = {0};
|
||||
Return<void> res = radioConfig->setSimSlotsMapping(serial, mapping);
|
||||
|
||||
@@ -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>
|
||||
@@ -26,6 +24,9 @@
|
||||
#include <android/hardware/radio/config/1.0/IRadioConfigIndication.h>
|
||||
#include <android/hardware/radio/config/1.0/IRadioConfigResponse.h>
|
||||
#include <android/hardware/radio/config/1.0/types.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "vts_test_util.h"
|
||||
|
||||
@@ -76,22 +77,8 @@ class RadioConfigIndication : public IRadioConfigIndication {
|
||||
RadioIndicationType type, const ::android::hardware::hidl_vec<SimSlotStatus>& slotStatus);
|
||||
};
|
||||
|
||||
// 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_;
|
||||
|
||||
Reference in New Issue
Block a user