canonical / checkbox

Checkbox is a testing framework used to validate device compatibility with Ubuntu Linux. It’s the testing tool developed for the purposes of the Ubuntu Certification program.
https://checkbox.readthedocs.io
GNU General Public License v3.0
34 stars 50 forks source link

Fixed issue with usb string comparison (BugFix) #1477

Closed fernando79513 closed 2 months ago

fernando79513 commented 2 months ago

Description

Taking a look at https://github.com/canonical/checkbox/issues/1456 I saw that there is an error in the "insertion" condition. Explanation The line:

python Copy code if "USB Mass Storage device detected" or "uas" in line_str: does not work as intended because of the way Python evaluates conditional expressions. Here's what's happening step by step:

Expression Evaluation Order:

Python evaluates "USB Mass Storage device detected" first. Since non-empty strings are considered True in a boolean context, "USB Mass Storage device detected" evaluates to True. Therefore, the entire expression before the or operator is True.

Resolved issues

N/A

Documentation

N/A

Tests

Run Storage tests (22.04 laptop) checkbox-cli run com.canonical.certification::usb3-cert-manual

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 47.10%. Comparing base (bf03f1a) to head (813f0f2). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1477 +/- ## ======================================= Coverage 47.09% 47.10% ======================================= Files 368 368 Lines 39435 39435 Branches 6667 6667 ======================================= + Hits 18573 18574 +1 Misses 20156 20156 + Partials 706 705 -1 ``` | [Flag](https://app.codecov.io/gh/canonical/checkbox/pull/1477/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=canonical) | Coverage Δ | | |---|---|---| | [checkbox-support](https://app.codecov.io/gh/canonical/checkbox/pull/1477/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=canonical) | `60.37% <100.00%> (+0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=canonical#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

eugene-yujinwu commented 2 months ago

my bad! Thanks for the fix.