Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
PCI: Add KUnit tests for __pci_read_base()
Currently it is hard to debug issues in the resource assignment code due to long reporduction cycles between the developer trying to fix the code and the user testing it due to the lack of hardware device with the developer [1]. [1]: https://lore.kernel.org/all/20210621123714.GA3286648@bjorn-Precision-5520/ This adds KUnit tests for __pci_read_base() which is only dependent on software structures, so no hardware is needed to run these. This lays the foundation for test fixtures we can use to reproduce the resource assignment code path of PCI. Sample output from KUnit Test run: # Subtest: __pci_read_base() 1..3 # test_pci_read_base_type_0_hdr_approach_1: initializing __pci_read_base() tests (null): reg 0x18: [mem 0x4f400000-0x4f400fff] ok 1 - test_pci_read_base_type_0_hdr_approach_1 # test_pci_read_base_type_0_hdr_approach_2: initializing __pci_read_base() tests (null): reg 0x18: [mem 0x4f400000-0x4f400fff] (null): reg 0x1c: [mem 0xaf400000-0xaf4000ff] ok 2 - test_pci_read_base_type_0_hdr_approach_2 # test_pci_read_base_type_1_hdr: initializing __pci_read_base() tests (null): reg 0x10: [mem 0xaf400000-0xaf4000ff] ok 3 - test_pci_read_base_type_1_hdr # __pci_read_base(): pass:3 fail:0 skip:0 total:3 # Totals: pass:3 fail:0 skip:0 total:3 # ok 8 - __pci_read_base() Suggested-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Naveen Naidu <naveennaidu479@gmail.com>
- Loading branch information