tests/run-tests.py
changeset 1092 25db33023e4e
parent 1090 e7e4ca624772
child 1093 660262879b48
equal deleted inserted replaced
1087:06fb629c6195 1092:25db33023e4e
   597     # True or False when in a true or false conditional section
   597     # True or False when in a true or false conditional section
   598     skipping = None
   598     skipping = None
   599 
   599 
   600     def hghave(reqs):
   600     def hghave(reqs):
   601         # TODO: do something smarter when all other uses of hghave is gone
   601         # TODO: do something smarter when all other uses of hghave is gone
       
   602         tdir = TESTDIR.replace('\\', '/')
   602         proc = Popen4('%s -c "%s/hghave %s"' %
   603         proc = Popen4('%s -c "%s/hghave %s"' %
   603                       (options.shell, TESTDIR, ' '.join(reqs)), TESTDIR, 0)
   604                       (options.shell, tdir, ' '.join(reqs)), TESTDIR, 0)
   604         proc.communicate()
   605         proc.communicate()
   605         ret = proc.wait()
   606         ret = proc.wait()
   606         if wifexited(ret):
   607         if wifexited(ret):
   607             ret = os.WEXITSTATUS(ret)
   608             ret = os.WEXITSTATUS(ret)
   608         return ret == 0
   609         return ret == 0
   907             return skip("not executable")
   908             return skip("not executable")
   908         runner = shtest
   909         runner = shtest
   909 
   910 
   910     # Make a tmp subdirectory to work in
   911     # Make a tmp subdirectory to work in
   911     testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \
   912     testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \
   912         os.path.join(HGTMP, os.path.basename(test)).replace('\\', '/')
   913         os.path.join(HGTMP, os.path.basename(test))
   913 
   914 
   914     replacements = [
   915     replacements = [
   915         (r':%s\b' % options.port, ':$HGPORT'),
   916         (r':%s\b' % options.port, ':$HGPORT'),
   916         (r':%s\b' % (options.port + 1), ':$HGPORT1'),
   917         (r':%s\b' % (options.port + 1), ':$HGPORT1'),
   917         (r':%s\b' % (options.port + 2), ':$HGPORT2'),
   918         (r':%s\b' % (options.port + 2), ':$HGPORT2'),
  1227             # can't remove on solaris
  1228             # can't remove on solaris
  1228             os.environ[k] = ''
  1229             os.environ[k] = ''
  1229             del os.environ[k]
  1230             del os.environ[k]
  1230 
  1231 
  1231     global TESTDIR, HGTMP, INST, BINDIR, PYTHONDIR, COVERAGE_FILE
  1232     global TESTDIR, HGTMP, INST, BINDIR, PYTHONDIR, COVERAGE_FILE
  1232     TESTDIR = os.environ["TESTDIR"] = os.getcwd().replace('\\', '/')
  1233     TESTDIR = os.environ["TESTDIR"] = os.getcwd()
  1233     if options.tmpdir:
  1234     if options.tmpdir:
  1234         options.keep_tmpdir = True
  1235         options.keep_tmpdir = True
  1235         tmpdir = options.tmpdir
  1236         tmpdir = options.tmpdir
  1236         if os.path.exists(tmpdir):
  1237         if os.path.exists(tmpdir):
  1237             # Meaning of tmpdir has changed since 1.3: we used to create
  1238             # Meaning of tmpdir has changed since 1.3: we used to create
  1244             # or "--tmpdir=$HOME".
  1245             # or "--tmpdir=$HOME".
  1245             #vlog("# Removing temp dir", tmpdir)
  1246             #vlog("# Removing temp dir", tmpdir)
  1246             #shutil.rmtree(tmpdir)
  1247             #shutil.rmtree(tmpdir)
  1247         os.makedirs(tmpdir)
  1248         os.makedirs(tmpdir)
  1248     else:
  1249     else:
  1249         tmpdir = tempfile.mkdtemp('', 'hgtests.')
  1250         d = None
       
  1251         if os.name == 'nt':
       
  1252             # without this, we get the default temp dir location, but
       
  1253             # in all lowercase, which causes troubles with paths (issue3490)
       
  1254             d = os.getenv('TMP')
       
  1255         tmpdir = tempfile.mkdtemp('', 'hgtests.', d)
  1250     HGTMP = os.environ['HGTMP'] = os.path.realpath(tmpdir)
  1256     HGTMP = os.environ['HGTMP'] = os.path.realpath(tmpdir)
  1251     DAEMON_PIDS = None
  1257     DAEMON_PIDS = None
  1252     HGRCPATH = None
  1258     HGRCPATH = None
  1253 
  1259 
  1254     os.environ["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"'
  1260     os.environ["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"'