This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In bisect.pl, provide a default test for --validate, and summary output.
[perl5.git] / Porting / bisect-runner.pl
index 012aad5..194fbb9 100755 (executable)
@@ -62,7 +62,8 @@ unless(GetOptions(\%options,
                   'target=s', 'jobs|j=i', 'expect-pass=i',
                   'expect-fail' => sub { $options{'expect-pass'} = 0; },
                   'clean!', 'one-liner|e=s', 'match=s', 'force-manifest',
-                  'test-build', 'check-args', 'A=s@', 'usage|help|?',
+                  'force-regen', 'test-build', 'check-args', 'A=s@', 'l', 'w',
+                  'usage|help|?',
                   'D=s@' => sub {
                       my (undef, $val) = @_;
                       if ($val =~ /\A([^=]+)=(.*)/s) {
@@ -83,6 +84,8 @@ my ($target, $j, $match) = @options{qw(target jobs match)};
 pod2usage(exitval => 255, verbose => 1) if $options{usage};
 pod2usage(exitval => 255, verbose => 1)
     unless @ARGV || $match || $options{'test-build'} || defined $options{'one-liner'};
+pod2usage(exitval => 255, verbose => 1)
+    if !$options{'one-liner'} && ($options{l} || $options{w});
 
 exit 0 if $options{'check-args'};
 
@@ -269,6 +272,27 @@ which interferes with detecting errors in the example code itself.
 
 =item *
 
+-l
+
+Add C<-l> to the command line with C<-e>
+
+This will automatically append a newline to every output line of your testcase.
+Note that you can't specify an argument to F<perl>'s C<-l> with this, as it's
+not feasible to emulate F<perl>'s somewhat quirky switch parsing with
+L<Getopt::Long>. If you need the full flexibility of C<-l>, you need to write
+a full test case, instead of using C<bisect.pl>'s C<-e> shortcut.
+
+=item *
+
+-w
+
+Add C<-w> to the command line with C<-e>
+
+It's not valid to pass C<-l> or C<-w> to C<bisect.pl> unless you are also
+using C<-e>
+
+=item *
+
 --expect-fail
 
 The test case should fail for the I<start> revision, and pass for the I<end>
@@ -359,6 +383,15 @@ F<MANIFEST> are missing.
 
 =item *
 
+--force-regen
+
+Run C<make regen_headers> before building F<miniperl>. This may fix a build
+that otherwise would skip because the generated headers at that revision
+are stale. It's not the default because it conceals this error in the true
+state of such revisions.
+
+=item *
+
 --expect-pass [0|1]
 
 C<--expect-pass=0> is equivalent to C<--expect-fail>. I<1> is the default.
@@ -377,12 +410,16 @@ Passing this to F<bisect.pl> will likely cause the bisect to fail badly.
 
 --validate
 
-Test that all stable revisions can be built. Attempts to build I<blead>,
-I<v5.14.0> .. I<perl-5.002>. Stops at the first failure, without cleaning
-the checkout. Ignores I<--start> and I<--end>. Useful for validating a new
+Test that all stable revisions can be built. By default, attempts to build
+I<blead>, I<v5.14.0> .. I<perl-5.002>. Stops at the first failure, without
+cleaning the checkout. Use I<--start> to specify the earliest revision to
+test, I<--end> to specify the most recent. Useful for validating a new
 OS/CPU/compiler combination. For example
 
-    ../perl/Porting/bisect.pl --validate -e'print "Hello from $]\n"'
+    ../perl/Porting/bisect.pl --validate -le 'print "Hello from $]"'
+
+If no testcase is specified, the default is to use F<t/TEST> to run
+F<t/base/*.t>
 
 =item *
 
@@ -669,6 +706,14 @@ if ($target =~ /config\.s?h/) {
 force_manifest_cleanup($missing, $created_dirs)
         if $missing;
 
+if($options{'force-regen'}
+   && extract_from_file('Makefile', qr/\bregen_headers\b/)) {
+    # regen_headers was added in e50aee73b3d4c555, patch.1m for perl5.001
+    # It's not worth faking it for earlier revisions.
+    system "make regen_headers </dev/null"
+        and die;
+}
+
 patch_C();
 patch_ext();
 
@@ -711,7 +756,10 @@ match_and_exit($real_target) if $match;
 
 if (defined $options{'one-liner'}) {
     my $exe = $target =~ /^(?:perl$|test)/ ? 'perl' : 'miniperl';
-    unshift @ARGV, "./$exe", '-Ilib', '-e', $options{'one-liner'};
+    unshift @ARGV, '-e', $options{'one-liner'};
+    unshift @ARGV, '-l' if $options{l};
+    unshift @ARGV, '-w' if $options{w};
+    unshift @ARGV, "./$exe", '-Ilib';
 }
 
 # This is what we came here to run: