equal
deleted
inserted
replaced
238 help="enable Py3k warnings on Python 2.6+") |
238 help="enable Py3k warnings on Python 2.6+") |
239 parser.add_option('--extra-config-opt', action="append", |
239 parser.add_option('--extra-config-opt', action="append", |
240 help='set the given config opt in the test hgrc') |
240 help='set the given config opt in the test hgrc') |
241 parser.add_option('--random', action="store_true", |
241 parser.add_option('--random', action="store_true", |
242 help='run tests in random order') |
242 help='run tests in random order') |
|
243 parser.add_option('--profile-runner', action='store_true', |
|
244 help='run statprof on run-tests') |
243 |
245 |
244 for option, (envvar, default) in defaults.items(): |
246 for option, (envvar, default) in defaults.items(): |
245 defaults[option] = type(default)(os.environ.get(envvar, default)) |
247 defaults[option] = type(default)(os.environ.get(envvar, default)) |
246 parser.set_defaults(**defaults) |
248 parser.set_defaults(**defaults) |
247 |
249 |
1658 args = [a.encode('utf-8') for a in args] |
1660 args = [a.encode('utf-8') for a in args] |
1659 self.options = options |
1661 self.options = options |
1660 |
1662 |
1661 self._checktools() |
1663 self._checktools() |
1662 tests = self.findtests(args) |
1664 tests = self.findtests(args) |
1663 return self._run(tests) |
1665 if options.profile_runner: |
|
1666 import statprof |
|
1667 statprof.start() |
|
1668 result = self._run(tests) |
|
1669 if options.profile_runner: |
|
1670 statprof.stop() |
|
1671 statprof.display() |
|
1672 return result |
|
1673 |
1664 finally: |
1674 finally: |
1665 os.umask(oldmask) |
1675 os.umask(oldmask) |
1666 |
1676 |
1667 def _run(self, tests): |
1677 def _run(self, tests): |
1668 if self.options.random: |
1678 if self.options.random: |