tests/run-tests.py
branchstable
changeset 904 d758c9ebc705
parent 903 92c48e9ca3a7
child 905 66b8706b3112
equal deleted inserted replaced
903:92c48e9ca3a7 904:d758c9ebc705
   631 
   631 
   632     for s, r in replacements:
   632     for s, r in replacements:
   633         output = re.sub(s, r, output)
   633         output = re.sub(s, r, output)
   634     return ret, splitnewlines(output)
   634     return ret, splitnewlines(output)
   635 
   635 
   636 def runone(options, test, skips, fails):
   636 def runone(options, test, skips, fails, ignores):
   637     '''tristate output:
   637     '''tristate output:
   638     None -> skipped
   638     None -> skipped
   639     True -> passed
   639     True -> passed
   640     False -> failed'''
   640     False -> failed'''
   641 
   641 
   938                 print "running all tests"
   938                 print "running all tests"
   939                 tests = orig
   939                 tests = orig
   940 
   940 
   941         skips = []
   941         skips = []
   942         fails = []
   942         fails = []
       
   943         ignores = []
   943 
   944 
   944         for test in tests:
   945         for test in tests:
   945             if options.blacklist:
   946             if options.blacklist:
   946                 filename = options.blacklist.get(test)
   947                 filename = options.blacklist.get(test)
   947                 if filename is not None:
   948                 if filename is not None:
   948                     skips.append((test, "blacklisted (%s)" % filename))
   949                     skipped.append((test, "blacklisted (%s)" % filename))
   949                     skipped += 1
   950                     skipped += 1
   950                     continue
   951                     continue
   951 
   952 
   952             if options.retest and not os.path.exists(test + ".err"):
   953             if options.retest and not os.path.exists(test + ".err"):
   953                 skipped += 1
   954                 ignores.append((test, "not retesting"))
   954                 continue
   955                 continue
   955 
   956 
   956             if options.keywords:
   957             if options.keywords:
   957                 try:
   958                 try:
   958                     fp = open(test)
   959                     fp = open(test)
   962                 fp.close()
   963                 fp.close()
   963                 for k in options.keywords.lower().split():
   964                 for k in options.keywords.lower().split():
   964                     if k in t:
   965                     if k in t:
   965                         break
   966                         break
   966                 else:
   967                 else:
   967                     skipped += 1
   968                     ignores.append((test, "doesn't match keyword"))
   968                     continue
   969                     continue
   969 
   970 
   970             ret = runone(options, test, skips, fails)
   971             ret = runone(options, test, skips, fails, ignores)
   971             if ret is None:
   972             if ret is None:
   972                 skipped += 1
   973                 skipped += 1
   973             elif not ret:
   974             elif not ret:
   974                 failed += 1
   975                 failed += 1
   975                 if options.first:
   976                 if options.first:
   990                 print "Skipped %s: %s" % s
   991                 print "Skipped %s: %s" % s
   991             for s in fails:
   992             for s in fails:
   992                 print "Failed %s: %s" % s
   993                 print "Failed %s: %s" % s
   993             _checkhglib("Tested")
   994             _checkhglib("Tested")
   994             print "# Ran %d tests, %d skipped, %d failed." % (
   995             print "# Ran %d tests, %d skipped, %d failed." % (
   995                 tested, skipped, failed)
   996                 tested, len(skips) + len(ignores), failed)
   996 
   997 
   997         if options.anycoverage:
   998         if options.anycoverage:
   998             outputcoverage(options)
   999             outputcoverage(options)
   999     except KeyboardInterrupt:
  1000     except KeyboardInterrupt:
  1000         failed = True
  1001         failed = True