This document discusses a patch written by Shota Fukumori to enable parallel testing in Ruby. The patch allows the "make test-all" command to spawn multiple worker processes to run tests concurrently. It overcame challenges like traps in tests, modifying stdin/out, and duplicate filenames. Performance tests showed the patch significantly reduced test runtime by utilizing additional processor cores. The patch was accepted and merged into Ruby.
2. Self Introduction
• Ruby Committer (I became by this patch!)
• Rubyist
• 8th grade student; (in Japan JHS 2nd)
• see http://sorah.cosmio.net/ or
http://about.me/sorah
13. Windows
• ... It’ll be rejected if I don’t support Windows.
• So I used IO.popen
• but currently this feature doesn’t work at
Windows. I’m working with it.
22. How does it work
1. Load list of files.
2. Spawn workers.
3. Shift file from files and throw to worker
which is ready while files isn’t empty
4. Retry testcase failed at worker in master
5. Output results.
23. How does it work
• Master: `make test-all`
Worker: will be spawned by master process
ruby parallel.rb
worker
master IO.popen …
worker
24. How does it work
• Master: `make test-all`
Worker: will be spawned by master process
master
workers
25. How does it work
• Worker and Master are connected via
STDIN,OUT = IO.pipe, IO.pipe
worker
master pipe …
worker
26. How does it work
File List I’m ready
Run test.rb
master worker
Done <result>
I’m ready
27. How does it work
File List
test.rb 1 Fail worker
master worker Disk
……
worker
28. How does it work
File List
1 Fail worker
master
test.rb worker Disk
……
worker
29. How does it work
File List
test.rb
1 Fail worker
master worker Disk
……
worker
30. How does it work
File List
test.rb
1 Fail worker
master worker Disk
……
worker
31. How does it work
File List
test.rb
1 Fail worker
master worker Disk
……
worker
32. How does it work
File List
test.rb
1 Fail worker
master worker Disk
……
worker
38. Testing
• If you found bug, please submit to
http://redmine.ruby-lang.org/
With assigning to “Shota Fukumori”.
• I’ll see and response to the ticket.
39. Todos
• Many bugs
• Windows
• Anyone can test?
• I can’t test on Win because Windows
machine (MacBook)’s HDD is strange... ;’(
• Refactoring (I’m working)
40. Apology
• Thanks mrkn (Kenta Murata)
• Providing Hints to me
• Taking performance data