Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions avocado/utils/pci.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def get_pci_class_name(pci_address):
"0280": "net",
"0207": "net",
"0c03": "usb",
"1200": "accelerator",

Choose a reason for hiding this comment

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

medium

While this addition is correct, there are a couple of ways to improve the quality of this module:

  1. Testing: The get_pci_class_name function is not covered by unit tests in selftests/unit/utils/pci.py. Please add tests to verify this new 'accelerator' class and ideally the existing ones to prevent future regressions.

  2. Maintainability: The pci_class_dic could be improved by defining it as a module-level constant and keeping its keys sorted. This would improve performance by avoiding its recreation on every call and make it easier to maintain.

}
pci_class_id = get_pci_prop(pci_address, "Class")
if pci_class_id not in pci_class_dic:
Expand Down