##// END OF EJS Templates
tests: add -R switch...
Matt Mackall -
r3625:cc0cd594 default
parent child Browse files
Show More
@@ -36,6 +36,8 b' parser.add_option("-r", "--retest", acti'
36 36 help="retest failed tests")
37 37 parser.add_option("-f", "--first", action="store_true",
38 38 help="exit on the first test failure")
39 parser.add_option("-R", "--restart", action="store_true",
40 help="restart at last error")
39 41
40 42 parser.set_defaults(timeout=180)
41 43 (options, args) = parser.parse_args()
@@ -355,7 +357,7 b' try:'
355 357 print 'WARNING: cannot run tests with timeouts'
356 358 options.timeout = 0
357 359
358 tests = 0
360 tested = 0
359 361 failed = 0
360 362 skipped = 0
361 363
@@ -363,23 +365,38 b' try:'
363 365 args = os.listdir(".")
364 366 args.sort()
365 367
368
369 tests = []
366 370 for test in args:
367 371 if (test.startswith("test-") and '~' not in test and
368 372 ('.' not in test or test.endswith('.py') or
369 373 test.endswith('.bat'))):
370 if options.retest and not os.path.exists(test + ".err"):
371 skipped += 1
372 continue
373 ret = run_one(test)
374 if ret is None:
375 skipped += 1
376 elif not ret:
377 failed += 1
378 if options.first:
379 break
380 tests += 1
374 tests.append(test)
375
376 if options.restart:
377 orig = list(tests)
378 while tests:
379 if os.path.exists(tests[0] + ".err"):
380 break
381 tests.pop(0)
382 if not tests:
383 print "running all tests"
384 tests = orig
381 385
382 print "\n# Ran %d tests, %d skipped, %d failed." % (tests, skipped,
386 for test in tests:
387 if options.retest and not os.path.exists(test + ".err"):
388 skipped += 1
389 continue
390 ret = run_one(test)
391 if ret is None:
392 skipped += 1
393 elif not ret:
394 failed += 1
395 if options.first:
396 break
397 tested += 1
398
399 print "\n# Ran %d tests, %d skipped, %d failed." % (tested, skipped,
383 400 failed)
384 401 if coverage:
385 402 output_coverage()
General Comments 0
You need to be logged in to leave comments. Login now