diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -406,6 +406,10 @@ def getparser(): metavar="known_good_rev", help=("Automatically bisect any failures using this " "revision as a known-good revision.")) + parser.add_option('--bisect-repo', type="string", + metavar='bisect_repo', + help=("Path of a repo to bisect. Use together with " + "--known-good-rev")) for option, (envvar, default) in defaults.items(): defaults[option] = type(default)(os.environ.get(envvar, default)) @@ -458,6 +462,9 @@ def parseargs(args, parser): sys.stderr.write('warning: --color=always ignored because ' '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') @@ -2071,6 +2078,9 @@ class TextTestRunner(unittest.TextTestRu if failed and self._runner.options.known_good_rev: bisectcmd = ['hg', 'bisect'] + bisectrepo = self._runner.options.bisect_repo + if bisectrepo: + bisectcmd.extend(['-R', os.path.abspath(bisectrepo)]) def nooutput(args): p = subprocess.Popen(args, stderr=subprocess.STDOUT, stdout=subprocess.PIPE) 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 @@ -1285,6 +1285,58 @@ support for bisecting failed tests autom $ cd .. +support bisecting a separate repo + + $ hg init bisect-dependent + $ cd bisect-dependent + $ cat > test-bisect-dependent.t < $ 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 + + --- $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 + + --- $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. ============================================================== $ mkdir broken