Mercurial > public > mercurial-scm > hg
changeset 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 | 72af9fa34832 |
children | 9b5e058a7fb9 |
files | tests/run-tests.py tests/test-run-tests.t |
diffstat | 2 files changed, 0 insertions(+), 162 deletions(-) [+] |
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')
--- a/tests/test-run-tests.t Mon Dec 16 19:46:07 2024 -0500 +++ b/tests/test-run-tests.t Mon Dec 30 21:48:33 2024 +0100 @@ -1556,94 +1556,6 @@ python hash seed: * (glob) [1] -support for bisecting failed tests automatically - $ hg init bisect - $ cd bisect - $ cat >> test-bisect.t <<EOF - > $ echo pass - > pass - > EOF - $ hg add test-bisect.t - $ hg ci -m 'good' - $ cat >> test-bisect.t <<EOF - > $ echo pass - > fail - > EOF - $ hg ci -m 'bad' - $ rt --known-good-rev=0 test-bisect.t - running 1 tests using 1 parallel processes - - --- $TESTTMP/anothertests/bisect/test-bisect.t - +++ $TESTTMP/anothertests/bisect/test-bisect.t.err - @@ -1,4 +1,4 @@ - $ echo pass - pass - $ echo pass - - fail - + pass - - ERROR: test-bisect.t output changed - ! - Failed test-bisect.t: output changed - test-bisect.t broken by 72cbf122d116 (bad) - # Ran 1 tests, 0 skipped, 1 failed. - python hash seed: * (glob) - [1] - - $ cd .. - -support bisecting a separate repo - - $ hg init bisect-dependent - $ cd bisect-dependent - $ cat > test-bisect-dependent.t <<EOF - > $ tail -1 \$TESTDIR/../bisect/test-bisect.t - > pass - > EOF - $ hg commit -Am dependent test-bisect-dependent.t - - $ rt --known-good-rev=0 test-bisect-dependent.t - running 1 tests using 1 parallel processes - - --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t - +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err - @@ -1,2 +1,2 @@ - $ tail -1 $TESTDIR/../bisect/test-bisect.t - - pass - + fail - - ERROR: test-bisect-dependent.t output changed - ! - Failed test-bisect-dependent.t: output changed - Failed to identify failure point for test-bisect-dependent.t - # Ran 1 tests, 0 skipped, 1 failed. - python hash seed: * (glob) - [1] - - $ rt --bisect-repo=../test-bisect test-bisect-dependent.t - usage: run-tests.py [options] [tests] - run-tests.py: error: --bisect-repo cannot be used without --known-good-rev - [2] - - $ rt --known-good-rev=0 --bisect-repo=../bisect test-bisect-dependent.t - running 1 tests using 1 parallel processes - - --- $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t - +++ $TESTTMP/anothertests/bisect-dependent/test-bisect-dependent.t.err - @@ -1,2 +1,2 @@ - $ tail -1 $TESTDIR/../bisect/test-bisect.t - - pass - + fail - - ERROR: test-bisect-dependent.t output changed - ! - Failed test-bisect-dependent.t: output changed - test-bisect-dependent.t broken by 72cbf122d116 (bad) - # Ran 1 tests, 0 skipped, 1 failed. - python hash seed: * (glob) - [1] - - $ cd .. Test a broken #if statement doesn't break run-tests threading. ==============================================================