SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
Introduction for language testing
Hiroshi SHIBATA / GMO PEPABO inc.
2016.06.21 RedDotRubyConf 2016
How to Begin
Developing Ruby Core
self.introduce
=>
{
name: “SHIBATA Hiroshi”,
nickname: “hsbt”,
title: “Chief engineer at GMO Pepabo, Inc.”,
commit_bits: [“ruby”, “rake”, “rubygems”, “rdoc”, “psych”, “syck”, “ruby-
build”, “railsgirls”, “railsgirls-jp”, …],
sites: [“hsbt.org”, “ruby-lang.org”, “rubyci.org”, “railsgirls.com”,
“railsgirls.jp”],
}
How to contribute to OSS
Contributing of OSS
People say:
“Contributing to OSS is easy! Please write some documentation and
submit a patch!”
You say:
“Okay! I will contribute new documentation for Ruby!”
Documentation is hard
But documentation is hard, I think
• No-one knows the true behavior of OSS
• Only author knows that.
• Documentation is tedious work :bow:
Because documentation is valuable work.
Testing and Running are easy
On the other hand:
• Ruby has a lot of test ecosystem and libraries.
• Bundler and Docker provide an encapsulated environment.
If you get test failures, you can submit issue ticket to tracker like
github. It helps OSS author.
Let’s try
to
contribute ruby core
Start to test Ruby language
$ git clone https://github.com/ruby/ruby
$ cd ruby
$ autoconf
$ ./configure —disable-install-doc
$ make -j
$ make check
You can invoke language tests with the following instructions:
% make check TESTS=‘-j4’
(snip)
PASS all 1010 tests
exec ./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems "./bootstraptest/runner.rb" --ruby="ruby --disable-gems" ./
KNOWNBUGS.rb
2016-06-18 15:42:02 +0900
Driver is ruby 2.4.0dev (2016-06-18 trunk 55440) [x86_64-darwin15]
Target is ruby 2.4.0dev (2016-06-18 trunk 55440) [x86_64-darwin15]
last_commit=* test/rubygems/test_gem_installer.rb: Fixed broken test with extension build. https://github.com/rubygems/rubygems/pull/1645
KNOWNBUGS.rb PASS 0
No tests, no problem
test succeeded
Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
# Running tests:
Finished tests in 2.513254s, 87.9338 tests/s, 177.4592 assertions/s.
221 tests, 446 assertions, 0 failures, 0 errors, 0 skips
ruby -v: ruby 2.4.0dev (2016-06-18 trunk 55440) [x86_64-darwin15]
Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" --excludes-dir=./test/excludes --name=!/
memory_leak/ --exclude=/testunit/ --exclude=/minitest/ -j4
# Running tests:
[ 89/803] 4625=test_bigdecimal 4626=test_table 4627=test_encodings 4628=test_bug_reporter
common.mk
• check/check-ruby
• btest/btest-ruby
• test-basic/test-knownbug
• test-testframework
• test
• test-all
• test-almost
• test-ruby
• test-rubyspec
make test
• btest-ruby
• snip for next slides
• test-basic
• invoke `basictest/runner.rb` with target ruby
• test-knownbug
• invoke `KNOWNBUGS.rb`
• It’s empty a lot of the time.
make btest-ruby
% ls bootstraptest
pending.rb runner.rb* test_attr.rb test_autoload.rb test_block.rb test_class.rb test_eval.rb test_exception.rb test_finalizer.rb test_flip.rb
test_flow.rb test_fork.rb test_gc.rb test_io.rb test_jump.rb test_literal.rb test_literal_suffix.rb test_load.rb test_marshal.rb test_massign.rb
test_method.rb test_objectspace.rb test_proc.rb test_string.rb test_struct.rb test_syntax.rb test_thread.rb
What’s `bootstraptest/runner.rb` ?
• load test files and invoke them
• define assertion methods like `assert_equal` etc.
`cat bootstraptest/test_class.rb`
assert_equal 'true', %q( class C; end
Object.const_defined?(:C) )
assert_equal 'Class', %q( class C; end
C.class )
(snip)
assert_equal 'Class', %q( class A; end
class C < A; end
C.class )
(snip)
assert_equal 'M', %q( module M; end
M.name )
(snip)
assert_equal 'A::B', %q( class A; end
class A::B; end
A::B )
test-basic
a, = nil; test_ok(a == nil)
a, = 1; test_ok(a == 1)
a, = []; test_ok(a == nil)
(snip)
def r; return *[]; end; a = r(); test_ok(a == [])
def r; return *[1]; end; a = r(); test_ok(a == [1])
def r; return *[nil]; end; a = r(); test_ok(a == [nil])
(snip)
f = lambda { |a, b=42, *c| [a,b,c] }
test_ok(f.call(1 ) == [1,42,[ ]] )
test_ok(f.call(1,43 ) == [1,43,[ ]] )
test_ok(f.call(1,43,44) == [1,43,[44]] )
(snip)
These are for Developer
of
VM/GC/Syntax/etc
make test-all
test-all invokes test files under the `test` directory. test-all has some
options for testing:
• make test-all TESTS=“logger”
• test only files under `test/logger`
• make test-all TESTS=“-j4”
• it make parallel execution with 4 processes.
cat `test/ruby/test_array.rb`
% cat test/ruby/test_array.rb
# coding: US-ASCII
require 'test/unit'
class TestArray < Test::Unit::TestCase
(snip)
def test_percent_i
assert_equal([:foo, :bar], %i[foo bar])
assert_equal([:""foo"], %i["foo])
end
def test_0_literal
assert_equal([1, 2, 3, 4], [1, 2] + [3, 4])
assert_equal([1, 2, 1, 2], [1, 2] * 2)
assert_equal("1:2", [1, 2] * ":")
(snip)
cat `test/logger/test_logger.rb`
% cat test/logger/test_logger.rb
# coding: US-ASCII
require 'test/unit'
require 'logger'
require 'tempfile'
class TestLogger < Test::Unit::TestCase
(snip)
def test_add
logger = Logger.new(nil)
logger.progname = "my_progname"
assert(logger.add(INFO))
log = log_add(logger, nil, "msg")
assert_equal("ANY", log.severity)
assert_equal("my_progname", log.progname)
(snip)
cat `test/-ext-/array/test_resize.rb`
% cat ext/-test-/array/resize/resize.c
#include "ruby/ruby.h"
static VALUE
ary_resize(VALUE ary, VALUE len)
{
rb_ary_resize(ary, NUM2LONG(len));
return ary;
}
void
Init_resize(void)
{
rb_define_method(rb_cArray, "__resize__", ary_resize, 1);
}
require 'test/unit'
require '-test-/array/resize'
class TestArray < Test::Unit::TestCase
class TestResize < Test::Unit::TestCase
def test_expand
feature = '[ruby-dev:42912]'
ary = [*1..10]
ary.__resize__(10)
assert_equal(10, ary.size, feature)
assert_equal([*1..10], ary, feature)
ary.__resize__(100)
assert_equal(100, ary.size, feature)
(snip)
make check
make check depends on the following definitions:
• main
• build encodings and extensions.
• test
• test-testframework
• run tests for `testunit` and `minitest`
• test-almost
• run tests under `test` excluding `testunit` and `minitest`
These are for “you”
make test-rubyspec
CRuby has `make update-rubyspec` and `make test-rubyspec` tasks.
•`make update-rubyspec`
• pulls ruby/rubyspec and ruby/mspec into the spec directory.
•`make test-rubyspec`
• invokes mspec with the ruby binary and the latest rubyspecs.
cat spec/rubyspec/core/string/append_spec.rb
% cat spec/rubyspec/core/string/concat_spec.rb
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
require File.expand_path('../shared/concat', __FILE__)
describe "String#<<" do
it_behaves_like :string_concat, :<<
it_behaves_like :string_concat_encoding, :<<
end
% cat spec/rubyspec/core/string/shared/concat.rb
describe :string_concat, shared: true do
it "concatenates the given argument to self and returns self" do
str = 'hello '
str.send(@method, 'world').should equal(str)
str.should == "hello world"
end
(snip)
Please check details: https://github.com/ruby/spec
These are for developer
who
interest compatibility
Please contribute tests to ruby
$ git clone https://github.com/ruby/ruby
$ cd ruby
$ autoconf
$ ./configure —disable-install-doc
$ make -j
$ make check
You can invoke CRuby tests:
You can invoke focused tests with coverage:
$ COVERAGE=1 make test-all TESTS=“logger”
$ open coverage/index.html
You can code new tests or update existing tests. and submit patches to
our tracker or github.com/ruby/ruby.
Ruby (language) testing
is
so easy

Mais conteúdo relacionado

Mais procurados

20141210 rakuten techtalk
20141210 rakuten techtalk20141210 rakuten techtalk
20141210 rakuten techtalkHiroshi SHIBATA
 
The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and futureHiroshi SHIBATA
 
Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby CoreHiroshi SHIBATA
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for RubyHiroshi SHIBATA
 
Dependency Resolution with Standard Libraries
Dependency Resolution with Standard LibrariesDependency Resolution with Standard Libraries
Dependency Resolution with Standard LibrariesHiroshi SHIBATA
 
Gate of Agile Web Development
Gate of Agile Web DevelopmentGate of Agile Web Development
Gate of Agile Web DevelopmentKoichi ITO
 
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)ngotogenome
 
Leave end-to-end testing to Capybara
Leave end-to-end testing to CapybaraLeave end-to-end testing to Capybara
Leave end-to-end testing to CapybaraHiroshi SHIBATA
 
How to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rbHow to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rbHiroshi SHIBATA
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the worldHiroshi SHIBATA
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the worldHiroshi SHIBATA
 
20140425 ruby conftaiwan2014
20140425 ruby conftaiwan201420140425 ruby conftaiwan2014
20140425 ruby conftaiwan2014Hiroshi SHIBATA
 
20140626 red dotrubyconf2014
20140626 red dotrubyconf201420140626 red dotrubyconf2014
20140626 red dotrubyconf2014Hiroshi SHIBATA
 
The Future of Dependency Management for Ruby
The Future of Dependency Management for RubyThe Future of Dependency Management for Ruby
The Future of Dependency Management for RubyHiroshi SHIBATA
 
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
 
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
 
The Future of library dependency management of Ruby
 The Future of library dependency management of Ruby The Future of library dependency management of Ruby
The Future of library dependency management of RubyHiroshi SHIBATA
 

Mais procurados (20)

20141210 rakuten techtalk
20141210 rakuten techtalk20141210 rakuten techtalk
20141210 rakuten techtalk
 
The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and future
 
Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby Core
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for Ruby
 
Dependency Resolution with Standard Libraries
Dependency Resolution with Standard LibrariesDependency Resolution with Standard Libraries
Dependency Resolution with Standard Libraries
 
Gate of Agile Web Development
Gate of Agile Web DevelopmentGate of Agile Web Development
Gate of Agile Web Development
 
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
 
Leave end-to-end testing to Capybara
Leave end-to-end testing to CapybaraLeave end-to-end testing to Capybara
Leave end-to-end testing to Capybara
 
RubyGems 3 & 4
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4
 
How to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rbHow to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rb
 
RubyGems 3 & 4
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the world
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the world
 
20140425 ruby conftaiwan2014
20140425 ruby conftaiwan201420140425 ruby conftaiwan2014
20140425 ruby conftaiwan2014
 
20140626 red dotrubyconf2014
20140626 red dotrubyconf201420140626 red dotrubyconf2014
20140626 red dotrubyconf2014
 
20140925 rails pacific
20140925 rails pacific20140925 rails pacific
20140925 rails pacific
 
The Future of Dependency Management for Ruby
The Future of Dependency Management for RubyThe Future of Dependency Management for Ruby
The Future of Dependency Management for Ruby
 
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
 
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
 
The Future of library dependency management of Ruby
 The Future of library dependency management of Ruby The Future of library dependency management of Ruby
The Future of library dependency management of Ruby
 

Destaque

成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略Hiroshi SHIBATA
 
GitHub Enterprise with GMO Pepabo
GitHub Enterprise with GMO PepaboGitHub Enterprise with GMO Pepabo
GitHub Enterprise with GMO PepaboHiroshi SHIBATA
 
The story of language development
The story of language developmentThe story of language development
The story of language developmentHiroshi SHIBATA
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesHiroshi SHIBATA
 
Usecase examples of Packer
Usecase examples of Packer Usecase examples of Packer
Usecase examples of Packer Hiroshi SHIBATA
 
技術的負債との付き合い方
技術的負債との付き合い方技術的負債との付き合い方
技術的負債との付き合い方Hiroshi SHIBATA
 
Music recommendations @ MLConf 2014
Music recommendations @ MLConf 2014Music recommendations @ MLConf 2014
Music recommendations @ MLConf 2014Erik Bernhardsson
 

Destaque (9)

成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略
 
How DSL works on Ruby
How DSL works on RubyHow DSL works on Ruby
How DSL works on Ruby
 
High Performance tDiary
High Performance tDiaryHigh Performance tDiary
High Performance tDiary
 
GitHub Enterprise with GMO Pepabo
GitHub Enterprise with GMO PepaboGitHub Enterprise with GMO Pepabo
GitHub Enterprise with GMO Pepabo
 
The story of language development
The story of language developmentThe story of language development
The story of language development
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutes
 
Usecase examples of Packer
Usecase examples of Packer Usecase examples of Packer
Usecase examples of Packer
 
技術的負債との付き合い方
技術的負債との付き合い方技術的負債との付き合い方
技術的負債との付き合い方
 
Music recommendations @ MLConf 2014
Music recommendations @ MLConf 2014Music recommendations @ MLConf 2014
Music recommendations @ MLConf 2014
 

Semelhante a Easy ways to contribute Ruby core tests

Why Every Tester Should Learn Ruby
Why Every Tester Should Learn RubyWhy Every Tester Should Learn Ruby
Why Every Tester Should Learn RubyRaimonds Simanovskis
 
Hacking with ruby2ruby
Hacking with ruby2rubyHacking with ruby2ruby
Hacking with ruby2rubyMarc Chung
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
 
plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6Nobuo Danjou
 
¡El mejor lenguaje para automatizar pruebas!
¡El mejor lenguaje para automatizar pruebas!¡El mejor lenguaje para automatizar pruebas!
¡El mejor lenguaje para automatizar pruebas!Antonio Robres Turon
 
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures LibraryAPOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Libraryjexp
 
Testing Zen
Testing ZenTesting Zen
Testing Zenday
 
Make BDD great again
Make BDD great againMake BDD great again
Make BDD great againYana Gusti
 
Puppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet
 
20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-parisJohan De Wit
 
Testing NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoverageTesting NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoveragemlilley
 
Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009pratiknaik
 
JSLT: JSON querying and transformation
JSLT: JSON querying and transformationJSLT: JSON querying and transformation
JSLT: JSON querying and transformationLars Marius Garshol
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyNikhil Mungel
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web DevelopmentCheng-Yi Yu
 
Creating a Benchmarking Infrastructure That Just Works
Creating a Benchmarking Infrastructure That Just WorksCreating a Benchmarking Infrastructure That Just Works
Creating a Benchmarking Infrastructure That Just WorksTim Callaghan
 

Semelhante a Easy ways to contribute Ruby core tests (20)

Rails Performance
Rails PerformanceRails Performance
Rails Performance
 
Why Every Tester Should Learn Ruby
Why Every Tester Should Learn RubyWhy Every Tester Should Learn Ruby
Why Every Tester Should Learn Ruby
 
Logstash
LogstashLogstash
Logstash
 
Hacking with ruby2ruby
Hacking with ruby2rubyHacking with ruby2ruby
Hacking with ruby2ruby
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 
plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6
 
¡El mejor lenguaje para automatizar pruebas!
¡El mejor lenguaje para automatizar pruebas!¡El mejor lenguaje para automatizar pruebas!
¡El mejor lenguaje para automatizar pruebas!
 
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures LibraryAPOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
 
Testing Zen
Testing ZenTesting Zen
Testing Zen
 
Make BDD great again
Make BDD great againMake BDD great again
Make BDD great again
 
Puppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven Development
 
20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris
 
Testing NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoverageTesting NodeJS with Mocha, Should, Sinon, and JSCoverage
Testing NodeJS with Mocha, Should, Sinon, and JSCoverage
 
Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009
 
JSLT: JSON querying and transformation
JSLT: JSON querying and transformationJSLT: JSON querying and transformation
JSLT: JSON querying and transformation
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in Ruby
 
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
 
Creating a Benchmarking Infrastructure That Just Works
Creating a Benchmarking Infrastructure That Just WorksCreating a Benchmarking Infrastructure That Just Works
Creating a Benchmarking Infrastructure That Just Works
 

Mais de Hiroshi SHIBATA

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023Hiroshi SHIBATA
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?Hiroshi SHIBATA
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?Hiroshi SHIBATA
 
Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発Hiroshi SHIBATA
 
Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?Hiroshi SHIBATA
 
RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩Hiroshi SHIBATA
 
How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?Hiroshi SHIBATA
 
Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3Hiroshi SHIBATA
 
Ruby Security the Hard Way
Ruby Security the Hard WayRuby Security the Hard Way
Ruby Security the Hard WayHiroshi SHIBATA
 
OSS Security the hard way
OSS Security the hard wayOSS Security the hard way
OSS Security the hard wayHiroshi SHIBATA
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyHiroshi SHIBATA
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled BundlerHiroshi SHIBATA
 
Productive Organization with Ruby
Productive Organization with RubyProductive Organization with Ruby
Productive Organization with RubyHiroshi SHIBATA
 

Mais de Hiroshi SHIBATA (17)

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?
 
Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発
 
Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?
 
RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩
 
How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?
 
Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3
 
Ruby Security the Hard Way
Ruby Security the Hard WayRuby Security the Hard Way
Ruby Security the Hard Way
 
OSS Security the hard way
OSS Security the hard wayOSS Security the hard way
OSS Security the hard way
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of Ruby
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled Bundler
 
What's new in RubyGems3
What's new in RubyGems3What's new in RubyGems3
What's new in RubyGems3
 
Productive Organization with Ruby
Productive Organization with RubyProductive Organization with Ruby
Productive Organization with Ruby
 
Gems on Ruby
Gems on RubyGems on Ruby
Gems on Ruby
 
Gems on Ruby
Gems on RubyGems on Ruby
Gems on Ruby
 

Último

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
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...apidays
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
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?Igalia
 

Último (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
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...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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?
 

Easy ways to contribute Ruby core tests

  • 1. Introduction for language testing Hiroshi SHIBATA / GMO PEPABO inc. 2016.06.21 RedDotRubyConf 2016 How to Begin Developing Ruby Core
  • 2. self.introduce => { name: “SHIBATA Hiroshi”, nickname: “hsbt”, title: “Chief engineer at GMO Pepabo, Inc.”, commit_bits: [“ruby”, “rake”, “rubygems”, “rdoc”, “psych”, “syck”, “ruby- build”, “railsgirls”, “railsgirls-jp”, …], sites: [“hsbt.org”, “ruby-lang.org”, “rubyci.org”, “railsgirls.com”, “railsgirls.jp”], }
  • 4. Contributing of OSS People say: “Contributing to OSS is easy! Please write some documentation and submit a patch!” You say: “Okay! I will contribute new documentation for Ruby!”
  • 5. Documentation is hard But documentation is hard, I think • No-one knows the true behavior of OSS • Only author knows that. • Documentation is tedious work :bow: Because documentation is valuable work.
  • 6. Testing and Running are easy On the other hand: • Ruby has a lot of test ecosystem and libraries. • Bundler and Docker provide an encapsulated environment. If you get test failures, you can submit issue ticket to tracker like github. It helps OSS author.
  • 8. Start to test Ruby language $ git clone https://github.com/ruby/ruby $ cd ruby $ autoconf $ ./configure —disable-install-doc $ make -j $ make check You can invoke language tests with the following instructions:
  • 9. % make check TESTS=‘-j4’ (snip) PASS all 1010 tests exec ./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems "./bootstraptest/runner.rb" --ruby="ruby --disable-gems" ./ KNOWNBUGS.rb 2016-06-18 15:42:02 +0900 Driver is ruby 2.4.0dev (2016-06-18 trunk 55440) [x86_64-darwin15] Target is ruby 2.4.0dev (2016-06-18 trunk 55440) [x86_64-darwin15] last_commit=* test/rubygems/test_gem_installer.rb: Fixed broken test with extension build. https://github.com/rubygems/rubygems/pull/1645 KNOWNBUGS.rb PASS 0 No tests, no problem test succeeded Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" # Running tests: Finished tests in 2.513254s, 87.9338 tests/s, 177.4592 assertions/s. 221 tests, 446 assertions, 0 failures, 0 errors, 0 skips ruby -v: ruby 2.4.0dev (2016-06-18 trunk 55440) [x86_64-darwin15] Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" --excludes-dir=./test/excludes --name=!/ memory_leak/ --exclude=/testunit/ --exclude=/minitest/ -j4 # Running tests: [ 89/803] 4625=test_bigdecimal 4626=test_table 4627=test_encodings 4628=test_bug_reporter
  • 10. common.mk • check/check-ruby • btest/btest-ruby • test-basic/test-knownbug • test-testframework • test • test-all • test-almost • test-ruby • test-rubyspec
  • 11. make test • btest-ruby • snip for next slides • test-basic • invoke `basictest/runner.rb` with target ruby • test-knownbug • invoke `KNOWNBUGS.rb` • It’s empty a lot of the time.
  • 12. make btest-ruby % ls bootstraptest pending.rb runner.rb* test_attr.rb test_autoload.rb test_block.rb test_class.rb test_eval.rb test_exception.rb test_finalizer.rb test_flip.rb test_flow.rb test_fork.rb test_gc.rb test_io.rb test_jump.rb test_literal.rb test_literal_suffix.rb test_load.rb test_marshal.rb test_massign.rb test_method.rb test_objectspace.rb test_proc.rb test_string.rb test_struct.rb test_syntax.rb test_thread.rb What’s `bootstraptest/runner.rb` ? • load test files and invoke them • define assertion methods like `assert_equal` etc.
  • 13. `cat bootstraptest/test_class.rb` assert_equal 'true', %q( class C; end Object.const_defined?(:C) ) assert_equal 'Class', %q( class C; end C.class ) (snip) assert_equal 'Class', %q( class A; end class C < A; end C.class ) (snip) assert_equal 'M', %q( module M; end M.name ) (snip) assert_equal 'A::B', %q( class A; end class A::B; end A::B )
  • 14. test-basic a, = nil; test_ok(a == nil) a, = 1; test_ok(a == 1) a, = []; test_ok(a == nil) (snip) def r; return *[]; end; a = r(); test_ok(a == []) def r; return *[1]; end; a = r(); test_ok(a == [1]) def r; return *[nil]; end; a = r(); test_ok(a == [nil]) (snip) f = lambda { |a, b=42, *c| [a,b,c] } test_ok(f.call(1 ) == [1,42,[ ]] ) test_ok(f.call(1,43 ) == [1,43,[ ]] ) test_ok(f.call(1,43,44) == [1,43,[44]] ) (snip)
  • 15. These are for Developer of VM/GC/Syntax/etc
  • 16. make test-all test-all invokes test files under the `test` directory. test-all has some options for testing: • make test-all TESTS=“logger” • test only files under `test/logger` • make test-all TESTS=“-j4” • it make parallel execution with 4 processes.
  • 17. cat `test/ruby/test_array.rb` % cat test/ruby/test_array.rb # coding: US-ASCII require 'test/unit' class TestArray < Test::Unit::TestCase (snip) def test_percent_i assert_equal([:foo, :bar], %i[foo bar]) assert_equal([:""foo"], %i["foo]) end def test_0_literal assert_equal([1, 2, 3, 4], [1, 2] + [3, 4]) assert_equal([1, 2, 1, 2], [1, 2] * 2) assert_equal("1:2", [1, 2] * ":") (snip)
  • 18. cat `test/logger/test_logger.rb` % cat test/logger/test_logger.rb # coding: US-ASCII require 'test/unit' require 'logger' require 'tempfile' class TestLogger < Test::Unit::TestCase (snip) def test_add logger = Logger.new(nil) logger.progname = "my_progname" assert(logger.add(INFO)) log = log_add(logger, nil, "msg") assert_equal("ANY", log.severity) assert_equal("my_progname", log.progname) (snip)
  • 19. cat `test/-ext-/array/test_resize.rb` % cat ext/-test-/array/resize/resize.c #include "ruby/ruby.h" static VALUE ary_resize(VALUE ary, VALUE len) { rb_ary_resize(ary, NUM2LONG(len)); return ary; } void Init_resize(void) { rb_define_method(rb_cArray, "__resize__", ary_resize, 1); } require 'test/unit' require '-test-/array/resize' class TestArray < Test::Unit::TestCase class TestResize < Test::Unit::TestCase def test_expand feature = '[ruby-dev:42912]' ary = [*1..10] ary.__resize__(10) assert_equal(10, ary.size, feature) assert_equal([*1..10], ary, feature) ary.__resize__(100) assert_equal(100, ary.size, feature) (snip)
  • 20. make check make check depends on the following definitions: • main • build encodings and extensions. • test • test-testframework • run tests for `testunit` and `minitest` • test-almost • run tests under `test` excluding `testunit` and `minitest`
  • 21. These are for “you”
  • 22. make test-rubyspec CRuby has `make update-rubyspec` and `make test-rubyspec` tasks. •`make update-rubyspec` • pulls ruby/rubyspec and ruby/mspec into the spec directory. •`make test-rubyspec` • invokes mspec with the ruby binary and the latest rubyspecs.
  • 23. cat spec/rubyspec/core/string/append_spec.rb % cat spec/rubyspec/core/string/concat_spec.rb require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../fixtures/classes', __FILE__) require File.expand_path('../shared/concat', __FILE__) describe "String#<<" do it_behaves_like :string_concat, :<< it_behaves_like :string_concat_encoding, :<< end % cat spec/rubyspec/core/string/shared/concat.rb describe :string_concat, shared: true do it "concatenates the given argument to self and returns self" do str = 'hello ' str.send(@method, 'world').should equal(str) str.should == "hello world" end (snip) Please check details: https://github.com/ruby/spec
  • 24. These are for developer who interest compatibility
  • 25.
  • 26. Please contribute tests to ruby $ git clone https://github.com/ruby/ruby $ cd ruby $ autoconf $ ./configure —disable-install-doc $ make -j $ make check You can invoke CRuby tests: You can invoke focused tests with coverage: $ COVERAGE=1 make test-all TESTS=“logger” $ open coverage/index.html You can code new tests or update existing tests. and submit patches to our tracker or github.com/ruby/ruby.