changeset 40490:889424be7ad2

catapult: introduce HGTESTCATAPULTSERVERPIPE to control run-tests' tracing If unset, it will inherit its value from HGCATAPULTSERVERPIPE (which hg itself also respects). By setting only HGTESTCATAPULTSERVERPIPE, we can get per-command breakdowns of the test runtimes for the whole test suite without overloading the trace file with the contents of the tracing from hg (such as demandimport, etc.) Differential Revision: https://phab.mercurial-scm.org/D5216
author Kyle Lippincott <spectral@google.com>
date Thu, 01 Nov 2018 16:44:02 -0700
parents a9e00c48c5ef
children c311424ea579
files tests/run-tests.py
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Thu Nov 01 16:44:37 2018 -0700
+++ b/tests/run-tests.py	Thu Nov 01 16:44:02 2018 -0700
@@ -1084,8 +1084,11 @@
         env["HGENCODINGMODE"] = "strict"
         env["HGHOSTNAME"] = "test-hostname"
         env['HGIPV6'] = str(int(self._useipv6))
-        if 'HGCATAPULTSERVERPIPE' not in env:
-            env['HGCATAPULTSERVERPIPE'] = os.devnull
+        if 'HGTESTCATAPULTSERVERPIPE' not in env:
+            # If we don't have HGTESTCATAPULTSERVERPIPE explicitly set, pull the
+            # non-test one in as a default, otherwise set to devnull
+            env['HGTESTCATAPULTSERVERPIPE'] = \
+                env.get('HGCATAPULTSERVERPIPE', os.devnull)
 
         extraextensions = []
         for opt in self._extraconfigopts:
@@ -1382,14 +1385,14 @@
         session = str(uuid.uuid4())
         if PYTHON3:
             session = session.encode('ascii')
-        hgcatapult = os.getenv('HGCATAPULTSERVERPIPE')
+        hgcatapult = os.getenv('HGTESTCATAPULTSERVERPIPE')
         def toggletrace(cmd=None):
             if not hgcatapult or hgcatapult == os.devnull:
                 return
 
             if activetrace:
                 script.append(
-                    b'echo END %s %s >> "$HGCATAPULTSERVERPIPE"\n' % (
+                    b'echo END %s %s >> "$HGTESTCATAPULTSERVERPIPE"\n' % (
                         session, activetrace[0]))
             if cmd is None:
                 return
@@ -1400,7 +1403,7 @@
                 quoted = shellquote(cmd.strip().decode('utf8')).encode('utf8')
             quoted = quoted.replace(b'\\', b'\\\\')
             script.append(
-                b'echo START %s %s >> "$HGCATAPULTSERVERPIPE"\n' % (
+                b'echo START %s %s >> "$HGTESTCATAPULTSERVERPIPE"\n' % (
                     session, quoted))
             activetrace[0:] = [quoted]
 
@@ -1438,18 +1441,19 @@
             # loop to exit and closes the pipe. Sigh.
             script.append(
                 b'rtendtracing() {\n'
-                b'  echo END %(session)s %(name)s >> $HGCATAPULTSERVERPIPE\n'
+                b'  echo END %(session)s %(name)s >> %(catapult)s\n'
                 b'  rm -f "$TESTTMP/.still-running"\n'
                 b'}\n'
                 b'trap "rtendtracing" 0\n'
                 b'touch "$TESTTMP/.still-running"\n'
                 b'while [ -f "$TESTTMP/.still-running" ]; do sleep 1; done '
-                b'> $HGCATAPULTSERVERPIPE &\n'
+                b'> %(catapult)s &\n'
                 b'HGCATAPULTSESSION=%(session)s ; export HGCATAPULTSESSION\n'
-                b'echo START %(session)s %(name)s >> $HGCATAPULTSERVERPIPE\n'
+                b'echo START %(session)s %(name)s >> %(catapult)s\n'
                 % {
                     'name': self.name,
                     'session': session,
+                    'catapult': hgcatapult,
                 }
             )