This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Test-Harness to CPAN version 3.35
[perl5.git] / Porting / bench.pl
index 039997c..dc90a8f 100755 (executable)
@@ -14,7 +14,7 @@ perls.
     # Basic: run the tests in t/perf/benchmarks against two or
     # more perls
 
-    bench.pl [options] perl1=[label1] perl2[=label2] ...
+    bench.pl [options] perl1[=label1] perl2[=label2] ...
 
     # Run bench.pl's own built-in sanity tests
 
@@ -205,6 +205,7 @@ use strict;
 use Getopt::Long qw(:config no_auto_abbrev);
 use IPC::Open2 ();
 use IO::Select;
+use IO::File;
 use POSIX ":sys_wait_h";
 
 # The version of the file format used to save data. We refuse to process
@@ -457,7 +458,6 @@ sub select_a_perl {
 
 
 # Validate the list of perl=label on the command line.
-# Also validate $OPTS{norm}, $OPTS{sort};
 # Return a list of [ exe, label ] pairs.
 
 sub process_perls {
@@ -469,17 +469,11 @@ sub process_perls {
         die "Error: unable to execute '$perl': $r" if $r ne "ok\n";
         push @results, [ $perl, $label ];
     }
-
-    $OPTS{norm} = select_a_perl($OPTS{norm}, \@results, "--norm");
-    if (defined $OPTS{'sort-perl'}) {
-        $OPTS{'sort-perl'} =
-                select_a_perl($OPTS{'sort-perl'}, \@results, "--sort");
-    }
-
     return @results;
 }
 
 
+
 # Return a string containing perl test code wrapped in a loop
 # that runs $ARGV[0] times
 
@@ -600,9 +594,20 @@ sub do_grind {
             if defined $OPTS{bisect} and keys %$tests != 1;
 
         $perls = [ process_perls(@$perl_args) ];
+
+
         $results = grind_run($tests, $perls, $loop_counts);
     }
 
+    # now that we have a list of perls, use it to process the
+    # 'perl' component of the --norm and --sort args
+
+    $OPTS{norm} = select_a_perl($OPTS{norm}, $perls, "--norm");
+    if (defined $OPTS{'sort-perl'}) {
+        $OPTS{'sort-perl'} =
+                select_a_perl($OPTS{'sort-perl'}, $perls, "--sort");
+    }
+
     if (defined $OPTS{write}) {
         my $json = JSON::PP::encode_json({
                     version      => $FORMAT_VERSION,