Add `jobs` optional keyword argument

This commit is contained in:
Nobuyoshi Nakada 2023-10-17 16:59:41 +09:00
Родитель 5a3e8d2f18
Коммит 8b520bd3fb
1 изменённых файлов: 3 добавлений и 7 удалений

Просмотреть файл

@ -143,11 +143,11 @@ module TestParallel
end end
class TestParallel < Test::Unit::TestCase class TestParallel < Test::Unit::TestCase
def spawn_runner(*opt_args) def spawn_runner(*opt_args, jobs: "t1")
@test_out, o = IO.pipe @test_out, o = IO.pipe
@test_pid = spawn(*@options[:ruby], TESTS+"/runner.rb", @test_pid = spawn(*@options[:ruby], TESTS+"/runner.rb",
"--ruby", @options[:ruby].join(" "), "--ruby", @options[:ruby].join(" "),
"-j","t1",*opt_args, out: o, err: o) "-j", jobs, *opt_args, out: o, err: o)
o.close o.close
end end
@ -166,11 +166,7 @@ module TestParallel
end end
def test_ignore_jzero def test_ignore_jzero
@test_out, o = IO.pipe spawn_runner(jobs: "0")
@test_pid = spawn(*@options[:ruby], TESTS+"/runner.rb",
"--ruby", @options[:ruby].join(" "),
"-j","0", out: File::NULL, err: o)
o.close
Timeout.timeout(TIMEOUT) { Timeout.timeout(TIMEOUT) {
assert_match(/Error: parameter of -j option should be greater than 0/,@test_out.read) assert_match(/Error: parameter of -j option should be greater than 0/,@test_out.read)
} }