jolly has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42806?usp=email )


Change subject: CCID: Check if reader handles Abort correctly
......................................................................

CCID: Check if reader handles Abort correctly

This test fails with osmo-ccid-firmware, because it is not yet
implemented.

Change-Id: Iebe97e73497b8468ebf08faf2c4db700fc76997f
---
M ccid/CCID_Tests.ttcn
1 file changed, 53 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/06/42806/1

diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index 6d4d6c9..a9d640e 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -803,6 +803,58 @@
        f_start_and_wait();
 }

+/* The SIM transfer is aborted. */
+private function f_TC_abort() runs on CardemSlot_CT
+{
+       var octetstring req := c_SIM_READ_BINARY;
+       var CCID_PDU ccid_pdu;
+
+       /* We need to emulate a SIM that does not respond, so we can be sure
+        * that the reader is still waiting while we abort.
+        */
+       f_cardem_manager();
+
+       f_ccid_power_on(CCID_PWRSEL_3V0);
+
+       /* Send a request towards reader. */
+       CCID.send(ts_CCID_XfrBlock(g_slot_nr, req, 0));
+       /* Receive the request by SIM. */
+       f_cardem_receive(tr_SIMTRACE_CEMU_RX_DATA(?, req));
+       /* Transmit NULL procedure byte by SIM. */
+       
f_cardem_transmit(ts_SIMTRACE_CEMU_TX_DATA(ts_CardEmu_DataFlags(pb_and_tx := 
true, final := true),
+                                                  req[1]));
+       /* Send abort toward reader. */
+       CCID.send(ts_CCID_Abort(g_slot_nr, 0));
+       /* Eat the possible 'DataBlock' that will be received after timeout. */
+       timer T := 1.0;
+       T.start;
+       alt {
+       [] CCID.receive(tr_CCID_DataBlock(g_slot_nr, ?, ?, ?)) {
+               log("Eating 'DataBlock'.");
+               repeat;
+               }
+       [] T.timeout { }
+       }
+       /* Receive the response from reader. */
+       ccid_pdu := f_ccid_receive(tr_CCID_SlotStatus(g_slot_nr, ?, ?, ?));
+       if (ccid_pdu.hdr_in.bStatus.bmCommandStatus != CCID_CMD_STATUS_OK) {
+               setverdict(fail, "Unexpected Response");
+               mtc.stop;
+       }
+
+       /* Stop simtrace emulation, to prevent race condition. */
+       vc_Cardem.stop;
+       vc_Cardem.done;
+}
+testcase TC_abort() runs on Test_CT
+{
+       f_init();
+
+       f_start_handler(refers(f_TC_abort), mp_simtrace_slot, true);
+
+       f_start_and_wait();
+}
+


 /* TODO */
@@ -1205,6 +1257,7 @@
        execute( TC_256_bytes_response() );
        execute( TC_null_procedure_byte() );
        execute( TC_255_bytes_request() );
+       execute( TC_abort() );

        /* error handling */
        execute( TC_inval_slot() );

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42806?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Iebe97e73497b8468ebf08faf2c4db700fc76997f
Gerrit-Change-Number: 42806
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <[email protected]>

Reply via email to