Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a60b89b authored by sqian's avatar sqian
Browse files

Sim Status Present VTS

Fix and enhance sim-present tests,
Save VTS running time,
Fix serial number inconsistancy issue

Fix and enhance sim-present tests:
In 1.0:
- setupDataCall timeout, need more waiting time
- requestIccSimAuthentication returns REQUEST_NOT_SUPPORTED,
need to check it
- sendSms timeout, would need more waiting time
- sendSMSExpectMore timeout, would need more waiting time
- getAllowedCarriers, getting CardState::RESTRICTED, the previous test
of setAllowedCarriers is doing resetting back to no carrier restriction,
but that needs some time to populate.
In 1.1:
- setSimCardPower_1_1 set sim card power down that makes other tests
fail, reset it back with sim card power on.

Save VTS running time,
- Use waiting loop and prevent unnecessary waiting to save the whole
running time.

Fix serial number inconsistancy issue
- During the enforcement running, it is liked the serial number is
not consistent. And it happens in b/78249227. Suspect that when sim
card is inserted, during the testing running time, the radio may
request some response that is not triggered from the test, but the
test may receive it and think it is what is triggered by the test. The
fix is to check serial number before notifying of unlock the test
lock.

Bug: 76125134
Bug: 78248071
Bug: 78139665
Bug: 78249227
Test: run vts -m VtsHalRadioV1_0Target; run vts -m VtsHalRadioV1_1Target
Change-Id: I08fe9d7ac16283c7ce1a5aeb6b3b372786a8d5c3
Merged-In: I08fe9d7ac16283c7ce1a5aeb6b3b372786a8d5c3
(cherry picked from commit 788eb808)
parent 085c7ef6
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ using namespace ::android::hardware::radio::V1_0;
 * Test IRadio.setGsmBroadcastConfig() for the response returned.
 */
TEST_F(RadioHidlTest, setGsmBroadcastConfig) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    // Create GsmBroadcastSmsConfigInfo #1
    GsmBroadcastSmsConfigInfo gbSmsConfig1;
@@ -85,7 +85,7 @@ TEST_F(RadioHidlTest, setGsmBroadcastConfig) {
 * Test IRadio.getGsmBroadcastConfig() for the response returned.
 */
TEST_F(RadioHidlTest, getGsmBroadcastConfig) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    radio->getGsmBroadcastConfig(serial);

@@ -105,7 +105,7 @@ TEST_F(RadioHidlTest, getGsmBroadcastConfig) {
 * Test IRadio.setCdmaBroadcastConfig() for the response returned.
 */
TEST_F(RadioHidlTest, setCdmaBroadcastConfig) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    CdmaBroadcastSmsConfigInfo cbSmsConfig;
    cbSmsConfig.serviceCategory = 4096;
@@ -132,7 +132,7 @@ TEST_F(RadioHidlTest, setCdmaBroadcastConfig) {
 * Test IRadio.getCdmaBroadcastConfig() for the response returned.
 */
TEST_F(RadioHidlTest, getCdmaBroadcastConfig) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    radio->getCdmaBroadcastConfig(serial);

@@ -150,7 +150,7 @@ TEST_F(RadioHidlTest, getCdmaBroadcastConfig) {
 * Test IRadio.setCdmaBroadcastActivation() for the response returned.
 */
TEST_F(RadioHidlTest, setCdmaBroadcastActivation) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    bool activate = false;

    radio->setCdmaBroadcastActivation(serial, activate);
@@ -170,7 +170,7 @@ TEST_F(RadioHidlTest, setCdmaBroadcastActivation) {
 * Test IRadio.setGsmBroadcastActivation() for the response returned.
 */
TEST_F(RadioHidlTest, setGsmBroadcastActivation) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    bool activate = false;

    radio->setGsmBroadcastActivation(serial, activate);
+8 −8
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ using namespace ::android::hardware::radio::V1_0;
 * Test IRadio.getDataRegistrationState() for the response returned.
 */
TEST_F(RadioHidlTest, getDataRegistrationState) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    radio->getDataRegistrationState(serial);

@@ -39,7 +39,7 @@ TEST_F(RadioHidlTest, getDataRegistrationState) {
 * Test IRadio.setupDataCall() for the response returned.
 */
TEST_F(RadioHidlTest, setupDataCall) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    RadioTechnology radioTechnology = RadioTechnology::LTE;

@@ -70,7 +70,7 @@ TEST_F(RadioHidlTest, setupDataCall) {
    radio->setupDataCall(serial, radioTechnology, dataProfileInfo, modemCognitive, roamingAllowed,
                         isRoaming);

    EXPECT_EQ(std::cv_status::no_timeout, wait());
    EXPECT_EQ(std::cv_status::no_timeout, wait(300));
    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
    EXPECT_EQ(serial, radioRsp->rspInfo.serial);

@@ -87,7 +87,7 @@ TEST_F(RadioHidlTest, setupDataCall) {
 * Test IRadio.deactivateDataCall() for the response returned.
 */
TEST_F(RadioHidlTest, deactivateDataCall) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    int cid = 1;
    bool reasonRadioShutDown = false;

@@ -109,7 +109,7 @@ TEST_F(RadioHidlTest, deactivateDataCall) {
 * Test IRadio.getDataCallList() for the response returned.
 */
TEST_F(RadioHidlTest, getDataCallList) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    radio->getDataCallList(serial);

@@ -128,7 +128,7 @@ TEST_F(RadioHidlTest, getDataCallList) {
 * Test IRadio.setInitialAttachApn() for the response returned.
 */
TEST_F(RadioHidlTest, setInitialAttachApn) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    DataProfileInfo dataProfileInfo;
    memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
@@ -171,7 +171,7 @@ TEST_F(RadioHidlTest, setInitialAttachApn) {
 * Test IRadio.setDataAllowed() for the response returned.
 */
TEST_F(RadioHidlTest, setDataAllowed) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    bool allow = true;

    radio->setDataAllowed(serial, allow);
@@ -189,7 +189,7 @@ TEST_F(RadioHidlTest, setDataAllowed) {
 * Test IRadio.setDataProfile() for the response returned.
 */
TEST_F(RadioHidlTest, setDataProfile) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    // Create a dataProfileInfo
    DataProfileInfo dataProfileInfo;
+17 −16
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ TEST_F(RadioHidlTest, getIccCardStatus) {
 * Test IRadio.supplyIccPinForApp() for the response returned
 */
TEST_F(RadioHidlTest, supplyIccPinForApp) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
    // 3GPP2 apps only
@@ -53,7 +53,7 @@ TEST_F(RadioHidlTest, supplyIccPinForApp) {
 * Test IRadio.supplyIccPukForApp() for the response returned.
 */
TEST_F(RadioHidlTest, supplyIccPukForApp) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
    // 3GPP2 apps only
@@ -76,7 +76,7 @@ TEST_F(RadioHidlTest, supplyIccPukForApp) {
 * Test IRadio.supplyIccPin2ForApp() for the response returned.
 */
TEST_F(RadioHidlTest, supplyIccPin2ForApp) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
    // 3GPP2 apps only
@@ -99,7 +99,7 @@ TEST_F(RadioHidlTest, supplyIccPin2ForApp) {
 * Test IRadio.supplyIccPuk2ForApp() for the response returned.
 */
TEST_F(RadioHidlTest, supplyIccPuk2ForApp) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
    // 3GPP2 apps only
@@ -122,7 +122,7 @@ TEST_F(RadioHidlTest, supplyIccPuk2ForApp) {
 * Test IRadio.changeIccPinForApp() for the response returned.
 */
TEST_F(RadioHidlTest, changeIccPinForApp) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
    // 3GPP2 apps only
@@ -145,7 +145,7 @@ TEST_F(RadioHidlTest, changeIccPinForApp) {
 * Test IRadio.changeIccPin2ForApp() for the response returned.
 */
TEST_F(RadioHidlTest, changeIccPin2ForApp) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
    // 3GPP2 apps only
@@ -168,7 +168,7 @@ TEST_F(RadioHidlTest, changeIccPin2ForApp) {
 * Test IRadio.getImsiForApp() for the response returned.
 */
TEST_F(RadioHidlTest, getImsiForApp) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    // Check success returned while getting imsi for 3GPP and 3GPP2 apps only
    for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
@@ -196,7 +196,7 @@ TEST_F(RadioHidlTest, getImsiForApp) {
 * Test IRadio.iccIOForApp() for the response returned.
 */
TEST_F(RadioHidlTest, iccIOForApp) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
        IccIo iccIo;
@@ -221,7 +221,7 @@ TEST_F(RadioHidlTest, iccIOForApp) {
 * Test IRadio.iccTransmitApduBasicChannel() for the response returned.
 */
TEST_F(RadioHidlTest, iccTransmitApduBasicChannel) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    SimApdu msg;
    memset(&msg, 0, sizeof(msg));
    msg.data = hidl_string();
@@ -238,7 +238,7 @@ TEST_F(RadioHidlTest, iccTransmitApduBasicChannel) {
 * Test IRadio.iccOpenLogicalChannel() for the response returned.
 */
TEST_F(RadioHidlTest, iccOpenLogicalChannel) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    int p2 = 0x04;
    // Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is requested.
    for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
@@ -253,7 +253,7 @@ TEST_F(RadioHidlTest, iccOpenLogicalChannel) {
 * Test IRadio.iccCloseLogicalChannel() for the response returned.
 */
TEST_F(RadioHidlTest, iccCloseLogicalChannel) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    // Try closing invalid channel and check INVALID_ARGUMENTS returned as error
    radio->iccCloseLogicalChannel(serial, 0);
    EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -267,7 +267,7 @@ TEST_F(RadioHidlTest, iccCloseLogicalChannel) {
 * Test IRadio.iccTransmitApduLogicalChannel() for the response returned.
 */
TEST_F(RadioHidlTest, iccTransmitApduLogicalChannel) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    SimApdu msg;
    memset(&msg, 0, sizeof(msg));
    msg.data = hidl_string();
@@ -284,17 +284,18 @@ TEST_F(RadioHidlTest, iccTransmitApduLogicalChannel) {
 * Test IRadio.requestIccSimAuthentication() for the response returned.
 */
TEST_F(RadioHidlTest, requestIccSimAuthentication) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    // Pass wrong challenge string and check RadioError::INVALID_ARGUMENTS
    // returned as error.
    // or REQUEST_NOT_SUPPORTED returned as error.
    for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
        radio->requestIccSimAuthentication(serial, 0, hidl_string("test"),
                                           cardStatus.applications[i].aidPtr);
        EXPECT_EQ(std::cv_status::no_timeout, wait());
        EXPECT_EQ(serial, radioRsp->rspInfo.serial);
        EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
        EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
        ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::INVALID_ARGUMENTS,
                                                               RadioError::REQUEST_NOT_SUPPORTED}));
    }
}

@@ -302,7 +303,7 @@ TEST_F(RadioHidlTest, requestIccSimAuthentication) {
 * Test IRadio.supplyNetworkDepersonalization() for the response returned.
 */
TEST_F(RadioHidlTest, supplyNetworkDepersonalization) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    radio->supplyNetworkDepersonalization(serial, hidl_string("test"));
    EXPECT_EQ(std::cv_status::no_timeout, wait());
+9 −9
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ using namespace ::android::hardware::radio::V1_0;
 * Test IRadio.getClir() for the response returned.
 */
TEST_F(RadioHidlTest, getClir) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    radio->getClir(serial);

@@ -40,7 +40,7 @@ TEST_F(RadioHidlTest, getClir) {
 * Test IRadio.setClir() for the response returned.
 */
TEST_F(RadioHidlTest, setClir) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    int32_t status = 1;

    radio->setClir(serial, status);
@@ -58,7 +58,7 @@ TEST_F(RadioHidlTest, setClir) {
 * Test IRadio.getFacilityLockForApp() for the response returned.
 */
TEST_F(RadioHidlTest, getFacilityLockForApp) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    std::string facility = "";
    std::string password = "";
    int32_t serviceClass = 1;
@@ -81,7 +81,7 @@ TEST_F(RadioHidlTest, getFacilityLockForApp) {
 * Test IRadio.setFacilityLockForApp() for the response returned.
 */
TEST_F(RadioHidlTest, setFacilityLockForApp) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    std::string facility = "";
    bool lockState = false;
    std::string password = "";
@@ -105,7 +105,7 @@ TEST_F(RadioHidlTest, setFacilityLockForApp) {
 * Test IRadio.setBarringPassword() for the response returned.
 */
TEST_F(RadioHidlTest, setBarringPassword) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    std::string facility = "";
    std::string oldPassword = "";
    std::string newPassword = "";
@@ -128,7 +128,7 @@ TEST_F(RadioHidlTest, setBarringPassword) {
 * Test IRadio.getClip() for the response returned.
 */
TEST_F(RadioHidlTest, getClip) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    radio->getClip(serial);

@@ -146,7 +146,7 @@ TEST_F(RadioHidlTest, getClip) {
 * Test IRadio.setSuppServiceNotifications() for the response returned.
 */
TEST_F(RadioHidlTest, setSuppServiceNotifications) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    bool enable = false;

    radio->setSuppServiceNotifications(serial, enable);
@@ -165,7 +165,7 @@ TEST_F(RadioHidlTest, setSuppServiceNotifications) {
 * Test IRadio.requestIsimAuthentication() for the response returned.
 */
TEST_F(RadioHidlTest, requestIsimAuthentication) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();
    std::string challenge = "";

    radio->requestIsimAuthentication(serial, challenge);
@@ -187,7 +187,7 @@ TEST_F(RadioHidlTest, requestIsimAuthentication) {
 * Test IRadio.getImsRegistrationState() for the response returned.
 */
TEST_F(RadioHidlTest, getImsRegistrationState) {
    int serial = GetRandomSerialNumber();
    serial = GetRandomSerialNumber();

    radio->getImsRegistrationState(serial);

+76 −49

File changed.

Preview size limit exceeded, changes collapsed.

Loading