"pci_endpoint_test" driver now returns 0 for success and negative error code for failure. So adapt to the change by reporting FAILURE if the return value is < 0, and SUCCESS otherwise.
Cc: stable@vger.kernel.org #5.10 Fixes: 3f2ed8134834 ("tools: PCI: Add a userspace tool to test PCI endpoint") Signed-off-by: Manivannan Sadhasivam manivannan.sadhasivam@linaro.org --- tools/pci/pcitest.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c index 441b54234635..a4e5b17cc3b5 100644 --- a/tools/pci/pcitest.c +++ b/tools/pci/pcitest.c @@ -18,7 +18,6 @@
#define BILLION 1E9
-static char *result[] = { "NOT OKAY", "OKAY" }; static char *irq[] = { "LEGACY", "MSI", "MSI-X" };
struct pci_test { @@ -54,9 +53,9 @@ static int run_test(struct pci_test *test) ret = ioctl(fd, PCITEST_BAR, test->barnum); fprintf(stdout, "BAR%d:\t\t", test->barnum); if (ret < 0) - fprintf(stdout, "TEST FAILED\n"); + fprintf(stdout, "FAILED\n"); else - fprintf(stdout, "%s\n", result[ret]); + fprintf(stdout, "SUCCESS\n"); }
if (test->set_irqtype) { @@ -65,16 +64,18 @@ static int run_test(struct pci_test *test) if (ret < 0) fprintf(stdout, "FAILED\n"); else - fprintf(stdout, "%s\n", result[ret]); + fprintf(stdout, "SUCCESS\n"); }
if (test->get_irqtype) { ret = ioctl(fd, PCITEST_GET_IRQTYPE); fprintf(stdout, "GET IRQ TYPE:\t\t"); - if (ret < 0) + if (ret < 0) { fprintf(stdout, "FAILED\n"); - else + } else { fprintf(stdout, "%s\n", irq[ret]); + ret = 0; + } }
if (test->clear_irq) { @@ -83,34 +84,34 @@ static int run_test(struct pci_test *test) if (ret < 0) fprintf(stdout, "FAILED\n"); else - fprintf(stdout, "%s\n", result[ret]); + fprintf(stdout, "SUCCESS\n"); }
if (test->legacyirq) { ret = ioctl(fd, PCITEST_LEGACY_IRQ, 0); fprintf(stdout, "LEGACY IRQ:\t"); if (ret < 0) - fprintf(stdout, "TEST FAILED\n"); + fprintf(stdout, "FAILED\n"); else - fprintf(stdout, "%s\n", result[ret]); + fprintf(stdout, "SUCCESS\n"); }
if (test->msinum > 0 && test->msinum <= 32) { ret = ioctl(fd, PCITEST_MSI, test->msinum); fprintf(stdout, "MSI%d:\t\t", test->msinum); if (ret < 0) - fprintf(stdout, "TEST FAILED\n"); + fprintf(stdout, "FAILED\n"); else - fprintf(stdout, "%s\n", result[ret]); + fprintf(stdout, "SUCCESS\n"); }
if (test->msixnum > 0 && test->msixnum <= 2048) { ret = ioctl(fd, PCITEST_MSIX, test->msixnum); fprintf(stdout, "MSI-X%d:\t\t", test->msixnum); if (ret < 0) - fprintf(stdout, "TEST FAILED\n"); + fprintf(stdout, "FAILED\n"); else - fprintf(stdout, "%s\n", result[ret]); + fprintf(stdout, "SUCCESS\n"); }
if (test->write) { @@ -120,9 +121,9 @@ static int run_test(struct pci_test *test) ret = ioctl(fd, PCITEST_WRITE, ¶m); fprintf(stdout, "WRITE (%7ld bytes):\t\t", test->size); if (ret < 0) - fprintf(stdout, "TEST FAILED\n"); + fprintf(stdout, "FAILED\n"); else - fprintf(stdout, "%s\n", result[ret]); + fprintf(stdout, "SUCCESS\n"); }
if (test->read) { @@ -132,9 +133,9 @@ static int run_test(struct pci_test *test) ret = ioctl(fd, PCITEST_READ, ¶m); fprintf(stdout, "READ (%7ld bytes):\t\t", test->size); if (ret < 0) - fprintf(stdout, "TEST FAILED\n"); + fprintf(stdout, "FAILED\n"); else - fprintf(stdout, "%s\n", result[ret]); + fprintf(stdout, "SUCCESS\n"); }
if (test->copy) { @@ -144,14 +145,14 @@ static int run_test(struct pci_test *test) ret = ioctl(fd, PCITEST_COPY, ¶m); fprintf(stdout, "COPY (%7ld bytes):\t\t", test->size); if (ret < 0) - fprintf(stdout, "TEST FAILED\n"); + fprintf(stdout, "FAILED\n"); else - fprintf(stdout, "%s\n", result[ret]); + fprintf(stdout, "SUCCESS\n"); }
fflush(stdout); close(fd); - return (ret < 0) ? ret : 1 - ret; /* return 0 if test succeeded */ + return ret; }
int main(int argc, char **argv)
On Wed, Aug 24, 2022 at 06:00:07PM +0530, Manivannan Sadhasivam wrote:
"pci_endpoint_test" driver now returns 0 for success and negative error code for failure. So adapt to the change by reporting FAILURE if the return value is < 0, and SUCCESS otherwise.
Cc: stable@vger.kernel.org #5.10 Fixes: 3f2ed8134834 ("tools: PCI: Add a userspace tool to test PCI endpoint") Signed-off-by: Manivannan Sadhasivam manivannan.sadhasivam@linaro.org
tools/pci/pcitest.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c index 441b54234635..a4e5b17cc3b5 100644 --- a/tools/pci/pcitest.c +++ b/tools/pci/pcitest.c @@ -18,7 +18,6 @@ #define BILLION 1E9 -static char *result[] = { "NOT OKAY", "OKAY" }; static char *irq[] = { "LEGACY", "MSI", "MSI-X" }; struct pci_test { @@ -54,9 +53,9 @@ static int run_test(struct pci_test *test) ret = ioctl(fd, PCITEST_BAR, test->barnum); fprintf(stdout, "BAR%d:\t\t", test->barnum); if (ret < 0)
fprintf(stdout, "TEST FAILED\n");
elsefprintf(stdout, "FAILED\n");
fprintf(stdout, "%s\n", result[ret]);
fprintf(stdout, "SUCCESS\n");
Is this following the kernel TAP output rules? If not, why not? If so, say that you are fixing that issue up in the changelog text.
thanks,
greg k-h
On Wed, Aug 24, 2022 at 02:44:06PM +0200, Greg KH wrote:
On Wed, Aug 24, 2022 at 06:00:07PM +0530, Manivannan Sadhasivam wrote:
"pci_endpoint_test" driver now returns 0 for success and negative error code for failure. So adapt to the change by reporting FAILURE if the return value is < 0, and SUCCESS otherwise.
Cc: stable@vger.kernel.org #5.10 Fixes: 3f2ed8134834 ("tools: PCI: Add a userspace tool to test PCI endpoint") Signed-off-by: Manivannan Sadhasivam manivannan.sadhasivam@linaro.org
tools/pci/pcitest.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c index 441b54234635..a4e5b17cc3b5 100644 --- a/tools/pci/pcitest.c +++ b/tools/pci/pcitest.c @@ -18,7 +18,6 @@ #define BILLION 1E9 -static char *result[] = { "NOT OKAY", "OKAY" }; static char *irq[] = { "LEGACY", "MSI", "MSI-X" }; struct pci_test { @@ -54,9 +53,9 @@ static int run_test(struct pci_test *test) ret = ioctl(fd, PCITEST_BAR, test->barnum); fprintf(stdout, "BAR%d:\t\t", test->barnum); if (ret < 0)
fprintf(stdout, "TEST FAILED\n");
elsefprintf(stdout, "FAILED\n");
fprintf(stdout, "%s\n", result[ret]);
fprintf(stdout, "SUCCESS\n");
Is this following the kernel TAP output rules? If not, why not? If so,
It is not following the TAP rules currently as I was not aware of it. Now that you pointed out, I'll try to adapt to it.
Thanks, Mani
say that you are fixing that issue up in the changelog text.
thanks,
greg k-h
On Wed, Aug 24, 2022 at 02:44:06PM +0200, Greg KH wrote:
On Wed, Aug 24, 2022 at 06:00:07PM +0530, Manivannan Sadhasivam wrote:
"pci_endpoint_test" driver now returns 0 for success and negative error code for failure. So adapt to the change by reporting FAILURE if the return value is < 0, and SUCCESS otherwise.
Cc: stable@vger.kernel.org #5.10 Fixes: 3f2ed8134834 ("tools: PCI: Add a userspace tool to test PCI endpoint") Signed-off-by: Manivannan Sadhasivam manivannan.sadhasivam@linaro.org
tools/pci/pcitest.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c index 441b54234635..a4e5b17cc3b5 100644 --- a/tools/pci/pcitest.c +++ b/tools/pci/pcitest.c @@ -18,7 +18,6 @@ #define BILLION 1E9 -static char *result[] = { "NOT OKAY", "OKAY" }; static char *irq[] = { "LEGACY", "MSI", "MSI-X" }; struct pci_test { @@ -54,9 +53,9 @@ static int run_test(struct pci_test *test) ret = ioctl(fd, PCITEST_BAR, test->barnum); fprintf(stdout, "BAR%d:\t\t", test->barnum); if (ret < 0)
fprintf(stdout, "TEST FAILED\n");
elsefprintf(stdout, "FAILED\n");
fprintf(stdout, "%s\n", result[ret]);
fprintf(stdout, "SUCCESS\n");
Is this following the kernel TAP output rules? If not, why not? If so, say that you are fixing that issue up in the changelog text.
Sorry to revive this two months old thread. Adapting to TAP output rules requires this test to be moved to KUnit which is strictly not necessary and can be done later.
Moreover, I do not have the hardware to run this testcase and I don't feel comfortable moving this to KUnit without doing functional testing.
So for now, I will fix the return value of IOCTLs which is the real motive behind this series.
Thanks, Mani
thanks,
greg k-h
On Tue, Nov 01, 2022 at 07:45:34PM +0530, Manivannan Sadhasivam wrote:
On Wed, Aug 24, 2022 at 02:44:06PM +0200, Greg KH wrote:
On Wed, Aug 24, 2022 at 06:00:07PM +0530, Manivannan Sadhasivam wrote:
"pci_endpoint_test" driver now returns 0 for success and negative error code for failure. So adapt to the change by reporting FAILURE if the return value is < 0, and SUCCESS otherwise.
Cc: stable@vger.kernel.org #5.10 Fixes: 3f2ed8134834 ("tools: PCI: Add a userspace tool to test PCI endpoint") Signed-off-by: Manivannan Sadhasivam manivannan.sadhasivam@linaro.org
tools/pci/pcitest.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c index 441b54234635..a4e5b17cc3b5 100644 --- a/tools/pci/pcitest.c +++ b/tools/pci/pcitest.c @@ -18,7 +18,6 @@ #define BILLION 1E9 -static char *result[] = { "NOT OKAY", "OKAY" }; static char *irq[] = { "LEGACY", "MSI", "MSI-X" }; struct pci_test { @@ -54,9 +53,9 @@ static int run_test(struct pci_test *test) ret = ioctl(fd, PCITEST_BAR, test->barnum); fprintf(stdout, "BAR%d:\t\t", test->barnum); if (ret < 0)
fprintf(stdout, "TEST FAILED\n");
elsefprintf(stdout, "FAILED\n");
fprintf(stdout, "%s\n", result[ret]);
fprintf(stdout, "SUCCESS\n");
Is this following the kernel TAP output rules? If not, why not? If so, say that you are fixing that issue up in the changelog text.
Sorry to revive this two months old thread. Adapting to TAP output rules requires this test to be moved to KUnit which is strictly not necessary and can be done later.
KUint has nothing to do with TAP output. TAP output is what the framework in tools/testing/selftests/ wants to see. Why not move this test into the proper location there and not in an odd location like tools/pci/? It does not belong in tools/pci/ at all.
thanks,
greg k-h
linux-stable-mirror@lists.linaro.org