laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42805?usp=email )
Change subject: CCID: Check response of reader with empty SIM carrier ......................................................................
CCID: Check response of reader with empty SIM carrier
The reader has a SIM carrier inserted, but there is no response from the SIM while expecting the ATR. The reader will get a timeout and is expected to respond with a suitable error code.
The test uses the slot with the SIMtrace inserted. The SIMtrace will not respond with an ATR. This way there is no (extra) empty slot required for this test.
Change-Id: Ifebdcce8f9dd9a51de5a5cb6cf223041d5c38622 --- M ccid/CCID_Tests.ttcn 1 file changed, 41 insertions(+), 2 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn index 8184bf3..a637d10 100644 --- a/ccid/CCID_Tests.ttcn +++ b/ccid/CCID_Tests.ttcn @@ -971,11 +971,49 @@ f_start_and_wait(); }
+/* The SIM slot is empty, but closed. There is no ATR received. */ +private function f_TC_empty_slot() runs on CardemSlot_CT +{ + var octetstring req := c_SIM_SELECT_EF_ICCID; + var octetstring res := '9000'O; + var CCID_PDU ccid_pdu; + var CCID_PDU par; + + /* Do not start SIM emulation, so there is no ATR. */ + f_cardem_transmit(ts_SIMTRACE_CEMU_SET_ATR(''O)); + f_sleep(0.2); + + f_ccid_power_on(CCID_PWRSEL_3V0, tr_CCID_HeaderIN_FAIL(CCID_ERR_ICC_MUTE, CCID_ICC_STATUS_PRES_INACT)); + + /* Send a request towards reader. */ + CCID.send(ts_CCID_XfrBlock(g_slot_nr, req, 0)); + /* Receive the response from reader. */ + ccid_pdu := f_ccid_receive(tr_CCID_DataBlock(g_slot_nr, ?, ?, ?)); + if (ccid_pdu.hdr_in.bError != CCID_ERR_CMD_NOT_SUPPORTED) { + setverdict(fail, "Unexpected Response or error code"); + mtc.stop; + } + /* Send GetParameters on empty slot. */ + par := f_ccid_get_par(); + log(par); + // FIXME: check result code + + /* Stop simtrace emulation, to prevent race condition. */ + vc_Cardem.stop; + vc_Cardem.done; +} +testcase TC_empty_slot() runs on Test_CT +{ + f_init(); + + f_start_handler(refers(f_TC_empty_slot), mp_simtrace_slot, true); + + f_start_and_wait(); +} +
/* TODO */ /* IccPowerOn with wrong voltage (> 0x04) */ -/* XfrBlock on empty slot */ -/* GetParameters on empty slot */ /* SetParameters for bProtocolNum > 0x01 */ /* SetParameters: invalid parameters */ /* set unsupported frequency */ @@ -1019,6 +1057,7 @@ execute( TC_unsupp_secure() ); execute( TC_truncated() ); execute( TC_truncated_response() ); + execute( TC_empty_slot() ); }