##// END OF EJS Templates
tests: make coverage run in parallel mode, clean up coverage code
Dirkjan Ochtman -
r8620:b38f275b default
parent child Browse files
Show More
@@ -259,13 +259,13 b' def installhg(options):'
259 f = open(os.path.join(BINDIR, 'hg'), 'w')
259 f = open(os.path.join(BINDIR, 'hg'), 'w')
260 f.write('#!' + sys.executable + '\n')
260 f.write('#!' + sys.executable + '\n')
261 f.write('import sys, os; os.execv(sys.executable, [sys.executable, '
261 f.write('import sys, os; os.execv(sys.executable, [sys.executable, '
262 '"%s", "-x", "%s"] + sys.argv[1:])\n' %
262 '"%s", "-x", "-p", "%s"] + sys.argv[1:])\n' %
263 (os.path.join(TESTDIR, 'coverage.py'),
263 (os.path.join(TESTDIR, 'coverage.py'),
264 os.path.join(BINDIR, '_hg.py')))
264 os.path.join(BINDIR, '_hg.py')))
265 f.close()
265 f.close()
266 os.chmod(os.path.join(BINDIR, 'hg'), 0700)
266 os.chmod(os.path.join(BINDIR, 'hg'), 0700)
267 PYTHON = '"%s" "%s" -x' % (sys.executable,
267 PYTHON = '"%s" "%s" -x -p' % (sys.executable,
268 os.path.join(TESTDIR,'coverage.py'))
268 os.path.join(TESTDIR, 'coverage.py'))
269
269
270 def _hgpath():
270 def _hgpath():
271 cmd = '%s -c "import mercurial; print mercurial.__path__[0]"'
271 cmd = '%s -c "import mercurial; print mercurial.__path__[0]"'
@@ -275,26 +275,29 b' def _hgpath():'
275 return path
275 return path
276
276
277 def outputcoverage(options):
277 def outputcoverage(options):
278 vlog("# Producing coverage report")
278
279 vlog('# Producing coverage report')
280 os.chdir(PYTHONDIR)
281
282 def covrun(*args):
283 start = sys.executable, os.path.join(TESTDIR, 'coverage.py')
284 cmd = '"%s" "%s" %s' % (start[0], start[1], ' '.join(args))
285 vlog('# Running: %s' % cmd)
286 os.system(cmd)
287
279 omit = [BINDIR, TESTDIR, PYTHONDIR]
288 omit = [BINDIR, TESTDIR, PYTHONDIR]
280 if not options.cover_stdlib:
289 if not options.cover_stdlib:
281 # Exclude as system paths (ignoring empty strings seen on win)
290 # Exclude as system paths (ignoring empty strings seen on win)
282 omit += [x for x in sys.path if x != '']
291 omit += [x for x in sys.path if x != '']
283 omit = ','.join(omit)
292 omit = ','.join(omit)
284 os.chdir(PYTHONDIR)
293
285 cmd = '"%s" "%s" -i -r "--omit=%s"' % (
294 covrun('-c') # combine from parallel processes
286 sys.executable, os.path.join(TESTDIR, 'coverage.py'), omit)
295 covrun('-i', '-r', '"--omit=%s"' % omit) # report
287 vlog("# Running: "+cmd)
288 os.system(cmd)
289 if options.annotate:
296 if options.annotate:
290 adir = os.path.join(TESTDIR, 'annotated')
297 adir = os.path.join(TESTDIR, 'annotated')
291 if not os.path.isdir(adir):
298 if not os.path.isdir(adir):
292 os.mkdir(adir)
299 os.mkdir(adir)
293 cmd = '"%s" "%s" -i -a "--directory=%s" "--omit=%s"' % (
300 covrun('-i', '-a', '"--directory=%s"' % adir, '"--omit=%s"' % omit)
294 sys.executable, os.path.join(TESTDIR, 'coverage.py'),
295 adir, omit)
296 vlog("# Running: "+cmd)
297 os.system(cmd)
298
301
299 class Timeout(Exception):
302 class Timeout(Exception):
300 pass
303 pass
General Comments 0
You need to be logged in to leave comments. Login now