Alexander Gordeev | f7f81c6 | 2016-11-07 11:14:44 +0100 | [diff] [blame] | 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 | |
Andrew Jones | 24f588e | 2016-12-02 13:57:55 +0100 | [diff] [blame] | 17 | if (!pci_probe()) { |
| 18 | printf("PCI bus probing failed, skipping tests...\n"); |
| 19 | return report_summary(); |
| 20 | } |
Alexander Gordeev | f7f81c6 | 2016-11-07 11:14:44 +0100 | [diff] [blame] | 21 | |
| 22 | pci_print(); |
| 23 | |
| 24 | ret = pci_testdev(); |
Andrew Jones | 24f588e | 2016-12-02 13:57:55 +0100 | [diff] [blame] | 25 | if (ret == -1) |
| 26 | report_skip("No PCI test device"); |
| 27 | else |
| 28 | report("PCI test device passed %d/%d tests", |
| 29 | ret >= NR_TESTS, ret > 0 ? ret : 0, NR_TESTS); |
Alexander Gordeev | f7f81c6 | 2016-11-07 11:14:44 +0100 | [diff] [blame] | 30 | |
| 31 | return report_summary(); |
| 32 | } |