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

Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009pratiknaik
 
Rocket Fuelled Cucumbers
Rocket Fuelled CucumbersRocket Fuelled Cucumbers
Rocket Fuelled CucumbersJoseph Wilk
 
How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHiroshi SHIBATA
 
淺談Ruby process fork應用
淺談Ruby process fork應用淺談Ruby process fork應用
淺談Ruby process fork應用YC Ling
 
Disconnecting the Database with ActiveRecord
Disconnecting the Database with ActiveRecordDisconnecting the Database with ActiveRecord
Disconnecting the Database with ActiveRecordBen Mabey
 
Rails development environment talk
Rails development environment talkRails development environment talk
Rails development environment talkReuven Lerner
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLBarry Jones
 
Intro to JavaScript Testing
Intro to JavaScript TestingIntro to JavaScript Testing
Intro to JavaScript TestingRan Mizrahi
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011tobiascrawley
 
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)Masaki Nakagawa
 
Testing is Fun @Confoo.ca 2012
Testing is Fun @Confoo.ca  2012Testing is Fun @Confoo.ca  2012
Testing is Fun @Confoo.ca 2012Gourav Tiwari
 
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 2013Puppet
 
Test First Teaching
Test First TeachingTest First Teaching
Test First TeachingSarah Allen
 
Testing sync engine
Testing sync engineTesting sync engine
Testing sync engineIlya Puchka
 
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.0Hiroshi SHIBATA
 
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 CoreHiroshi SHIBATA
 
Parsing and Rewriting Ruby Templates
Parsing and Rewriting Ruby TemplatesParsing and Rewriting Ruby Templates
Parsing and Rewriting Ruby TemplatesJohn Hawthorn
 
Ruby, the language of devops
Ruby, the language of devopsRuby, the language of devops
Ruby, the language of devopsRob Kinyon
 

Ä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

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

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...DianaGray10
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
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 REVIEWERMadyBayot
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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 SavingEdi Saputra
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
"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 ...Zilliz
 
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 connectorsNanddeep Nachan
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 

Kürzlich hochgeladen (20)

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...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
"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 ...
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

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