xref: /kvm-unit-tests/arm/pci-test.c (revision f7f81c6a1b8d92f08c106572e2c4b5f139437af8)
1 /*
2  * PCI bus operation test
3  *
4  * Copyright (C) 2016, Red Hat Inc, Alexander Gordeev <agordeev@redhat.com>
5  *
6  * This work is licensed under the terms of the GNU LGPL, version 2.
7  */
8 #include <libcflat.h>
9 #include <pci.h>
10 
11 #define NR_TESTS (PCI_TESTDEV_NUM_BARS * PCI_TESTDEV_NUM_TESTS)
12 
13 int main(void)
14 {
15 	int ret;
16 
17 	if (!pci_probe())
18 		report_abort("PCI bus probing failed\n");
19 
20 	pci_print();
21 
22 	ret = pci_testdev();
23 	report("PCI test device passed %d/%d tests",
24 		ret >= NR_TESTS, ret > 0 ? ret : 0, NR_TESTS);
25 
26 	return report_summary();
27 }
28