validate:launcher: Allow running the testsuite N number of times

This commit is contained in:
Thibault Saunier 2016-10-29 11:22:31 -03:00
parent 30f4b590d8
commit f5828b2b5c
2 changed files with 15 additions and 0 deletions

View file

@ -1469,6 +1469,16 @@ class _TestsLauncher(Loggable):
self.clean_tests()
return False
elif self.options.n_runs:
res = True
for r in range(self.options.n_runs):
t = "Running iteration %d" % r
print("%s\n%s\n%s\n" % ("=" * len(t), t, "=" * len(t)))
if not self._run_tests():
res = False
self.clean_tests()
return res
else:
return self._run_tests()

View file

@ -180,6 +180,7 @@ class LauncherConfig(Loggable):
self.testsuites = []
self.debug = False
self.forever = False
self.n_runs = None
self.fatal_error = False
self.wanted_tests = []
self.blacklisted_tests = []
@ -377,6 +378,10 @@ Note that all testsuite should be inside python modules, so the directory should
parser.add_argument("-f", "--forever", dest="forever",
action="store_true",
help="Keep running tests until one fails")
parser.add_argument("--n-runs", dest="n_runs", action='store',
help="Number of runs, if the testsuites."
" Meaning no failure will stop the testuite"
" run meanwhile.", type=int),
parser.add_argument("-F", "--fatal-error", dest="fatal_error",
action="store_true",
help="Stop on first fail")