tests/run-tests.py
changeset 1271 181e420ff0ac
parent 1270 79e0df6ffaad
child 1272 4a224ed7e923
equal deleted inserted replaced
1264:b42c9f1d461a 1271:181e420ff0ac
   254     if options.debug:
   254     if options.debug:
   255         if options.timeout != defaults['timeout']:
   255         if options.timeout != defaults['timeout']:
   256             sys.stderr.write(
   256             sys.stderr.write(
   257                 'warning: --timeout option ignored with --debug\n')
   257                 'warning: --timeout option ignored with --debug\n')
   258         options.timeout = 0
   258         options.timeout = 0
   259         if options.time:
       
   260             sys.stderr.write(
       
   261                 'warning: --time option ignored with --debug\n')
       
   262         options.time = False
       
   263     if options.py3k_warnings:
   259     if options.py3k_warnings:
   264         if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0):
   260         if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0):
   265             parser.error('--py3k-warnings can only be used on Python 2.6+')
   261             parser.error('--py3k-warnings can only be used on Python 2.6+')
   266     if options.blacklist:
   262     if options.blacklist:
   267         options.blacklist = parselistfiles(options.blacklist, 'blacklist')
   263         options.blacklist = parselistfiles(options.blacklist, 'blacklist')
   331             return name
   327             return name
   332     return None
   328     return None
   333 
   329 
   334 def createhgrc(path, options):
   330 def createhgrc(path, options):
   335     # create a fresh hgrc
   331     # create a fresh hgrc
   336     hgrc = open(path, 'w+')
   332     hgrc = open(path, 'w')
   337     hgrc.write('[ui]\n')
   333     hgrc.write('[ui]\n')
   338     hgrc.write('slash = True\n')
   334     hgrc.write('slash = True\n')
   339     hgrc.write('interactive = False\n')
   335     hgrc.write('interactive = False\n')
   340     hgrc.write('[defaults]\n')
   336     hgrc.write('[defaults]\n')
   341     hgrc.write('backout = -d "0 0"\n')
   337     hgrc.write('backout = -d "0 0"\n')
   958         replacements.append((re.escape(testtmp), '$TESTTMP'))
   954         replacements.append((re.escape(testtmp), '$TESTTMP'))
   959 
   955 
   960     env = createenv(options, testtmp, threadtmp, port)
   956     env = createenv(options, testtmp, threadtmp, port)
   961     createhgrc(env['HGRCPATH'], options)
   957     createhgrc(env['HGRCPATH'], options)
   962 
   958 
   963     if options.time:
   959     starttime = time.time()
   964         starttime = time.time()
   960     try:
   965     ret, out = runner(testpath, testtmp, options, replacements, env)
   961         ret, out = runner(testpath, testtmp, options, replacements, env)
   966     if options.time:
   962     except KeyboardInterrupt:
   967         endtime = time.time()
   963         endtime = time.time()
   968         times.append((test, endtime - starttime))
   964         log('INTERRUPTED: %s (after %d seconds)' % (test, endtime - starttime))
       
   965         raise
       
   966     endtime = time.time()
       
   967     times.append((test, endtime - starttime))
   969     vlog("# Ret was:", ret)
   968     vlog("# Ret was:", ret)
   970 
   969 
   971     killdaemons(env['DAEMON_PIDS'])
   970     killdaemons(env['DAEMON_PIDS'])
   972 
   971 
   973     skipped = (ret == SKIPPED_STATUS)
   972     skipped = (ret == SKIPPED_STATUS)