tests/run-tests.py
branchstable
changeset 932 eb562ea207c3
parent 931 b56e95db7ac5
child 934 cf241f12e977
equal deleted inserted replaced
931:b56e95db7ac5 932:eb562ea207c3
   102 
   102 
   103 defaults = {
   103 defaults = {
   104     'jobs': ('HGTEST_JOBS', 1),
   104     'jobs': ('HGTEST_JOBS', 1),
   105     'timeout': ('HGTEST_TIMEOUT', 180),
   105     'timeout': ('HGTEST_TIMEOUT', 180),
   106     'port': ('HGTEST_PORT', 20059),
   106     'port': ('HGTEST_PORT', 20059),
       
   107     'shell': ('HGTEST_SHELL', '/bin/sh'),
   107 }
   108 }
   108 
   109 
   109 def parseargs():
   110 def parseargs():
   110     parser = optparse.OptionParser("%prog [options] [tests]")
   111     parser = optparse.OptionParser("%prog [options] [tests]")
   111 
   112 
   147         help="restart at last error")
   148         help="restart at last error")
   148     parser.add_option("-r", "--retest", action="store_true",
   149     parser.add_option("-r", "--retest", action="store_true",
   149         help="retest failed tests")
   150         help="retest failed tests")
   150     parser.add_option("-S", "--noskips", action="store_true",
   151     parser.add_option("-S", "--noskips", action="store_true",
   151         help="don't report skip tests verbosely")
   152         help="don't report skip tests verbosely")
       
   153     parser.add_option("--shell", type="string",
       
   154         help="shell to use (default: $%s or %s)" % defaults['shell'])
   152     parser.add_option("-t", "--timeout", type="int",
   155     parser.add_option("-t", "--timeout", type="int",
   153         help="kill errant tests after TIMEOUT seconds"
   156         help="kill errant tests after TIMEOUT seconds"
   154              " (default: $%s or %d)" % defaults['timeout'])
   157              " (default: $%s or %d)" % defaults['timeout'])
   155     parser.add_option("--tmpdir", type="string",
   158     parser.add_option("--tmpdir", type="string",
   156         help="run tests in the given temporary directory"
   159         help="run tests in the given temporary directory"
   174     (options, args) = parser.parse_args()
   177     (options, args) = parser.parse_args()
   175 
   178 
   176     # jython is always pure
   179     # jython is always pure
   177     if 'java' in sys.platform or '__pypy__' in sys.modules:
   180     if 'java' in sys.platform or '__pypy__' in sys.modules:
   178         options.pure = True
   181         options.pure = True
       
   182 
       
   183     if not (os.path.isfile(options.shell) and
       
   184             os.access(options.shell, os.X_OK)):
       
   185         parser.error('--shell must be executable')
   179 
   186 
   180     if options.with_hg:
   187     if options.with_hg:
   181         if not (os.path.isfile(options.with_hg) and
   188         if not (os.path.isfile(options.with_hg) and
   182                 os.access(options.with_hg, os.X_OK)):
   189                 os.access(options.with_hg, os.X_OK)):
   183             parser.error('--with-hg must specify an executable hg script')
   190             parser.error('--with-hg must specify an executable hg script')
   525     try:
   532     try:
   526         for l in script:
   533         for l in script:
   527             os.write(fd, l)
   534             os.write(fd, l)
   528         os.close(fd)
   535         os.close(fd)
   529 
   536 
   530         cmd = '/bin/sh "%s"' % name
   537         cmd = '"%s" "%s"' % (options.shell, name)
   531         vlog("# Running", cmd)
   538         vlog("# Running", cmd)
   532         exitcode, output = run(cmd, wd, options, replacements)
   539         exitcode, output = run(cmd, wd, options, replacements)
   533         # do not merge output if skipped, return hghave message instead
   540         # do not merge output if skipped, return hghave message instead
   534         # similarly, with --debug, output is None
   541         # similarly, with --debug, output is None
   535         if exitcode == SKIPPED_STATUS or output is None:
   542         if exitcode == SKIPPED_STATUS or output is None: