diff options
author | Dan Shi <dshi@google.com> | 2019-11-30 04:47:54 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-11-30 04:47:54 +0000 |
commit | 745d7d7d60c7ee5bd5a0e7a2c7f098bda68a51f8 (patch) | |
tree | 46caca481b277f0174757a054c275d50d06a26e9 /radio | |
parent | 00d2ae597496c31b866f3b8bc0220621b3c45ce4 (diff) | |
parent | 8caedd0d684c1b4ece5d766cd809a3d39f08792a (diff) | |
download | platform_hardware_interfaces-745d7d7d60c7ee5bd5a0e7a2c7f098bda68a51f8.tar.gz platform_hardware_interfaces-745d7d7d60c7ee5bd5a0e7a2c7f098bda68a51f8.tar.bz2 platform_hardware_interfaces-745d7d7d60c7ee5bd5a0e7a2c7f098bda68a51f8.zip |
Merge "Convert VtsHalRadioV1_*TargetTest to be parameterized test"
Diffstat (limited to 'radio')
43 files changed, 481 insertions, 406 deletions
diff --git a/radio/1.0/vts/functional/Android.bp b/radio/1.0/vts/functional/Android.bp index 9dec2f28a1..2351d903fa 100644 --- a/radio/1.0/vts/functional/Android.bp +++ b/radio/1.0/vts/functional/Android.bp @@ -33,7 +33,8 @@ cc_test { static_libs: [ "android.hardware.radio@1.0", ], - test_suites: ["general-tests"], + test_config: "vts_hal_radio_target_test.xml", + test_suites: ["general-tests", "vts-core"], } cc_test { @@ -47,7 +48,8 @@ cc_test { static_libs: [ "android.hardware.radio@1.0", ], - test_suites: ["general-tests"], + test_config: "vts_hal_sap_target_test.xml", + test_suites: ["general-tests", "vts-core"], } cc_library_static { diff --git a/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp b/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp index d53c062ad2..9d61b52cd3 100644 --- a/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp +++ b/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp @@ -14,12 +14,18 @@ * limitations under the License. */ +#include <gtest/gtest.h> +#include <hidl/GtestPrinter.h> +#include <hidl/ServiceManagement.h> #include <radio_hidl_hal_utils_v1_0.h> +INSTANTIATE_TEST_SUITE_P(PerInstance, RadioHidlTest, + testing::ValuesIn(android::hardware::getAllHalInstanceNames( + ::android::hardware::radio::V1_0::IRadio::descriptor)), + android::hardware::PrintInstanceNameToString); + int main(int argc, char** argv) { - ::testing::AddGlobalTestEnvironment(RadioHidlEnvironment::Instance()); ::testing::InitGoogleTest(&argc, argv); - RadioHidlEnvironment::Instance()->init(&argc, argv); // setup seed for rand function int seedSrand = time(NULL); diff --git a/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp b/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp index 859e6fb52f..b80b971ff4 100644 --- a/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp +++ b/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp @@ -14,12 +14,18 @@ * limitations under the License. */ +#include <gtest/gtest.h> +#include <hidl/GtestPrinter.h> +#include <hidl/ServiceManagement.h> #include <sap_hidl_hal_utils.h> +INSTANTIATE_TEST_SUITE_P(PerInstance, SapHidlTest, + testing::ValuesIn(android::hardware::getAllHalInstanceNames( + ::android::hardware::radio::V1_0::ISap::descriptor)), + android::hardware::PrintInstanceNameToString); + int main(int argc, char** argv) { - ::testing::AddGlobalTestEnvironment(SapHidlEnvironment::Instance()); ::testing::InitGoogleTest(&argc, argv); - SapHidlEnvironment::Instance()->init(&argc, argv); // setup seed for rand function int seedSrand = time(NULL); diff --git a/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp b/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp index 2c1eb607ca..125ea0cce6 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp @@ -21,7 +21,7 @@ using namespace ::android::hardware::radio::V1_0; /* * Test IRadio.setGsmBroadcastConfig() for the response returned. */ -TEST_F(RadioHidlTest, setGsmBroadcastConfig) { +TEST_P(RadioHidlTest, setGsmBroadcastConfig) { serial = GetRandomSerialNumber(); // Create GsmBroadcastSmsConfigInfo #1 @@ -84,7 +84,7 @@ TEST_F(RadioHidlTest, setGsmBroadcastConfig) { /* * Test IRadio.getGsmBroadcastConfig() for the response returned. */ -TEST_F(RadioHidlTest, getGsmBroadcastConfig) { +TEST_P(RadioHidlTest, getGsmBroadcastConfig) { serial = GetRandomSerialNumber(); radio->getGsmBroadcastConfig(serial); @@ -104,7 +104,7 @@ TEST_F(RadioHidlTest, getGsmBroadcastConfig) { /* * Test IRadio.setCdmaBroadcastConfig() for the response returned. */ -TEST_F(RadioHidlTest, setCdmaBroadcastConfig) { +TEST_P(RadioHidlTest, setCdmaBroadcastConfig) { serial = GetRandomSerialNumber(); CdmaBroadcastSmsConfigInfo cbSmsConfig; @@ -131,7 +131,7 @@ TEST_F(RadioHidlTest, setCdmaBroadcastConfig) { /* * Test IRadio.getCdmaBroadcastConfig() for the response returned. */ -TEST_F(RadioHidlTest, getCdmaBroadcastConfig) { +TEST_P(RadioHidlTest, getCdmaBroadcastConfig) { serial = GetRandomSerialNumber(); radio->getCdmaBroadcastConfig(serial); @@ -149,7 +149,7 @@ TEST_F(RadioHidlTest, getCdmaBroadcastConfig) { /* * Test IRadio.setCdmaBroadcastActivation() for the response returned. */ -TEST_F(RadioHidlTest, setCdmaBroadcastActivation) { +TEST_P(RadioHidlTest, setCdmaBroadcastActivation) { serial = GetRandomSerialNumber(); bool activate = false; @@ -169,7 +169,7 @@ TEST_F(RadioHidlTest, setCdmaBroadcastActivation) { /* * Test IRadio.setGsmBroadcastActivation() for the response returned. */ -TEST_F(RadioHidlTest, setGsmBroadcastActivation) { +TEST_P(RadioHidlTest, setGsmBroadcastActivation) { serial = GetRandomSerialNumber(); bool activate = false; diff --git a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp index eaef3edf8e..d937d74403 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp @@ -21,7 +21,7 @@ using namespace ::android::hardware::radio::V1_0; /* * Test IRadio.getDataRegistrationState() for the response returned. */ -TEST_F(RadioHidlTest, getDataRegistrationState) { +TEST_P(RadioHidlTest, getDataRegistrationState) { serial = GetRandomSerialNumber(); radio->getDataRegistrationState(serial); @@ -99,7 +99,7 @@ TEST_F(RadioHidlTest, getDataRegistrationState) { /* * Test IRadio.setupDataCall() for the response returned. */ -TEST_F(RadioHidlTest, setupDataCall) { +TEST_P(RadioHidlTest, setupDataCall) { serial = GetRandomSerialNumber(); RadioTechnology radioTechnology = RadioTechnology::LTE; @@ -147,7 +147,7 @@ TEST_F(RadioHidlTest, setupDataCall) { /* * Test IRadio.deactivateDataCall() for the response returned. */ -TEST_F(RadioHidlTest, deactivateDataCall) { +TEST_P(RadioHidlTest, deactivateDataCall) { serial = GetRandomSerialNumber(); int cid = 1; bool reasonRadioShutDown = false; @@ -169,7 +169,7 @@ TEST_F(RadioHidlTest, deactivateDataCall) { /* * Test IRadio.getDataCallList() for the response returned. */ -TEST_F(RadioHidlTest, getDataCallList) { +TEST_P(RadioHidlTest, getDataCallList) { serial = GetRandomSerialNumber(); radio->getDataCallList(serial); @@ -188,7 +188,7 @@ TEST_F(RadioHidlTest, getDataCallList) { /* * Test IRadio.setInitialAttachApn() for the response returned. */ -TEST_F(RadioHidlTest, setInitialAttachApn) { +TEST_P(RadioHidlTest, setInitialAttachApn) { serial = GetRandomSerialNumber(); DataProfileInfo dataProfileInfo; @@ -231,7 +231,7 @@ TEST_F(RadioHidlTest, setInitialAttachApn) { /* * Test IRadio.setDataAllowed() for the response returned. */ -TEST_F(RadioHidlTest, setDataAllowed) { +TEST_P(RadioHidlTest, setDataAllowed) { serial = GetRandomSerialNumber(); bool allow = true; @@ -249,7 +249,7 @@ TEST_F(RadioHidlTest, setDataAllowed) { /* * Test IRadio.setDataProfile() for the response returned. */ -TEST_F(RadioHidlTest, setDataProfile) { +TEST_P(RadioHidlTest, setDataProfile) { serial = GetRandomSerialNumber(); // Create a dataProfileInfo diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp index 2670d96cf3..60cb2fecda 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp @@ -19,7 +19,7 @@ /* * Test IRadio.getIccCardStatus() for the response returned. */ -TEST_F(RadioHidlTest, getIccCardStatus) { +TEST_P(RadioHidlTest, getIccCardStatus) { EXPECT_LE(cardStatus.applications.size(), (unsigned int)RadioConst::CARD_MAX_APPS); EXPECT_LT(cardStatus.gsmUmtsSubscriptionAppIndex, (int)RadioConst::CARD_MAX_APPS); EXPECT_LT(cardStatus.cdmaSubscriptionAppIndex, (int)RadioConst::CARD_MAX_APPS); @@ -29,7 +29,7 @@ TEST_F(RadioHidlTest, getIccCardStatus) { /* * Test IRadio.supplyIccPinForApp() for the response returned */ -TEST_F(RadioHidlTest, supplyIccPinForApp) { +TEST_P(RadioHidlTest, supplyIccPinForApp) { serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -54,7 +54,7 @@ TEST_F(RadioHidlTest, supplyIccPinForApp) { /* * Test IRadio.supplyIccPukForApp() for the response returned. */ -TEST_F(RadioHidlTest, supplyIccPukForApp) { +TEST_P(RadioHidlTest, supplyIccPukForApp) { serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -78,7 +78,7 @@ TEST_F(RadioHidlTest, supplyIccPukForApp) { /* * Test IRadio.supplyIccPin2ForApp() for the response returned. */ -TEST_F(RadioHidlTest, supplyIccPin2ForApp) { +TEST_P(RadioHidlTest, supplyIccPin2ForApp) { serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -104,7 +104,7 @@ TEST_F(RadioHidlTest, supplyIccPin2ForApp) { /* * Test IRadio.supplyIccPuk2ForApp() for the response returned. */ -TEST_F(RadioHidlTest, supplyIccPuk2ForApp) { +TEST_P(RadioHidlTest, supplyIccPuk2ForApp) { serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -128,7 +128,7 @@ TEST_F(RadioHidlTest, supplyIccPuk2ForApp) { /* * Test IRadio.changeIccPinForApp() for the response returned. */ -TEST_F(RadioHidlTest, changeIccPinForApp) { +TEST_P(RadioHidlTest, changeIccPinForApp) { serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -153,7 +153,7 @@ TEST_F(RadioHidlTest, changeIccPinForApp) { /* * Test IRadio.changeIccPin2ForApp() for the response returned. */ -TEST_F(RadioHidlTest, changeIccPin2ForApp) { +TEST_P(RadioHidlTest, changeIccPin2ForApp) { serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -179,7 +179,7 @@ TEST_F(RadioHidlTest, changeIccPin2ForApp) { /* * Test IRadio.getImsiForApp() for the response returned. */ -TEST_F(RadioHidlTest, getImsiForApp) { +TEST_P(RadioHidlTest, getImsiForApp) { serial = GetRandomSerialNumber(); // Check success returned while getting imsi for 3GPP and 3GPP2 apps only @@ -208,7 +208,7 @@ TEST_F(RadioHidlTest, getImsiForApp) { /* * Test IRadio.iccIOForApp() for the response returned. */ -TEST_F(RadioHidlTest, iccIOForApp) { +TEST_P(RadioHidlTest, iccIOForApp) { serial = GetRandomSerialNumber(); for (int i = 0; i < (int)cardStatus.applications.size(); i++) { @@ -233,7 +233,7 @@ TEST_F(RadioHidlTest, iccIOForApp) { /* * Test IRadio.iccTransmitApduBasicChannel() for the response returned. */ -TEST_F(RadioHidlTest, iccTransmitApduBasicChannel) { +TEST_P(RadioHidlTest, iccTransmitApduBasicChannel) { serial = GetRandomSerialNumber(); SimApdu msg; memset(&msg, 0, sizeof(msg)); @@ -250,7 +250,7 @@ TEST_F(RadioHidlTest, iccTransmitApduBasicChannel) { /* * Test IRadio.iccOpenLogicalChannel() for the response returned. */ -TEST_F(RadioHidlTest, iccOpenLogicalChannel) { +TEST_P(RadioHidlTest, iccOpenLogicalChannel) { serial = GetRandomSerialNumber(); int p2 = 0x04; // Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is requested. @@ -265,7 +265,7 @@ TEST_F(RadioHidlTest, iccOpenLogicalChannel) { /* * Test IRadio.iccCloseLogicalChannel() for the response returned. */ -TEST_F(RadioHidlTest, iccCloseLogicalChannel) { +TEST_P(RadioHidlTest, iccCloseLogicalChannel) { serial = GetRandomSerialNumber(); // Try closing invalid channel and check INVALID_ARGUMENTS returned as error radio->iccCloseLogicalChannel(serial, 0); @@ -279,7 +279,7 @@ TEST_F(RadioHidlTest, iccCloseLogicalChannel) { /* * Test IRadio.iccTransmitApduLogicalChannel() for the response returned. */ -TEST_F(RadioHidlTest, iccTransmitApduLogicalChannel) { +TEST_P(RadioHidlTest, iccTransmitApduLogicalChannel) { serial = GetRandomSerialNumber(); SimApdu msg; memset(&msg, 0, sizeof(msg)); @@ -296,7 +296,7 @@ TEST_F(RadioHidlTest, iccTransmitApduLogicalChannel) { /* * Test IRadio.requestIccSimAuthentication() for the response returned. */ -TEST_F(RadioHidlTest, requestIccSimAuthentication) { +TEST_P(RadioHidlTest, requestIccSimAuthentication) { serial = GetRandomSerialNumber(); // Pass wrong challenge string and check RadioError::INVALID_ARGUMENTS @@ -315,7 +315,7 @@ TEST_F(RadioHidlTest, requestIccSimAuthentication) { /* * Test IRadio.supplyNetworkDepersonalization() for the response returned. */ -TEST_F(RadioHidlTest, supplyNetworkDepersonalization) { +TEST_P(RadioHidlTest, supplyNetworkDepersonalization) { serial = GetRandomSerialNumber(); radio->supplyNetworkDepersonalization(serial, hidl_string("test")); diff --git a/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp b/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp index 4331c06c85..e253dcf97a 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp @@ -21,7 +21,7 @@ using namespace ::android::hardware::radio::V1_0; /* * Test IRadio.getClir() for the response returned. */ -TEST_F(RadioHidlTest, getClir) { +TEST_P(RadioHidlTest, getClir) { serial = GetRandomSerialNumber(); radio->getClir(serial); @@ -39,7 +39,7 @@ TEST_F(RadioHidlTest, getClir) { /* * Test IRadio.setClir() for the response returned. */ -TEST_F(RadioHidlTest, setClir) { +TEST_P(RadioHidlTest, setClir) { serial = GetRandomSerialNumber(); int32_t status = 1; @@ -57,7 +57,7 @@ TEST_F(RadioHidlTest, setClir) { /* * Test IRadio.getFacilityLockForApp() for the response returned. */ -TEST_F(RadioHidlTest, getFacilityLockForApp) { +TEST_P(RadioHidlTest, getFacilityLockForApp) { serial = GetRandomSerialNumber(); std::string facility = ""; std::string password = ""; @@ -80,7 +80,7 @@ TEST_F(RadioHidlTest, getFacilityLockForApp) { /* * Test IRadio.setFacilityLockForApp() for the response returned. */ -TEST_F(RadioHidlTest, setFacilityLockForApp) { +TEST_P(RadioHidlTest, setFacilityLockForApp) { serial = GetRandomSerialNumber(); std::string facility = ""; bool lockState = false; @@ -104,7 +104,7 @@ TEST_F(RadioHidlTest, setFacilityLockForApp) { /* * Test IRadio.setBarringPassword() for the response returned. */ -TEST_F(RadioHidlTest, setBarringPassword) { +TEST_P(RadioHidlTest, setBarringPassword) { serial = GetRandomSerialNumber(); std::string facility = ""; std::string oldPassword = ""; @@ -127,7 +127,7 @@ TEST_F(RadioHidlTest, setBarringPassword) { /* * Test IRadio.getClip() for the response returned. */ -TEST_F(RadioHidlTest, getClip) { +TEST_P(RadioHidlTest, getClip) { serial = GetRandomSerialNumber(); radio->getClip(serial); @@ -145,7 +145,7 @@ TEST_F(RadioHidlTest, getClip) { /* * Test IRadio.setSuppServiceNotifications() for the response returned. */ -TEST_F(RadioHidlTest, setSuppServiceNotifications) { +TEST_P(RadioHidlTest, setSuppServiceNotifications) { serial = GetRandomSerialNumber(); bool enable = false; @@ -164,7 +164,7 @@ TEST_F(RadioHidlTest, setSuppServiceNotifications) { /* * Test IRadio.requestIsimAuthentication() for the response returned. */ -TEST_F(RadioHidlTest, requestIsimAuthentication) { +TEST_P(RadioHidlTest, requestIsimAuthentication) { serial = GetRandomSerialNumber(); std::string challenge = ""; @@ -186,7 +186,7 @@ TEST_F(RadioHidlTest, requestIsimAuthentication) { /* * Test IRadio.getImsRegistrationState() for the response returned. */ -TEST_F(RadioHidlTest, getImsRegistrationState) { +TEST_P(RadioHidlTest, getImsRegistrationState) { serial = GetRandomSerialNumber(); radio->getImsRegistrationState(serial); 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 34997625b1..d04cb36f5c 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp @@ -19,7 +19,7 @@ /* * Test IRadio.getSignalStrength() for the response returned. */ -TEST_F(RadioHidlTest, getSignalStrength) { +TEST_P(RadioHidlTest, getSignalStrength) { serial = GetRandomSerialNumber(); radio->getSignalStrength(serial); @@ -35,7 +35,7 @@ TEST_F(RadioHidlTest, getSignalStrength) { /* * Test IRadio.getVoiceRegistrationState() for the response returned. */ -TEST_F(RadioHidlTest, getVoiceRegistrationState) { +TEST_P(RadioHidlTest, getVoiceRegistrationState) { serial = GetRandomSerialNumber(); radio->getVoiceRegistrationState(serial); @@ -51,7 +51,7 @@ TEST_F(RadioHidlTest, getVoiceRegistrationState) { /* * Test IRadio.getOperator() for the response returned. */ -TEST_F(RadioHidlTest, getOperator) { +TEST_P(RadioHidlTest, getOperator) { serial = GetRandomSerialNumber(); radio->getOperator(serial); @@ -67,7 +67,7 @@ TEST_F(RadioHidlTest, getOperator) { /* * Test IRadio.setRadioPower() for the response returned. */ -TEST_F(RadioHidlTest, setRadioPower) { +TEST_P(RadioHidlTest, setRadioPower) { serial = GetRandomSerialNumber(); radio->setRadioPower(serial, 1); @@ -83,7 +83,7 @@ TEST_F(RadioHidlTest, setRadioPower) { /* * Test IRadio.getNetworkSelectionMode() for the response returned. */ -TEST_F(RadioHidlTest, getNetworkSelectionMode) { +TEST_P(RadioHidlTest, getNetworkSelectionMode) { serial = GetRandomSerialNumber(); radio->getNetworkSelectionMode(serial); @@ -99,7 +99,7 @@ TEST_F(RadioHidlTest, getNetworkSelectionMode) { /* * Test IRadio.setNetworkSelectionModeAutomatic() for the response returned. */ -TEST_F(RadioHidlTest, setNetworkSelectionModeAutomatic) { +TEST_P(RadioHidlTest, setNetworkSelectionModeAutomatic) { serial = GetRandomSerialNumber(); radio->setNetworkSelectionModeAutomatic(serial); @@ -118,7 +118,7 @@ TEST_F(RadioHidlTest, setNetworkSelectionModeAutomatic) { /* * Test IRadio.setNetworkSelectionModeManual() for the response returned. */ -TEST_F(RadioHidlTest, setNetworkSelectionModeManual) { +TEST_P(RadioHidlTest, setNetworkSelectionModeManual) { serial = GetRandomSerialNumber(); radio->setNetworkSelectionModeManual(serial, "123456"); @@ -137,7 +137,7 @@ TEST_F(RadioHidlTest, setNetworkSelectionModeManual) { /* * Test IRadio.getAvailableNetworks() for the response returned. */ -TEST_F(RadioHidlTest, getAvailableNetworks) { +TEST_P(RadioHidlTest, getAvailableNetworks) { serial = GetRandomSerialNumber(); radio->getAvailableNetworks(serial); @@ -158,7 +158,7 @@ TEST_F(RadioHidlTest, getAvailableNetworks) { /* * Test IRadio.getBasebandVersion() for the response returned. */ -TEST_F(RadioHidlTest, getBasebandVersion) { +TEST_P(RadioHidlTest, getBasebandVersion) { serial = GetRandomSerialNumber(); radio->getBasebandVersion(serial); @@ -174,7 +174,7 @@ TEST_F(RadioHidlTest, getBasebandVersion) { /* * Test IRadio.setBandMode() for the response returned. */ -TEST_F(RadioHidlTest, setBandMode) { +TEST_P(RadioHidlTest, setBandMode) { serial = GetRandomSerialNumber(); radio->setBandMode(serial, RadioBandMode::BAND_MODE_USA); @@ -191,7 +191,7 @@ TEST_F(RadioHidlTest, setBandMode) { /* * Test IRadio.getAvailableBandModes() for the response returned. */ -TEST_F(RadioHidlTest, getAvailableBandModes) { +TEST_P(RadioHidlTest, getAvailableBandModes) { serial = GetRandomSerialNumber(); radio->getAvailableBandModes(serial); @@ -207,7 +207,7 @@ TEST_F(RadioHidlTest, getAvailableBandModes) { /* * Test IRadio.setPreferredNetworkType() for the response returned. */ -TEST_F(RadioHidlTest, setPreferredNetworkType) { +TEST_P(RadioHidlTest, setPreferredNetworkType) { serial = GetRandomSerialNumber(); radio->setPreferredNetworkType(serial, PreferredNetworkType::GSM_ONLY); @@ -224,7 +224,7 @@ TEST_F(RadioHidlTest, setPreferredNetworkType) { /* * Test IRadio.getPreferredNetworkType() for the response returned. */ -TEST_F(RadioHidlTest, getPreferredNetworkType) { +TEST_P(RadioHidlTest, getPreferredNetworkType) { serial = GetRandomSerialNumber(); radio->getPreferredNetworkType(serial); @@ -240,7 +240,7 @@ TEST_F(RadioHidlTest, getPreferredNetworkType) { /* * Test IRadio.getNeighboringCids() for the response returned. */ -TEST_F(RadioHidlTest, getNeighboringCids) { +TEST_P(RadioHidlTest, getNeighboringCids) { serial = GetRandomSerialNumber(); radio->getNeighboringCids(serial); @@ -258,7 +258,7 @@ TEST_F(RadioHidlTest, getNeighboringCids) { /* * Test IRadio.setLocationUpdates() for the response returned. */ -TEST_F(RadioHidlTest, setLocationUpdates) { +TEST_P(RadioHidlTest, setLocationUpdates) { serial = GetRandomSerialNumber(); radio->setLocationUpdates(serial, true); @@ -275,7 +275,7 @@ TEST_F(RadioHidlTest, setLocationUpdates) { /* * Test IRadio.setCdmaRoamingPreference() for the response returned. */ -TEST_F(RadioHidlTest, setCdmaRoamingPreference) { +TEST_P(RadioHidlTest, setCdmaRoamingPreference) { serial = GetRandomSerialNumber(); radio->setCdmaRoamingPreference(serial, CdmaRoamingType::HOME_NETWORK); @@ -293,7 +293,7 @@ TEST_F(RadioHidlTest, setCdmaRoamingPreference) { /* * Test IRadio.getCdmaRoamingPreference() for the response returned. */ -TEST_F(RadioHidlTest, getCdmaRoamingPreference) { +TEST_P(RadioHidlTest, getCdmaRoamingPreference) { serial = GetRandomSerialNumber(); radio->getCdmaRoamingPreference(serial); @@ -312,7 +312,7 @@ TEST_F(RadioHidlTest, getCdmaRoamingPreference) { /* * Test IRadio.getTTYMode() for the response returned. */ -TEST_F(RadioHidlTest, getTTYMode) { +TEST_P(RadioHidlTest, getTTYMode) { serial = GetRandomSerialNumber(); radio->getTTYMode(serial); @@ -328,7 +328,7 @@ TEST_F(RadioHidlTest, getTTYMode) { /* * Test IRadio.setTTYMode() for the response returned. */ -TEST_F(RadioHidlTest, setTTYMode) { +TEST_P(RadioHidlTest, setTTYMode) { serial = GetRandomSerialNumber(); radio->setTTYMode(serial, TtyMode::OFF); @@ -344,7 +344,7 @@ TEST_F(RadioHidlTest, setTTYMode) { /* * Test IRadio.setPreferredVoicePrivacy() for the response returned. */ -TEST_F(RadioHidlTest, setPreferredVoicePrivacy) { +TEST_P(RadioHidlTest, setPreferredVoicePrivacy) { serial = GetRandomSerialNumber(); radio->setPreferredVoicePrivacy(serial, true); @@ -361,7 +361,7 @@ TEST_F(RadioHidlTest, setPreferredVoicePrivacy) { /* * Test IRadio.getPreferredVoicePrivacy() for the response returned. */ -TEST_F(RadioHidlTest, getPreferredVoicePrivacy) { +TEST_P(RadioHidlTest, getPreferredVoicePrivacy) { serial = GetRandomSerialNumber(); radio->getPreferredVoicePrivacy(serial); @@ -378,7 +378,7 @@ TEST_F(RadioHidlTest, getPreferredVoicePrivacy) { /* * Test IRadio.getCDMASubscription() for the response returned. */ -TEST_F(RadioHidlTest, getCDMASubscription) { +TEST_P(RadioHidlTest, getCDMASubscription) { serial = GetRandomSerialNumber(); radio->getCDMASubscription(serial); @@ -396,7 +396,7 @@ TEST_F(RadioHidlTest, getCDMASubscription) { /* * Test IRadio.getDeviceIdentity() for the response returned. */ -TEST_F(RadioHidlTest, getDeviceIdentity) { +TEST_P(RadioHidlTest, getDeviceIdentity) { serial = GetRandomSerialNumber(); radio->getDeviceIdentity(serial); @@ -413,7 +413,7 @@ TEST_F(RadioHidlTest, getDeviceIdentity) { /* * Test IRadio.exitEmergencyCallbackMode() for the response returned. */ -TEST_F(RadioHidlTest, exitEmergencyCallbackMode) { +TEST_P(RadioHidlTest, exitEmergencyCallbackMode) { serial = GetRandomSerialNumber(); radio->exitEmergencyCallbackMode(serial); @@ -431,7 +431,7 @@ TEST_F(RadioHidlTest, exitEmergencyCallbackMode) { /* * Test IRadio.getCdmaSubscriptionSource() for the response returned. */ -TEST_F(RadioHidlTest, getCdmaSubscriptionSource) { +TEST_P(RadioHidlTest, getCdmaSubscriptionSource) { serial = GetRandomSerialNumber(); radio->getCdmaSubscriptionSource(serial); @@ -449,7 +449,7 @@ TEST_F(RadioHidlTest, getCdmaSubscriptionSource) { /* * Test IRadio.setCdmaSubscriptionSource() for the response returned. */ -TEST_F(RadioHidlTest, setCdmaSubscriptionSource) { +TEST_P(RadioHidlTest, setCdmaSubscriptionSource) { serial = GetRandomSerialNumber(); radio->setCdmaSubscriptionSource(serial, CdmaSubscriptionSource::RUIM_SIM); @@ -468,7 +468,7 @@ TEST_F(RadioHidlTest, setCdmaSubscriptionSource) { /* * Test IRadio.getVoiceRadioTechnology() for the response returned. */ -TEST_F(RadioHidlTest, getVoiceRadioTechnology) { +TEST_P(RadioHidlTest, getVoiceRadioTechnology) { serial = GetRandomSerialNumber(); radio->getVoiceRadioTechnology(serial); @@ -484,7 +484,7 @@ TEST_F(RadioHidlTest, getVoiceRadioTechnology) { /* * Test IRadio.getCellInfoList() for the response returned. */ -TEST_F(RadioHidlTest, getCellInfoList) { +TEST_P(RadioHidlTest, getCellInfoList) { serial = GetRandomSerialNumber(); radio->getCellInfoList(serial); @@ -502,7 +502,7 @@ TEST_F(RadioHidlTest, getCellInfoList) { /* * Test IRadio.setCellInfoListRate() for the response returned. */ -TEST_F(RadioHidlTest, setCellInfoListRate) { +TEST_P(RadioHidlTest, setCellInfoListRate) { serial = GetRandomSerialNumber(); // TODO(sanketpadawe): RIL crashes with value of rate = 10 @@ -520,7 +520,7 @@ TEST_F(RadioHidlTest, setCellInfoListRate) { /* * Test IRadio.nvReadItem() for the response returned. */ -TEST_F(RadioHidlTest, nvReadItem) { +TEST_P(RadioHidlTest, nvReadItem) { serial = GetRandomSerialNumber(); radio->nvReadItem(serial, NvItem::LTE_BAND_ENABLE_25); @@ -537,7 +537,7 @@ TEST_F(RadioHidlTest, nvReadItem) { /* * Test IRadio.nvWriteItem() for the response returned. */ -TEST_F(RadioHidlTest, nvWriteItem) { +TEST_P(RadioHidlTest, nvWriteItem) { serial = GetRandomSerialNumber(); NvWriteItem item; memset(&item, 0, sizeof(item)); @@ -557,7 +557,7 @@ TEST_F(RadioHidlTest, nvWriteItem) { /* * Test IRadio.nvWriteCdmaPrl() for the response returned. */ -TEST_F(RadioHidlTest, nvWriteCdmaPrl) { +TEST_P(RadioHidlTest, nvWriteCdmaPrl) { serial = GetRandomSerialNumber(); std::vector<uint8_t> prl = {1, 2, 3, 4, 5}; @@ -575,7 +575,7 @@ TEST_F(RadioHidlTest, nvWriteCdmaPrl) { /* * Test IRadio.nvResetConfig() for the response returned. */ -TEST_F(RadioHidlTest, nvResetConfig) { +TEST_P(RadioHidlTest, nvResetConfig) { serial = GetRandomSerialNumber(); radio->nvResetConfig(serial, ResetNvType::ERASE); @@ -592,7 +592,7 @@ TEST_F(RadioHidlTest, nvResetConfig) { /* * Test IRadio.setUiccSubscription() for the response returned. */ -TEST_F(RadioHidlTest, setUiccSubscription) { +TEST_P(RadioHidlTest, setUiccSubscription) { serial = GetRandomSerialNumber(); SelectUiccSub item; memset(&item, 0, sizeof(item)); @@ -614,7 +614,7 @@ TEST_F(RadioHidlTest, setUiccSubscription) { /* * Test IRadio.getHardwareConfig() for the response returned. */ -TEST_F(RadioHidlTest, getHardwareConfig) { +TEST_P(RadioHidlTest, getHardwareConfig) { serial = GetRandomSerialNumber(); radio->getHardwareConfig(serial); @@ -631,7 +631,7 @@ TEST_F(RadioHidlTest, getHardwareConfig) { /* * Test IRadio.requestShutdown() for the response returned. */ -TEST_F(RadioHidlTest, requestShutdown) { +TEST_P(RadioHidlTest, requestShutdown) { serial = GetRandomSerialNumber(); radio->requestShutdown(serial); @@ -648,7 +648,7 @@ TEST_F(RadioHidlTest, requestShutdown) { /* * Test IRadio.getRadioCapability() for the response returned. */ -TEST_F(RadioHidlTest, getRadioCapability) { +TEST_P(RadioHidlTest, getRadioCapability) { serial = GetRandomSerialNumber(); radio->getRadioCapability(serial); @@ -664,7 +664,7 @@ TEST_F(RadioHidlTest, getRadioCapability) { /* * Test IRadio.setRadioCapability() for the response returned. */ -TEST_F(RadioHidlTest, setRadioCapability) { +TEST_P(RadioHidlTest, setRadioCapability) { serial = GetRandomSerialNumber(); RadioCapability rc; memset(&rc, 0, sizeof(rc)); @@ -685,7 +685,7 @@ TEST_F(RadioHidlTest, setRadioCapability) { /* * Test IRadio.startLceService() for the response returned. */ -TEST_F(RadioHidlTest, startLceService) { +TEST_P(RadioHidlTest, startLceService) { serial = GetRandomSerialNumber(); radio->startLceService(serial, 5, true); @@ -704,7 +704,7 @@ TEST_F(RadioHidlTest, startLceService) { /* * Test IRadio.stopLceService() for the response returned. */ -TEST_F(RadioHidlTest, stopLceService) { +TEST_P(RadioHidlTest, stopLceService) { serial = GetRandomSerialNumber(); radio->stopLceService(serial); @@ -722,7 +722,7 @@ TEST_F(RadioHidlTest, stopLceService) { /* * Test IRadio.pullLceData() for the response returned. */ -TEST_F(RadioHidlTest, pullLceData) { +TEST_P(RadioHidlTest, pullLceData) { serial = GetRandomSerialNumber(); radio->pullLceData(serial); @@ -741,7 +741,7 @@ TEST_F(RadioHidlTest, pullLceData) { /* * Test IRadio.getModemActivityInfo() for the response returned. */ -TEST_F(RadioHidlTest, getModemActivityInfo) { +TEST_P(RadioHidlTest, getModemActivityInfo) { serial = GetRandomSerialNumber(); radio->getModemActivityInfo(serial); @@ -758,7 +758,7 @@ TEST_F(RadioHidlTest, getModemActivityInfo) { /* * Test IRadio.setAllowedCarriers() for the response returned. */ -TEST_F(RadioHidlTest, setAllowedCarriers) { +TEST_P(RadioHidlTest, setAllowedCarriers) { serial = GetRandomSerialNumber(); CarrierRestrictions carriers; memset(&carriers, 0, sizeof(carriers)); @@ -835,7 +835,7 @@ TEST_F(RadioHidlTest, setAllowedCarriers) { /* * Test IRadio.getAllowedCarriers() for the response returned. */ -TEST_F(RadioHidlTest, getAllowedCarriers) { +TEST_P(RadioHidlTest, getAllowedCarriers) { serial = GetRandomSerialNumber(); radio->getAllowedCarriers(serial); @@ -852,7 +852,7 @@ TEST_F(RadioHidlTest, getAllowedCarriers) { /* * Test IRadio.sendDeviceState() for the response returned. */ -TEST_F(RadioHidlTest, sendDeviceState) { +TEST_P(RadioHidlTest, sendDeviceState) { serial = GetRandomSerialNumber(); radio->sendDeviceState(serial, DeviceStateType::POWER_SAVE_MODE, true); @@ -871,7 +871,7 @@ TEST_F(RadioHidlTest, sendDeviceState) { /* * Test IRadio.setIndicationFilter() for the response returned. */ -TEST_F(RadioHidlTest, setIndicationFilter) { +TEST_P(RadioHidlTest, setIndicationFilter) { serial = GetRandomSerialNumber(); radio->setIndicationFilter(serial, 1); @@ -890,7 +890,7 @@ TEST_F(RadioHidlTest, setIndicationFilter) { /* * Test IRadio.setSimCardPower() for the response returned. */ -TEST_F(RadioHidlTest, setSimCardPower) { +TEST_P(RadioHidlTest, setSimCardPower) { serial = GetRandomSerialNumber(); radio->setSimCardPower(serial, true); diff --git a/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp b/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp index 9e4142960f..58c3bbd7de 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp @@ -21,7 +21,7 @@ using namespace ::android::hardware::radio::V1_0; /* * Test IRadio.sendSms() for the response returned. */ -TEST_F(RadioHidlTest, sendSms) { +TEST_P(RadioHidlTest, sendSms) { serial = GetRandomSerialNumber(); GsmSmsMessage msg; msg.smscPdu = ""; @@ -45,7 +45,7 @@ TEST_F(RadioHidlTest, sendSms) { /* * Test IRadio.sendSMSExpectMore() for the response returned. */ -TEST_F(RadioHidlTest, sendSMSExpectMore) { +TEST_P(RadioHidlTest, sendSMSExpectMore) { serial = GetRandomSerialNumber(); GsmSmsMessage msg; msg.smscPdu = ""; @@ -71,7 +71,7 @@ TEST_F(RadioHidlTest, sendSMSExpectMore) { /* * Test IRadio.acknowledgeLastIncomingGsmSms() for the response returned. */ -TEST_F(RadioHidlTest, acknowledgeLastIncomingGsmSms) { +TEST_P(RadioHidlTest, acknowledgeLastIncomingGsmSms) { serial = GetRandomSerialNumber(); bool success = true; @@ -92,7 +92,7 @@ TEST_F(RadioHidlTest, acknowledgeLastIncomingGsmSms) { /* * Test IRadio.acknowledgeIncomingGsmSmsWithPdu() for the response returned. */ -TEST_F(RadioHidlTest, acknowledgeIncomingGsmSmsWithPdu) { +TEST_P(RadioHidlTest, acknowledgeIncomingGsmSmsWithPdu) { serial = GetRandomSerialNumber(); bool success = true; std::string ackPdu = ""; @@ -111,7 +111,7 @@ TEST_F(RadioHidlTest, acknowledgeIncomingGsmSmsWithPdu) { /* * Test IRadio.sendCdmaSms() for the response returned. */ -TEST_F(RadioHidlTest, sendCdmaSms) { +TEST_P(RadioHidlTest, sendCdmaSms) { serial = GetRandomSerialNumber(); // Create a CdmaSmsAddress @@ -155,7 +155,7 @@ TEST_F(RadioHidlTest, sendCdmaSms) { /* * Test IRadio.acknowledgeLastIncomingCdmaSms() for the response returned. */ -TEST_F(RadioHidlTest, acknowledgeLastIncomingCdmaSms) { +TEST_P(RadioHidlTest, acknowledgeLastIncomingCdmaSms) { serial = GetRandomSerialNumber(); // Create a CdmaSmsAck @@ -179,7 +179,7 @@ TEST_F(RadioHidlTest, acknowledgeLastIncomingCdmaSms) { /* * Test IRadio.sendImsSms() for the response returned. */ -TEST_F(RadioHidlTest, sendImsSms) { +TEST_P(RadioHidlTest, sendImsSms) { serial = GetRandomSerialNumber(); // Create a CdmaSmsAddress @@ -229,7 +229,7 @@ TEST_F(RadioHidlTest, sendImsSms) { /* * Test IRadio.getSmscAddress() for the response returned. */ -TEST_F(RadioHidlTest, getSmscAddress) { +TEST_P(RadioHidlTest, getSmscAddress) { serial = GetRandomSerialNumber(); radio->getSmscAddress(serial); @@ -249,7 +249,7 @@ TEST_F(RadioHidlTest, getSmscAddress) { /* * Test IRadio.setSmscAddress() for the response returned. */ -TEST_F(RadioHidlTest, setSmscAddress) { +TEST_P(RadioHidlTest, setSmscAddress) { serial = GetRandomSerialNumber(); hidl_string address = hidl_string("smscAddress"); @@ -270,7 +270,7 @@ TEST_F(RadioHidlTest, setSmscAddress) { /* * Test IRadio.writeSmsToSim() for the response returned. */ -TEST_F(RadioHidlTest, writeSmsToSim) { +TEST_P(RadioHidlTest, writeSmsToSim) { serial = GetRandomSerialNumber(); SmsWriteArgs smsWriteArgs; smsWriteArgs.status = SmsWriteArgsStatus::REC_UNREAD; @@ -296,7 +296,7 @@ TEST_F(RadioHidlTest, writeSmsToSim) { /* * Test IRadio.deleteSmsOnSim() for the response returned. */ -TEST_F(RadioHidlTest, deleteSmsOnSim) { +TEST_P(RadioHidlTest, deleteSmsOnSim) { serial = GetRandomSerialNumber(); int index = 1; @@ -319,7 +319,7 @@ TEST_F(RadioHidlTest, deleteSmsOnSim) { /* * Test IRadio.writeSmsToRuim() for the response returned. */ -TEST_F(RadioHidlTest, writeSmsToRuim) { +TEST_P(RadioHidlTest, writeSmsToRuim) { serial = GetRandomSerialNumber(); // Create a CdmaSmsAddress @@ -370,7 +370,7 @@ TEST_F(RadioHidlTest, writeSmsToRuim) { /* * Test IRadio.deleteSmsOnRuim() for the response returned. */ -TEST_F(RadioHidlTest, deleteSmsOnRuim) { +TEST_P(RadioHidlTest, deleteSmsOnRuim) { serial = GetRandomSerialNumber(); int index = 1; @@ -421,7 +421,7 @@ TEST_F(RadioHidlTest, deleteSmsOnRuim) { /* * Test IRadio.reportSmsMemoryStatus() for the response returned. */ -TEST_F(RadioHidlTest, reportSmsMemoryStatus) { +TEST_P(RadioHidlTest, reportSmsMemoryStatus) { serial = GetRandomSerialNumber(); bool available = true; diff --git a/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp b/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp index a3b5029f45..1170111fba 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp @@ -21,7 +21,7 @@ using namespace ::android::hardware::radio::V1_0; /* * Test IRadio.sendEnvelope() for the response returned. */ -TEST_F(RadioHidlTest, sendEnvelope) { +TEST_P(RadioHidlTest, sendEnvelope) { serial = GetRandomSerialNumber(); // Test with sending empty string @@ -44,7 +44,7 @@ TEST_F(RadioHidlTest, sendEnvelope) { /* * Test IRadio.sendTerminalResponseToSim() for the response returned. */ -TEST_F(RadioHidlTest, sendTerminalResponseToSim) { +TEST_P(RadioHidlTest, sendTerminalResponseToSim) { serial = GetRandomSerialNumber(); // Test with sending empty string @@ -67,7 +67,7 @@ TEST_F(RadioHidlTest, sendTerminalResponseToSim) { /* * Test IRadio.handleStkCallSetupRequestFromSim() for the response returned. */ -TEST_F(RadioHidlTest, handleStkCallSetupRequestFromSim) { +TEST_P(RadioHidlTest, handleStkCallSetupRequestFromSim) { serial = GetRandomSerialNumber(); bool accept = false; @@ -88,7 +88,7 @@ TEST_F(RadioHidlTest, handleStkCallSetupRequestFromSim) { /* * Test IRadio.reportStkServiceIsRunning() for the response returned. */ -TEST_F(RadioHidlTest, reportStkServiceIsRunning) { +TEST_P(RadioHidlTest, reportStkServiceIsRunning) { serial = GetRandomSerialNumber(); radio->reportStkServiceIsRunning(serial); @@ -107,7 +107,7 @@ TEST_F(RadioHidlTest, reportStkServiceIsRunning) { * Test IRadio.sendEnvelopeWithStatus() for the response returned with empty * string. */ -TEST_F(RadioHidlTest, sendEnvelopeWithStatus) { +TEST_P(RadioHidlTest, sendEnvelopeWithStatus) { serial = GetRandomSerialNumber(); // Test with sending empty string 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 96719d6d8d..3c833c0c20 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp @@ -17,13 +17,10 @@ #include <radio_hidl_hal_utils_v1_0.h> void RadioHidlTest::SetUp() { - radio = ::testing::VtsHalHidlTargetTestBase::getService<IRadio>( - RadioHidlEnvironment::Instance()->getServiceName<IRadio>(hidl_string(RADIO_SERVICE_NAME))); + radio = IRadio::getService(GetParam()); if (radio == NULL) { sleep(60); - radio = ::testing::VtsHalHidlTargetTestBase::getService<IRadio>( - RadioHidlEnvironment::Instance()->getServiceName<IRadio>( - hidl_string(RADIO_SERVICE_NAME))); + radio = IRadio::getService(GetParam()); } ASSERT_NE(nullptr, radio.get()); 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 23bc434804..8a551f7c36 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 @@ -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,7 @@ #include <android/hardware/radio/1.0/IRadioIndication.h> #include <android/hardware/radio/1.0/IRadioResponse.h> #include <android/hardware/radio/1.0/types.h> +#include <gtest/gtest.h> #include "vts_test_util.h" @@ -515,23 +514,9 @@ class RadioIndication : public IRadioIndication { const ::android::hardware::hidl_string& reason); }; -// Test environment for Radio HIDL HAL. -class RadioHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { - public: - // get the test environment singleton - static RadioHidlEnvironment* Instance() { - static RadioHidlEnvironment* instance = new RadioHidlEnvironment; - return instance; - } - virtual void registerTestServices() override { registerTestService<IRadio>(); } - - private: - RadioHidlEnvironment() {} -}; - // The main test class for Radio HIDL. -class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase { - protected: +class RadioHidlTest : public ::testing::TestWithParam<std::string> { + protected: std::mutex mtx; std::condition_variable cv; int count; diff --git a/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp b/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp index 1fce470558..a192a33a07 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp @@ -19,7 +19,7 @@ /* * Test IRadio.getCurrentCalls() for the response returned. */ -TEST_F(RadioHidlTest, getCurrentCalls) { +TEST_P(RadioHidlTest, getCurrentCalls) { serial = GetRandomSerialNumber(); radio->getCurrentCalls(serial); @@ -35,7 +35,7 @@ TEST_F(RadioHidlTest, getCurrentCalls) { /* * Test IRadio.dial() for the response returned. */ -TEST_F(RadioHidlTest, dial) { +TEST_P(RadioHidlTest, dial) { serial = GetRandomSerialNumber(); Dial dialInfo; @@ -62,7 +62,7 @@ TEST_F(RadioHidlTest, dial) { /* * Test IRadio.hangup() for the response returned. */ -TEST_F(RadioHidlTest, hangup) { +TEST_P(RadioHidlTest, hangup) { serial = GetRandomSerialNumber(); radio->hangup(serial, 1); @@ -81,7 +81,7 @@ TEST_F(RadioHidlTest, hangup) { /* * Test IRadio.hangupWaitingOrBackground() for the response returned. */ -TEST_F(RadioHidlTest, hangupWaitingOrBackground) { +TEST_P(RadioHidlTest, hangupWaitingOrBackground) { serial = GetRandomSerialNumber(); radio->hangupWaitingOrBackground(serial); @@ -99,7 +99,7 @@ TEST_F(RadioHidlTest, hangupWaitingOrBackground) { /* * Test IRadio.hangupForegroundResumeBackground() for the response returned. */ -TEST_F(RadioHidlTest, hangupForegroundResumeBackground) { +TEST_P(RadioHidlTest, hangupForegroundResumeBackground) { serial = GetRandomSerialNumber(); radio->hangupForegroundResumeBackground(serial); @@ -117,7 +117,7 @@ TEST_F(RadioHidlTest, hangupForegroundResumeBackground) { /* * Test IRadio.switchWaitingOrHoldingAndActive() for the response returned. */ -TEST_F(RadioHidlTest, switchWaitingOrHoldingAndActive) { +TEST_P(RadioHidlTest, switchWaitingOrHoldingAndActive) { serial = GetRandomSerialNumber(); radio->switchWaitingOrHoldingAndActive(serial); @@ -135,7 +135,7 @@ TEST_F(RadioHidlTest, switchWaitingOrHoldingAndActive) { /* * Test IRadio.conference() for the response returned. */ -TEST_F(RadioHidlTest, conference) { +TEST_P(RadioHidlTest, conference) { serial = GetRandomSerialNumber(); radio->conference(serial); @@ -153,7 +153,7 @@ TEST_F(RadioHidlTest, conference) { /* * Test IRadio.rejectCall() for the response returned. */ -TEST_F(RadioHidlTest, rejectCall) { +TEST_P(RadioHidlTest, rejectCall) { serial = GetRandomSerialNumber(); radio->rejectCall(serial); @@ -171,7 +171,7 @@ TEST_F(RadioHidlTest, rejectCall) { /* * Test IRadio.getLastCallFailCause() for the response returned. */ -TEST_F(RadioHidlTest, getLastCallFailCause) { +TEST_P(RadioHidlTest, getLastCallFailCause) { serial = GetRandomSerialNumber(); radio->getLastCallFailCause(serial); @@ -188,7 +188,7 @@ TEST_F(RadioHidlTest, getLastCallFailCause) { /* * Test IRadio.sendUssd() for the response returned. */ -TEST_F(RadioHidlTest, sendUssd) { +TEST_P(RadioHidlTest, sendUssd) { serial = GetRandomSerialNumber(); radio->sendUssd(serial, hidl_string("test")); EXPECT_EQ(std::cv_status::no_timeout, wait()); @@ -206,7 +206,7 @@ TEST_F(RadioHidlTest, sendUssd) { /* * Test IRadio.cancelPendingUssd() for the response returned. */ -TEST_F(RadioHidlTest, cancelPendingUssd) { +TEST_P(RadioHidlTest, cancelPendingUssd) { serial = GetRandomSerialNumber(); radio->cancelPendingUssd(serial); @@ -225,7 +225,7 @@ TEST_F(RadioHidlTest, cancelPendingUssd) { /* * Test IRadio.getCallForwardStatus() for the response returned. */ -TEST_F(RadioHidlTest, getCallForwardStatus) { +TEST_P(RadioHidlTest, getCallForwardStatus) { serial = GetRandomSerialNumber(); CallForwardInfo callInfo; memset(&callInfo, 0, sizeof(callInfo)); @@ -247,7 +247,7 @@ TEST_F(RadioHidlTest, getCallForwardStatus) { /* * Test IRadio.setCallForward() for the response returned. */ -TEST_F(RadioHidlTest, setCallForward) { +TEST_P(RadioHidlTest, setCallForward) { serial = GetRandomSerialNumber(); CallForwardInfo callInfo; memset(&callInfo, 0, sizeof(callInfo)); @@ -269,7 +269,7 @@ TEST_F(RadioHidlTest, setCallForward) { /* * Test IRadio.getCallWaiting() for the response returned. */ -TEST_F(RadioHidlTest, getCallWaiting) { +TEST_P(RadioHidlTest, getCallWaiting) { serial = GetRandomSerialNumber(); radio->getCallWaiting(serial, 1); @@ -288,7 +288,7 @@ TEST_F(RadioHidlTest, getCallWaiting) { /* * Test IRadio.setCallWaiting() for the response returned. */ -TEST_F(RadioHidlTest, setCallWaiting) { +TEST_P(RadioHidlTest, setCallWaiting) { serial = GetRandomSerialNumber(); radio->setCallWaiting(serial, true, 1); @@ -307,7 +307,7 @@ TEST_F(RadioHidlTest, setCallWaiting) { /* * Test IRadio.acceptCall() for the response returned. */ -TEST_F(RadioHidlTest, acceptCall) { +TEST_P(RadioHidlTest, acceptCall) { serial = GetRandomSerialNumber(); radio->acceptCall(serial); @@ -325,7 +325,7 @@ TEST_F(RadioHidlTest, acceptCall) { /* * Test IRadio.separateConnection() for the response returned. */ -TEST_F(RadioHidlTest, separateConnection) { +TEST_P(RadioHidlTest, separateConnection) { serial = GetRandomSerialNumber(); radio->separateConnection(serial, 1); @@ -344,7 +344,7 @@ TEST_F(RadioHidlTest, separateConnection) { /* * Test IRadio.explicitCallTransfer() for the response returned. */ -TEST_F(RadioHidlTest, explicitCallTransfer) { +TEST_P(RadioHidlTest, explicitCallTransfer) { serial = GetRandomSerialNumber(); radio->explicitCallTransfer(serial); @@ -362,7 +362,7 @@ TEST_F(RadioHidlTest, explicitCallTransfer) { /* * Test IRadio.sendCDMAFeatureCode() for the response returned. */ -TEST_F(RadioHidlTest, sendCDMAFeatureCode) { +TEST_P(RadioHidlTest, sendCDMAFeatureCode) { serial = GetRandomSerialNumber(); radio->sendCDMAFeatureCode(serial, hidl_string()); @@ -382,7 +382,7 @@ TEST_F(RadioHidlTest, sendCDMAFeatureCode) { /* * Test IRadio.sendDtmf() for the response returned. */ -TEST_F(RadioHidlTest, sendDtmf) { +TEST_P(RadioHidlTest, sendDtmf) { serial = GetRandomSerialNumber(); radio->sendDtmf(serial, "1"); @@ -402,7 +402,7 @@ TEST_F(RadioHidlTest, sendDtmf) { /* * Test IRadio.startDtmf() for the response returned. */ -TEST_F(RadioHidlTest, startDtmf) { +TEST_P(RadioHidlTest, startDtmf) { serial = GetRandomSerialNumber(); radio->startDtmf(serial, "1"); @@ -422,7 +422,7 @@ TEST_F(RadioHidlTest, startDtmf) { /* * Test IRadio.stopDtmf() for the response returned. */ -TEST_F(RadioHidlTest, stopDtmf) { +TEST_P(RadioHidlTest, stopDtmf) { serial = GetRandomSerialNumber(); radio->stopDtmf(serial); @@ -441,7 +441,7 @@ TEST_F(RadioHidlTest, stopDtmf) { /* * Test IRadio.setMute() for the response returned. */ -TEST_F(RadioHidlTest, setMute) { +TEST_P(RadioHidlTest, setMute) { serial = GetRandomSerialNumber(); radio->setMute(serial, true); @@ -459,7 +459,7 @@ TEST_F(RadioHidlTest, setMute) { /* * Test IRadio.getMute() for the response returned. */ -TEST_F(RadioHidlTest, getMute) { +TEST_P(RadioHidlTest, getMute) { serial = GetRandomSerialNumber(); radio->getMute(serial); @@ -475,7 +475,7 @@ TEST_F(RadioHidlTest, getMute) { /* * Test IRadio.sendBurstDtmf() for the response returned. */ -TEST_F(RadioHidlTest, sendBurstDtmf) { +TEST_P(RadioHidlTest, sendBurstDtmf) { serial = GetRandomSerialNumber(); radio->sendBurstDtmf(serial, "1", 0, 0); diff --git a/radio/1.0/vts/functional/sap_hidl_hal_api.cpp b/radio/1.0/vts/functional/sap_hidl_hal_api.cpp index 1d79ff61a0..6bd2c88a05 100644 --- a/radio/1.0/vts/functional/sap_hidl_hal_api.cpp +++ b/radio/1.0/vts/functional/sap_hidl_hal_api.cpp @@ -19,7 +19,7 @@ /* * Test ISap.connectReq() for the response returned. */ -TEST_F(SapHidlTest, connectReq) { +TEST_P(SapHidlTest, connectReq) { token = GetRandomSerialNumber(); int32_t maxMsgSize = 100; @@ -35,7 +35,7 @@ TEST_F(SapHidlTest, connectReq) { /* * Test IRadio.disconnectReq() for the response returned */ -TEST_F(SapHidlTest, disconnectReq) { +TEST_P(SapHidlTest, disconnectReq) { token = GetRandomSerialNumber(); sap->disconnectReq(token); @@ -46,7 +46,7 @@ TEST_F(SapHidlTest, disconnectReq) { /* * Test IRadio.apduReq() for the response returned. */ -TEST_F(SapHidlTest, apduReq) { +TEST_P(SapHidlTest, apduReq) { token = GetRandomSerialNumber(); SapApduType sapApduType = SapApduType::APDU; android::hardware::hidl_vec<uint8_t> command = {}; @@ -64,7 +64,7 @@ TEST_F(SapHidlTest, apduReq) { /* * Test IRadio.transferAtrReq() for the response returned. */ -TEST_F(SapHidlTest, transferAtrReq) { +TEST_P(SapHidlTest, transferAtrReq) { token = GetRandomSerialNumber(); sap->transferAtrReq(token); @@ -80,7 +80,7 @@ TEST_F(SapHidlTest, transferAtrReq) { /* * Test IRadio.powerReq() for the response returned. */ -TEST_F(SapHidlTest, powerReq) { +TEST_P(SapHidlTest, powerReq) { token = GetRandomSerialNumber(); bool state = true; @@ -97,7 +97,7 @@ TEST_F(SapHidlTest, powerReq) { /* * Test IRadio.resetSimReq() for the response returned. */ -TEST_F(SapHidlTest, resetSimReq) { +TEST_P(SapHidlTest, resetSimReq) { token = GetRandomSerialNumber(); sap->resetSimReq(token); @@ -113,7 +113,7 @@ TEST_F(SapHidlTest, resetSimReq) { /* * Test IRadio.transferCardReaderStatusReq() for the response returned. */ -TEST_F(SapHidlTest, transferCardReaderStatusReq) { +TEST_P(SapHidlTest, transferCardReaderStatusReq) { token = GetRandomSerialNumber(); sap->transferCardReaderStatusReq(token); @@ -127,7 +127,7 @@ TEST_F(SapHidlTest, transferCardReaderStatusReq) { /* * Test IRadio.setTransferProtocolReq() for the response returned. */ -TEST_F(SapHidlTest, setTransferProtocolReq) { +TEST_P(SapHidlTest, setTransferProtocolReq) { token = GetRandomSerialNumber(); SapTransferProtocol sapTransferProtocol = SapTransferProtocol::T0; diff --git a/radio/1.0/vts/functional/sap_hidl_hal_test.cpp b/radio/1.0/vts/functional/sap_hidl_hal_test.cpp index 65b344b63e..fe105872b4 100644 --- a/radio/1.0/vts/functional/sap_hidl_hal_test.cpp +++ b/radio/1.0/vts/functional/sap_hidl_hal_test.cpp @@ -17,8 +17,7 @@ #include <sap_hidl_hal_utils.h> void SapHidlTest::SetUp() { - sap = ::testing::VtsHalHidlTargetTestBase::getService<ISap>( - SapHidlEnvironment::Instance()->getServiceName<ISap>(hidl_string(SAP_SERVICE_NAME))); + sap = ISap::getService(GetParam()); ASSERT_NE(sap, nullptr); sapCb = new SapCallback(*this); diff --git a/radio/1.0/vts/functional/sap_hidl_hal_utils.h b/radio/1.0/vts/functional/sap_hidl_hal_utils.h index f432932be3..2fc9ae368e 100644 --- a/radio/1.0/vts/functional/sap_hidl_hal_utils.h +++ b/radio/1.0/vts/functional/sap_hidl_hal_utils.h @@ -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,7 @@ #include <android/hardware/radio/1.0/ISap.h> #include <android/hardware/radio/1.0/ISapCallback.h> #include <android/hardware/radio/1.0/types.h> +#include <gtest/gtest.h> #include "vts_test_util.h" @@ -80,23 +79,9 @@ class SapCallback : public ISapCallback { Return<void> transferProtocolResponse(int32_t token, SapResultCode resultCode); }; -// Test environment for Sap HIDL HAL. -class SapHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { - public: - // get the test environment singleton - static SapHidlEnvironment* Instance() { - static SapHidlEnvironment* instance = new SapHidlEnvironment; - return instance; - } - virtual void registerTestServices() override { registerTestService<ISap>(); } - - private: - SapHidlEnvironment() {} -}; - // The main test class for Sap HIDL. -class SapHidlTest : public ::testing::VtsHalHidlTargetTestBase { - private: +class SapHidlTest : public ::testing::TestWithParam<std::string> { + private: std::mutex mtx; std::condition_variable cv; int count; diff --git a/radio/1.0/vts/functional/vts_hal_radio_target_test.xml b/radio/1.0/vts/functional/vts_hal_radio_target_test.xml new file mode 100644 index 0000000000..5e4a1cd7a1 --- /dev/null +++ b/radio/1.0/vts/functional/vts_hal_radio_target_test.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2019 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<configuration description="Runs VtsHalRadioV1_0TargetTest."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-native" /> + + <target_preparer class="com.android.tradefed.targetprep.MultiSimPreparer" /> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"> + </target_preparer> + + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="cleanup" value="true" /> + <option name="push" value="VtsHalRadioV1_0TargetTest->/data/local/tmp/VtsHalRadioV1_0TargetTest" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="VtsHalRadioV1_0TargetTest" /> + </test> +</configuration> diff --git a/radio/1.0/vts/functional/vts_hal_sap_target_test.xml b/radio/1.0/vts/functional/vts_hal_sap_target_test.xml new file mode 100644 index 0000000000..457d700e90 --- /dev/null +++ b/radio/1.0/vts/functional/vts_hal_sap_target_test.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2019 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<configuration description="Runs VtsHalSapV1_0TargetTest."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-native" /> + + <target_preparer class="com.android.tradefed.targetprep.MultiSimPreparer" /> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"> + </target_preparer> + + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="cleanup" value="true" /> + <option name="push" value="VtsHalSapV1_0TargetTest->/data/local/tmp/VtsHalSapV1_0TargetTest" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="VtsHalSapV1_0TargetTest" /> + </test> +</configuration> diff --git a/radio/1.0/vts/functional/vts_test_util.h b/radio/1.0/vts/functional/vts_test_util.h index 826f0deae8..05b47c9d66 100644 --- a/radio/1.0/vts/functional/vts_test_util.h +++ b/radio/1.0/vts/functional/vts_test_util.h @@ -16,9 +16,8 @@ #include <android-base/logging.h> -#include <VtsHalHidlTargetTestBase.h> - #include <android/hardware/radio/1.0/types.h> +#include <gtest/gtest.h> using ::android::hardware::radio::V1_0::RadioError; using ::android::hardware::radio::V1_0::SapResultCode; diff --git a/radio/1.1/vts/functional/Android.bp b/radio/1.1/vts/functional/Android.bp index 5695c6bb8b..58aa67e0f9 100644 --- a/radio/1.1/vts/functional/Android.bp +++ b/radio/1.1/vts/functional/Android.bp @@ -30,5 +30,5 @@ cc_test { header_libs: [ "radio.util.header@1.0", ], - test_suites: ["general-tests"], + test_suites: ["general-tests", "vts-core"], } diff --git a/radio/1.1/vts/functional/AndroidTest.xml b/radio/1.1/vts/functional/AndroidTest.xml new file mode 100644 index 0000000000..5badadd5e1 --- /dev/null +++ b/radio/1.1/vts/functional/AndroidTest.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2019 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<configuration description="Runs VtsHalRadioV1_1TargetTest."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-native" /> + + <target_preparer class="com.android.tradefed.targetprep.MultiSimPreparer" /> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"> + </target_preparer> + + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="cleanup" value="true" /> + <option name="push" value="VtsHalRadioV1_1TargetTest->/data/local/tmp/VtsHalRadioV1_1TargetTest" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="VtsHalRadioV1_1TargetTest" /> + </test> +</configuration> diff --git a/radio/1.1/vts/functional/VtsHalRadioV1_1TargetTest.cpp b/radio/1.1/vts/functional/VtsHalRadioV1_1TargetTest.cpp index 83564ee3f3..98dbf62c4a 100644 --- a/radio/1.1/vts/functional/VtsHalRadioV1_1TargetTest.cpp +++ b/radio/1.1/vts/functional/VtsHalRadioV1_1TargetTest.cpp @@ -14,13 +14,12 @@ * limitations under the License. */ +#include <gtest/gtest.h> +#include <hidl/GtestPrinter.h> +#include <hidl/ServiceManagement.h> #include <radio_hidl_hal_utils_v1_1.h> -int main(int argc, char** argv) { - ::testing::AddGlobalTestEnvironment(RadioHidlEnvironment::Instance()); - ::testing::InitGoogleTest(&argc, argv); - RadioHidlEnvironment::Instance()->init(&argc, argv); - int status = RUN_ALL_TESTS(); - LOG(INFO) << "Test result = " << status; - return status; -} +INSTANTIATE_TEST_SUITE_P(PerInstance, RadioHidlTest_v1_1, + testing::ValuesIn(android::hardware::getAllHalInstanceNames( + ::android::hardware::radio::V1_1::IRadio::descriptor)), + android::hardware::PrintInstanceNameToString); diff --git a/radio/1.1/vts/functional/radio_hidl_hal_api.cpp b/radio/1.1/vts/functional/radio_hidl_hal_api.cpp index 33347c5d7a..75abbbf107 100644 --- a/radio/1.1/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.1/vts/functional/radio_hidl_hal_api.cpp @@ -20,7 +20,7 @@ /* * Test IRadio.setSimCardPower() for the response returned. */ -TEST_F(RadioHidlTest_v1_1, setSimCardPower_1_1) { +TEST_P(RadioHidlTest_v1_1, setSimCardPower_1_1) { /* Record the sim card state for the testing environment */ CardState cardStateForTest = cardStatus.cardState; @@ -81,7 +81,7 @@ TEST_F(RadioHidlTest_v1_1, setSimCardPower_1_1) { /* * Test IRadio.startNetworkScan() for the response returned. */ -TEST_F(RadioHidlTest_v1_1, startNetworkScan) { +TEST_P(RadioHidlTest_v1_1, startNetworkScan) { serial = GetRandomSerialNumber(); NetworkScanRequest request; @@ -115,7 +115,7 @@ TEST_F(RadioHidlTest_v1_1, startNetworkScan) { /* * Test IRadio.startNetworkScan() for the response returned. */ -TEST_F(RadioHidlTest_v1_1, startNetworkScan_InvalidArgument) { +TEST_P(RadioHidlTest_v1_1, startNetworkScan_InvalidArgument) { serial = GetRandomSerialNumber(); NetworkScanRequest request; @@ -139,7 +139,7 @@ TEST_F(RadioHidlTest_v1_1, startNetworkScan_InvalidArgument) { /* * Test IRadio.stopNetworkScan() for the response returned. */ -TEST_F(RadioHidlTest_v1_1, stopNetworkScan) { +TEST_P(RadioHidlTest_v1_1, stopNetworkScan) { serial = GetRandomSerialNumber(); radio_v1_1->stopNetworkScan(serial); @@ -158,7 +158,7 @@ TEST_F(RadioHidlTest_v1_1, stopNetworkScan) { /* * Test IRadio.setCarrierInfoForImsiEncryption() for the response returned. */ -TEST_F(RadioHidlTest_v1_1, setCarrierInfoForImsiEncryption) { +TEST_P(RadioHidlTest_v1_1, setCarrierInfoForImsiEncryption) { serial = GetRandomSerialNumber(); ImsiEncryptionInfo imsiInfo; imsiInfo.mcc = "310"; @@ -181,7 +181,7 @@ TEST_F(RadioHidlTest_v1_1, setCarrierInfoForImsiEncryption) { /* * Test IRadio.startKeepalive() for the response returned. */ -TEST_F(RadioHidlTest_v1_1, startKeepalive) { +TEST_P(RadioHidlTest_v1_1, startKeepalive) { std::vector<KeepaliveRequest> requests = { { // Invalid IPv4 source address @@ -279,7 +279,7 @@ TEST_F(RadioHidlTest_v1_1, startKeepalive) { /* * Test IRadio.stopKeepalive() for the response returned. */ -TEST_F(RadioHidlTest_v1_1, stopKeepalive) { +TEST_P(RadioHidlTest_v1_1, stopKeepalive) { serial = GetRandomSerialNumber(); radio_v1_1->stopKeepalive(serial, 0xBAD); 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 2f657b4e34..020168e0a8 100644 --- a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp @@ -17,18 +17,10 @@ #include <radio_hidl_hal_utils_v1_1.h> void RadioHidlTest_v1_1::SetUp() { - radio_v1_1 = - ::testing::VtsHalHidlTargetTestBase::getService<::android::hardware::radio::V1_1::IRadio>( - RadioHidlEnvironment::Instance() - ->getServiceName<::android::hardware::radio::V1_1::IRadio>( - hidl_string(RADIO_SERVICE_NAME))); + radio_v1_1 = ::android::hardware::radio::V1_1::IRadio::getService(GetParam()); if (radio_v1_1 == NULL) { sleep(60); - radio_v1_1 = ::testing::VtsHalHidlTargetTestBase::getService< - ::android::hardware::radio::V1_1::IRadio>( - RadioHidlEnvironment::Instance() - ->getServiceName<::android::hardware::radio::V1_1::IRadio>( - hidl_string(RADIO_SERVICE_NAME))); + radio_v1_1 = ::android::hardware::radio::V1_1::IRadio::getService(GetParam()); } ASSERT_NE(nullptr, radio_v1_1.get()); 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 925f4fc821..b81ee13127 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 @@ -16,8 +16,7 @@ #include <android-base/logging.h> -#include <VtsHalHidlTargetTestBase.h> -#include <VtsHalHidlTargetTestEnvBase.h> +#include <log/log.h> #include <chrono> #include <condition_variable> #include <mutex> @@ -26,6 +25,7 @@ #include <android/hardware/radio/1.1/IRadioIndication.h> #include <android/hardware/radio/1.1/IRadioResponse.h> #include <android/hardware/radio/1.1/types.h> +#include <gtest/gtest.h> #include "vts_test_util.h" @@ -535,25 +535,9 @@ class RadioIndication_v1_1 : public ::android::hardware::radio::V1_1::IRadioIndi const ::android::hardware::hidl_string& reason); }; -// Test environment for Radio HIDL HAL. -class RadioHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { - public: - // get the test environment singleton - static RadioHidlEnvironment* Instance() { - static RadioHidlEnvironment* instance = new RadioHidlEnvironment; - return instance; - } - virtual void registerTestServices() override { - registerTestService<::android::hardware::radio::V1_1::IRadio>(); - } - - private: - RadioHidlEnvironment() {} -}; - // The main test class for Radio HIDL. -class RadioHidlTest_v1_1 : public ::testing::VtsHalHidlTargetTestBase { - protected: +class RadioHidlTest_v1_1 : public ::testing::TestWithParam<std::string> { + protected: std::mutex mtx; std::condition_variable cv; int count; diff --git a/radio/1.2/vts/functional/Android.bp b/radio/1.2/vts/functional/Android.bp index c5838a8edb..f7189a8cbd 100644 --- a/radio/1.2/vts/functional/Android.bp +++ b/radio/1.2/vts/functional/Android.bp @@ -34,5 +34,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"], } diff --git a/radio/1.2/vts/functional/AndroidTest.xml b/radio/1.2/vts/functional/AndroidTest.xml new file mode 100644 index 0000000000..5d92248886 --- /dev/null +++ b/radio/1.2/vts/functional/AndroidTest.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2019 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<configuration description="Runs VtsHalRadioV1_2TargetTest."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-native" /> + + <target_preparer class="com.android.tradefed.targetprep.MultiSimPreparer" /> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"> + </target_preparer> + + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="cleanup" value="true" /> + <option name="push" value="VtsHalRadioV1_2TargetTest->/data/local/tmp/VtsHalRadioV1_2TargetTest" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="VtsHalRadioV1_2TargetTest" /> + </test> +</configuration> diff --git a/radio/1.2/vts/functional/VtsHalRadioV1_2TargetTest.cpp b/radio/1.2/vts/functional/VtsHalRadioV1_2TargetTest.cpp index c1a2f3dd50..400e394668 100644 --- a/radio/1.2/vts/functional/VtsHalRadioV1_2TargetTest.cpp +++ b/radio/1.2/vts/functional/VtsHalRadioV1_2TargetTest.cpp @@ -14,13 +14,12 @@ * limitations under the License. */ +#include <gtest/gtest.h> +#include <hidl/GtestPrinter.h> +#include <hidl/ServiceManagement.h> #include <radio_hidl_hal_utils_v1_2.h> -int main(int argc, char** argv) { - ::testing::AddGlobalTestEnvironment(RadioHidlEnvironment::Instance()); - ::testing::InitGoogleTest(&argc, argv); - RadioHidlEnvironment::Instance()->init(&argc, argv); - int status = RUN_ALL_TESTS(); - LOG(INFO) << "Test result = " << status; - return status; -} +INSTANTIATE_TEST_SUITE_P(PerInstance, RadioHidlTest_v1_2, + testing::ValuesIn(android::hardware::getAllHalInstanceNames( + ::android::hardware::radio::V1_2::IRadio::descriptor)), + android::hardware::PrintInstanceNameToString); diff --git a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp index a98f22aacf..7464307a98 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp @@ -31,7 +31,7 @@ const RadioAccessSpecifier GERAN_SPECIFIER_850 = {.radioAccessNetwork = RadioAcc /* * Test IRadio.startNetworkScan() for the response returned. */ -TEST_F(RadioHidlTest_v1_2, startNetworkScan) { +TEST_P(RadioHidlTest_v1_2, startNetworkScan) { serial = GetRandomSerialNumber(); if (radioConfig != NULL && DDS_LOGICAL_SLOT_INDEX != logicalSlotId) { @@ -82,7 +82,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan) { /* * Test IRadio.startNetworkScan() with invalid specifier. */ -TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidArgument) { +TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidArgument) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = {.type = ScanType::ONE_SHOT, @@ -109,7 +109,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidArgument) { /* * Test IRadio.startNetworkScan() with invalid interval (lower boundary). */ -TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval1) { +TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval1) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = { @@ -141,7 +141,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval1) { /* * Test IRadio.startNetworkScan() with invalid interval (upper boundary). */ -TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval2) { +TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval2) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = { @@ -173,7 +173,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval2) { /* * Test IRadio.startNetworkScan() with invalid max search time (lower boundary). */ -TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime1) { +TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime1) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = { @@ -205,7 +205,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime1) { /* * Test IRadio.startNetworkScan() with invalid max search time (upper boundary). */ -TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime2) { +TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime2) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = { @@ -237,7 +237,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime2) { /* * Test IRadio.startNetworkScan() with invalid periodicity (lower boundary). */ -TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity1) { +TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity1) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = { @@ -269,7 +269,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity1) { /* * Test IRadio.startNetworkScan() with invalid periodicity (upper boundary). */ -TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity2) { +TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity2) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = { @@ -301,7 +301,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity2) { /* * Test IRadio.startNetworkScan() with valid periodicity */ -TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest1) { +TEST_P(RadioHidlTest_v1_2, startNetworkScan_GoodRequest1) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = { @@ -335,7 +335,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest1) { /* * Test IRadio.startNetworkScan() with valid periodicity and plmns */ -TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest2) { +TEST_P(RadioHidlTest_v1_2, startNetworkScan_GoodRequest2) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = { @@ -370,7 +370,7 @@ TEST_F(RadioHidlTest_v1_2, startNetworkScan_GoodRequest2) { /* * Test IRadio.setIndicationFilter_1_2() */ -TEST_F(RadioHidlTest_v1_2, setIndicationFilter_1_2) { +TEST_P(RadioHidlTest_v1_2, setIndicationFilter_1_2) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->setIndicationFilter_1_2( @@ -388,7 +388,7 @@ TEST_F(RadioHidlTest_v1_2, setIndicationFilter_1_2) { /* * Test IRadio.setSignalStrengthReportingCriteria() with invalid hysteresisDb */ -TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_invalidHysteresisDb) { +TEST_P(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_invalidHysteresisDb) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria( @@ -408,7 +408,7 @@ TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_invalidHysteresisD /* * Test IRadio.setSignalStrengthReportingCriteria() with empty parameters */ -TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_EmptyParams) { +TEST_P(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_EmptyParams) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria( @@ -426,7 +426,7 @@ TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_EmptyParams) { /* * Test IRadio.setSignalStrengthReportingCriteria() for GERAN */ -TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Geran) { +TEST_P(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Geran) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria( @@ -445,7 +445,7 @@ TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Geran) { /* * Test IRadio.setSignalStrengthReportingCriteria() for UTRAN */ -TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Utran) { +TEST_P(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Utran) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria( @@ -464,7 +464,7 @@ TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Utran) { /* * Test IRadio.setSignalStrengthReportingCriteria() for EUTRAN */ -TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Eutran) { +TEST_P(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Eutran) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria( @@ -483,7 +483,7 @@ TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Eutran) { /* * Test IRadio.setSignalStrengthReportingCriteria() for CDMA2000 */ -TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Cdma2000) { +TEST_P(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Cdma2000) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->setSignalStrengthReportingCriteria( @@ -502,7 +502,7 @@ TEST_F(RadioHidlTest_v1_2, setSignalStrengthReportingCriteria_Cdma2000) { /* * Test IRadio.setLinkCapacityReportingCriteria() invalid hysteresisDlKbps */ -TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisDlKbps) { +TEST_P(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisDlKbps) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->setLinkCapacityReportingCriteria( @@ -527,7 +527,7 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisDlK /* * Test IRadio.setLinkCapacityReportingCriteria() invalid hysteresisUlKbps */ -TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisUlKbps) { +TEST_P(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisUlKbps) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->setLinkCapacityReportingCriteria( @@ -552,7 +552,7 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_invalidHysteresisUlK /* * Test IRadio.setLinkCapacityReportingCriteria() empty params */ -TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_emptyParams) { +TEST_P(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_emptyParams) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->setLinkCapacityReportingCriteria( @@ -573,7 +573,7 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_emptyParams) { /* * Test IRadio.setLinkCapacityReportingCriteria() GERAN */ -TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_Geran) { +TEST_P(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_Geran) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->setLinkCapacityReportingCriteria( @@ -595,7 +595,7 @@ TEST_F(RadioHidlTest_v1_2, setLinkCapacityReportingCriteria_Geran) { /* * Test IRadio.setupDataCall_1_2() for the response returned. */ -TEST_F(RadioHidlTest_v1_2, setupDataCall_1_2) { +TEST_P(RadioHidlTest_v1_2, setupDataCall_1_2) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::AccessNetwork accessNetwork = @@ -655,7 +655,7 @@ TEST_F(RadioHidlTest_v1_2, setupDataCall_1_2) { /* * Test IRadio.deactivateDataCall_1_2() for the response returned. */ -TEST_F(RadioHidlTest_v1_2, deactivateDataCall_1_2) { +TEST_P(RadioHidlTest_v1_2, deactivateDataCall_1_2) { serial = GetRandomSerialNumber(); int cid = 1; ::android::hardware::radio::V1_2::DataRequestReason reason = @@ -686,7 +686,7 @@ TEST_F(RadioHidlTest_v1_2, deactivateDataCall_1_2) { /* * Test IRadio.getCellInfoList() for the response returned. */ -TEST_F(RadioHidlTest_v1_2, getCellInfoList_1_2) { +TEST_P(RadioHidlTest_v1_2, getCellInfoList_1_2) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->getCellInfoList(serial); @@ -704,7 +704,7 @@ TEST_F(RadioHidlTest_v1_2, getCellInfoList_1_2) { /* * Test IRadio.getVoiceRegistrationState() for the response returned. */ -TEST_F(RadioHidlTest_v1_2, getVoiceRegistrationState) { +TEST_P(RadioHidlTest_v1_2, getVoiceRegistrationState) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->getVoiceRegistrationState(serial); @@ -722,7 +722,7 @@ TEST_F(RadioHidlTest_v1_2, getVoiceRegistrationState) { /* * Test IRadio.getDataRegistrationState() for the response returned. */ -TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) { +TEST_P(RadioHidlTest_v1_2, getDataRegistrationState) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->getDataRegistrationState(serial); @@ -797,7 +797,7 @@ TEST_F(RadioHidlTest_v1_2, getDataRegistrationState) { /* * Test IRadio.getAvailableBandModes() for the response returned. */ -TEST_F(RadioHidlTest_v1_2, getAvailableBandModes) { +TEST_P(RadioHidlTest_v1_2, getAvailableBandModes) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_2->getAvailableBandModes(serial); diff --git a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp index 21caddb4bf..4845c7f3d2 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp @@ -17,18 +17,10 @@ #include <radio_hidl_hal_utils_v1_2.h> void RadioHidlTest_v1_2::SetUp() { - radio_v1_2 = - ::testing::VtsHalHidlTargetTestBase::getService<::android::hardware::radio::V1_2::IRadio>( - RadioHidlEnvironment::Instance() - ->getServiceName<::android::hardware::radio::V1_2::IRadio>( - hidl_string(RADIO_SERVICE_NAME))); + radio_v1_2 = ::android::hardware::radio::V1_2::IRadio::getService(GetParam()); if (radio_v1_2 == NULL) { sleep(60); - radio_v1_2 = ::testing::VtsHalHidlTargetTestBase::getService< - ::android::hardware::radio::V1_2::IRadio>( - RadioHidlEnvironment::Instance() - ->getServiceName<::android::hardware::radio::V1_2::IRadio>( - hidl_string(RADIO_SERVICE_NAME))); + radio_v1_2 = ::android::hardware::radio::V1_2::IRadio::getService(GetParam()); } ASSERT_NE(nullptr, radio_v1_2.get()); @@ -51,8 +43,7 @@ void RadioHidlTest_v1_2::SetUp() { /* Enforce Vts Testing with Sim Status Present only. */ EXPECT_EQ(CardState::PRESENT, cardStatus.base.cardState); - radioConfig = ::testing::VtsHalHidlTargetTestBase::getService< - ::android::hardware::radio::config::V1_1::IRadioConfig>(); + radioConfig = ::android::hardware::radio::config::V1_1::IRadioConfig::getService(); /* Enforce Vts tesing with RadioConfig for network scan excemption. */ // Some devices can only perform network scan on logical modem that currently used for packet diff --git a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h index 2db1cac724..479340cd88 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h +++ b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h @@ -16,8 +16,7 @@ #include <android-base/logging.h> -#include <VtsHalHidlTargetTestBase.h> -#include <VtsHalHidlTargetTestEnvBase.h> +#include <log/log.h> #include <chrono> #include <condition_variable> #include <mutex> @@ -30,6 +29,7 @@ #include <android/hardware/radio/1.2/IRadioIndication.h> #include <android/hardware/radio/1.2/IRadioResponse.h> #include <android/hardware/radio/1.2/types.h> +#include <gtest/gtest.h> #include "vts_test_util.h" @@ -631,25 +631,9 @@ class RadioIndication_v1_2 : public ::android::hardware::radio::V1_2::IRadioIndi const ::android::hardware::hidl_string& reason); }; -// Test environment for Radio HIDL HAL. -class RadioHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { - public: - // get the test environment singleton - static RadioHidlEnvironment* Instance() { - static RadioHidlEnvironment* instance = new RadioHidlEnvironment; - return instance; - } - virtual void registerTestServices() override { - registerTestService<::android::hardware::radio::V1_2::IRadio>(); - } - - private: - RadioHidlEnvironment() {} -}; - // The main test class for Radio HIDL. -class RadioHidlTest_v1_2 : public ::testing::VtsHalHidlTargetTestBase { - protected: +class RadioHidlTest_v1_2 : public ::testing::TestWithParam<std::string> { + protected: std::mutex mtx_; std::condition_variable cv_; int count_; diff --git a/radio/1.3/vts/functional/Android.bp b/radio/1.3/vts/functional/Android.bp index 67aff6ee26..2301732331 100644 --- a/radio/1.3/vts/functional/Android.bp +++ b/radio/1.3/vts/functional/Android.bp @@ -32,5 +32,5 @@ cc_test { "android.hardware.radio@1.0", ], header_libs: ["radio.util.header@1.0"], - test_suites: ["general-tests"], + test_suites: ["general-tests", "vts-core"], } diff --git a/radio/1.3/vts/functional/AndroidTest.xml b/radio/1.3/vts/functional/AndroidTest.xml new file mode 100644 index 0000000000..c9100470e4 --- /dev/null +++ b/radio/1.3/vts/functional/AndroidTest.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2019 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<configuration description="Runs VtsHalRadioV1_3TargetTest."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-native" /> + + <target_preparer class="com.android.tradefed.targetprep.MultiSimPreparer" /> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"> + </target_preparer> + + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="cleanup" value="true" /> + <option name="push" value="VtsHalRadioV1_3TargetTest->/data/local/tmp/VtsHalRadioV1_3TargetTest" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="VtsHalRadioV1_3TargetTest" /> + </test> +</configuration> diff --git a/radio/1.3/vts/functional/VtsHalRadioV1_3TargetTest.cpp b/radio/1.3/vts/functional/VtsHalRadioV1_3TargetTest.cpp index 7d2623eb32..2622bbc5e4 100644 --- a/radio/1.3/vts/functional/VtsHalRadioV1_3TargetTest.cpp +++ b/radio/1.3/vts/functional/VtsHalRadioV1_3TargetTest.cpp @@ -14,13 +14,12 @@ * limitations under the License. */ +#include <gtest/gtest.h> +#include <hidl/GtestPrinter.h> +#include <hidl/ServiceManagement.h> #include <radio_hidl_hal_utils_v1_3.h> -int main(int argc, char** argv) { - ::testing::AddGlobalTestEnvironment(RadioHidlEnvironment::Instance()); - ::testing::InitGoogleTest(&argc, argv); - RadioHidlEnvironment::Instance()->init(&argc, argv); - int status = RUN_ALL_TESTS(); - LOG(INFO) << "Test result = " << status; - return status; -} +INSTANTIATE_TEST_SUITE_P(PerInstance, RadioHidlTest_v1_3, + testing::ValuesIn(android::hardware::getAllHalInstanceNames( + ::android::hardware::radio::V1_3::IRadio::descriptor)), + android::hardware::PrintInstanceNameToString);
\ No newline at end of file diff --git a/radio/1.3/vts/functional/radio_hidl_hal_api.cpp b/radio/1.3/vts/functional/radio_hidl_hal_api.cpp index 813dd133a5..4e4814103d 100644 --- a/radio/1.3/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.3/vts/functional/radio_hidl_hal_api.cpp @@ -22,7 +22,7 @@ /* * Test IRadio.enableMddem() for the response returned. */ -TEST_F(RadioHidlTest_v1_3, enableModem) { +TEST_P(RadioHidlTest_v1_3, enableModem) { serial = GetRandomSerialNumber(); bool responseToggle = radioRsp_v1_3->enableModemResponseToggle; @@ -61,7 +61,7 @@ TEST_F(RadioHidlTest_v1_3, enableModem) { /* * Test IRadio.getModemStackStatus() for the response returned. */ -TEST_F(RadioHidlTest_v1_3, getModemStackStatus) { +TEST_P(RadioHidlTest_v1_3, getModemStackStatus) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_3->getModemStackStatus(serial); @@ -81,7 +81,7 @@ TEST_F(RadioHidlTest_v1_3, getModemStackStatus) { * * This test is excluded from manifest, due to non-implementation in Q. Tracked by b/130254624. */ -TEST_F(RadioHidlTest_v1_3, setSystemSelectionChannels) { +TEST_P(RadioHidlTest_v1_3, setSystemSelectionChannels) { serial = GetRandomSerialNumber(); RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, diff --git a/radio/1.3/vts/functional/radio_hidl_hal_test.cpp b/radio/1.3/vts/functional/radio_hidl_hal_test.cpp index a876b1a3f1..4581350e9b 100644 --- a/radio/1.3/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.3/vts/functional/radio_hidl_hal_test.cpp @@ -17,18 +17,10 @@ #include <radio_hidl_hal_utils_v1_3.h> void RadioHidlTest_v1_3::SetUp() { - radio_v1_3 = ::testing::VtsHalHidlTargetTestBase::getService< - ::android::hardware::radio::V1_3::IRadio>( - RadioHidlEnvironment::Instance() - ->getServiceName<::android::hardware::radio::V1_3::IRadio>( - hidl_string(RADIO_SERVICE_NAME))); + radio_v1_3 = ::android::hardware::radio::V1_3::IRadio::getService(GetParam()); if (radio_v1_3 == NULL) { sleep(60); - radio_v1_3 = ::testing::VtsHalHidlTargetTestBase::getService< - ::android::hardware::radio::V1_3::IRadio>( - RadioHidlEnvironment::Instance() - ->getServiceName<::android::hardware::radio::V1_3::IRadio>( - hidl_string(RADIO_SERVICE_NAME))); + radio_v1_3 = ::android::hardware::radio::V1_3::IRadio::getService(GetParam()); } ASSERT_NE(nullptr, radio_v1_3.get()); diff --git a/radio/1.3/vts/functional/radio_hidl_hal_utils_v1_3.h b/radio/1.3/vts/functional/radio_hidl_hal_utils_v1_3.h index 1d03a99e01..893eac52a2 100644 --- a/radio/1.3/vts/functional/radio_hidl_hal_utils_v1_3.h +++ b/radio/1.3/vts/functional/radio_hidl_hal_utils_v1_3.h @@ -16,8 +16,7 @@ #include <android-base/logging.h> -#include <VtsHalHidlTargetTestBase.h> -#include <VtsHalHidlTargetTestEnvBase.h> +#include <log/log.h> #include <chrono> #include <condition_variable> #include <mutex> @@ -609,25 +608,9 @@ class RadioIndication_v1_3 : public ::android::hardware::radio::V1_3::IRadioIndi const ::android::hardware::hidl_string& reason); }; -// Test environment for Radio HIDL HAL. -class RadioHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { - public: - // get the test environment singleton - static RadioHidlEnvironment* Instance() { - static RadioHidlEnvironment* instance = new RadioHidlEnvironment; - return instance; - } - virtual void registerTestServices() override { - registerTestService<::android::hardware::radio::V1_3::IRadio>(); - } - - private: - RadioHidlEnvironment() {} -}; - // The main test class for Radio HIDL. -class RadioHidlTest_v1_3 : public ::testing::VtsHalHidlTargetTestBase { - protected: +class RadioHidlTest_v1_3 : public ::testing::TestWithParam<std::string> { + protected: std::mutex mtx_; std::condition_variable cv_; int count_; diff --git a/radio/1.4/vts/functional/Android.bp b/radio/1.4/vts/functional/Android.bp index 6827132948..82844048b6 100644 --- a/radio/1.4/vts/functional/Android.bp +++ b/radio/1.4/vts/functional/Android.bp @@ -35,5 +35,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"] } diff --git a/radio/1.4/vts/functional/AndroidTest.xml b/radio/1.4/vts/functional/AndroidTest.xml new file mode 100644 index 0000000000..c9100470e4 --- /dev/null +++ b/radio/1.4/vts/functional/AndroidTest.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2019 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<configuration description="Runs VtsHalRadioV1_3TargetTest."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-native" /> + + <target_preparer class="com.android.tradefed.targetprep.MultiSimPreparer" /> + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"> + </target_preparer> + + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="cleanup" value="true" /> + <option name="push" value="VtsHalRadioV1_3TargetTest->/data/local/tmp/VtsHalRadioV1_3TargetTest" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="VtsHalRadioV1_3TargetTest" /> + </test> +</configuration> diff --git a/radio/1.4/vts/functional/VtsHalRadioV1_4TargetTest.cpp b/radio/1.4/vts/functional/VtsHalRadioV1_4TargetTest.cpp index d6330e6ab3..23ec011829 100644 --- a/radio/1.4/vts/functional/VtsHalRadioV1_4TargetTest.cpp +++ b/radio/1.4/vts/functional/VtsHalRadioV1_4TargetTest.cpp @@ -14,13 +14,12 @@ * limitations under the License. */ +#include <gtest/gtest.h> +#include <hidl/GtestPrinter.h> +#include <hidl/ServiceManagement.h> #include <radio_hidl_hal_utils_v1_4.h> -int main(int argc, char** argv) { - ::testing::AddGlobalTestEnvironment(RadioHidlEnvironment::Instance()); - ::testing::InitGoogleTest(&argc, argv); - RadioHidlEnvironment::Instance()->init(&argc, argv); - int status = RUN_ALL_TESTS(); - LOG(INFO) << "Test result = " << status; - return status; -}
\ No newline at end of file +INSTANTIATE_TEST_SUITE_P(PerInstance, RadioHidlTest_v1_4, + testing::ValuesIn(android::hardware::getAllHalInstanceNames( + ::android::hardware::radio::V1_4::IRadio::descriptor)), + android::hardware::PrintInstanceNameToString);
\ No newline at end of file diff --git a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp index a4953d7a70..95136bb3ae 100644 --- a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp @@ -21,7 +21,7 @@ /* * Test IRadio.emergencyDial() for the response returned. */ -TEST_F(RadioHidlTest_v1_4, emergencyDial) { +TEST_P(RadioHidlTest_v1_4, emergencyDial) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_0::Dial dialInfo; @@ -52,7 +52,7 @@ TEST_F(RadioHidlTest_v1_4, emergencyDial) { /* * Test IRadio.emergencyDial() with specified service and its response returned. */ -TEST_F(RadioHidlTest_v1_4, emergencyDial_withServices) { +TEST_P(RadioHidlTest_v1_4, emergencyDial_withServices) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_0::Dial dialInfo; @@ -84,7 +84,7 @@ TEST_F(RadioHidlTest_v1_4, emergencyDial_withServices) { /* * Test IRadio.emergencyDial() with known emergency call routing and its response returned. */ -TEST_F(RadioHidlTest_v1_4, emergencyDial_withEmergencyRouting) { +TEST_P(RadioHidlTest_v1_4, emergencyDial_withEmergencyRouting) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_0::Dial dialInfo; @@ -116,7 +116,7 @@ TEST_F(RadioHidlTest_v1_4, emergencyDial_withEmergencyRouting) { /* * Test IRadio.getPreferredNetworkTypeBitmap() for the response returned. */ -TEST_F(RadioHidlTest_v1_4, getPreferredNetworkTypeBitmap) { +TEST_P(RadioHidlTest_v1_4, getPreferredNetworkTypeBitmap) { serial = GetRandomSerialNumber(); Return<void> res = radio_v1_4->getPreferredNetworkTypeBitmap(serial); @@ -130,7 +130,7 @@ TEST_F(RadioHidlTest_v1_4, getPreferredNetworkTypeBitmap) { EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error); } -TEST_F(RadioHidlTest_v1_4, setPreferredNetworkTypeBitmap) { +TEST_P(RadioHidlTest_v1_4, setPreferredNetworkTypeBitmap) { serial = GetRandomSerialNumber(); ::android::hardware::hidl_bitfield<::android::hardware::radio::V1_4::RadioAccessFamily> network_type_bitmap{}; @@ -175,7 +175,7 @@ TEST_F(RadioHidlTest_v1_4, setPreferredNetworkTypeBitmap) { * REQUEST_NOT_SUPPORTED will be disallowed for all tests. Modems have "GSM" rat scan need to * support scanning requests combined with some parameters. */ -TEST_F(RadioHidlTest_v1_4, startNetworkScan) { +TEST_P(RadioHidlTest_v1_4, startNetworkScan) { serial = GetRandomSerialNumber(); RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, @@ -218,7 +218,7 @@ TEST_F(RadioHidlTest_v1_4, startNetworkScan) { /* * Test IRadio.startNetworkScan() with invalid specifier. */ -TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidArgument) { +TEST_P(RadioHidlTest_v1_4, startNetworkScan_InvalidArgument) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = {.type = ScanType::ONE_SHOT, @@ -246,7 +246,7 @@ TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidArgument) { /* * Test IRadio.startNetworkScan() with invalid interval (lower boundary). */ -TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidInterval1) { +TEST_P(RadioHidlTest_v1_4, startNetworkScan_InvalidInterval1) { serial = GetRandomSerialNumber(); RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, @@ -283,7 +283,7 @@ TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidInterval1) { /* * Test IRadio.startNetworkScan() with invalid interval (upper boundary). */ -TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidInterval2) { +TEST_P(RadioHidlTest_v1_4, startNetworkScan_InvalidInterval2) { serial = GetRandomSerialNumber(); RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, @@ -319,7 +319,7 @@ TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidInterval2) { /* * Test IRadio.startNetworkScan() with invalid max search time (lower boundary). */ -TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidMaxSearchTime1) { +TEST_P(RadioHidlTest_v1_4, startNetworkScan_InvalidMaxSearchTime1) { serial = GetRandomSerialNumber(); RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, @@ -355,7 +355,7 @@ TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidMaxSearchTime1) { /* * Test IRadio.startNetworkScan() with invalid max search time (upper boundary). */ -TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidMaxSearchTime2) { +TEST_P(RadioHidlTest_v1_4, startNetworkScan_InvalidMaxSearchTime2) { serial = GetRandomSerialNumber(); RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, @@ -391,7 +391,7 @@ TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidMaxSearchTime2) { /* * Test IRadio.startNetworkScan() with invalid periodicity (lower boundary). */ -TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidPeriodicity1) { +TEST_P(RadioHidlTest_v1_4, startNetworkScan_InvalidPeriodicity1) { serial = GetRandomSerialNumber(); RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, @@ -427,7 +427,7 @@ TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidPeriodicity1) { /* * Test IRadio.startNetworkScan() with invalid periodicity (upper boundary). */ -TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidPeriodicity2) { +TEST_P(RadioHidlTest_v1_4, startNetworkScan_InvalidPeriodicity2) { serial = GetRandomSerialNumber(); RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, @@ -463,7 +463,7 @@ TEST_F(RadioHidlTest_v1_4, startNetworkScan_InvalidPeriodicity2) { /* * Test IRadio.startNetworkScan() with valid periodicity */ -TEST_F(RadioHidlTest_v1_4, startNetworkScan_GoodRequest1) { +TEST_P(RadioHidlTest_v1_4, startNetworkScan_GoodRequest1) { serial = GetRandomSerialNumber(); RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, @@ -502,7 +502,7 @@ TEST_F(RadioHidlTest_v1_4, startNetworkScan_GoodRequest1) { /* * Test IRadio.startNetworkScan() with valid periodicity and plmns */ -TEST_F(RadioHidlTest_v1_4, startNetworkScan_GoodRequest2) { +TEST_P(RadioHidlTest_v1_4, startNetworkScan_GoodRequest2) { serial = GetRandomSerialNumber(); RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN, @@ -543,7 +543,7 @@ TEST_F(RadioHidlTest_v1_4, startNetworkScan_GoodRequest2) { /* * Test IRadio.getSignalStrength_1_4() for the response returned. */ -TEST_F(RadioHidlTest_v1_4, getSignalStrength_1_4) { +TEST_P(RadioHidlTest_v1_4, getSignalStrength_1_4) { serial = GetRandomSerialNumber(); radio_v1_4->getSignalStrength_1_4(serial); @@ -562,7 +562,7 @@ TEST_F(RadioHidlTest_v1_4, getSignalStrength_1_4) { /* * Test IRadio.setupDataCall_1_4() for the response returned. */ -TEST_F(RadioHidlTest_v1_4, setupDataCall_1_4) { +TEST_P(RadioHidlTest_v1_4, setupDataCall_1_4) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_4::AccessNetwork accessNetwork = @@ -617,7 +617,7 @@ TEST_F(RadioHidlTest_v1_4, setupDataCall_1_4) { /* * Test IRadio.getAllowedCarriers_1_4() for the response returned. */ -TEST_F(RadioHidlTest_v1_4, getAllowedCarriers_1_4) { +TEST_P(RadioHidlTest_v1_4, getAllowedCarriers_1_4) { serial = GetRandomSerialNumber(); radio_v1_4->getAllowedCarriers_1_4(serial); @@ -632,7 +632,7 @@ TEST_F(RadioHidlTest_v1_4, getAllowedCarriers_1_4) { /** * Test IRadio.setAllowedCarriers_1_4() for the response returned. */ -TEST_F(RadioHidlTest_v1_4, setAllowedCarriers_1_4) { +TEST_P(RadioHidlTest_v1_4, setAllowedCarriers_1_4) { serial = GetRandomSerialNumber(); CarrierRestrictionsWithPriority carrierRestrictions; memset(&carrierRestrictions, 0, sizeof(carrierRestrictions)); @@ -727,7 +727,7 @@ TEST_F(RadioHidlTest_v1_4, setAllowedCarriers_1_4) { } } -TEST_F(RadioHidlTest_v1_4, setDataProfile_1_4) { +TEST_P(RadioHidlTest_v1_4, setDataProfile_1_4) { serial = GetRandomSerialNumber(); // Create a dataProfileInfo @@ -770,7 +770,7 @@ TEST_F(RadioHidlTest_v1_4, setDataProfile_1_4) { } } -TEST_F(RadioHidlTest_v1_4, setInitialAttachApn_1_4) { +TEST_P(RadioHidlTest_v1_4, setInitialAttachApn_1_4) { serial = GetRandomSerialNumber(); // Create a dataProfileInfo @@ -812,7 +812,7 @@ TEST_F(RadioHidlTest_v1_4, setInitialAttachApn_1_4) { /* * Test IRadio.getDataRegistrationStateResponse_1_4() for the response returned. */ -TEST_F(RadioHidlTest_v1_4, getDataRegistrationState_1_4) { +TEST_P(RadioHidlTest_v1_4, getDataRegistrationState_1_4) { int rat; serial = GetRandomSerialNumber(); diff --git a/radio/1.4/vts/functional/radio_hidl_hal_test.cpp b/radio/1.4/vts/functional/radio_hidl_hal_test.cpp index f27749b3e3..15a0b24914 100644 --- a/radio/1.4/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.4/vts/functional/radio_hidl_hal_test.cpp @@ -17,18 +17,11 @@ #include <radio_hidl_hal_utils_v1_4.h> void RadioHidlTest_v1_4::SetUp() { - radio_v1_4 = ::testing::VtsHalHidlTargetTestBase::getService< - ::android::hardware::radio::V1_4::IRadio>( - RadioHidlEnvironment::Instance() - ->getServiceName<::android::hardware::radio::V1_4::IRadio>( - hidl_string(RADIO_SERVICE_NAME))); + radio_v1_4 = ::android::hardware::radio::V1_4::IRadio::getService(GetParam()); + if (radio_v1_4 == NULL) { sleep(60); - radio_v1_4 = ::testing::VtsHalHidlTargetTestBase::getService< - ::android::hardware::radio::V1_4::IRadio>( - RadioHidlEnvironment::Instance() - ->getServiceName<::android::hardware::radio::V1_4::IRadio>( - hidl_string(RADIO_SERVICE_NAME))); + radio_v1_4 = ::android::hardware::radio::V1_4::IRadio::getService(GetParam()); } ASSERT_NE(nullptr, radio_v1_4.get()); @@ -48,8 +41,7 @@ void RadioHidlTest_v1_4::SetUp() { EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error); sp<::android::hardware::radio::config::V1_1::IRadioConfig> radioConfig = - ::testing::VtsHalHidlTargetTestBase::getService< - ::android::hardware::radio::config::V1_1::IRadioConfig>(); + ::android::hardware::radio::config::V1_1::IRadioConfig::getService(); /* Enforce Vts tesing with RadioConfig is existed. */ ASSERT_NE(nullptr, radioConfig.get()); diff --git a/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h b/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h index b07f9c36e6..31b7e13e29 100644 --- a/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h +++ b/radio/1.4/vts/functional/radio_hidl_hal_utils_v1_4.h @@ -16,8 +16,7 @@ #include <android-base/logging.h> -#include <VtsHalHidlTargetTestBase.h> -#include <VtsHalHidlTargetTestEnvBase.h> +#include <log/log.h> #include <chrono> #include <condition_variable> #include <mutex> @@ -28,6 +27,7 @@ #include <android/hardware/radio/1.4/IRadioIndication.h> #include <android/hardware/radio/1.4/IRadioResponse.h> #include <android/hardware/radio/1.4/types.h> +#include <gtest/gtest.h> #include "vts_test_util.h" @@ -705,25 +705,9 @@ class RadioIndication_v1_4 : public ::android::hardware::radio::V1_4::IRadioIndi const ::android::hardware::hidl_string& reason); }; -// Test environment for Radio HIDL HAL. -class RadioHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { - public: - // get the test environment singleton - static RadioHidlEnvironment* Instance() { - static RadioHidlEnvironment* instance = new RadioHidlEnvironment; - return instance; - } - virtual void registerTestServices() override { - registerTestService<::android::hardware::radio::V1_4::IRadio>(); - } - - private: - RadioHidlEnvironment() {} -}; - // The main test class for Radio HIDL. -class RadioHidlTest_v1_4 : public ::testing::VtsHalHidlTargetTestBase { - protected: +class RadioHidlTest_v1_4 : public ::testing::TestWithParam<std::string> { + protected: std::mutex mtx_; std::condition_variable cv_; int count_; |