From: ara.t.howard@... Date: 2006-10-25T07:29:13+09:00 Subject: Re: run test scripts concurrently On Wed, 25 Oct 2006, Chris McMahon wrote: > I've been futzing with this for some time and I am out of ideas. > I have a number of files named "test_something.rb" that each contain > one test like so: > > class TC_foo < Test::Unit::TestCase > def test_foo > #do some stuff > #assert some things > end > end > > I have a little harness that runs them one after another like so: > > topdir = File.join(File.dirname(__FILE__)) > Dir.chdir topdir do > tests = Dir["test*"] > tests.each{|x| require x} > end > > But I would like to be able to run each individual script file in it's > own process simultaneously. I have been fooling around with > Thread.new, system(), exec(), and it seems that no matter what I try, > each script file has to finish before the next one will run. > > Any suggestions for running all of my test files at the same time from > one controller/harness? threads = [] Dir.chdir topdir do tests = Dir["test*"] tests.each{|x| threads << Thread.new{ system x or raise x } } end threads.each{|t| t.join} -a -- my religion is very simple. my religion is kindness. -- the dalai lama