tests/run-tests.py
branchstable
changeset 1238 c2b8e0ffffc8
parent 1237 ac098555f410
child 1239 02112fca2ff3
equal deleted inserted replaced
1237:ac098555f410 1238:c2b8e0ffffc8
   238     if options.anycoverage and options.local:
   238     if options.anycoverage and options.local:
   239         # this needs some path mangling somewhere, I guess
   239         # this needs some path mangling somewhere, I guess
   240         parser.error("sorry, coverage options do not work when --local "
   240         parser.error("sorry, coverage options do not work when --local "
   241                      "is specified")
   241                      "is specified")
   242 
   242 
   243     global vlog
   243     global verbose
   244     if options.verbose:
   244     if options.verbose:
   245         if options.jobs > 1 or options.child is not None:
   245         if options.jobs > 1 or options.child is not None:
   246             pid = "[%d]" % os.getpid()
   246             verbose = "[%d]" % os.getpid()
   247         else:
   247         else:
   248             pid = None
   248             verbose = ''
   249         def vlog(*msg):
       
   250             iolock.acquire()
       
   251             if pid:
       
   252                 print pid,
       
   253             for m in msg:
       
   254                 print m,
       
   255             print
       
   256             sys.stdout.flush()
       
   257             iolock.release()
       
   258     else:
       
   259         vlog = lambda *msg: None
       
   260 
   249 
   261     if options.tmpdir:
   250     if options.tmpdir:
   262         options.tmpdir = os.path.expanduser(options.tmpdir)
   251         options.tmpdir = os.path.expanduser(options.tmpdir)
   263 
   252 
   264     if options.jobs < 1:
   253     if options.jobs < 1:
   316 
   305 
   317 def showdiff(expected, output, ref, err):
   306 def showdiff(expected, output, ref, err):
   318     print
   307     print
   319     for line in difflib.unified_diff(expected, output, ref, err):
   308     for line in difflib.unified_diff(expected, output, ref, err):
   320         sys.stdout.write(line)
   309         sys.stdout.write(line)
       
   310 
       
   311 verbose = False
       
   312 def vlog(*msg):
       
   313     if verbose is not False:
       
   314         iolock.acquire()
       
   315         if verbose:
       
   316             print verbose,
       
   317         for m in msg:
       
   318             print m,
       
   319         print
       
   320         sys.stdout.flush()
       
   321         iolock.release()
   321 
   322 
   322 def findprogram(program):
   323 def findprogram(program):
   323     """Search PATH for a executable program"""
   324     """Search PATH for a executable program"""
   324     for p in os.environ.get('PATH', os.defpath).split(os.pathsep):
   325     for p in os.environ.get('PATH', os.defpath).split(os.pathsep):
   325         name = os.path.join(p, program)
   326         name = os.path.join(p, program)