Lines Matching full:test

3  * Userspace PCI Endpoint Test Module
41 static int run_test(struct pci_test *test) in run_test() argument
47 fd = open(test->device, O_RDWR); in run_test()
49 perror("can't open PCI Endpoint Test device"); in run_test()
53 if (test->barnum >= 0 && test->barnum <= 5) { in run_test()
54 ret = ioctl(fd, PCITEST_BAR, test->barnum); in run_test()
55 fprintf(stdout, "BAR%d:\t\t", test->barnum); in run_test()
57 fprintf(stdout, "TEST FAILED\n"); in run_test()
62 if (test->set_irqtype) { in run_test()
63 ret = ioctl(fd, PCITEST_SET_IRQTYPE, test->irqtype); in run_test()
64 fprintf(stdout, "SET IRQ TYPE TO %s:\t\t", irq[test->irqtype]); in run_test()
71 if (test->get_irqtype) { in run_test()
80 if (test->clear_irq) { in run_test()
89 if (test->legacyirq) { in run_test()
93 fprintf(stdout, "TEST FAILED\n"); in run_test()
98 if (test->msinum > 0 && test->msinum <= 32) { in run_test()
99 ret = ioctl(fd, PCITEST_MSI, test->msinum); in run_test()
100 fprintf(stdout, "MSI%d:\t\t", test->msinum); in run_test()
102 fprintf(stdout, "TEST FAILED\n"); in run_test()
107 if (test->msixnum > 0 && test->msixnum <= 2048) { in run_test()
108 ret = ioctl(fd, PCITEST_MSIX, test->msixnum); in run_test()
109 fprintf(stdout, "MSI-X%d:\t\t", test->msixnum); in run_test()
111 fprintf(stdout, "TEST FAILED\n"); in run_test()
116 if (test->write) { in run_test()
117 param.size = test->size; in run_test()
118 if (test->use_dma) in run_test()
121 fprintf(stdout, "WRITE (%7ld bytes):\t\t", test->size); in run_test()
123 fprintf(stdout, "TEST FAILED\n"); in run_test()
128 if (test->read) { in run_test()
129 param.size = test->size; in run_test()
130 if (test->use_dma) in run_test()
133 fprintf(stdout, "READ (%7ld bytes):\t\t", test->size); in run_test()
135 fprintf(stdout, "TEST FAILED\n"); in run_test()
140 if (test->copy) { in run_test()
141 param.size = test->size; in run_test()
142 if (test->use_dma) in run_test()
145 fprintf(stdout, "COPY (%7ld bytes):\t\t", test->size); in run_test()
147 fprintf(stdout, "TEST FAILED\n"); in run_test()
154 return (ret < 0) ? ret : 1 - ret; /* return 0 if test succeeded */ in run_test()
160 struct pci_test *test; in main() local
162 test = calloc(1, sizeof(*test)); in main()
163 if (!test) { in main()
169 test->barnum = -1; in main()
172 test->size = 0x19000; in main()
175 test->device = "/dev/pci-endpoint-test.0"; in main()
180 test->device = optarg; in main()
183 test->barnum = atoi(optarg); in main()
184 if (test->barnum < 0 || test->barnum > 5) in main()
188 test->legacyirq = true; in main()
191 test->msinum = atoi(optarg); in main()
192 if (test->msinum < 1 || test->msinum > 32) in main()
196 test->msixnum = atoi(optarg); in main()
197 if (test->msixnum < 1 || test->msixnum > 2048) in main()
201 test->irqtype = atoi(optarg); in main()
202 if (test->irqtype < 0 || test->irqtype > 2) in main()
204 test->set_irqtype = true; in main()
207 test->get_irqtype = true; in main()
210 test->read = true; in main()
213 test->write = true; in main()
216 test->copy = true; in main()
219 test->clear_irq = true; in main()
222 test->size = strtoul(optarg, NULL, 0); in main()
225 test->use_dma = true; in main()
233 "\t-D <dev> PCI endpoint test device {default: /dev/pci-endpoint-test.0}\n" in main()
234 "\t-b <bar num> BAR test (bar number between 0..5)\n" in main()
235 "\t-m <msi num> MSI test (msi number between 1..32)\n" in main()
236 "\t-x <msix num> \tMSI-X test (msix number between 1..2048)\n" in main()
241 "\t-l Legacy IRQ test\n" in main()
242 "\t-r Read buffer test\n" in main()
243 "\t-w Write buffer test\n" in main()
244 "\t-c Copy buffer test\n" in main()
251 return run_test(test); in main()