Rakefiles: execute tests in random order
As some tests are CPU bound while some others are IO bound,
this should help to distribute the load more evenly in cases
where multiple tests (`rake test` invocations) are run in
parallel (such as on CI)
--- a/rakelib/test.rake Fri Jul 06 16:35:55 2018 +0100
+++ b/rakelib/test.rake Fri Aug 24 13:34:05 2018 +0100
@@ -84,7 +84,13 @@
task :'setup:tasks:test' do
$__testresults__ = []
app = project.application
- project.packages.each do |pkg|
+
+ # We shuffle the order of the packages by purpose.
+ # Some tests are CPU bound while some are IO bound,
+ # so this should help to distribute the load more evenly
+ # in cases where multiple tests (`rake test` invocations)
+ # are run in parallel (such as on CI)
+ project.packages.shuffle.each do |pkg|
if pkg.test
task "test:package:#{pkg.name}:pre"
task "test:package:#{pkg.name}:post"
@@ -148,7 +154,7 @@
puts
puts 'OVERALL SUMMARY'
puts
- TestReportSummary::SUMMARIES.each do |test_summary|
+ (TestReportSummary::SUMMARIES.sort { | a, b | a.pkg <=> b.pkg }).each do |test_summary|
puts "%-20s %s - %d run, %d passed, %d skipped, %d failed, %d errors" % [
test_summary.pkg,
test_summary.outcome,