##// END OF EJS Templates
run-tests: show scheduling with --showchannels...
Matt Mackall -
r27396:64c58407 default
parent child Browse files
Show More
@@ -267,6 +267,8 b' def getparser():'
267 help='run statprof on run-tests')
267 help='run statprof on run-tests')
268 parser.add_option('--allow-slow-tests', action='store_true',
268 parser.add_option('--allow-slow-tests', action='store_true',
269 help='allow extremely slow tests')
269 help='allow extremely slow tests')
270 parser.add_option('--showchannels', action='store_true',
271 help='show scheduling channels')
270
272
271 for option, (envvar, default) in defaults.items():
273 for option, (envvar, default) in defaults.items():
272 defaults[option] = type(default)(os.environ.get(envvar, default))
274 defaults[option] = type(default)(os.environ.get(envvar, default))
@@ -347,6 +349,9 b' def parseargs(args, parser):'
347 else:
349 else:
348 options.whitelisted = {}
350 options.whitelisted = {}
349
351
352 if options.showchannels:
353 options.nodiff = True
354
350 return (options, args)
355 return (options, args)
351
356
352 def rename(src, dst):
357 def rename(src, dst):
@@ -1418,7 +1423,7 b' class TestSuite(unittest.TestSuite):'
1418
1423
1419 def __init__(self, testdir, jobs=1, whitelist=None, blacklist=None,
1424 def __init__(self, testdir, jobs=1, whitelist=None, blacklist=None,
1420 retest=False, keywords=None, loop=False, runs_per_test=1,
1425 retest=False, keywords=None, loop=False, runs_per_test=1,
1421 loadtest=None,
1426 loadtest=None, showchannels=False,
1422 *args, **kwargs):
1427 *args, **kwargs):
1423 """Create a new instance that can run tests with a configuration.
1428 """Create a new instance that can run tests with a configuration.
1424
1429
@@ -1455,6 +1460,7 b' class TestSuite(unittest.TestSuite):'
1455 self._loop = loop
1460 self._loop = loop
1456 self._runs_per_test = runs_per_test
1461 self._runs_per_test = runs_per_test
1457 self._loadtest = loadtest
1462 self._loadtest = loadtest
1463 self._showchannels = showchannels
1458
1464
1459 def run(self, result):
1465 def run(self, result):
1460 # We have a number of filters that need to be applied. We do this
1466 # We have a number of filters that need to be applied. We do this
@@ -1501,7 +1507,14 b' class TestSuite(unittest.TestSuite):'
1501 done = queue.Queue()
1507 done = queue.Queue()
1502 running = 0
1508 running = 0
1503
1509
1510 channels = [""] * self._jobs
1511
1504 def job(test, result):
1512 def job(test, result):
1513 for n, v in enumerate(channels):
1514 if not v:
1515 channel = n
1516 break
1517 channels[channel] = "=" + test.name[5:].split(".")[0]
1505 try:
1518 try:
1506 test(result)
1519 test(result)
1507 done.put(None)
1520 done.put(None)
@@ -1510,9 +1523,33 b' class TestSuite(unittest.TestSuite):'
1510 except: # re-raises
1523 except: # re-raises
1511 done.put(('!', test, 'run-test raised an error, see traceback'))
1524 done.put(('!', test, 'run-test raised an error, see traceback'))
1512 raise
1525 raise
1526 channels[channel] = ''
1527
1528 def stat():
1529 count = 0
1530 while channels:
1531 d = '\n%03s ' % count
1532 for n, v in enumerate(channels):
1533 if v:
1534 d += v[0]
1535 channels[n] = v[1:] or '.'
1536 else:
1537 d += ' '
1538 d += ' '
1539 with iolock:
1540 sys.stdout.write(d + ' ')
1541 sys.stdout.flush()
1542 for x in xrange(10):
1543 if channels:
1544 time.sleep(.1)
1545 count += 1
1513
1546
1514 stoppedearly = False
1547 stoppedearly = False
1515
1548
1549 if self._showchannels:
1550 statthread = threading.Thread(target=stat, name="stat")
1551 statthread.start()
1552
1516 try:
1553 try:
1517 while tests or running:
1554 while tests or running:
1518 if not done.empty() or running == self._jobs or not tests:
1555 if not done.empty() or running == self._jobs or not tests:
@@ -1553,6 +1590,8 b' class TestSuite(unittest.TestSuite):'
1553 for test in runtests:
1590 for test in runtests:
1554 test.abort()
1591 test.abort()
1555
1592
1593 channels = []
1594
1556 return result
1595 return result
1557
1596
1558 class TextTestRunner(unittest.TextTestRunner):
1597 class TextTestRunner(unittest.TextTestRunner):
@@ -1942,6 +1981,7 b' class TestRunner(object):'
1942 keywords=kws,
1981 keywords=kws,
1943 loop=self.options.loop,
1982 loop=self.options.loop,
1944 runs_per_test=self.options.runs_per_test,
1983 runs_per_test=self.options.runs_per_test,
1984 showchannels=self.options.showchannels,
1945 tests=tests, loadtest=self._gettest)
1985 tests=tests, loadtest=self._gettest)
1946 verbosity = 1
1986 verbosity = 1
1947 if self.options.verbose:
1987 if self.options.verbose:
General Comments 0
You need to be logged in to leave comments. Login now