tests/run-tests.py
branchstable
changeset 1174 193946338595
parent 1173 d5da1c5cf1f5
child 1175 62cc0851c70f
equal deleted inserted replaced
1173:d5da1c5cf1f5 1174:193946338595
   326 
   326 
   327 def checktools():
   327 def checktools():
   328     # Before we go any further, check for pre-requisite tools
   328     # Before we go any further, check for pre-requisite tools
   329     # stuff from coreutils (cat, rm, etc) are not tested
   329     # stuff from coreutils (cat, rm, etc) are not tested
   330     for p in requiredtools:
   330     for p in requiredtools:
   331         if os.name == 'nt':
   331         if os.name == 'nt' and not p.endswith('.exe'):
   332             p += '.exe'
   332             p += '.exe'
   333         found = findprogram(p)
   333         found = findprogram(p)
   334         if found:
   334         if found:
   335             vlog("# Found prerequisite", p, "at", found)
   335             vlog("# Found prerequisite", p, "at", found)
   336         else:
   336         else:
   363             return
   363             return
   364     else:
   364     else:
   365         exename = 'python'
   365         exename = 'python'
   366         if sys.platform == 'win32':
   366         if sys.platform == 'win32':
   367             exename = 'python.exe'
   367             exename = 'python.exe'
   368     vlog('# Making python executable in test path use correct Python')
   368     if getattr(os, 'symlink', None):
   369     mypython = os.path.join(BINDIR, exename)
   369         vlog("# Making python executable in test path a symlink to '%s'" % 
   370     try:
   370              sys.executable)
   371         os.symlink(sys.executable, mypython)
   371         mypython = os.path.join(BINDIR, exename)
   372     except AttributeError:
   372         try:
   373         # windows fallback
   373             os.symlink(sys.executable, mypython)
   374         shutil.copyfile(sys.executable, mypython)
   374         except OSError, err:
   375         shutil.copymode(sys.executable, mypython)
   375             # child processes may race, which is harmless
   376     except OSError, err:
   376             if err.errno != errno.EEXIST:
   377         # child processes may race, which is harmless
   377                 raise
   378         if err.errno != errno.EEXIST:
   378     else:
   379             raise
   379         vlog("# Modifying search path to find %s in '%s'" % (exename, exedir))
       
   380         path = os.environ['PATH'].split(os.pathsep)
       
   381         while exedir in path:
       
   382             path.remove(exedir)
       
   383         os.environ['PATH'] = os.pathsep.join([exedir] + path)
       
   384         if not findprogram(exename):
       
   385             print "WARNING: Cannot find %s in search path" % exename
   380 
   386 
   381 def installhg(options):
   387 def installhg(options):
   382     vlog("# Performing temporary installation of HG")
   388     vlog("# Performing temporary installation of HG")
   383     installerrs = os.path.join("tests", "install.err")
   389     installerrs = os.path.join("tests", "install.err")
   384     compiler = ''
   390     compiler = ''