Skip to content

Fixed issue with usb string comparison (BugFix)#1477

Merged
pieqq merged 2 commits intomainfrom
fix-error-with-usb3gen2x1
Sep 16, 2024
Merged

Fixed issue with usb string comparison (BugFix)#1477
pieqq merged 2 commits intomainfrom
fix-error-with-usb3gen2x1

Conversation

@fernando79513
Copy link
Copy Markdown
Collaborator

Description

Taking a look at #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

@fernando79513 fernando79513 changed the title Fixed issue with usb string comparison Fixed issue with usb string comparison (BugFix) Sep 16, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented Sep 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@           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 Coverage Δ
checkbox-support 60.37% <100.00%> (+0.01%) ⬆️

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.

Copy link
Copy Markdown
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 finding this issue and providing a quick fix for it!

@pieqq pieqq merged commit 3ba7e2c into main Sep 16, 2024
@pieqq pieqq deleted the fix-error-with-usb3gen2x1 branch September 16, 2024 20:58
@eugene-yujinwu
Copy link
Copy Markdown
Contributor

my bad! Thanks for the fix.

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