tools: PCI: Exit with error code when test fails
authorJean-Jacques Hiblot <jjhiblot@ti.com>
Thu, 20 Sep 2018 15:02:53 +0000 (17:02 +0200)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Fri, 22 Mar 2019 10:50:29 +0000 (10:50 +0000)
This makes it easier to use pcitest in automated setups.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
tools/pci/pcitest.c

index ec4d51f..310a7e4 100644 (file)
@@ -140,6 +140,7 @@ static void run_test(struct pci_test *test)
        }
 
        fflush(stdout);
+       return (ret < 0) ? ret : 1 - ret; /* return 0 if test succeeded */
 }
 
 int main(int argc, char **argv)
@@ -228,6 +229,5 @@ usage:
                return -EINVAL;
        }
 
-       run_test(test);
-       return 0;
+       return run_test(test);
 }