Move the implementation of --validate from bisect.pl to bisect-runner.pl
authorNicholas Clark <nick@ccl4.org>
Wed, 23 Nov 2011 20:39:06 +0000 (21:39 +0100)
committerNicholas Clark <nick@ccl4.org>
Wed, 23 Nov 2011 20:39:06 +0000 (21:39 +0100)
--validate sets a default testcase by assigning to @ARGV if its empty. It
makes more sense to do this in bisect-runner.pl, as that processes options
fully, unlike bisect.pl, which passes most through. Hence bisect.pl doesn't
know if some elements of @ARGV are actually options, and hence no testcase
has been supplied, and hence the default is needed.

This change permits the use of --validate with build options such as -D to
work as expected.

Porting/bisect-runner.pl
Porting/bisect.pl

index 41e15cc..711a14a 100755 (executable)
@@ -63,7 +63,7 @@ unless(GetOptions(\%options,
                   'expect-fail' => sub { $options{'expect-pass'} = 0; },
                   'clean!', 'one-liner|e=s', 'match=s', 'force-manifest',
                   'force-regen', 'test-build', 'A=s@', 'l', 'w',
-                  'check-args', 'check-shebang!', 'usage|help|?',
+                  'check-args', 'check-shebang!', 'usage|help|?', 'validate',
                   'D=s@' => sub {
                       my (undef, $val) = @_;
                       if ($val =~ /\A([^=]+)=(.*)/s) {
@@ -81,6 +81,9 @@ unless(GetOptions(\%options,
 
 my ($target, $j, $match) = @options{qw(target jobs match)};
 
+@ARGV = ('sh', '-c', 'cd t && ./perl TEST base/*.t')
+    if $options{validate} && !@ARGV;
+
 pod2usage(exitval => 255, verbose => 1) if $options{usage};
 pod2usage(exitval => 255, verbose => 1)
     unless @ARGV || $match || $options{'test-build'} || defined $options{'one-liner'};
index d28e1c5..f2e68ce 100755 (executable)
@@ -17,9 +17,7 @@ my ($start, $end, $validate);
 unshift @ARGV, '--help' unless GetOptions('start=s' => \$start,
                                           'end=s' => \$end,
                                           validate => \$validate);
-
-@ARGV = ('--', 'sh', '-c', 'cd t && ./perl TEST base/*.t')
-    if $validate && !@ARGV;
+unshift @ARGV, '--validate' if $validate;
 
 my $runner = $0;
 $runner =~ s/bisect\.pl/bisect-runner.pl/;