From 4819dd2a106804e2c3b00007d9e460a64a8348dd Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sat, 1 Oct 2011 17:37:52 +0200 Subject: [PATCH] In bisect.pl, use the earliest passing stable perl as the default revision. This is better than defaulting the start revision to any particular fixed revision, as it handles most "new" syntax gracefully, instead of forcing the user to work out what minimum version is required to run their testcase. --- Porting/bisect.pl | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/Porting/bisect.pl b/Porting/bisect.pl index ebaf402..b401cdc 100755 --- a/Porting/bisect.pl +++ b/Porting/bisect.pl @@ -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; -- 1.8.3.1