tests/run-tests.py
branchstable
changeset 1163 d5d13134793a
parent 1161 ce884838a955
child 1164 8ed9a9f075f9
equal deleted inserted replaced
1161:ce884838a955 1163:d5d13134793a
   766     '''tristate output:
   766     '''tristate output:
   767     None -> skipped
   767     None -> skipped
   768     True -> passed
   768     True -> passed
   769     False -> failed'''
   769     False -> failed'''
   770 
   770 
   771     global results, iolock
   771     global results, resultslock, iolock
   772 
   772 
   773     testpath = os.path.join(TESTDIR, test)
   773     testpath = os.path.join(TESTDIR, test)
       
   774 
       
   775     def result(l, e):
       
   776         resultslock.acquire()
       
   777         results[l].append(e)
       
   778         resultslock.release()
   774 
   779 
   775     def skip(msg):
   780     def skip(msg):
   776         if not options.verbose:
   781         if not options.verbose:
   777             results['s'].append((test, msg))
   782             result('s', (test, msg))
   778         else:
   783         else:
   779             iolock.acquire()
   784             iolock.acquire()
   780             print "\nSkipping %s: %s" % (testpath, msg)
   785             print "\nSkipping %s: %s" % (testpath, msg)
   781             iolock.release()
   786             iolock.release()
   782         return None
   787         return None
   795             if answer.lower() in "y yes".split():
   800             if answer.lower() in "y yes".split():
   796                 if test.endswith(".t"):
   801                 if test.endswith(".t"):
   797                     rename(testpath + ".err", testpath)
   802                     rename(testpath + ".err", testpath)
   798                 else:
   803                 else:
   799                     rename(testpath + ".err", testpath + ".out")
   804                     rename(testpath + ".err", testpath + ".out")
   800                 success(test)
   805                 result('p', test)
   801                 return
   806                 return
   802         results['f'].append((test, msg))
   807         result('f', (test, msg))
   803 
   808 
   804     def success():
   809     def success():
   805         results['p'].append(test)
   810         result('p', test)
   806 
   811 
   807     def ignore(msg):
   812     def ignore(msg):
   808         results['i'].append((test, msg))
   813         result('i', (test, msg))
   809 
   814 
   810     if (os.path.basename(test).startswith("test-") and '~' not in test and
   815     if (os.path.basename(test).startswith("test-") and '~' not in test and
   811         ('.' not in test or test.endswith('.py') or
   816         ('.' not in test or test.endswith('.py') or
   812          test.endswith('.bat') or test.endswith('.t'))):
   817          test.endswith('.bat') or test.endswith('.t'))):
   813         if not os.path.exists(test):
   818         if not os.path.exists(test):
  1116     if options.anycoverage:
  1121     if options.anycoverage:
  1117         outputcoverage(options)
  1122         outputcoverage(options)
  1118     sys.exit(failures != 0)
  1123     sys.exit(failures != 0)
  1119 
  1124 
  1120 results = dict(p=[], f=[], s=[], i=[])
  1125 results = dict(p=[], f=[], s=[], i=[])
       
  1126 resultslock = threading.Lock()
  1121 times = []
  1127 times = []
  1122 iolock = threading.Lock()
  1128 iolock = threading.Lock()
  1123 
  1129 
  1124 def runqueue(options, tests):
  1130 def runqueue(options, tests):
  1125     for test in tests:
  1131     for test in tests: