#!/usr/bin/perl -w use strict; =for comment Documentation for this is in bisect-runner.pl =cut my $start_time = time; # The default, auto_abbrev will treat -e as an abbreviation of --end # Which isn't what we want. use Getopt::Long qw(:config pass_through no_auto_abbrev); my ($start, $end, $validate); unshift @ARGV, '--help' unless GetOptions('start=s' => \$start, 'end=s' => \$end, validate => \$validate); unshift @ARGV, '--validate' if $validate; my $runner = $0; $runner =~ s/bisect\.pl/bisect-runner.pl/; die "Can't find bisect runner $runner" unless -f $runner; { my ($dev0, $ino0) = stat $0; die "Can't stat $0: $!" unless defined $ino0; my ($dev1, $ino1) = stat 'Porting/bisect.pl'; die "Can't run a bisect using the directory containing $runner" if defined $dev1 && $dev0 == $dev1 && $ino0 == $ino1; } system $^X, $runner, '--check-args', '--check-shebang', @ARGV and exit 255; # We try these in this order for the start revision if none is specified. my @stable = qw(perl-5.005 perl-5.6.0 perl-5.8.0 v5.10.0 v5.12.0 v5.14.0); { my ($dev_C, $ino_C) = stat 'Configure'; my ($dev_c, $ino_c) = stat 'configure'; if (defined $dev_C && defined $dev_c && $dev_C == $dev_c && $ino_C == $ino_c) { print "You seem to to be on a case insensitive file system.\n\n"; } else { unshift @stable, qw(perl-5.002 perl-5.003 perl-5.004) } } $end = 'blead' unless defined $end; # Canonicalising branches to revisions before moving the checkout permits one # to use revisions such as 'HEAD' for --start or --end foreach ($start, $end) { next unless $_; $_ = `git rev-parse $_`; die unless defined $_; chomp; } my $modified = () = `git ls-files --modified --deleted --others`; die "This checkout is not clean - $modified modified or untracked file(s)" if $modified; sub validate { my $commit = shift; if (defined $start && `git rev-list -n1 $commit ^$start^` eq "") { print "Skipping $commit, as it is earlier than $start\n"; return; } if (defined $end && `git rev-list -n1 $end ^$commit^` eq "") { print "Skipping $commit, as it is more recent than $end\n"; return; } print "Testing $commit...\n"; system "git checkout $commit