Started 1 day 1 hr ago
Took 7 min 52 sec
on simtester
Started by timer | |
This run spent:
| |
| Revision: f2567de387c71cf637a4cb1365089ba7173870b0
Repository: https://gerrit.osmocom.org/pysim
|
Started by timer | |
This run spent:
| |
| Revision: f2567de387c71cf637a4cb1365089ba7173870b0
Repository: https://gerrit.osmocom.org/pysim
|
pysim/pcsc: do not use getProtocol for protocol selection The documentation of the getProtocol provided by pyscard says: "Return bit mask for the protocol of connection, or None if no protocol set. The return value is a bit mask of CardConnection.T0_protocol, CardConnection.T1_protocol, CardConnection.RAW_protocol, CardConnection.T15_protocol" This suggests that the purpose of getProtocol is not to determine which protocols are supported. Its purpose is to determine which protocol is currently selected (either through auto selection or through the explicit selection made by the API user). This means we are using getProtocol wrong. So far this was no problem, since the auto-selected protocol should be a supported protocol anyway. However, the automatic protocol selection may not always return a correct result (see bug report from THD-siegfried [1]). Let's not trust the automatic protocol selection. Instead let's parse the ATR and make the decision based on the TD1/TD2 bytes). [1] https://osmocom.org/issues/6952 Related: OS#6952 Change-Id: Ib119948aa68c430e42ac84daec8b9bd542db7963 docs: auto-generate Card Filesystem Reference Add a Sphinx extension (docs/pysim_fs_sphinx.py) that hooks into the builder-inited event and generates docs/filesystem.rst before Sphinx reads any source files. The generated page contains a hierarchical listing of all implemented EFs and DFs, organised by application/specification (UICC/TS 102 221, ADF.USIM/TS 31.102, ADF.ISIM/TS 31.103, SIM/TS 51.011). For each file, the class docstring and any _test_de_encode / _test_decode vectors are included as an encoding/decoding example table. docs/filesystem.rst is fully generated at build time and is therefore added to .gitignore. Add tests/unittests/test_fs_coverage.py that walks all pySim.* modules and verifies that every CardProfile, CardApplication, and standalone CardDF subclass with EF/DF children is either listed in the SECTIONS (and will appear in the docs) or explicitly EXCLUDED. Change-Id: I06ddeefc6c11e04d7c24e116f3f39c8a6635856f Related: OS#6316
laforge
at
filesystem: edit_{binary,record}_decoded: add encode/decode examples When invoking `edit_binary_decoded` or `edit_record_decoded`, the temp file opened in the editor now contains the EF's encode/decode test vectors as //-comment lines below the JSON content, similar to how 'git commit' appends comments to the commit message template. The comment block is stripped before JSON parsing on save, so it has no effect on the written data. The feature is implemented via a new module-level JsonEditor context manager class that encapsulates the full edit cycle: * write JSON + examples to a TemporaryDirectory * invoke the editor * read back, strip //-comments, parse and return the result Change-Id: I5a046a9c7ba7e08a98cf643d5a26bc669539b38f Related: OS#6900
laforge
at
filesystem: JsonEditor: use NamedTemporaryFile A plain NamedTemporaryFile is sufficient here: we only need a single file, not a directory to hold it. Using NamedTemporaryFile is simpler (no subdirectory to manage) and gives us a .json suffix for free, which editors use for syntax highlighting. Change-Id: If3b0bd0fcc90732407dbd03b9cc883f7abeb948e filesystem: JsonEditor: offer interactive retry on error When json.loads() fails (e.g. the user made a syntax mistake), prompt the user with "Re-open file for editing? [y]es/[n]o:" and loop back to the editor if they answer 'y' or 'yes'. If the user declines, return the original unmodified value so no write is attempted; the temp file is still cleaned up by __exit__() in that case. Change-Id: I9161b7becea0d8dfd3f5f740fbb253da2f061a1d Related: OS#6899 tests: fix TransRecEF _test_de_encode to operate at file level Previously, _test_de_encode vectors for TransRecEF subclasses were tested via decode_record_hex()/encode_record_hex(), i.e. one record at a time, with the decoded value being a scalar. Switch test_de_encode_record() in TransRecEF_Test to use decode_hex() / encode_hex() instead, so that vectors represent whole-file content (decoded value is a list of records) -- consistent with how LinFixedEF handles _test_de_encode. Update all existing vectors accordingly. Change-Id: I4a9610f9ee39833cd0c90f64f89f5fbdd6f0846d pySim/ts_51_011.py: add multi-record test vector for EF_PL Change-Id: I9f7a444b18056b1683cbd52a25af950125531746 |