This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In bisect.pl, use the earliest passing stable perl as the default revision.
[perl5.git] / Porting / bisect.pl
index ebaf402..b401cdc 100755 (executable)
@@ -33,13 +33,16 @@ foreach (qw(force-manifest test-build)) {
     undef $options{$_} if exists $options{$_};
 }
 
+# We try these in this order for the start revision if none is specified.
+my @stable = qw(perl-5.002 perl-5.003 perl-5.004 perl-5.005 perl-5.6.0
+                perl-5.8.0 v5.10.0 v5.12.0 v5.14.0);
 my $start = delete $options{start};
-# Currently the earliest version that the runner can build
-$start = 'perl-5.004' unless defined $start;
+if ($start) {
+    system "git rev-parse $start >/dev/null" and die;
+}
 my $end = delete $options{end};
 $end = 'blead' unless defined $end;
 
-system "git rev-parse $start >/dev/null" and die;
 system "git rev-parse $end >/dev/null" and die;
 
 my $modified = () = `git ls-files --modified --deleted --others`;
@@ -61,12 +64,25 @@ $runner =~ s/bisect\.pl/bisect-runner.pl/;
 die "Can't find bisect runner $runner" unless -f $runner;
 
 # Sanity check the first and last revisions:
-system "git checkout $start" and die;
-my $ret = system $^X, $runner, @ARGS;
-die "Runner returned $ret, not 0 for start revision" if $ret;
-
+if (defined $start) {
+    system "git checkout $start" and die;
+    my $ret = system $^X, $runner, @ARGS;
+    die "Runner returned $ret, not 0 for start revision" if $ret;
+} else {
+    # Try to find the earliest version for which the test works
+    foreach my $try (@stable) {
+        system "git checkout $try" and die;
+        my $ret = system $^X, $runner, @ARGS;
+        if (!$ret) {
+            $start = $try;
+            last;
+        }
+    }
+    die "Can't find a suitable start revision to default to. Tried @stable"
+        unless defined $start;
+}
 system "git checkout $end" and die;
-$ret = system $^X, $runner, @ARGS;
+my $ret = system $^X, $runner, @ARGS;
 die "Runner returned $ret for end revision" unless $ret;
 
 system "git bisect start" and die;