run-tests: add --chg-debug flag to show chg debug output
authorPulkit Goyal <7895pulkit@gmail.com>
Wed, 25 Mar 2020 13:20:08 +0530
changeset 44615 78a8f65eacc8
parent 44614 7f9538a3b29e
child 44616 bdc8a5944d44
run-tests: add --chg-debug flag to show chg debug output This has helped me a lot in debugging chg failures in tests.
tests/run-tests.py
--- a/tests/run-tests.py	Tue Mar 24 12:48:57 2020 +0530
+++ b/tests/run-tests.py	Wed Mar 25 13:20:08 2020 +0530
@@ -531,6 +531,9 @@
         action="store_true",
         help="install and use chg wrapper in place of hg",
     )
+    hgconf.add_argument(
+        "--chg-debug", action="store_true", help="show chg debug logs",
+    )
     hgconf.add_argument("--compiler", help="compiler to build with")
     hgconf.add_argument(
         '--extra-config-opt',
@@ -924,6 +927,7 @@
         hgcommand=None,
         slowtimeout=None,
         usechg=False,
+        chgdebug=False,
         useipv6=False,
     ):
         """Create a test from parameters.
@@ -979,6 +983,7 @@
         self._shell = _sys2bytes(shell)
         self._hgcommand = hgcommand or b'hg'
         self._usechg = usechg
+        self._chgdebug = chgdebug
         self._useipv6 = useipv6
 
         self._aborted = False
@@ -1417,6 +1422,8 @@
 
         if self._usechg:
             env['CHGSOCKNAME'] = os.path.join(self._chgsockdir, b'server')
+        if self._chgdebug:
+            env['CHGDEBUG'] = 'true'
 
         return env
 
@@ -3386,6 +3393,7 @@
             shell=self.options.shell,
             hgcommand=self._hgcommand,
             usechg=bool(self.options.with_chg or self.options.chg),
+            chgdebug=self.options.chg_debug,
             useipv6=useipv6,
             **kwds
         )