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 |