##// END OF EJS Templates
run-tests: upper-case global PYTHON variable
Martin Geisler -
r8096:a110d7a2 default
parent child Browse files
Show More
@@ -37,6 +37,7 b' import time'
37 SKIPPED_STATUS = 80
37 SKIPPED_STATUS = 80
38 SKIPPED_PREFIX = 'skipped: '
38 SKIPPED_PREFIX = 'skipped: '
39 FAILED_PREFIX = 'hghave check failed: '
39 FAILED_PREFIX = 'hghave check failed: '
40 PYTHON = sys.executable
40
41
41 required_tools = ["python", "diff", "grep", "unzip", "gunzip", "bunzip2", "sed"]
42 required_tools = ["python", "diff", "grep", "unzip", "gunzip", "bunzip2", "sed"]
42
43
@@ -46,8 +47,6 b' defaults = {'
46 'port': ('HGTEST_PORT', 20059),
47 'port': ('HGTEST_PORT', 20059),
47 }
48 }
48
49
49 python = sys.executable
50
51 def parse_args():
50 def parse_args():
52 parser = optparse.OptionParser("%prog [options] [tests]")
51 parser = optparse.OptionParser("%prog [options] [tests]")
53 parser.add_option("-C", "--annotate", action="store_true",
52 parser.add_option("-C", "--annotate", action="store_true",
@@ -204,7 +203,7 b' def use_correct_python():'
204 shutil.copymode(sys.executable, my_python)
203 shutil.copymode(sys.executable, my_python)
205
204
206 def install_hg(options):
205 def install_hg(options):
207 global python
206 global PYTHON
208 vlog("# Performing temporary installation of HG")
207 vlog("# Performing temporary installation of HG")
209 installerrs = os.path.join("tests", "install.err")
208 installerrs = os.path.join("tests", "install.err")
210 pure = options.pure and "--pure" or ""
209 pure = options.pure and "--pure" or ""
@@ -268,12 +267,12 b' def install_hg(options):'
268 os.path.join(BINDIR, '_hg.py')))
267 os.path.join(BINDIR, '_hg.py')))
269 f.close()
268 f.close()
270 os.chmod(os.path.join(BINDIR, 'hg'), 0700)
269 os.chmod(os.path.join(BINDIR, 'hg'), 0700)
271 python = '"%s" "%s" -x' % (sys.executable,
270 PYTHON = '"%s" "%s" -x' % (sys.executable,
272 os.path.join(TESTDIR,'coverage.py'))
271 os.path.join(TESTDIR,'coverage.py'))
273
272
274 def _hgpath():
273 def _hgpath():
275 cmd = '%s -c "import mercurial; print mercurial.__path__[0]"'
274 cmd = '%s -c "import mercurial; print mercurial.__path__[0]"'
276 hgpath = os.popen(cmd % python)
275 hgpath = os.popen(cmd % PYTHON)
277 path = hgpath.read().strip()
276 path = hgpath.read().strip()
278 hgpath.close()
277 hgpath.close()
279 return path
278 return path
@@ -389,7 +388,7 b' def run_one(options, test, skips, fails)'
389 lctest = test.lower()
388 lctest = test.lower()
390
389
391 if lctest.endswith('.py') or firstline == '#!/usr/bin/env python':
390 if lctest.endswith('.py') or firstline == '#!/usr/bin/env python':
392 cmd = '%s "%s"' % (python, testpath)
391 cmd = '%s "%s"' % (PYTHON, testpath)
393 elif lctest.endswith('.bat'):
392 elif lctest.endswith('.bat'):
394 # do not run batch scripts on non-windows
393 # do not run batch scripts on non-windows
395 if os.name != 'nt':
394 if os.name != 'nt':
@@ -523,7 +522,7 b' def run_children(options, expecthg, test'
523 continue
522 continue
524 rfd, wfd = os.pipe()
523 rfd, wfd = os.pipe()
525 childopts = ['--child=%d' % wfd, '--port=%d' % (options.port + j * 3)]
524 childopts = ['--child=%d' % wfd, '--port=%d' % (options.port + j * 3)]
526 cmdline = [python, sys.argv[0]] + opts + childopts + job
525 cmdline = [PYTHON, sys.argv[0]] + opts + childopts + job
527 vlog(' '.join(cmdline))
526 vlog(' '.join(cmdline))
528 fps[os.spawnvp(os.P_NOWAIT, cmdline[0], cmdline)] = os.fdopen(rfd, 'r')
527 fps[os.spawnvp(os.P_NOWAIT, cmdline[0], cmdline)] = os.fdopen(rfd, 'r')
529 os.close(wfd)
528 os.close(wfd)
General Comments 0
You need to be logged in to leave comments. Login now