Lines Matching full:test

3  * Userspace PCI Endpoint Test Module
39 static int run_test(struct pci_test *test) in run_test() argument
45 fd = open(test->device, O_RDWR); in run_test()
47 perror("can't open PCI Endpoint Test device"); in run_test()
51 if (test->barnum >= 0 && test->barnum <= 5) { in run_test()
52 ret = ioctl(fd, PCITEST_BAR, test->barnum); in run_test()
53 fprintf(stdout, "BAR%d:\t\t", test->barnum); in run_test()
55 fprintf(stdout, "TEST FAILED\n"); in run_test()
60 if (test->set_irqtype) { in run_test()
61 ret = ioctl(fd, PCITEST_SET_IRQTYPE, test->irqtype); in run_test()
62 fprintf(stdout, "SET IRQ TYPE TO %s:\t\t", irq[test->irqtype]); in run_test()
69 if (test->get_irqtype) { in run_test()
78 if (test->clear_irq) { in run_test()
87 if (test->legacyirq) { in run_test()
91 fprintf(stdout, "TEST FAILED\n"); in run_test()
96 if (test->msinum > 0 && test->msinum <= 32) { in run_test()
97 ret = ioctl(fd, PCITEST_MSI, test->msinum); in run_test()
98 fprintf(stdout, "MSI%d:\t\t", test->msinum); in run_test()
100 fprintf(stdout, "TEST FAILED\n"); in run_test()
105 if (test->msixnum > 0 && test->msixnum <= 2048) { in run_test()
106 ret = ioctl(fd, PCITEST_MSIX, test->msixnum); in run_test()
107 fprintf(stdout, "MSI-X%d:\t\t", test->msixnum); in run_test()
109 fprintf(stdout, "TEST FAILED\n"); in run_test()
114 if (test->write) { in run_test()
115 param.size = test->size; in run_test()
116 if (test->use_dma) in run_test()
119 fprintf(stdout, "WRITE (%7ld bytes):\t\t", test->size); in run_test()
121 fprintf(stdout, "TEST FAILED\n"); in run_test()
126 if (test->read) { in run_test()
127 param.size = test->size; in run_test()
128 if (test->use_dma) in run_test()
131 fprintf(stdout, "READ (%7ld bytes):\t\t", test->size); in run_test()
133 fprintf(stdout, "TEST FAILED\n"); in run_test()
138 if (test->copy) { in run_test()
139 param.size = test->size; in run_test()
140 if (test->use_dma) in run_test()
143 fprintf(stdout, "COPY (%7ld bytes):\t\t", test->size); in run_test()
145 fprintf(stdout, "TEST FAILED\n"); in run_test()
152 return (ret < 0) ? ret : 1 - ret; /* return 0 if test succeeded */ in run_test()
158 struct pci_test *test; in main() local
160 test = calloc(1, sizeof(*test)); in main()
161 if (!test) { in main()
167 test->barnum = -1; in main()
170 test->size = 0x19000; in main()
173 test->device = "/dev/pci-endpoint-test.0"; in main()
178 test->device = optarg; in main()
181 test->barnum = atoi(optarg); in main()
182 if (test->barnum < 0 || test->barnum > 5) in main()
186 test->legacyirq = true; in main()
189 test->msinum = atoi(optarg); in main()
190 if (test->msinum < 1 || test->msinum > 32) in main()
194 test->msixnum = atoi(optarg); in main()
195 if (test->msixnum < 1 || test->msixnum > 2048) in main()
199 test->irqtype = atoi(optarg); in main()
200 if (test->irqtype < 0 || test->irqtype > 2) in main()
202 test->set_irqtype = true; in main()
205 test->get_irqtype = true; in main()
208 test->read = true; in main()
211 test->write = true; in main()
214 test->copy = true; in main()
217 test->clear_irq = true; in main()
220 test->size = strtoul(optarg, NULL, 0); in main()
223 test->use_dma = true; in main()
231 "\t-D <dev> PCI endpoint test device {default: /dev/pci-endpoint-test.0}\n" in main()
232 "\t-b <bar num> BAR test (bar number between 0..5)\n" in main()
233 "\t-m <msi num> MSI test (msi number between 1..32)\n" in main()
234 "\t-x <msix num> \tMSI-X test (msix number between 1..2048)\n" in main()
239 "\t-l Legacy IRQ test\n" in main()
240 "\t-r Read buffer test\n" in main()
241 "\t-w Write buffer test\n" in main()
242 "\t-c Copy buffer test\n" in main()
249 return run_test(test); in main()