tests/run-tests.py
changeset 25107 149cc7663ac8
parent 25098 bf84ab53c2fd
child 25155 6ab5a1c9ea3c
--- 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)