tests/run-tests.py
changeset 21515 9978ff48b1e8
parent 21514 59fe123dbb00
child 21516 1e275c09242e
equal deleted inserted replaced
21514:59fe123dbb00 21515:9978ff48b1e8
   339     SKIPPED_STATUS = 80
   339     SKIPPED_STATUS = 80
   340 
   340 
   341     def __init__(self, options, path, tmpdir, abort, keeptmpdir=False,
   341     def __init__(self, options, path, tmpdir, abort, keeptmpdir=False,
   342                  debug=False, nodiff=False, diffviewer=None,
   342                  debug=False, nodiff=False, diffviewer=None,
   343                  interactive=False, timeout=defaults['timeout'],
   343                  interactive=False, timeout=defaults['timeout'],
   344                  startport=defaults['port']):
   344                  startport=defaults['port'], extraconfigopts=None):
   345         """Create a test from parameters.
   345         """Create a test from parameters.
   346 
   346 
   347         options are parsed command line options that control test execution.
   347         options are parsed command line options that control test execution.
   348 
   348 
   349         path is the full path to the file defining the test.
   349         path is the full path to the file defining the test.
   371 
   371 
   372         startport controls the starting port number to use for this test. Each
   372         startport controls the starting port number to use for this test. Each
   373         test will reserve 3 port numbers for execution. It is the caller's
   373         test will reserve 3 port numbers for execution. It is the caller's
   374         responsibility to allocate a non-overlapping port range to Test
   374         responsibility to allocate a non-overlapping port range to Test
   375         instances.
   375         instances.
       
   376 
       
   377         extraconfigopts is an iterable of extra hgrc config options. Values
       
   378         must have the form "key=value" (something understood by hgrc). Values
       
   379         of the form "foo.key=value" will result in "[foo] key=value".
   376         """
   380         """
   377 
   381 
   378         self.path = path
   382         self.path = path
   379         self.name = os.path.basename(path)
   383         self.name = os.path.basename(path)
   380         self._testdir = os.path.dirname(path)
   384         self._testdir = os.path.dirname(path)
   388         self._nodiff = nodiff
   392         self._nodiff = nodiff
   389         self._diffviewer = diffviewer
   393         self._diffviewer = diffviewer
   390         self._interactive = interactive
   394         self._interactive = interactive
   391         self._timeout = timeout
   395         self._timeout = timeout
   392         self._startport = startport
   396         self._startport = startport
       
   397         self._extraconfigopts = extraconfigopts or []
   393         self._daemonpids = []
   398         self._daemonpids = []
   394 
   399 
   395         self._finished = None
   400         self._finished = None
   396         self._ret = None
   401         self._ret = None
   397         self._out = None
   402         self._out = None
   641         hgrc.write('[defaults]\n')
   646         hgrc.write('[defaults]\n')
   642         hgrc.write('backout = -d "0 0"\n')
   647         hgrc.write('backout = -d "0 0"\n')
   643         hgrc.write('commit = -d "0 0"\n')
   648         hgrc.write('commit = -d "0 0"\n')
   644         hgrc.write('shelve = --date "0 0"\n')
   649         hgrc.write('shelve = --date "0 0"\n')
   645         hgrc.write('tag = -d "0 0"\n')
   650         hgrc.write('tag = -d "0 0"\n')
   646         if self._options.extra_config_opt:
   651         for opt in self._extraconfigopts:
   647             for opt in self._options.extra_config_opt:
   652             section, key = opt.split('.', 1)
   648                 section, key = opt.split('.', 1)
   653             assert '=' in key, ('extra config opt %s must '
   649                 assert '=' in key, ('extra config opt %s must '
   654                                 'have an = for assignment' % opt)
   650                                     'have an = for assignment' % opt)
   655             hgrc.write('[%s]\n%s\n' % (section, key))
   651                 hgrc.write('[%s]\n%s\n' % (section, key))
       
   652         hgrc.close()
   656         hgrc.close()
   653 
   657 
   654     def fail(self, msg, ret):
   658     def fail(self, msg, ret):
   655         warned = ret is False
   659         warned = ret is False
   656         if not self._nodiff:
   660         if not self._nodiff:
  1515                        debug=self.options.debug,
  1519                        debug=self.options.debug,
  1516                        nodiff = self.options.nodiff,
  1520                        nodiff = self.options.nodiff,
  1517                        diffviewer=self.options.view,
  1521                        diffviewer=self.options.view,
  1518                        interactive=self.options.interactive,
  1522                        interactive=self.options.interactive,
  1519                        timeout=self.options.timeout,
  1523                        timeout=self.options.timeout,
  1520                        startport=self.options.port + count * 3)
  1524                        startport=self.options.port + count * 3,
       
  1525                        extraconfigopts=self.options.extra_config_opt)
  1521 
  1526 
  1522     def _cleanup(self):
  1527     def _cleanup(self):
  1523         """Clean up state from this test invocation."""
  1528         """Clean up state from this test invocation."""
  1524 
  1529 
  1525         if self.options.keep_tmpdir:
  1530         if self.options.keep_tmpdir: