tests/run-tests.py
branchstable
changeset 720 8008f7627b2f
parent 719 ad3048630bd8
child 721 1dbc96b10ebd
equal deleted inserted replaced
719:ad3048630bd8 720:8008f7627b2f
    68 # reserved exit code to skip test (used by hghave)
    68 # reserved exit code to skip test (used by hghave)
    69 SKIPPED_STATUS = 80
    69 SKIPPED_STATUS = 80
    70 SKIPPED_PREFIX = 'skipped: '
    70 SKIPPED_PREFIX = 'skipped: '
    71 FAILED_PREFIX  = 'hghave check failed: '
    71 FAILED_PREFIX  = 'hghave check failed: '
    72 PYTHON = sys.executable
    72 PYTHON = sys.executable
       
    73 IMPL_PATH = 'PYTHONPATH'
       
    74 if 'java' in sys.platform:
       
    75     IMPL_PATH = 'JYTHONPATH'
    73 
    76 
    74 requiredtools = ["python", "diff", "grep", "unzip", "gunzip", "bunzip2", "sed"]
    77 requiredtools = ["python", "diff", "grep", "unzip", "gunzip", "bunzip2", "sed"]
    75 
    78 
    76 defaults = {
    79 defaults = {
    77     'jobs': ('HGTEST_JOBS', 1),
    80     'jobs': ('HGTEST_JOBS', 1),
   138     for option, default in defaults.items():
   141     for option, default in defaults.items():
   139         defaults[option] = int(os.environ.get(*default))
   142         defaults[option] = int(os.environ.get(*default))
   140     parser.set_defaults(**defaults)
   143     parser.set_defaults(**defaults)
   141     (options, args) = parser.parse_args()
   144     (options, args) = parser.parse_args()
   142 
   145 
       
   146     # jython is always pure
       
   147     options.pure = options.pure or 'java' in sys.platform
       
   148 
   143     if options.with_hg:
   149     if options.with_hg:
   144         if not (os.path.isfile(options.with_hg) and
   150         if not (os.path.isfile(options.with_hg) and
   145                 os.access(options.with_hg, os.X_OK)):
   151                 os.access(options.with_hg, os.X_OK)):
   146             parser.error('--with-hg must specify an executable hg script')
   152             parser.error('--with-hg must specify an executable hg script')
   147         if not os.path.basename(options.with_hg) == 'hg':
   153         if not os.path.basename(options.with_hg) == 'hg':
   905         pypath = [PYTHONDIR, TESTDIR]
   911         pypath = [PYTHONDIR, TESTDIR]
   906         # We have to augment PYTHONPATH, rather than simply replacing
   912         # We have to augment PYTHONPATH, rather than simply replacing
   907         # it, in case external libraries are only available via current
   913         # it, in case external libraries are only available via current
   908         # PYTHONPATH.  (In particular, the Subversion bindings on OS X
   914         # PYTHONPATH.  (In particular, the Subversion bindings on OS X
   909         # are in /opt/subversion.)
   915         # are in /opt/subversion.)
   910         oldpypath = os.environ.get('PYTHONPATH')
   916         oldpypath = os.environ.get(IMPL_PATH)
   911         if oldpypath:
   917         if oldpypath:
   912             pypath.append(oldpypath)
   918             pypath.append(oldpypath)
   913         os.environ['PYTHONPATH'] = os.pathsep.join(pypath)
   919         os.environ[IMPL_PATH] = os.pathsep.join(pypath)
   914 
   920 
   915     COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
   921     COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
   916 
   922 
   917     if len(args) == 0:
   923     if len(args) == 0:
   918         args = os.listdir(".")
   924         args = os.listdir(".")
   929         return
   935         return
   930 
   936 
   931     vlog("# Using TESTDIR", TESTDIR)
   937     vlog("# Using TESTDIR", TESTDIR)
   932     vlog("# Using HGTMP", HGTMP)
   938     vlog("# Using HGTMP", HGTMP)
   933     vlog("# Using PATH", os.environ["PATH"])
   939     vlog("# Using PATH", os.environ["PATH"])
   934     vlog("# Using PYTHONPATH", os.environ["PYTHONPATH"])
   940     vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH])
   935 
   941 
   936     try:
   942     try:
   937         if len(tests) > 1 and options.jobs > 1:
   943         if len(tests) > 1 and options.jobs > 1:
   938             runchildren(options, tests)
   944             runchildren(options, tests)
   939         else:
   945         else: