test: Add test for PCI device without compat string and with DT node
authorMarek Vasut <marek.vasut@gmail.com>
Wed, 10 Oct 2018 19:27:09 +0000 (21:27 +0200)
committerTom Rini <trini@konsulko.com>
Sat, 20 Oct 2018 19:23:38 +0000 (15:23 -0400)
Add test which checks if a PCI device described in DT with an
entry and reg = <...> property, but without compatible string
results in a valid U-Boot PCI udevice with the udevice.node
populated with reference to this DT node. Also check if the
other PCI device without a DT node does not contain any bogus
udevice.node.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
test/dm/pci.c

index 8699700..a1dedd8 100644 (file)
@@ -119,8 +119,13 @@ static int dm_test_pci_drvdata(struct unit_test_state *uts)
 
        ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(1, 0x08, 0), &swap));
        ut_asserteq(SWAP_CASE_DRV_DATA, swap->driver_data);
+       ut_assertok(dev_of_valid(swap));
        ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(1, 0x0c, 0), &swap));
        ut_asserteq(SWAP_CASE_DRV_DATA, swap->driver_data);
+       ut_assertok(dev_of_valid(swap));
+       ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(1, 0x10, 0), &swap));
+       ut_asserteq(SWAP_CASE_DRV_DATA, swap->driver_data);
+       ut_assertok(!dev_of_valid(swap));
 
        return 0;
 }