Make parserTests.php more git bisect-friendly
authorAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 5 Feb 2009 23:41:00 +0000 (23:41 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 5 Feb 2009 23:41:00 +0000 (23:41 +0000)
Now the following commands can track down parser test regressions (if
you're using git svn, of course):

  git bisect start bad-rev good-rev
  git bisect run maintenance/parserTests.php --regex 'Test name'

Just type those in (replacing "bad-rev" and "good-rev" with revision
ids, and 'Test name' with a regex that uniquely matches the regressing
test's name), and git will magically find the first bad revision for you
in a couple of minutes.  (Then run git bisect reset to get back to
normal.)

All I changed to make this possible was changing the error return code
from 255 (-1) to 1.  git bisect treats 1-124 and 126-127 as error codes,
but for some reason doesn't like 128-255.

maintenance/parserTests.php

index 0d50feb..9a1a480 100644 (file)
@@ -71,5 +71,5 @@ if ( isset( $options['fuzz'] ) ) {
        $tester->fuzzTest( $files );
 } else {
        $ok = $tester->runTestsFromFiles( $files );
-       exit ($ok ? 0 : -1);
+       exit ($ok ? 0 : 1);
 }