diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2022-04-11 17:52:07 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-04-11 17:52:07 +0000 |
commit | 210c44dbe1c42320019332c352f44dcae598ba32 (patch) | |
tree | 19635ec10215171063338276164d4f30cd2a2322 | |
parent | 18704f22a0b86d890d2d19a3097ce1044be20f64 (diff) | |
parent | 148303775a3e5248ce1e5a62e5edf4e14298ab49 (diff) |
Merge changes I45e60f32,I2c8d3a16
* changes:
wait for response before running next TC
set SIM slots mapping based on current mapping
-rw-r--r-- | radio/aidl/vts/radio_config_test.cpp | 79 |
1 files changed, 55 insertions, 24 deletions
diff --git a/radio/aidl/vts/radio_config_test.cpp b/radio/aidl/vts/radio_config_test.cpp index 5e1c811d91..81d87d23c4 100644 --- a/radio/aidl/vts/radio_config_test.cpp +++ b/radio/aidl/vts/radio_config_test.cpp @@ -59,6 +59,7 @@ TEST_P(RadioConfigTest, getHalDeviceCapabilities) { serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_config->getHalDeviceCapabilities(serial); ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); ALOGI("getHalDeviceCapabilities, rspInfo.error = %s\n", toString(radioRsp_config->rspInfo.error).c_str()); } @@ -70,6 +71,7 @@ TEST_P(RadioConfigTest, getSimSlotsStatus) { serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_config->getSimSlotsStatus(serial); ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); ALOGI("getSimSlotsStatus, rspInfo.error = %s\n", toString(radioRsp_config->rspInfo.error).c_str()); } @@ -166,31 +168,60 @@ TEST_P(RadioConfigTest, setPreferredDataModem_invalidArgument) { * Test IRadioConfig.setSimSlotsMapping() for the response returned. */ TEST_P(RadioConfigTest, setSimSlotsMapping) { - serial = GetRandomSerialNumber(); - SlotPortMapping slotPortMapping; - slotPortMapping.physicalSlotId = 0; - slotPortMapping.portId = 0; - std::vector<SlotPortMapping> slotPortMappingList = {slotPortMapping}; - if (isDsDsEnabled()) { - slotPortMapping.physicalSlotId = 1; - slotPortMappingList.push_back(slotPortMapping); - } else if (isTsTsEnabled()) { - slotPortMapping.physicalSlotId = 1; - slotPortMappingList.push_back(slotPortMapping); - slotPortMapping.physicalSlotId = 2; - slotPortMappingList.push_back(slotPortMapping); - } - ndk::ScopedAStatus res = radio_config->setSimSlotsMapping(serial, slotPortMappingList); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type); - EXPECT_EQ(serial, radioRsp_config->rspInfo.serial); - ALOGI("setSimSlotsMapping, rspInfo.error = %s\n", - toString(radioRsp_config->rspInfo.error).c_str()); - ASSERT_TRUE(CheckAnyOfErrors(radioRsp_config->rspInfo.error, {RadioError::NONE})); + // get slot status and set SIM slots mapping based on the result. + updateSimSlotStatus(); + if (radioRsp_config->rspInfo.error == RadioError::NONE) { + SlotPortMapping slotPortMapping; + // put invalid value at first and adjust by slotStatusResponse. + slotPortMapping.physicalSlotId = -1; + slotPortMapping.portId = -1; + std::vector<SlotPortMapping> slotPortMappingList = {slotPortMapping}; + if (isDsDsEnabled()) { + slotPortMappingList.push_back(slotPortMapping); + } else if (isTsTsEnabled()) { + slotPortMappingList.push_back(slotPortMapping); + slotPortMappingList.push_back(slotPortMapping); + } + for (size_t i = 0; i < radioRsp_config->simSlotStatus.size(); i++) { + ASSERT_TRUE(radioRsp_config->simSlotStatus[i].portInfo.size() > 0); + for (size_t j = 0; j < radioRsp_config->simSlotStatus[i].portInfo.size(); j++) { + if (radioRsp_config->simSlotStatus[i].portInfo[j].portActive) { + int32_t logicalSlotId = + radioRsp_config->simSlotStatus[i].portInfo[j].logicalSlotId; + // logicalSlotId should be 0 or positive numbers if the port + // is active. + EXPECT_GE(logicalSlotId, 0); + // logicalSlotId should be less than the maximum number of + // supported SIM slots. + EXPECT_LT(logicalSlotId, slotPortMappingList.size()); + if (logicalSlotId >= 0 && logicalSlotId < slotPortMappingList.size()) { + slotPortMappingList[logicalSlotId].physicalSlotId = i; + slotPortMappingList[logicalSlotId].portId = j; + } + } + } + } - // Give some time for modem to fully switch SIM configuration - sleep(MODEM_SET_SIM_SLOT_MAPPING_DELAY_IN_SECONDS); + // set SIM slots mapping + for (size_t i = 0; i < slotPortMappingList.size(); i++) { + // physicalSlotId and portId should be 0 or positive numbers for the + // input of setSimSlotsMapping. + EXPECT_GE(slotPortMappingList[i].physicalSlotId, 0); + EXPECT_GE(slotPortMappingList[i].portId, 0); + } + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = radio_config->setSimSlotsMapping(serial, slotPortMappingList); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type); + EXPECT_EQ(serial, radioRsp_config->rspInfo.serial); + ALOGI("setSimSlotsMapping, rspInfo.error = %s\n", + toString(radioRsp_config->rspInfo.error).c_str()); + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_config->rspInfo.error, {RadioError::NONE})); + + // Give some time for modem to fully switch SIM configuration + sleep(MODEM_SET_SIM_SLOT_MAPPING_DELAY_IN_SECONDS); + } } /* |