scripts/unit-test.py: Add ability to run `make check` N times
This is useful for catching intermittent failures in test suites when
doing manual (non-CI) runs.
Tested: Reworked run-unit-test-docker.sh, ran and observed multiple runs
of `make check`.
Change-Id: Idf4d81a27b59cc377b2fdc0a672490befbdc4816
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index b2ee050..29434b3 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -389,6 +389,8 @@
help="OpenBMC package to be unit tested")
parser.add_argument("-v", "--verbose", action="store_true",
help="Print additional package status messages")
+ parser.add_argument("-r", "--repeat", help="Repeat tests N times",
+ type=int, default=1)
args = parser.parse_args(sys.argv[1:])
WORKSPACE = args.WORKSPACE
UNIT_TEST_PKG = args.PACKAGE
@@ -435,7 +437,9 @@
check_call_cmd(os.path.join(WORKSPACE, UNIT_TEST_PKG), 'ldconfig')
# Run package unit tests
try:
- check_call_cmd(os.path.join(WORKSPACE, UNIT_TEST_PKG), 'make', 'check')
+ cmd = [ 'make', 'check' ]
+ for i in range(0, args.repeat):
+ check_call_cmd(os.path.join(WORKSPACE, UNIT_TEST_PKG), *cmd)
except CalledProcessError:
check_call_cmd(os.path.join(WORKSPACE, UNIT_TEST_PKG), "cat",
os.path.join(WORKSPACE, UNIT_TEST_PKG, "test/test-suite.log"))