jolly has uploaded this change for review.
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(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/05/42805/1
diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index 5e7c49b..6d4d6c9 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -1129,11 +1129,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 */
@@ -1181,6 +1219,7 @@
execute( TC_unexpected_procedure_byte() );
execute( TC_procedure_byte_timeout() );
execute( TC_status_word_timeout() );
+ execute( TC_empty_slot() );
}
To view, visit change 42805. To unsubscribe, or for help writing mail filters, visit settings.