# HG changeset patch # User Augie Fackler # Date 1431541326 25200 # Node ID 149cc7663ac85994d617a3280b4c66c16760c62c # Parent 6f15114bdcc3be338d9a77e291cfd03e7a7593ff run-tests: add a --profile-runner option While in the throes of a recent run-tests adventure, I found it useful to have profiler output for the testrunner itself. Adding it was simple enough and seems worth keeping around. diff -r 6f15114bdcc3 -r 149cc7663ac8 tests/run-tests.py --- a/tests/run-tests.py Fri May 15 10:24:59 2015 +0200 +++ b/tests/run-tests.py Wed May 13 11:22:06 2015 -0700 @@ -240,6 +240,8 @@ help='set the given config opt in the test hgrc') parser.add_option('--random', action="store_true", help='run tests in random order') + parser.add_option('--profile-runner', action='store_true', + help='run statprof on run-tests') for option, (envvar, default) in defaults.items(): defaults[option] = type(default)(os.environ.get(envvar, default)) @@ -1660,7 +1662,15 @@ self._checktools() tests = self.findtests(args) - return self._run(tests) + if options.profile_runner: + import statprof + statprof.start() + result = self._run(tests) + if options.profile_runner: + statprof.stop() + statprof.display() + return result + finally: os.umask(oldmask)