D950: run-tests: update back to original node after bisecting

quark (Jun Wu) phabricator at mercurial-scm.org
Thu Oct 12 20:12:02 EDT 2017


quark updated this revision to Diff 2649.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D950?vs=2451&id=2649

REVISION DETAIL
  https://phab.mercurial-scm.org/D950

AFFECTED FILES
  tests/run-tests.py
  tests/test-run-tests.t

CHANGE DETAILS

diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -1277,6 +1277,8 @@
   >   fail
   > EOF
   $ hg ci -m 'bad'
+  $ echo 'unrelated' > unrelated
+  $ hg ci -m 'unrelated' -A unrelated
   $ rt --known-good-rev=0 test-bisect.t
   
   --- $TESTTMP/anothertests/bisect/test-bisect.t
@@ -1296,6 +1298,9 @@
   python hash seed: * (glob)
   [1]
 
+  $ hg id -R ../bisect
+  020d1494060d tip
+
   $ cd ..
 
 support bisecting a separate repo
@@ -1348,6 +1353,9 @@
   python hash seed: * (glob)
   [1]
 
+  $ hg id -R ../bisect
+  020d1494060d tip
+
   $ cd ..
 
 Test a broken #if statement doesn't break run-tests threading.
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2112,33 +2112,36 @@
             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(_strpath(withhg))
-            rtc = '%s %s %s %s' % (sys.executable, 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:
+            try:
+                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(_strpath(withhg))
+                rtc = '%s %s %s %s' % (sys.executable, 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'] == 'bad' else 'fixed'
                 self.stream.writeln(
-                    'Failed to identify failure point for %s' % test)
-                continue
-            dat = m.groupdict()
-            verb = 'broken' if dat['goodbad'] == 'bad' else 'fixed'
-            self.stream.writeln(
-                '%s %s by %s (%s)' % (
-                    test, verb, dat['node'], dat['summary']))
+                    '%s %s by %s (%s)' % (
+                        test, verb, dat['node'], dat['summary']))
+            finally:
+                pread(bisectcmd + ['--abort'])
 
     def printtimes(self, times):
         # iolock held by run



To: quark, #hg-reviewers, ryanmce
Cc: ryanmce, mercurial-devel


More information about the Mercurial-devel mailing list