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 929c854..b401cdc 100755 (executable)
@@ -19,17 +19,30 @@ unless(GetOptions(\%options,
                   'expect-fail',
                   'one-liner|e=s',
                   'match=s',
+                  'force-manifest',
+                  'test-build',
                  )) {
     usage();
 }
 
+foreach (qw(force-manifest test-build)) {
+    # This is a bodge. I can't see a clean way to pass through suitably exact
+    # strings the various arguments to bisect-runner.pl that are argument-less
+    # flags. It might be easier for this program not to use Getopt::Long, and
+    # instead just grep out --start and --end
+    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`;
@@ -51,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;