tests/run-tests.py
branchstable
changeset 1305 d8b739c3d37a
parent 1304 366b3a1bfea9
child 1307 164ed9bf157c
equal deleted inserted replaced
1304:366b3a1bfea9 1305:d8b739c3d37a
   101 if 'java' in sys.platform:
   101 if 'java' in sys.platform:
   102     IMPL_PATH = 'JYTHONPATH'
   102     IMPL_PATH = 'JYTHONPATH'
   103 
   103 
   104 requiredtools = [os.path.basename(sys.executable), "diff", "grep", "unzip",
   104 requiredtools = [os.path.basename(sys.executable), "diff", "grep", "unzip",
   105                  "gunzip", "bunzip2", "sed"]
   105                  "gunzip", "bunzip2", "sed"]
       
   106 createdfiles = []
   106 
   107 
   107 defaults = {
   108 defaults = {
   108     'jobs': ('HGTEST_JOBS', 1),
   109     'jobs': ('HGTEST_JOBS', 1),
   109     'timeout': ('HGTEST_TIMEOUT', 180),
   110     'timeout': ('HGTEST_TIMEOUT', 180),
   110     'port': ('HGTEST_PORT', 20059),
   111     'port': ('HGTEST_PORT', 20059),
   418 
   419 
   419 def cleanup(options):
   420 def cleanup(options):
   420     if not options.keep_tmpdir:
   421     if not options.keep_tmpdir:
   421         vlog("# Cleaning up HGTMP", HGTMP)
   422         vlog("# Cleaning up HGTMP", HGTMP)
   422         shutil.rmtree(HGTMP, True)
   423         shutil.rmtree(HGTMP, True)
       
   424         for f in createdfiles:
       
   425             try:
       
   426                 os.remove(f)
       
   427             except OSError:
       
   428                 pass
   423 
   429 
   424 def usecorrectpython():
   430 def usecorrectpython():
   425     # some tests run python interpreter. they must use same
   431     # some tests run python interpreter. they must use same
   426     # interpreter we use or bad things will happen.
   432     # interpreter we use or bad things will happen.
   427     pyexename = sys.platform == 'win32' and 'python.exe' or 'python'
   433     pyexename = sys.platform == 'win32' and 'python.exe' or 'python'
   437             if err.errno != errno.ENOENT:
   443             if err.errno != errno.ENOENT:
   438                 raise
   444                 raise
   439         if findprogram(pyexename) != sys.executable:
   445         if findprogram(pyexename) != sys.executable:
   440             try:
   446             try:
   441                 os.symlink(sys.executable, mypython)
   447                 os.symlink(sys.executable, mypython)
       
   448                 createdfiles.append(mypython)
   442             except OSError, err:
   449             except OSError, err:
   443                 # child processes may race, which is harmless
   450                 # child processes may race, which is harmless
   444                 if err.errno != errno.EEXIST:
   451                 if err.errno != errno.EEXIST:
   445                     raise
   452                     raise
   446     else:
   453     else: