From ee33d7e5468de28a2e221ec7417113cdf924c362 Mon Sep 17 00:00:00 2001 From: Jennifer Marks Date: Mon, 6 Apr 2015 11:46:47 -0400 Subject: [PATCH] add support for the loop argument to loop over a test run * added summary message for iteration number --- bin/smash | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/bin/smash b/bin/smash index c1cd305..e2bb592 100755 --- a/bin/smash +++ b/bin/smash @@ -42,6 +42,7 @@ def main(): parser.add_argument('--keep-going',dest="keep_going",action="store_true",default=False,help='do not abort the execution on the first failed testcase') parser.add_argument('--all-testsets', '-a', dest="all_testsets", action="store_true", help='run all testsets defined within each test script file') parser.add_argument('--testset', '-t', dest="testset", action="store", default=None, type=int, help='run just one testset specified by index, starting from 0') + parser.add_argument('--loop', '-l', dest="loop", action="store", default=1, type=int, help='number of times a test command should be executed') args = parser.parse_args() @@ -204,17 +205,19 @@ def main(): if not args.dry_run: run_multiprocessing_engine(config,os.path.abspath(t)) - if args.all_testsets or args.testset is not None: - smashbox.no_engine.testsets=[None] - execfile(os.path.abspath(t),smashbox.no_engine.__dict__) - - if args.all_testsets: - for i,ts in enumerate(smashbox.no_engine.testsets): - run_test(ts,i) + for j in range(1,args.loop+1): + log_quiet ("Running iteration %d" % j) + if args.all_testsets or args.testset is not None: + smashbox.no_engine.testsets=[None] + execfile(os.path.abspath(t),smashbox.no_engine.__dict__) + + if args.all_testsets: + for i,ts in enumerate(smashbox.no_engine.testsets): + run_test(ts,i) + else: + run_test(smashbox.no_engine.testsets[args.testset],args.testset) else: - run_test(smashbox.no_engine.testsets[args.testset],args.testset) - else: - run_test(None) + run_test(None)