tests/run-tests.py
changeset 40490 889424be7ad2
parent 40489 a9e00c48c5ef
child 40491 c311424ea579
equal deleted inserted replaced
40489:a9e00c48c5ef 40490:889424be7ad2
  1082         env["HGUSER"]   = "test"
  1082         env["HGUSER"]   = "test"
  1083         env["HGENCODING"] = "ascii"
  1083         env["HGENCODING"] = "ascii"
  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:
  1092             section, key = opt.encode('utf-8').split(b'.', 1)
  1095             section, key = opt.encode('utf-8').split(b'.', 1)
  1093             if section != 'extensions':
  1096             if section != 'extensions':
  1380                 script.append(b'echo %s %d $?\n' % (salt, line))
  1383                 script.append(b'echo %s %d $?\n' % (salt, line))
  1381         activetrace = []
  1384         activetrace = []
  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
  1396 
  1399 
  1397             if isinstance(cmd, str):
  1400             if isinstance(cmd, str):
  1398                 quoted = shellquote(cmd.strip())
  1401                 quoted = shellquote(cmd.strip())
  1399             else:
  1402             else:
  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 
  1407         script = []
  1410         script = []
  1408 
  1411 
  1436             # closed by our echo commands. The still-running file gets
  1439             # closed by our echo commands. The still-running file gets
  1437             # reaped at the end of the script, which causes the while
  1440             # reaped at the end of the script, which causes the while
  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 
  1456         if self._case:
  1460         if self._case:
  1457             casestr = b'#'.join(self._case)
  1461             casestr = b'#'.join(self._case)