tests/run-tests.py
branchstable
changeset 1239 02112fca2ff3
parent 1238 c2b8e0ffffc8
child 1240 3ee0bfc336f7
equal deleted inserted replaced
1238:c2b8e0ffffc8 1239:02112fca2ff3
   318             print m,
   318             print m,
   319         print
   319         print
   320         sys.stdout.flush()
   320         sys.stdout.flush()
   321         iolock.release()
   321         iolock.release()
   322 
   322 
       
   323 def log(*msg):
       
   324     iolock.acquire()
       
   325     if verbose:
       
   326         print verbose,
       
   327     for m in msg:
       
   328         print m,
       
   329     print
       
   330     sys.stdout.flush()
       
   331     iolock.release()
       
   332 
   323 def findprogram(program):
   333 def findprogram(program):
   324     """Search PATH for a executable program"""
   334     """Search PATH for a executable program"""
   325     for p in os.environ.get('PATH', os.defpath).split(os.pathsep):
   335     for p in os.environ.get('PATH', os.defpath).split(os.pathsep):
   326         name = os.path.join(p, program)
   336         name = os.path.join(p, program)
   327         if os.name == 'nt' or os.access(name, os.X_OK):
   337         if os.name == 'nt' or os.access(name, os.X_OK):
   570     # The only supported special characters are * and ? plus / which also
   580     # The only supported special characters are * and ? plus / which also
   571     # matches \ on windows. Escaping of these caracters is supported.
   581     # matches \ on windows. Escaping of these caracters is supported.
   572     if el + '\n' == l:
   582     if el + '\n' == l:
   573         if os.name == 'nt':
   583         if os.name == 'nt':
   574             # matching on "/" is not needed for this line
   584             # matching on "/" is not needed for this line
   575             iolock.acquire()
   585             log("\nInfo, unnecessary glob: %s (glob)" % el)
   576             print "\nInfo, unnecessary glob: %s (glob)" % el
       
   577             iolock.release()
       
   578         return True
   586         return True
   579     i, n = 0, len(el)
   587     i, n = 0, len(el)
   580     res = ''
   588     res = ''
   581     while i < n:
   589     while i < n:
   582         c = el[i]
   590         c = el[i]
   830 
   838 
   831     global iolock
   839     global iolock
   832 
   840 
   833     def skip(msg):
   841     def skip(msg):
   834         if options.verbose:
   842         if options.verbose:
   835             iolock.acquire()
   843             log("\nSkipping %s: %s" % (testpath, msg))
   836             print "\nSkipping %s: %s" % (testpath, msg)
       
   837             iolock.release()
       
   838         return 's', test, msg
   844         return 's', test, msg
   839 
   845 
   840     def fail(msg, ret):
   846     def fail(msg, ret):
   841         if not options.nodiff:
   847         if not options.nodiff:
   842             iolock.acquire()
   848             log("\nERROR: %s %s" % (testpath, msg))
   843             print "\nERROR: %s %s" % (testpath, msg)
       
   844             iolock.release()
       
   845         if (not ret and options.interactive
   849         if (not ret and options.interactive
   846             and os.path.exists(testpath + ".err")):
   850             and os.path.exists(testpath + ".err")):
   847             iolock.acquire()
   851             iolock.acquire()
   848             print "Accept this change? [n] ",
   852             print "Accept this change? [n] ",
   849             answer = sys.stdin.readline().strip()
   853             answer = sys.stdin.readline().strip()