tests/run-tests.py
branchstable
changeset 1246 e6ba976e152c
parent 1245 605be28ee4d0
child 1247 7691a1e24745
equal deleted inserted replaced
1245:605be28ee4d0 1246:e6ba976e152c
   903     else:
   903     else:
   904         return skip("unknown test type")
   904         return skip("unknown test type")
   905 
   905 
   906     vlog("# Test", test)
   906     vlog("# Test", test)
   907 
   907 
   908     createhgrc(HGRCPATH, options)
       
   909 
       
   910     if os.path.exists(err):
   908     if os.path.exists(err):
   911         os.remove(err)       # Remove any previous output files
   909         os.remove(err)       # Remove any previous output files
   912 
   910 
   913     # Make a tmp subdirectory to work in
   911     # Make a tmp subdirectory to work in
   914     testtmp = os.path.join(HGTMP, os.path.basename(test))
   912     testtmp = os.path.join(HGTMP, os.path.basename(test))
   933     env['TESTTMP'] = testtmp
   931     env['TESTTMP'] = testtmp
   934     env['HOME'] = testtmp
   932     env['HOME'] = testtmp
   935     env["HGPORT"] = str(options.port)
   933     env["HGPORT"] = str(options.port)
   936     env["HGPORT1"] = str(options.port + 1)
   934     env["HGPORT1"] = str(options.port + 1)
   937     env["HGPORT2"] = str(options.port + 2)
   935     env["HGPORT2"] = str(options.port + 2)
       
   936     env["HGRCPATH"] = os.path.join(HGTMP, '.hgrc')
   938     env["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids')
   937     env["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids')
       
   938 
       
   939     createhgrc(env['HGRCPATH'], options)
   939 
   940 
   940     if options.time:
   941     if options.time:
   941         starttime = time.time()
   942         starttime = time.time()
   942     ret, out = runner(testpath, testtmp, options, replacements, env)
   943     ret, out = runner(testpath, testtmp, options, replacements, env)
   943     if options.time:
   944     if options.time:
  1165 
  1166 
  1166         if options.first and code not in '.si':
  1167         if options.first and code not in '.si':
  1167             break
  1168             break
  1168 
  1169 
  1169 def runtests(options, tests):
  1170 def runtests(options, tests):
  1170     global HGRCPATH
       
  1171     HGRCPATH = os.environ["HGRCPATH"] = os.path.join(HGTMP, '.hgrc')
       
  1172 
       
  1173     try:
  1171     try:
  1174         if INST:
  1172         if INST:
  1175             installhg(options)
  1173             installhg(options)
  1176             _checkhglib("Testing")
  1174             _checkhglib("Testing")
  1177         else:
  1175         else:
  1298             # without this, we get the default temp dir location, but
  1296             # without this, we get the default temp dir location, but
  1299             # in all lowercase, which causes troubles with paths (issue3490)
  1297             # in all lowercase, which causes troubles with paths (issue3490)
  1300             d = os.getenv('TMP')
  1298             d = os.getenv('TMP')
  1301         tmpdir = tempfile.mkdtemp('', 'hgtests.', d)
  1299         tmpdir = tempfile.mkdtemp('', 'hgtests.', d)
  1302     HGTMP = os.environ['HGTMP'] = os.path.realpath(tmpdir)
  1300     HGTMP = os.environ['HGTMP'] = os.path.realpath(tmpdir)
  1303     HGRCPATH = None
       
  1304 
  1301 
  1305     os.environ["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"'
  1302     os.environ["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"'
  1306     os.environ["HGMERGE"] = "internal:merge"
  1303     os.environ["HGMERGE"] = "internal:merge"
  1307     os.environ["HGUSER"]   = "test"
  1304     os.environ["HGUSER"]   = "test"
  1308     os.environ["HGENCODING"] = "ascii"
  1305     os.environ["HGENCODING"] = "ascii"