diff tests/run-tests.py @ 52587:732c7ad5d684

run-tests: remove the bisect related options In 8 years of using that test runner, I never used that option from run-tests. I use `hg bisect` calling the test runner a lot, but not the other way around. Dropping the option simplify the code.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 30 Dec 2024 21:48:33 +0100
parents 1a0d8556fd00
children 9b5e058a7fb9
line wrap: on
line diff
--- a/tests/run-tests.py	Mon Dec 16 19:46:07 2024 -0500
+++ b/tests/run-tests.py	Mon Dec 30 21:48:33 2024 +0100
@@ -496,13 +496,6 @@
 
     harness = parser.add_argument_group('Test Harness Behavior')
     harness.add_argument(
-        '--bisect-repo',
-        metavar='bisect_repo',
-        help=(
-            "Path of a repo to bisect. Use together with " "--known-good-rev"
-        ),
-    )
-    harness.add_argument(
         "-d",
         "--debug",
         action="store_true",
@@ -534,14 +527,6 @@
         help="keep temporary directory after running tests",
     )
     harness.add_argument(
-        '--known-good-rev',
-        metavar="known_good_rev",
-        help=(
-            "Automatically bisect any failures using this "
-            "revision as a known-good revision."
-        ),
-    )
-    harness.add_argument(
         "--list-tests",
         action="store_true",
         help="list tests instead of running them",
@@ -850,9 +835,6 @@
             'pygments is not installed\n'
         )
 
-    if options.bisect_repo and not options.known_good_rev:
-        parser.error("--bisect-repo cannot be used without --known-good-rev")
-
     global useipv6
     if options.ipv6:
         useipv6 = checksocketfamily('AF_INET6')
@@ -2903,8 +2885,6 @@
 
             savetimes(self._runner._outputdir, self._result)
 
-            if failed and self._runner.options.known_good_rev:
-                self._bisecttests(t for t, m in self._result.failures)
             self.stream.writeln(
                 '# Ran %d tests, %d skipped, %d failed.'
                 % (self._result.testsRun, skipped + ignored, failed)
@@ -2947,60 +2927,6 @@
 
         return self._result
 
-    def _bisecttests(self, tests):
-        bisectcmd = ['hg', 'bisect']
-        bisectrepo = self._runner.options.bisect_repo
-        if bisectrepo:
-            bisectcmd.extend(['-R', os.path.abspath(bisectrepo)])
-
-        def pread(args):
-            env = os.environ.copy()
-            env['HGPLAIN'] = '1'
-            p = subprocess.Popen(
-                args, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, env=env
-            )
-            data = p.stdout.read()
-            p.wait()
-            return data
-
-        for test in tests:
-            pread(bisectcmd + ['--reset']),
-            pread(bisectcmd + ['--bad', '.'])
-            pread(bisectcmd + ['--good', self._runner.options.known_good_rev])
-            # TODO: we probably need to forward more options
-            # that alter hg's behavior inside the tests.
-            opts = ''
-            withhg = self._runner.options.with_hg
-            if withhg:
-                opts += ' --with-hg=%s ' % shellquote(_bytes2sys(withhg))
-            rtc = '%s %s %s %s' % (sysexecutable, sys.argv[0], opts, test)
-            data = pread(bisectcmd + ['--command', rtc])
-            m = re.search(
-                (
-                    br'\nThe first (?P<goodbad>bad|good) revision '
-                    br'is:\nchangeset: +\d+:(?P<node>[a-f0-9]+)\n.*\n'
-                    br'summary: +(?P<summary>[^\n]+)\n'
-                ),
-                data,
-                (re.MULTILINE | re.DOTALL),
-            )
-            if m is None:
-                self.stream.writeln(
-                    'Failed to identify failure point for %s' % test
-                )
-                continue
-            dat = m.groupdict()
-            verb = 'broken' if dat['goodbad'] == b'bad' else 'fixed'
-            self.stream.writeln(
-                '%s %s by %s (%s)'
-                % (
-                    test,
-                    verb,
-                    dat['node'].decode('ascii'),
-                    dat['summary'].decode('utf8', 'ignore'),
-                )
-            )
-
     def printtimes(self, times):
         # iolock held by run
         self.stream.writeln('# Producing time report')