Fix up dspec task for parallelization
This commit is contained in:
parent
9d6321685e
commit
baf4e036fb
@ -29,6 +29,7 @@ task :spec do
|
||||
end
|
||||
task :spec => :build_tests
|
||||
task :spec do
|
||||
unless ENV["rscons_dist_specs"]
|
||||
original_stdout = $stdout
|
||||
sio = StringIO.new
|
||||
$stdout = sio
|
||||
@ -37,6 +38,7 @@ task :spec do
|
||||
sio.string.lines.each do |line|
|
||||
$stdout.write(line) unless line =~ /Coverage report generated for/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task :build_tests do |task, args|
|
||||
@ -54,6 +56,7 @@ task :dspec, [:example_string] => :build_dist do |task, args|
|
||||
FileUtils.cp("dist/rscons", "test_run/rscons.rb")
|
||||
ENV["rscons_dist_specs"] = "1"
|
||||
Rake::Task["spec"].execute(args)
|
||||
Rake::Task["build_tests"].execute(args)
|
||||
ENV.delete("rscons_dist_specs")
|
||||
FileUtils.rm_f(Dir.glob(".rscons-*"))
|
||||
end
|
||||
|
||||
@ -86,7 +86,7 @@ class Test
|
||||
def run_rscons(options = {})
|
||||
args = Array(options[:args]) || []
|
||||
if ENV["dist_specs"]
|
||||
exe = "#{OWD}/test/rscons.rb"
|
||||
exe = "#{OWD}/test_run/rscons.rb"
|
||||
else
|
||||
exe = "#{OWD}/bin/rscons"
|
||||
end
|
||||
@ -248,7 +248,7 @@ def run_tests
|
||||
tests = @focused_tests.size > 0 ? @focused_tests : @tests
|
||||
queue = Queue.new
|
||||
threads = {}
|
||||
n_procs = `nproc`.to_i
|
||||
n_procs = `nproc`.to_i * 2
|
||||
failure = false
|
||||
loop do
|
||||
break if threads.empty? && tests.empty?
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
if ENV["rscons_dist_specs"]
|
||||
require_relative "../test/rscons"
|
||||
require_relative "../test_run/rscons"
|
||||
else
|
||||
require "simplecov"
|
||||
|
||||
@ -15,7 +15,7 @@ else
|
||||
else
|
||||
command_name "RSpec"
|
||||
end
|
||||
add_filter "test/rscons.rb"
|
||||
add_filter "test_run/rscons.rb"
|
||||
project_name "Rscons"
|
||||
merge_timeout 3600
|
||||
formatter(MyFormatter)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user