tests/run-tests.py
changeset 28644 2e50eb6304bd
parent 28620 759d167f75cf
child 28645 c226e9b69bac
equal deleted inserted replaced
28643:392a7e7e97d3 28644:2e50eb6304bd
   148     'timeout': ('HGTEST_TIMEOUT', 180),
   148     'timeout': ('HGTEST_TIMEOUT', 180),
   149     'slowtimeout': ('HGTEST_SLOWTIMEOUT', 500),
   149     'slowtimeout': ('HGTEST_SLOWTIMEOUT', 500),
   150     'port': ('HGTEST_PORT', 20059),
   150     'port': ('HGTEST_PORT', 20059),
   151     'shell': ('HGTEST_SHELL', 'sh'),
   151     'shell': ('HGTEST_SHELL', 'sh'),
   152 }
   152 }
       
   153 
       
   154 def canonpath(path):
       
   155     return os.path.realpath(os.path.expanduser(path))
   153 
   156 
   154 def parselistfiles(files, listtype, warn=True):
   157 def parselistfiles(files, listtype, warn=True):
   155     entries = dict()
   158     entries = dict()
   156     for filename in files:
   159     for filename in files:
   157         try:
   160         try:
   288     # jython is always pure
   291     # jython is always pure
   289     if 'java' in sys.platform or '__pypy__' in sys.modules:
   292     if 'java' in sys.platform or '__pypy__' in sys.modules:
   290         options.pure = True
   293         options.pure = True
   291 
   294 
   292     if options.with_hg:
   295     if options.with_hg:
   293         options.with_hg = os.path.realpath(
   296         options.with_hg = canonpath(_bytespath(options.with_hg))
   294             os.path.expanduser(_bytespath(options.with_hg)))
       
   295         if not (os.path.isfile(options.with_hg) and
   297         if not (os.path.isfile(options.with_hg) and
   296                 os.access(options.with_hg, os.X_OK)):
   298                 os.access(options.with_hg, os.X_OK)):
   297             parser.error('--with-hg must specify an executable hg script')
   299             parser.error('--with-hg must specify an executable hg script')
   298         if not os.path.basename(options.with_hg) == b'hg':
   300         if not os.path.basename(options.with_hg) == b'hg':
   299             sys.stderr.write('warning: --with-hg should specify an hg script\n')
   301             sys.stderr.write('warning: --with-hg should specify an hg script\n')
   300     if options.local:
   302     if options.local:
   301         testdir = os.path.dirname(_bytespath(os.path.realpath(sys.argv[0])))
   303         testdir = os.path.dirname(_bytespath(canonpath(sys.argv[0])))
   302         hgbin = os.path.join(os.path.dirname(testdir), b'hg')
   304         hgbin = os.path.join(os.path.dirname(testdir), b'hg')
   303         if os.name != 'nt' and not os.access(hgbin, os.X_OK):
   305         if os.name != 'nt' and not os.access(hgbin, os.X_OK):
   304             parser.error('--local specified, but %r not found or not executable'
   306             parser.error('--local specified, but %r not found or not executable'
   305                          % hgbin)
   307                          % hgbin)
   306         options.with_hg = hgbin
   308         options.with_hg = hgbin
   307 
   309 
   308     if (options.chg or options.with_chg) and os.name == 'nt':
   310     if (options.chg or options.with_chg) and os.name == 'nt':
   309         parser.error('chg does not work on %s' % os.name)
   311         parser.error('chg does not work on %s' % os.name)
   310     if options.with_chg:
   312     if options.with_chg:
   311         options.chg = False  # no installation to temporary location
   313         options.chg = False  # no installation to temporary location
   312         options.with_chg = os.path.realpath(
   314         options.with_chg = canonpath(_bytespath(options.with_chg))
   313             os.path.expanduser(_bytespath(options.with_chg)))
       
   314         if not (os.path.isfile(options.with_chg) and
   315         if not (os.path.isfile(options.with_chg) and
   315                 os.access(options.with_chg, os.X_OK)):
   316                 os.access(options.with_chg, os.X_OK)):
   316             parser.error('--with-chg must specify a chg executable')
   317             parser.error('--with-chg must specify a chg executable')
   317     if options.chg and options.with_hg:
   318     if options.chg and options.with_hg:
   318         # chg shares installation location with hg
   319         # chg shares installation location with hg
   341     global verbose
   342     global verbose
   342     if options.verbose:
   343     if options.verbose:
   343         verbose = ''
   344         verbose = ''
   344 
   345 
   345     if options.tmpdir:
   346     if options.tmpdir:
   346         options.tmpdir = os.path.expanduser(options.tmpdir)
   347         options.tmpdir = canonpath(options.tmpdir)
   347 
   348 
   348     if options.jobs < 1:
   349     if options.jobs < 1:
   349         parser.error('--jobs must be positive')
   350         parser.error('--jobs must be positive')
   350     if options.interactive and options.debug:
   351     if options.interactive and options.debug:
   351         parser.error("-i/--interactive and -d/--debug are incompatible")
   352         parser.error("-i/--interactive and -d/--debug are incompatible")