Mercurial > hg-stable
changeset 14202:b68a41420397
run-tests: add --shell command line flag
This makes it easy to test with, say, both /bin/bash and /bin/dash
instead of changing the system-wide /bin/sh.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Thu, 05 May 2011 20:04:49 +0200 |
parents | 57e04ded3da4 |
children | b230922eb0c3 |
files | tests/run-tests.py |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Thu May 05 20:03:43 2011 +0200 +++ b/tests/run-tests.py Thu May 05 20:04:49 2011 +0200 @@ -104,6 +104,7 @@ 'jobs': ('HGTEST_JOBS', 1), 'timeout': ('HGTEST_TIMEOUT', 180), 'port': ('HGTEST_PORT', 20059), + 'shell': ('HGTEST_SHELL', '/bin/sh'), } def parseargs(): @@ -149,6 +150,8 @@ help="retest failed tests") parser.add_option("-S", "--noskips", action="store_true", help="don't report skip tests verbosely") + parser.add_option("--shell", type="string", + help="shell to use (default: $%s or %s)" % defaults['shell']) parser.add_option("-t", "--timeout", type="int", help="kill errant tests after TIMEOUT seconds" " (default: $%s or %d)" % defaults['timeout']) @@ -177,6 +180,10 @@ if 'java' in sys.platform or '__pypy__' in sys.modules: options.pure = True + if not (os.path.isfile(options.shell) and + os.access(options.shell, os.X_OK)): + parser.error('--shell must be executable') + if options.with_hg: if not (os.path.isfile(options.with_hg) and os.access(options.with_hg, os.X_OK)): @@ -527,7 +534,7 @@ os.write(fd, l) os.close(fd) - cmd = '/bin/sh "%s"' % name + cmd = '"%s" "%s"' % (options.shell, name) vlog("# Running", cmd) exitcode, output = run(cmd, wd, options, replacements) # do not merge output if skipped, return hghave message instead