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

Cover smaller genio tests (New) #1060

Merged
merged 10 commits into from
Mar 13, 2024
Merged

Cover smaller genio tests (New) #1060

merged 10 commits into from
Mar 13, 2024

Conversation

fernando79513
Copy link
Collaborator

@fernando79513 fernando79513 commented Mar 13, 2024

Description

After the inclusion of genio tests on the contrib area of checkbox, we have to add unit-tests to ensure the coverage requirements are satisfied. We have included unit-tests for the scripts with less than 100 LOC

Resolved issues

https://warthogs.atlassian.net/browse/CHECKBOX-996

Documentation

There are no changes to the documentation

Tests

To run the unittests:

cd ~/checkbox/contrib/genio
pytest

Coverage Report

Module statements missing excluded branches partial coverage
bin/pmic_regulator.py 49 1 0 16 1 97%
bin/spidev_test.py 37 1 0 12 1 96%
bin/dvfs_gpu_check_governors.py 25 1 0 12 1 95%
bin/linux_ccf.py 45 1 0 18 2 95%
bin/serialcheck.py 34 1 0 8 1 95%
bin/boot_partition.py 91 91 0 28 0 0%
bin/brightness_test.py 92 92 0 30 0 0%
bin/cpu_idle.py 142 142 0 50 0 0%
bin/gpio_loopback_test.py 92 92 0 24 0 0%
Total 607 422 0 198 6 30%

@fernando79513
Copy link
Collaborator Author

I tried to modify the code as little as possible. There were some mistakes that I had to fix to be able to run the unit-tests, but there are still many small things on the test that could be simplified, made more clear, and more general.

@fernando79513
Copy link
Collaborator Author

Here you can have the coverage in html:
htmlcov.zip

kissiel
kissiel previously approved these changes Mar 13, 2024
Copy link
Contributor

@kissiel kissiel left a comment

Choose a reason for hiding this comment

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

I guess in order to make it more tidy, it would require a bit more refactoring.
I added some suggestions below.
Overall landable as is, +1

contrib/genio/bin/serialcheck.py Show resolved Hide resolved
contrib/genio/bin/spidev_test.py Outdated Show resolved Hide resolved
Copy link
Contributor

@kissiel kissiel left a comment

Choose a reason for hiding this comment

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

Still great! +1

@fernando79513 fernando79513 merged commit 71f0d20 into main Mar 13, 2024
4 checks passed
@fernando79513 fernando79513 deleted the cover-smaller-genio-tests branch March 13, 2024 17:50
LiaoU3 pushed a commit to LiaoU3/checkbox that referenced this pull request Mar 20, 2024
* Formatted dvfs test and removed typos

* Added test for dvfs_gpu_check_governors

* Raise SystemExit only on fail

* Added serialcheck tests

* Fixed Error raise when stdout is empty

* Added spidev test

* Added pmic regulator tests

* Fixed errors in linux_ccf

 - Moved check_env_variables to function so the module can be imported without requiring them
 - Added choices for devices considered in the test
 - Test failing with wrong verify output

* Added linux ccf tests

* Update contrib/genio/bin/spidev_test.py

Co-authored-by: kissiel <[email protected]>

---------

Co-authored-by: kissiel <[email protected]>
binli pushed a commit to binli/checkbox that referenced this pull request Mar 22, 2024
* Formatted dvfs test and removed typos

* Added test for dvfs_gpu_check_governors

* Raise SystemExit only on fail

* Added serialcheck tests

* Fixed Error raise when stdout is empty

* Added spidev test

* Added pmic regulator tests

* Fixed errors in linux_ccf

 - Moved check_env_variables to function so the module can be imported without requiring them
 - Added choices for devices considered in the test
 - Test failing with wrong verify output

* Added linux ccf tests

* Update contrib/genio/bin/spidev_test.py

Co-authored-by: kissiel <[email protected]>

---------

Co-authored-by: kissiel <[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.

2 participants