diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-08-09 10:44:28 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-08-09 10:44:28 +0100 |
commit | 226de479579f4a84dd17654b44e5aef323b0a403 (patch) | |
tree | 30913e3a64b48208d0cb00e5679975b5731187cf /t/harness | |
parent | fc279e463ddb1765ee76b9e5d84a0c7545544bbe (diff) | |
download | perl-226de479579f4a84dd17654b44e5aef323b0a403.tar.gz |
Run the main tests "slowest first" by ordering the rules correctly.
(It seems that the current TAP::Harness implementation sequences based on the
parallel/serial rules, not the order of the list of test names presented to it.)
Diffstat (limited to 't/harness')
-rw-r--r-- | t/harness | 30 |
1 files changed, 21 insertions, 9 deletions
@@ -200,19 +200,31 @@ if (@ARGV) { push @last, <pod/*.t>; push @last, <x2p/*.t>; + my %times; + if ($state) { + # Where known, collate the elapsed times by test name + foreach ($state->results->tests()) { + $times{$_->name} = $_->elapsed(); + } + } + + my %dir; + my %total_time; + + for (@last) { + m!(.*/)! or die "'$_'"; + push @{$dir{$1}}, $_; + $total_time{$1} += $times{$_} || 0; + } + push @tests, @last; # Generate T::H schedule rules that run the contents of each directory # sequentially. - { - my %dir; - for (@last) { - s{[^/]+$}{\*}; - $dir{$_}++; - } - - push @seq, { par => [ map { { seq => $_ } } sort keys %dir ] }; - } + push @seq, { par => [ map { { seq => "$_*" } } sort { + # Directories, ordered by total time descending then name ascending + $total_time{$b} <=> $total_time{$a} || $a cmp $b + } keys %dir ] }; $rules = { seq => \@seq }; } |