Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the search pattern for CAN device (BugFix) #849

Merged

Conversation

stanley31huang
Copy link
Collaborator

@stanley31huang stanley31huang commented Nov 28, 2023

BugFix: Fixed the udevadm parser for CAN devices

Modify the search pattern for CAN devices, including new llcecan device, and adding unit tests

Description

There are two kind of CAN devices on NXP S32G development board, one is generic CAN device named as canxxxx, another one is can devices from Low Latency Communication Engine (LLCE) and named as llcecanxxxx.
The current implementation for CAN devices in udevadm parser is the device name should starts with 'can' string.

So I have modified the search pattern for CAN devices, including new llcecan device, and adding unit tests.

I also applied this patch to the checkbox to ensure checkbox could identified both generic CAN device and LLCE CAN devices on NXP S32G development board.

Resolved issues

N/A

Documentation

N/A

Tests

stanley@stanley-ThinkPad-T490:~/Desktop/Git_Repos/checkbox-2023$ PYTHONPATH=checkbox-support/:$PYTHONAPATH python3 -m unittest -vv checkbox-support/checkbox_support/parsers/tests/test_udevadm.py
-k test_NXP_S32G_SOCKETCAN
test_NXP_S32G_SOCKETCAN (checkbox-support.checkbox_support.parsers.tests.test_udevadm.TestUdevadmParser) ... ok


Ran 1 test in 0.079s

OK

C3 submission with side-load checkbox:
https://certification.canonical.com/hardware/202304-31451/submission/349081/test-results/pass/

Update the search pattern for CAN device and adding unittest
Copy link

codecov bot commented Nov 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (545b143) 35.38% compared to head (db8ec4e) 35.39%.
Report is 49 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #849      +/-   ##
==========================================
+ Coverage   35.38%   35.39%   +0.01%     
==========================================
  Files         303      303              
  Lines       34240    34240              
  Branches     5917     5917              
==========================================
+ Hits        12115    12119       +4     
+ Misses      21559    21558       -1     
+ Partials      566      563       -3     
Flag Coverage Δ
checkbox-support 49.83% <100.00%> (+0.08%) ⬆️

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.

@stanley31huang stanley31huang changed the title Fix: update the search pattern for CAN device update the search pattern for CAN device (BugFix) Nov 28, 2023
@pieqq
Copy link
Collaborator

pieqq commented Dec 6, 2023

/canonical/self-hosted-runners/run-workflows 00873f7

Copy link
Collaborator

@pieqq pieqq left a comment

Choose a reason for hiding this comment

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

Thanks for this PR!

There are already unit tests for the udevadm parser, they are located in checkbox-support/checkbox_support/parsers/tests/test_udevadm.py (with sample data hosted in checkbox-support/checkbox_support/parsers/tests/udevadm_data).

Is there a reason why you separated your tests and put them at a different location?

I recommend you add the outcome of your own DUT in the udevadm_data, and add your tests to test_udevadm.py. You can look at how tests have been implemented there and use similar methods.

For your information, there are already a few sample data files that have a Canbus device: ZCU104.txt and CARA_T_SOCKETCAN.txt. You can leverage these when you write your tests to make sure your changes don't impact existing data.

fixed the unit tests for the CAN device in NXP S32G
@stanley31huang
Copy link
Collaborator Author

@pieqq I just sent a new commits for those suggestion you came up. Please review this PR again, thanks.

Copy link
Collaborator

@pieqq pieqq left a comment

Choose a reason for hiding this comment

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

One question about the regex being used below.

Also, since both CARA_T_SOCKETCAN.txt and ZCU104.txt have a socketcan device, could you add a check in their respective unit tests? This will help with regression testing.

checkbox-support/checkbox_support/parsers/udevadm.py Outdated Show resolved Hide resolved
@pieqq
Copy link
Collaborator

pieqq commented Jan 2, 2024

/canonical/self-hosted-runners/run-workflows db8ec4e

@pieqq
Copy link
Collaborator

pieqq commented Jan 2, 2024

Thanks for the changes! I added a check for socketcan devices in the ZCU104 unit test, so we're good to go!

@pieqq pieqq enabled auto-merge (squash) January 2, 2024 05:31
@pieqq pieqq disabled auto-merge January 2, 2024 06:20
Copy link
Contributor

@diohe0311 diohe0311 left a comment

Choose a reason for hiding this comment

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

LGTM +1
Just learnt from here that we can run a single unit test, nice!

@diohe0311 diohe0311 merged commit 2e0f376 into canonical:main Jan 2, 2024
12 checks passed
LiaoU3 pushed a commit to LiaoU3/checkbox that referenced this pull request Jan 9, 2024
* Fix: update the search pattern for CAN device

Update the search pattern for CAN device and adding unittest

* Fix: fixed unit test for NXP S32G

fixed the unit tests for the CAN device in NXP S32G

* Fix: updated the search pattern

updated the search pattern

* Add check for socketcan in udevadm parser unit test for ZCU

---------

Co-authored-by: Pierre Equoy <[email protected]>
LiaoU3 pushed a commit to LiaoU3/checkbox that referenced this pull request Mar 20, 2024
* Fix: update the search pattern for CAN device

Update the search pattern for CAN device and adding unittest

* Fix: fixed unit test for NXP S32G

fixed the unit tests for the CAN device in NXP S32G

* Fix: updated the search pattern

updated the search pattern

* Add check for socketcan in udevadm parser unit test for ZCU

---------

Co-authored-by: Pierre Equoy <[email protected]>
@stanley31huang stanley31huang deleted the 211123_identify-can-devices branch March 21, 2024 01:47
binli pushed a commit to binli/checkbox that referenced this pull request Mar 22, 2024
* Fix: update the search pattern for CAN device

Update the search pattern for CAN device and adding unittest

* Fix: fixed unit test for NXP S32G

fixed the unit tests for the CAN device in NXP S32G

* Fix: updated the search pattern

updated the search pattern

* Add check for socketcan in udevadm parser unit test for ZCU

---------

Co-authored-by: Pierre Equoy <[email protected]>
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.

3 participants