tests/run-tests.py
branchstable
changeset 914 3c57e9963070
parent 913 ee01b53f9ac9
child 915 5660a21567b7
equal deleted inserted replaced
913:ee01b53f9ac9 914:3c57e9963070
   652     '''tristate output:
   652     '''tristate output:
   653     None -> skipped
   653     None -> skipped
   654     True -> passed
   654     True -> passed
   655     False -> failed'''
   655     False -> failed'''
   656 
   656 
   657     global results, resultslock
   657     global results, resultslock, iolock
   658 
   658 
   659     testpath = os.path.join(TESTDIR, test)
   659     testpath = os.path.join(TESTDIR, test)
   660 
   660 
   661     def result(l, e):
   661     def result(l, e):
   662         resultslock.acquire()
   662         resultslock.acquire()
   823         if ret:
   823         if ret:
   824             fail("output changed and returned error code %d" % ret, ret)
   824             fail("output changed and returned error code %d" % ret, ret)
   825         else:
   825         else:
   826             fail("output changed", ret)
   826             fail("output changed", ret)
   827         if ret != 'timeout' and not options.nodiff:
   827         if ret != 'timeout' and not options.nodiff:
       
   828             iolock.acquire()
   828             if options.view:
   829             if options.view:
   829                 os.system("%s %s %s" % (options.view, ref, err))
   830                 os.system("%s %s %s" % (options.view, ref, err))
   830             else:
   831             else:
   831                 showdiff(refout, out, ref, err)
   832                 showdiff(refout, out, ref, err)
       
   833             iolock.release()
   832         ret = 1
   834         ret = 1
   833     elif ret:
   835     elif ret:
   834         mark = '!'
   836         mark = '!'
   835         fail("returned error code %d" % ret, ret)
   837         fail("returned error code %d" % ret, ret)
   836 
   838 
   837     if not options.verbose:
   839     if not options.verbose:
       
   840         iolock.acquire()
   838         sys.stdout.write(mark)
   841         sys.stdout.write(mark)
   839         sys.stdout.flush()
   842         sys.stdout.flush()
       
   843         iolock.release()
   840 
   844 
   841     killdaemons()
   845     killdaemons()
   842 
   846 
   843     os.chdir(TESTDIR)
   847     os.chdir(TESTDIR)
   844     if not options.keep_tmpdir:
   848     if not options.keep_tmpdir:
   952         outputcoverage(options)
   956         outputcoverage(options)
   953     sys.exit(failures != 0)
   957     sys.exit(failures != 0)
   954 
   958 
   955 results = dict(p=[], f=[], s=[], i=[])
   959 results = dict(p=[], f=[], s=[], i=[])
   956 resultslock = threading.Lock()
   960 resultslock = threading.Lock()
       
   961 iolock = threading.Lock()
   957 
   962 
   958 def runqueue(options, tests, results):
   963 def runqueue(options, tests, results):
   959     for test in tests:
   964     for test in tests:
   960         ret = runone(options, test)
   965         ret = runone(options, test)
   961         if options.first and ret is not None and not ret:
   966         if options.first and ret is not None and not ret: