##// END OF EJS Templates
catapult: introduce HGTESTCATAPULTSERVERPIPE to control run-tests' tracing...
Kyle Lippincott -
r40525:889424be default
parent child Browse files
Show More
@@ -1084,8 +1084,11 b' class Test(unittest.TestCase):'
1084 env["HGENCODINGMODE"] = "strict"
1084 env["HGENCODINGMODE"] = "strict"
1085 env["HGHOSTNAME"] = "test-hostname"
1085 env["HGHOSTNAME"] = "test-hostname"
1086 env['HGIPV6'] = str(int(self._useipv6))
1086 env['HGIPV6'] = str(int(self._useipv6))
1087 if 'HGCATAPULTSERVERPIPE' not in env:
1087 if 'HGTESTCATAPULTSERVERPIPE' not in env:
1088 env['HGCATAPULTSERVERPIPE'] = os.devnull
1088 # If we don't have HGTESTCATAPULTSERVERPIPE explicitly set, pull the
1089 # non-test one in as a default, otherwise set to devnull
1090 env['HGTESTCATAPULTSERVERPIPE'] = \
1091 env.get('HGCATAPULTSERVERPIPE', os.devnull)
1089
1092
1090 extraextensions = []
1093 extraextensions = []
1091 for opt in self._extraconfigopts:
1094 for opt in self._extraconfigopts:
@@ -1382,14 +1385,14 b' class TTest(Test):'
1382 session = str(uuid.uuid4())
1385 session = str(uuid.uuid4())
1383 if PYTHON3:
1386 if PYTHON3:
1384 session = session.encode('ascii')
1387 session = session.encode('ascii')
1385 hgcatapult = os.getenv('HGCATAPULTSERVERPIPE')
1388 hgcatapult = os.getenv('HGTESTCATAPULTSERVERPIPE')
1386 def toggletrace(cmd=None):
1389 def toggletrace(cmd=None):
1387 if not hgcatapult or hgcatapult == os.devnull:
1390 if not hgcatapult or hgcatapult == os.devnull:
1388 return
1391 return
1389
1392
1390 if activetrace:
1393 if activetrace:
1391 script.append(
1394 script.append(
1392 b'echo END %s %s >> "$HGCATAPULTSERVERPIPE"\n' % (
1395 b'echo END %s %s >> "$HGTESTCATAPULTSERVERPIPE"\n' % (
1393 session, activetrace[0]))
1396 session, activetrace[0]))
1394 if cmd is None:
1397 if cmd is None:
1395 return
1398 return
@@ -1400,7 +1403,7 b' class TTest(Test):'
1400 quoted = shellquote(cmd.strip().decode('utf8')).encode('utf8')
1403 quoted = shellquote(cmd.strip().decode('utf8')).encode('utf8')
1401 quoted = quoted.replace(b'\\', b'\\\\')
1404 quoted = quoted.replace(b'\\', b'\\\\')
1402 script.append(
1405 script.append(
1403 b'echo START %s %s >> "$HGCATAPULTSERVERPIPE"\n' % (
1406 b'echo START %s %s >> "$HGTESTCATAPULTSERVERPIPE"\n' % (
1404 session, quoted))
1407 session, quoted))
1405 activetrace[0:] = [quoted]
1408 activetrace[0:] = [quoted]
1406
1409
@@ -1438,18 +1441,19 b' class TTest(Test):'
1438 # loop to exit and closes the pipe. Sigh.
1441 # loop to exit and closes the pipe. Sigh.
1439 script.append(
1442 script.append(
1440 b'rtendtracing() {\n'
1443 b'rtendtracing() {\n'
1441 b' echo END %(session)s %(name)s >> $HGCATAPULTSERVERPIPE\n'
1444 b' echo END %(session)s %(name)s >> %(catapult)s\n'
1442 b' rm -f "$TESTTMP/.still-running"\n'
1445 b' rm -f "$TESTTMP/.still-running"\n'
1443 b'}\n'
1446 b'}\n'
1444 b'trap "rtendtracing" 0\n'
1447 b'trap "rtendtracing" 0\n'
1445 b'touch "$TESTTMP/.still-running"\n'
1448 b'touch "$TESTTMP/.still-running"\n'
1446 b'while [ -f "$TESTTMP/.still-running" ]; do sleep 1; done '
1449 b'while [ -f "$TESTTMP/.still-running" ]; do sleep 1; done '
1447 b'> $HGCATAPULTSERVERPIPE &\n'
1450 b'> %(catapult)s &\n'
1448 b'HGCATAPULTSESSION=%(session)s ; export HGCATAPULTSESSION\n'
1451 b'HGCATAPULTSESSION=%(session)s ; export HGCATAPULTSESSION\n'
1449 b'echo START %(session)s %(name)s >> $HGCATAPULTSERVERPIPE\n'
1452 b'echo START %(session)s %(name)s >> %(catapult)s\n'
1450 % {
1453 % {
1451 'name': self.name,
1454 'name': self.name,
1452 'session': session,
1455 'session': session,
1456 'catapult': hgcatapult,
1453 }
1457 }
1454 )
1458 )
1455
1459
General Comments 0
You need to be logged in to leave comments. Login now