##// 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 help="retest failed tests")
36 help="retest failed tests")
37 parser.add_option("-f", "--first", action="store_true",
37 parser.add_option("-f", "--first", action="store_true",
38 help="exit on the first test failure")
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 parser.set_defaults(timeout=180)
42 parser.set_defaults(timeout=180)
41 (options, args) = parser.parse_args()
43 (options, args) = parser.parse_args()
@@ -355,7 +357,7 b' try:'
355 print 'WARNING: cannot run tests with timeouts'
357 print 'WARNING: cannot run tests with timeouts'
356 options.timeout = 0
358 options.timeout = 0
357
359
358 tests = 0
360 tested = 0
359 failed = 0
361 failed = 0
360 skipped = 0
362 skipped = 0
361
363
@@ -363,23 +365,38 b' try:'
363 args = os.listdir(".")
365 args = os.listdir(".")
364 args.sort()
366 args.sort()
365
367
368
369 tests = []
366 for test in args:
370 for test in args:
367 if (test.startswith("test-") and '~' not in test and
371 if (test.startswith("test-") and '~' not in test and
368 ('.' not in test or test.endswith('.py') or
372 ('.' not in test or test.endswith('.py') or
369 test.endswith('.bat'))):
373 test.endswith('.bat'))):
370 if options.retest and not os.path.exists(test + ".err"):
374 tests.append(test)
371 skipped += 1
375
372 continue
376 if options.restart:
373 ret = run_one(test)
377 orig = list(tests)
374 if ret is None:
378 while tests:
375 skipped += 1
379 if os.path.exists(tests[0] + ".err"):
376 elif not ret:
380 break
377 failed += 1
381 tests.pop(0)
378 if options.first:
382 if not tests:
379 break
383 print "running all tests"
380 tests += 1
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 failed)
400 failed)
384 if coverage:
401 if coverage:
385 output_coverage()
402 output_coverage()
General Comments 0
You need to be logged in to leave comments. Login now