diff --git a/test/parallel.rb b/test/parallel.rb index 8fcfe88c6..58085a6c9 100644 --- a/test/parallel.rb +++ b/test/parallel.rb @@ -1,3 +1,4 @@ require 'rake' Rake.application.num_threads = 8 +puts "- Testing multi-threaded" diff --git a/test/single_threaded.rb b/test/single_threaded.rb index b2673f951..7b93a1356 100644 --- a/test/single_threaded.rb +++ b/test/single_threaded.rb @@ -1,2 +1,3 @@ require 'rake' Rake.application.num_threads = 1 +puts "- Testing single-threaded" diff --git a/test/test_parallel.rb b/test/test_parallel.rb index 29d71301c..5160ea322 100644 --- a/test/test_parallel.rb +++ b/test/test_parallel.rb @@ -2,9 +2,28 @@ require 'rbconfig' require 'test/unit' +PARALLEL_TEST_MESSAGE = <<'EOS' + + +Task graph for sample parallel execution: + + default + / \ + / \ + a b + / \ + / \ + x y + +EOS + if Rake.application.num_threads > 1 class TestSimpleParallel < Test::Unit::TestCase - def test_1 + def setup + puts PARALLEL_TEST_MESSAGE + end + + def test_parallel here = File.dirname(__FILE__) rake = File.expand_path("#{here}/../bin/rake") @@ -18,15 +37,17 @@ def test_1 lib end }.call - + [ - "Rakefile.simple", - "Rakefile.seq", - ].each { |file| + ["Rakefile.simple", true], + ["Rakefile.seq", false], + ].each { |file, disp| (1..5).each { |n| - args = [rake, "--threads", n.to_s, "-f", "test/#{file}"] - puts("\n" + "-"*40) - puts(args.join(" ")) + args = [rake, "--threads", n.to_s, "-s", "-f", "test/#{file}"] + if disp + puts "\nvisual check: #{n} thread#{n > 1 ? 's' : ''}" + puts args.join(" ") + end assert(ruby(*args)) } }