diff tests/run-tests.py @ 37342:4e6a6d0dccee

tests: conditionalize tests based on presence of custom extensions The test harness supports injecting extensions via --extra-config-opt. However, if you do this, various tests that print state about loaded extensions fail. This commit teaches the test harness to recognize when custom extensions are loaded so that tests can use feature sniffing to conditionalize tests based on that. Differential Revision: https://phab.mercurial-scm.org/D3039
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 04 Apr 2018 13:21:34 -0700
parents 5890e5872f36
children 700aaa19de63
line wrap: on
line diff
--- a/tests/run-tests.py	Wed Apr 04 12:16:50 2018 -0700
+++ b/tests/run-tests.py	Wed Apr 04 13:21:34 2018 -0700
@@ -1070,6 +1070,17 @@
         env["HGENCODINGMODE"] = "strict"
         env['HGIPV6'] = str(int(self._useipv6))
 
+        extraextensions = []
+        for opt in self._extraconfigopts:
+            section, key = opt.encode('utf-8').split(b'.', 1)
+            if section != 'extensions':
+                continue
+            name = key.split(b'=', 1)[0]
+            extraextensions.append(name)
+
+        if extraextensions:
+            env['HGTESTEXTRAEXTENSIONS'] = b' '.join(extraextensions)
+
         # LOCALIP could be ::1 or 127.0.0.1. Useful for tests that require raw
         # IP addresses.
         env['LOCALIP'] = self._localip()