Skip to content

Conversation

@hanhsuan
Copy link
Contributor

@hanhsuan hanhsuan commented Jul 9, 2025

Description

This PR is going to add smart card relevant test cases and test plan. Including

  1. add libpcsclite-dev and swig to tox environment to make pyscard could be compiled
  2. add python3-pyscard under cehckbox-provider-base in the snapcraft.yaml
  3. add new smartcard category
  4. add smartcard_resource_contact resource job to generate contact type smart card reader
  5. add smartcard_resource_contactless resource job to generate contactless type smart card reader (The contactless smart card reader could not test without moving card manually)
  6. add smartcard/smartcard-reader-info to dump smart card reader debug information to log
  7. add smartcard/smartcard-reader-detect-contact to detect contact type smart card reader
  8. add smartcard/smartcard-reader-detect-contactless to detect contactless type smart card reader
  9. add smartcard/smartcard-reader-send-apdu-auto to test the APDU command could be sent and processed
  10. add smartcard/smartcard-reader-detect-contact-manual to test contact type smart card reader could detect smart card insert/remove
  11. add smartcard/smartcard-reader-detect-contactless-manual to test contactless type smart card reader could detect smart card insert/remove

Resolved issues

https://warthogs.atlassian.net/browse/SOMERVILLE-2331

Documentation

Tests

Building test:
https://github.com/canonical/checkbox/actions/runs/16443809078

@codecov
Copy link

codecov bot commented Jul 13, 2025

Codecov Report

❌ Patch coverage is 93.54839% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.83%. Comparing base (e054a85) to head (0741c89).
⚠️ Report is 28 commits behind head on main.

Files with missing lines Patch % Lines
providers/base/bin/smartcard_test.py 93.54% 2 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2013      +/-   ##
==========================================
+ Coverage   53.82%   54.83%   +1.00%     
==========================================
  Files         406      413       +7     
  Lines       43289    45015    +1726     
  Branches     7997     8408     +411     
==========================================
+ Hits        23301    24682    +1381     
- Misses      19176    19487     +311     
- Partials      812      846      +34     
Flag Coverage Δ
checkbox-ng 70.84% <ø> (-0.74%) ⬇️
checkbox-support 68.50% <ø> (+3.21%) ⬆️
provider-base 32.58% <92.74%> (+1.67%) ⬆️
provider-certification-client 57.14% <ø> (ø)
provider-certification-server 57.14% <ø> (ø)
provider-genio 96.90% <ø> (ø)
provider-gpgpu 93.14% <ø> (ø)
provider-iiotg 100.00% <ø> (ø)
provider-resource 39.57% <ø> (ø)
provider-sru 97.97% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hanhsuan hanhsuan force-pushed the add_smartcard_test branch from ac45574 to 9cf1e5a Compare July 20, 2025 02:50
hanhsuan added a commit that referenced this pull request Jul 21, 2025
@hanhsuan hanhsuan force-pushed the add_smartcard_test branch from 9cf1e5a to 90c96da Compare July 21, 2025 12:06
hanhsuan added a commit that referenced this pull request Jul 22, 2025
@hanhsuan hanhsuan force-pushed the add_smartcard_test branch from 90c96da to d63740f Compare July 22, 2025 12:02
@hanhsuan hanhsuan marked this pull request as ready for review July 22, 2025 13:06
Copy link
Contributor

@tomli380576 tomli380576 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall lgtm the main thing is the comparison on line 186

@hanhsuan hanhsuan requested a review from tomli380576 September 1, 2025 12:18
tomli380576
tomli380576 previously approved these changes Sep 5, 2025
Copy link
Contributor

@tomli380576 tomli380576 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, I tested with 202411-36032's built-in reader and all the commands work as expected

@Hook25
Copy link
Collaborator

Hook25 commented Sep 12, 2025

Hook25
Hook25 previously approved these changes Jan 22, 2026
Copy link
Collaborator

@Hook25 Hook25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, lgtm, sorry it took this much. Feel free to land it.

Have a few comments below for minor things

sudo add-apt-repository ppa:checkbox-dev/edge
sudo apt-get update
sudo apt-get install -y -qq libgl1 gcc python$PYTHON_VERSION-dev shellcheck
sudo apt-get install -y -qq libgl1 gcc python$PYTHON_VERSION-dev shellcheck libpcsclite-dev swig
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? aren't those build depends?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they are. PySCard will be built from source code with the libpcsclite Python bindings that generated by swig in the tox environment.

Co-authored-by: Massimiliano <massimiliano.girardi@canonical.com>
hanhsuan and others added 2 commits January 23, 2026 14:19
Co-authored-by: Massimiliano <massimiliano.girardi@canonical.com>
@hanhsuan
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants