SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Parallel running
`make test-all` of Ruby
      Shota Fukumori (sora_h)
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
Agenda

• Background
• Implementation
• Result
• How to use
Background

• `make test-all` is slow
• Can’t run parallel
• I started writing a patch
Background


• Today I talk about between
Background
Background
• 4 days
Background


• 80% Project.
Windows
Windows


• In Windows, Ruby can’t use Kernel.fork
• Asked at IRC
Windows

sora_h: test-all
    Windows

(Will you reject a patch doesn’t support
Windows if I wrote a patch?)
Windows


unak:

(Yes I’ll reject.)
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.
Traps in test
Trap?

• Doesn’t work well with parallel running
• Modify STDIN/OUT
• Duplicate filename/port number in 2+
  testcases
ruby/test_signal.rb

• def have_fork?; ... Process.fork{} ...; end
• test/unit at_exit, at_exit, at_exit
• Added flag for at_exit
ruby/test_process.rb


• Modifies STDIN/OUT
• duplicate and save backup in parallel.rb
net/http/test_https.rb
• Port number is same as net/http/test_http.rb
  --- a/test/net/http/test_https.rb
  +++ b/test/net/http/test_https.rb
  @@ -24,7 +24,7 @@ class TestNetHTTPS < Test::Unit::TestCase

      CONFIG = {
        'host' => '127.0.0.1',
  -     'port' => 10081,
  +     'port' => 10082,
        'proxy_host' => nil,
        'proxy_port' => nil,
        'ssl_enable' => true,
csv

• csv have duplicate temporary file name
  --- a/test/csv/test_serialization.rb
  +++ b/test/csv/test_serialization.rb
  @@ -131,7 +131,7 @@ class TestCSV::Serialization < TestCSV
      def test_io
       test_class_dump


  -    data_file = File.join(File.dirname(__FILE__), "temp_test_data.csv")
  +    data_file = File.join(File.dirname(__FILE__), "serialization_test_data.csv")
       CSV.dump(@names, File.open(data_file, "wb"))


       assert(File.exist?(data_file))
Implementation
Implementation
• http://github.com/sorah/ruby/blob/
  parallel_test
• patch on test/unit
• because minitest/unit is outer project
• and minitest/unit doesn’t support multiple
  file running?
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.
How does it work
• Master: `make test-all`
  Worker: will be spawned by master process

                                 ruby parallel.rb
                      worker

 master    IO.popen     …

                      worker
How does it work
• Master: `make test-all`
  Worker: will be spawned by master process

        master




                            workers
How does it work
• Worker and Master are connected via
  STDIN,OUT = IO.pipe, IO.pipe


                    worker

 master     pipe      …

                    worker
How does it work
File List              I’m ready


                      Run test.rb
            master                   worker
                     Done <result>


                       I’m ready
How does it work
File List


test.rb        1 Fail   worker



              master    worker   Disk
                        ……

                        worker
How does it work
File List


               1 Fail   worker



              master
              test.rb   worker   Disk
                        ……

                        worker
How does it work
File List
                        test.rb
               1 Fail          worker



              master         worker     Disk
                              ……

                             worker
How does it work
File List

                        test.rb
               1 Fail   worker



              master    worker    Disk
                         ……

                        worker
How does it work
File List

                        test.rb
               1 Fail   worker



              master    worker    Disk
                         ……

                        worker
How does it work
File List

                        test.rb
               1 Fail   worker



              master    worker    Disk
                         ……

                        worker
Demo
Performance
                      TOTAL         TESTCASES       TESTS/S


150.0


112.5


 75.0


 37.5


   0
        no -j   -j1           -j2        -j3        -j5        -j8        -j13


                                       https://gist.github.com/834848 - thanks mrkn!
Performance
                             Fraction
               TOTAL         TESTCASES            TESTS/S
3.00

2.50

2.00

1.50

1.00

0.50

  0
       no -j   -j1     -j2       -j3        -j5         -j8    -j13

                                https://gist.github.com/834848 - thanks mrkn!
Discussion

• [ruby-dev:43222]
• [ruby-core:35294]
• #4415 [ruby-dev:43226]
• And I become a committer!
• Imported at r30939.
Testing


• Build ruby trunk (svn head)
• make TESTS=’-j N -v’ test-all
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.
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)
Apology

• Thanks mrkn (Kenta Murata)
 • Providing Hints to me
 • Taking performance data
See Also

• http://www.slideshare.net/mrkn/ruby-
  workshop-sapporo16mrkn
• Ruby             - Kenta Murata a.k.a. mrkn

• (Japanese)
Thanks!

Weitere ähnliche Inhalte

Ähnlich wie ruby test-all parallel running

淺談Ruby process fork應用
淺談Ruby process fork應用淺談Ruby process fork應用
淺談Ruby process fork應用
YC Ling
 
Intro to JavaScript Testing
Intro to JavaScript TestingIntro to JavaScript Testing
Intro to JavaScript Testing
Ran Mizrahi
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
tobiascrawley
 
Testing is Fun @Confoo.ca 2012
Testing is Fun @Confoo.ca  2012Testing is Fun @Confoo.ca  2012
Testing is Fun @Confoo.ca 2012
Gourav Tiwari
 

Ähnlich wie ruby test-all parallel running (20)

Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009
 
Rocket Fuelled Cucumbers
Rocket Fuelled CucumbersRocket Fuelled Cucumbers
Rocket Fuelled Cucumbers
 
How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby Core
 
淺談Ruby process fork應用
淺談Ruby process fork應用淺談Ruby process fork應用
淺談Ruby process fork應用
 
Disconnecting the Database with ActiveRecord
Disconnecting the Database with ActiveRecordDisconnecting the Database with ActiveRecord
Disconnecting the Database with ActiveRecord
 
How DSL works on Ruby
How DSL works on RubyHow DSL works on Ruby
How DSL works on Ruby
 
Rails development environment talk
Rails development environment talkRails development environment talk
Rails development environment talk
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
Intro to JavaScript Testing
Intro to JavaScript TestingIntro to JavaScript Testing
Intro to JavaScript Testing
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
 
Perl Testing Consideration (seen from other languages)
Perl Testing Consideration (seen from other languages)Perl Testing Consideration (seen from other languages)
Perl Testing Consideration (seen from other languages)
 
Testing is Fun @Confoo.ca 2012
Testing is Fun @Confoo.ca  2012Testing is Fun @Confoo.ca  2012
Testing is Fun @Confoo.ca 2012
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
 
Test First Teaching
Test First TeachingTest First Teaching
Test First Teaching
 
Rails Performance
Rails PerformanceRails Performance
Rails Performance
 
Testing sync engine
Testing sync engineTesting sync engine
Testing sync engine
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby Core
 
Parsing and Rewriting Ruby Templates
Parsing and Rewriting Ruby TemplatesParsing and Rewriting Ruby Templates
Parsing and Rewriting Ruby Templates
 
Ruby, the language of devops
Ruby, the language of devopsRuby, the language of devops
Ruby, the language of devops
 

Mehr von Shota Fukumori (8)

3班 #spcamp amachang LT
3班 #spcamp amachang LT3班 #spcamp amachang LT
3班 #spcamp amachang LT
 
ぼくとわたしのVim
ぼくとわたしのVimぼくとわたしのVim
ぼくとわたしのVim
 
What is few?
What is few?What is few?
What is few?
 
Onsg11 iphone
Onsg11 iphoneOnsg11 iphone
Onsg11 iphone
 
Introduction to #pasratce
Introduction to #pasratceIntroduction to #pasratce
Introduction to #pasratce
 
Onsg10 Intro Termtter
Onsg10 Intro TermtterOnsg10 Intro Termtter
Onsg10 Intro Termtter
 
Online.sg #9 "LLVM" Opening & Closing
Online.sg #9 "LLVM" Opening & ClosingOnline.sg #9 "LLVM" Opening & Closing
Online.sg #9 "LLVM" Opening & Closing
 
Less to Few
Less to FewLess to Few
Less to Few
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

ruby test-all parallel running

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n