Patchwork [4,of,8] run-tests: add --chg-debug flag to show chg debug output

login
register
mail settings
Submitter Pulkit Goyal
Date March 26, 2020, 7:36 a.m.
Message ID <e31595eeab43977cd927.1585208211@workspace>
Download mbox | patch
Permalink /patch/45899/
State Accepted
Headers show

Comments

Pulkit Goyal - March 26, 2020, 7:36 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1585122608 -19800
#      Wed Mar 25 13:20:08 2020 +0530
# Node ID e31595eeab43977cd927a5a9ab43c371c202bb24
# Parent  1185d1a02ee1b93490faef3767431a65c6edacda
run-tests: add --chg-debug flag to show chg debug output

This has helped me a lot in debugging chg failures in tests.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -531,6 +531,11 @@  def getparser():
         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 +929,7 @@  class Test(unittest.TestCase):
         hgcommand=None,
         slowtimeout=None,
         usechg=False,
+        chgdebug=False,
         useipv6=False,
     ):
         """Create a test from parameters.
@@ -979,6 +985,7 @@  class Test(unittest.TestCase):
         self._shell = _sys2bytes(shell)
         self._hgcommand = hgcommand or b'hg'
         self._usechg = usechg
+        self._chgdebug = chgdebug
         self._useipv6 = useipv6
 
         self._aborted = False
@@ -1417,6 +1424,8 @@  class Test(unittest.TestCase):
 
         if self._usechg:
             env['CHGSOCKNAME'] = os.path.join(self._chgsockdir, b'server')
+        if self._chgdebug:
+            env['CHGDEBUG'] = 'true'
 
         return env
 
@@ -3386,6 +3395,7 @@  class TestRunner(object):
             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
         )