How to Begin to Develop Ruby Core

Hiroshi SHIBATA
Hiroshi SHIBATAOSS programmer at GMO Pepabo, Inc.
The secrets of CRuby ecosystem
How to Begin to
Develop Ruby Core
Hiroshi SHIBATA / GMO PEPABO inc.
2016.09.24 Euruko 2016
Chief Engineer
Hiroshi SHIBATA @hsbt
https://www.hsbt.org
How to Begin to Develop Ruby Core
How to Begin to Develop 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”],
}
https://pepabo.com
CEO(@kentarow) and CTO(@kentaro) support me
What’s (C)Ruby?
1.
Variation of Ruby Interpreter
Implementation:
• Ruby(MRI, CRuby)
• JRuby
• Rubinius
• Opal
ISO/IEC 30170:2012:
• CRuby
• mruby
Basis of CRuby and YARV
“ Throughout most of this book we’ll learn about the original,
standard implementation of Ruby, known as Matz’s Ruby Interpreter
(MRI) after Yukihiro Matsumoto, who invented Ruby in 1993.”
Ruby Under a Microscope, p.4
“ With Ruby 1.9, Koichi Sasada and the Ruby core team introduced
Yet Another Ruby Virtual Machine (YARV), which actually executes
your Ruby code.”
Ruby Under a Microscope, p.33
Ruby 1.8
Ruby 1.9
Ruby Committer
Heroku
• Matz
• ko1
• n0kada
$ cat ~svn/.ssh/authorized_keys | awk '{print $5}' | sort | uniq | wc -l
93
Total 91 people + 2 bot
MoneyForward
• shyouhei
Full-time commiters
Branch maintainers
trunk known as 2.4
nurse: Release manager
2.3
nagachika: Stable branch maintainer
2.2, 2.1
unak: Old stable branch maintainer
Linux
•akr
•normalperson
•n0kada
and others
Windows
•unak
•n0kada
Platform maintainers
BSD
•nurse
Solaris
•ngoto
OS X
•n0kada
•mrkn
Ruby Core Maintenance scope policy
Language core features including security
Yukihiro Matsumoto (matz)
Ruby VM(YARV)
Koichi Sasada (ko1)
Core classes
Ruby Commiters
Ruby Core Maintenance Policy
Standard Libraries
Each maintainers
Bundled Libraries(default/bundled gems)
Hiroshi SHIBATA(hsbt), Nobuyoshi Nakada(nobu)
Documentation
Zachary Scott(zzak)
*.ruby-lang.org
www.ruby-lang.org
Official Website of Ruby language. It’s hosted by Heroku.
We welcomed to translate contribution.
see http://github.com/ruby/www.ruby-lang.org
svn.ruby-lang.org
Main repository of Ruby source.
bugs.ruby-lang.org
Official issue tracker of Ruby. It’s hosted by Heroku
*.ruby-lang.org
ftp.ruby-lang.org
Site of distribute official package
docs.ruby-lang.org
Hosted document generated from RDoc and rubima project.
CDN
Our site and package distribution were supported by fastly.
• www.ruby-lang.org
• cache.ruby-lang.org
Statistics of our CDN:
• Access ratio: USA: 37.9%, EU: 17.8%, Asia: 39.0%, Others: 5.3%
• Bandwidth: 6181 GB/month
• Requests: 12,296,848 req/month = 4 req/sec
What does mean “official”?
“official” means “Matz controllable”
Un-controllable examples:
• ruby-doc.org
• rubygems.org
• bundler.io
• rvm/rbenv/chruby
Licenses of Ruby language
• 2-clause BSDL
• Ruby License
see details of `COPYING` file in ruby source code.
Ruby is OSS
Do submit your patch
to OSS
2.
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
• 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
I always start code reading with the following commands
I pick out `before_script` and `script` code from .travis.yml and
invoke it. For example:
$ git clone https://github.com/some/gems
$ cd gems
$ less .travis.yml
$ bundle install
$ rake spec
$ rake spec:plugins
In the case of ruby
You will get…
$ git clone https://github.com/ruby/ruby
$ cd ruby
$ less .travis.yml
.travis.yml in ruby/ruby
before_script:
- "uname -a"
- "uname -r"
- "rm -fr .ext autom4te.cache"
- "echo $TERM"
- "make -f common.mk BASERUBY=ruby MAKEDIRS='mkdir -p' srcdir=. update-config_files"
- "autoconf"
- "mkdir config_1st config_2nd"
- "./configure -C --disable-install-doc --with-gcc=$CC $CONFIG_FLAG"
- "cp -pr config.status .ext/include config_1st"
- "make reconfig"
- "cp -pr config.status .ext/include config_2nd"
- "diff -ru config_1st config_2nd"
- "make after-update BASERUBY=ruby"
- "make -s $JOBS"
- "make update-rubyspec"
script:
- "make test TESTOPTS=--color=never"
- "make test-all TESTOPTS='-q -j3 --color=never --job-status=normal'"
- "make test-rubyspec MSPECOPT=-fm"
How to contribute
to OSS Ruby
Do submit your patch to ruby core
1. Write code :)
2. Run tests
3. Open bugs.ruby-lang.org and create new account
4. Open https://bugs.ruby-lang.org/projects/ruby-trunk/issues/new
5. Attach your code and write description of your proposal
6. Press “submit”
Do submit your patch to ruby core
1. Write code :)
2. Run tests
3. Open bugs.ruby-lang.org and create new account
4. Open https://bugs.ruby-lang.org/projects/ruby-trunk/issues/new
5. Attach your code and write description of your proposal
6. Press “submit”
Test ruby language
3.
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)
These are for “you”
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`
test-unit/minitest
Why separated the test framework?
The following libraries uses minitest directly in Ruby 2.3:
• rubygems
• rdoc
Other libraries uses test-unit. rubygems and rdoc are developed at
github.com/rubygems/rubygems and github.com/rdoc/rdoc. We need
to support these libraries and their tests.
How to merge upstream from others
I merged upstream into ruby/ruby periodically using following
instructions.
ruby and rubygems guarantee to work to test and code each other.
it’s the same situation for ruby and rdoc
$ git clone https://github.com/ruby/ruby
$ git clone https://github.com/rubygems/rubygems
$ cd ruby
$ rm -rf lib/rubygems test/rubygtems lib/rubygems.rb
$ cp -rf ../../rubygems/rubygems/lib/rubygems ./lib
$ cp -rf ../../rubygems/rubygems/lib/rubygems.rb ./lib
$ cp -rf ../../rubygems/rubygems/test/rubygems ./test
$ git checkout lib/rubygems/LICENSE.txt
backport is hard
rubygems still supports Ruby 1.8.
% g show a34fb569e41cd87866e644d92a9df4be89b3cad2 test/rubygems/test_gem_package.rb
commit a34fb569e41cd87866e644d92a9df4be89b3cad2
Author: Eric Hodel <drbrain@segment7.net>
(snip)
--- test/rubygems/test_gem_package.rb
+++ test/rubygems/test_gem_package.rb
@@ -638,7 +638,7 @@ class TestGemPackage < Gem::Package::TarTestCase
e.message
io
end
- tf.close!
+ tf.close! if tf.respond_to? :close!
end
def test_verify_empty
ruby/spec
RubySpec
Q. What’s rubyspec?
A. RubySpec is an executable specification for the Ruby
programming language.
“Matz's Ruby Developers Don't Use RubySpec and It's Hurting Ruby”
http://rubini.us/2014/12/31/matz-s-ruby-developers-don-t-use-rubyspec/
“ruby/spec” is not a “specification”. It’s actually a set of “test”. The
only real ruby specification is inside of Matz :)
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
rubyspec and mspec
We approved new or updated examples at github.com/ruby/spec.
@headius wrote: “So nice to see RubySpec getting a steady stream
of Ruby 2.3 specs.”
https://twitter.com/headius/status/667793518098673664
A lot of contributors submitted new specs for Ruby 2.3 and 2.4
features.
test coverage
% make update-coverage
updating simplecov ...
remote: Counting objects: 90, done.
(snip)
updating simplecov-html ...
updating doclie …
% COVERAGE=1 make test-all TESTS=webrick
I added a coverage task using simplecov
You can get coverage results for `webrick` under the coverage
directory.
How to Begin to Develop Ruby Core
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 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 it.
Ruby (language) testing
is
so easy
How request Ruby core
4.
Feature request
• We need to focus “Use case” than “function”.
• We need to attach patch to feature request.
• We need Matz approval.
Acceptable requests without usecase
• Symmetrical:
`Array#shift`, `Array#unshift`
• POSIX
Socket.gethostbyname
• [BUG] [SEGV]
Bug report
• We need minimum reproduction code
• We need to describe expected/unexpected behavior
• We need to attach crash log
• We need to try different version of ruby
Issue tracker
Our official tracker is “bugs.ruby-lang.org”
Mailing list integration
•https://github.com/ruby/redmine_*
•This behavior is same as github
Continuous Upgrade Ruby and Rails to latest version.
Redmine vs GitHub
github.com/ruby/ruby is ok for ruby core team
[CAUTION] If you hope to ask new feature to Matz, You need to
submit bugs.ruby-lang.org . Matz is only available on redmine.
Why Ruby does not use GitHub?
• GitHub is proprietary service
• ruby committers do not have problem with redmine
• We start to consider issue of “Why Ruby does not use Git”
Monthly Developer Meeting
We hope to increase to transparency for Ruby development process.
One of our challenges is “Developer Meeting”. It’s open discussion
time for feature and issue of Ruby every months.
[ruby-core:69550]: https://bugs.ruby-lang.org/projects/ruby/wiki/
DevelopersMeeting20150728Japan
Gemification for stdlib
• We extract old or un-maintain status stdlibs like net-telnet, xmlrpc,
tk to bundled gems.
• These are extracted under the https://github.com/ruby/ . And
shipped on rubygems.org
• Date, CGI, Readline are also extracted at the future(It’s my ideas).
• OpenSSL is also extracted default gems. You can update it
separated ruby core releases same as rubygems, rdoc, bigdecimal
How develop Ruby core
5.
Ruby CI
What’s Ruby CI
Ruby CI is a CI results collector for alternative platforms
• http://rubyci.org
• https://github.com/nurse/rubyci
• https://github.com/ruby/chkbuild
Ruby CI goal is entirely supports all of Ruby platform. We can detect
a lot of build fails using Ruby CI. It has 2 or 3 versions every linux
distribution and BSD, Windows, OS X, Solaris Environments.
How to Begin to Develop Ruby Core
How to add a new server
You can add your server to rubyci.org
Requirements:
• not yet supported platforms.
• ex. linux with ARM, *BSD, icc with OSX, Windows
• periodically running every day
• It must be possible to access to AWS S3
You should check the following commands on your server
$ git clone https://github.com/akr/chkbuild
$ cd chkbuild
$ ruby start-build
Version number and release cycle
We plan to release every christmas.
• 2.1.0: 2013/12/25
• 2.2.0: 2014/12/25
• 2.3.0: 2015/12/25
• 2.4.0: 2016/12/25(TBD)
Ruby core backport model
trunk
ruby_2_1
ruby_2_0_0
trunk
ruby_2_1
ruby_2_0_0
We backport fixes to stable branch from trunk.
We do not merge fixes to trunk from stable branch
Release management
We will release new version of Ruby at “Release Day” by @narse
There is no exception to this rule.
• If we have incompletion issue or feature, we will revert it.
• If we don’t have enough discussion for some issue, we don’t
merge or implement it into new version of ruby.
• If we found some regression, we need to fix it or revert to related
code or issue.
Security release
We have “security@ruby-lang.org” for security report. We received
buffer overflow, memory leak, escape string etc etc…
We hard to fix and release these security issue. so all of release
maintainer are volunteer work.
Our release delayed by preparing new releases of stable and old
stable version.
HackerOne
We’ve been use
https://hackerone.com/ruby
It has bounty program provided by IBB.
We accepts to security report via
hackerone too.
How to Begin to Develop Ruby Core
Conclusion
CRuby secrets
•Who develop CRuby
•Where is official resource of CRuby
•How to develop CRuby
•What is important of feature request in CRuby
•When release new version of CRuby
and…
Why use Ruby?
“Ruby is designed to make
programmers happy.”
1 of 80

Recommended

Gemification plan of Standard Library on Ruby by
Gemification plan of Standard Library on RubyGemification plan of Standard Library on Ruby
Gemification plan of Standard Library on RubyHiroshi SHIBATA
351 views14 slides
Middleware as Code with mruby by
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mrubyHiroshi SHIBATA
5.2K views57 slides
Large-scaled Deploy Over 100 Servers in 3 Minutes by
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesHiroshi SHIBATA
3.8K views89 slides
The secret of programming language development and future by
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and futureHiroshi SHIBATA
1.1K views76 slides
Dependency Resolution with Standard Libraries by
Dependency Resolution with Standard LibrariesDependency Resolution with Standard Libraries
Dependency Resolution with Standard LibrariesHiroshi SHIBATA
803 views24 slides
How to Begin Developing Ruby Core by
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHiroshi SHIBATA
1.9K views27 slides

More Related Content

What's hot

How DSL works on Ruby by
How DSL works on RubyHow DSL works on Ruby
How DSL works on RubyHiroshi SHIBATA
5.1K views64 slides
The details of CI/CD environment for Ruby by
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for RubyHiroshi SHIBATA
1.1K views39 slides
Gems on Ruby by
Gems on RubyGems on Ruby
Gems on RubyHiroshi SHIBATA
1.9K views35 slides
RubyGems 3 & 4 by
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4Hiroshi SHIBATA
1.3K views36 slides
RubyGems 3 & 4 by
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4Hiroshi SHIBATA
11.5K views64 slides
How to test code with mruby by
How to test code with mrubyHow to test code with mruby
How to test code with mrubyHiroshi SHIBATA
10.1K views39 slides

What's hot(20)

The details of CI/CD environment for Ruby by Hiroshi SHIBATA
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for Ruby
Hiroshi SHIBATA1.1K views
How to test code with mruby by Hiroshi SHIBATA
How to test code with mrubyHow to test code with mruby
How to test code with mruby
Hiroshi SHIBATA10.1K views
The Future of Dependency Management for Ruby by Hiroshi SHIBATA
The Future of Dependency Management for RubyThe Future of Dependency Management for Ruby
The Future of Dependency Management for Ruby
Hiroshi SHIBATA7.4K views
How to distribute Ruby to the world by Hiroshi SHIBATA
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the world
Hiroshi SHIBATA937 views
How to distribute Ruby to the world by Hiroshi SHIBATA
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the world
Hiroshi SHIBATA3.8K views
Gemification for Ruby 2.5/3.0 by Hiroshi SHIBATA
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
Hiroshi SHIBATA1.3K views
How to develop the Standard Libraries of Ruby? by 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?
Hiroshi SHIBATA3.6K views
tDiary annual report 2009 - Sapporo Ruby Kaigi02 by Hiroshi SHIBATA
tDiary annual report 2009 - Sapporo Ruby Kaigi02tDiary annual report 2009 - Sapporo Ruby Kaigi02
tDiary annual report 2009 - Sapporo Ruby Kaigi02
Hiroshi SHIBATA1.5K views
The Future of library dependency management of Ruby by Hiroshi 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
Hiroshi SHIBATA644 views

Viewers also liked

RSpec Performance Turning by
RSpec Performance TurningRSpec Performance Turning
RSpec Performance TurningGo Sueyoshi (a.k.a sue445)
6.6K views33 slides
Test::Kantan - Perl and Testing by
Test::Kantan - Perl and TestingTest::Kantan - Perl and Testing
Test::Kantan - Perl and TestingTokuhiro Matsuno
5.1K views79 slides
やさしいGemパッチの作り方 by
やさしいGemパッチの作り方やさしいGemパッチの作り方
やさしいGemパッチの作り方Maki Toshio
984 views7 slides
Quine・難解プログラミングについて by
Quine・難解プログラミングについてQuine・難解プログラミングについて
Quine・難解プログラミングについてmametter
15.3K views63 slides
Cookpad 17 day Tech internship 2017 言語処理系入門 Rubyをコンパイルしよう by
Cookpad 17 day Tech internship 2017 言語処理系入門 RubyをコンパイルしようCookpad 17 day Tech internship 2017 言語処理系入門 Rubyをコンパイルしよう
Cookpad 17 day Tech internship 2017 言語処理系入門 RubyをコンパイルしようKoichi Sasada
15.4K views85 slides
Esoteric, Obfuscated, Artistic Programming in Ruby by
Esoteric, Obfuscated, Artistic Programming in RubyEsoteric, Obfuscated, Artistic Programming in Ruby
Esoteric, Obfuscated, Artistic Programming in Rubymametter
3.2K views44 slides

Viewers also liked(9)

やさしいGemパッチの作り方 by Maki Toshio
やさしいGemパッチの作り方やさしいGemパッチの作り方
やさしいGemパッチの作り方
Maki Toshio984 views
Quine・難解プログラミングについて by mametter
Quine・難解プログラミングについてQuine・難解プログラミングについて
Quine・難解プログラミングについて
mametter15.3K views
Cookpad 17 day Tech internship 2017 言語処理系入門 Rubyをコンパイルしよう by Koichi Sasada
Cookpad 17 day Tech internship 2017 言語処理系入門 RubyをコンパイルしようCookpad 17 day Tech internship 2017 言語処理系入門 Rubyをコンパイルしよう
Cookpad 17 day Tech internship 2017 言語処理系入門 Rubyをコンパイルしよう
Koichi Sasada15.4K views
Esoteric, Obfuscated, Artistic Programming in Ruby by mametter
Esoteric, Obfuscated, Artistic Programming in RubyEsoteric, Obfuscated, Artistic Programming in Ruby
Esoteric, Obfuscated, Artistic Programming in Ruby
mametter3.2K views
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える by pospome
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考えるGoのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える
Goのサーバサイド実装におけるレイヤ設計とレイヤ内実装について考える
pospome65.4K views
Ruby and Distributed Storage Systems by SATOSHI TAGOMORI
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage Systems
SATOSHI TAGOMORI13.3K views

Similar to How to Begin to Develop Ruby Core

The story of language development by
The story of language developmentThe story of language development
The story of language developmentHiroshi SHIBATA
11K views45 slides
Ruby by
RubyRuby
RubyAizat Faiz
6.4K views48 slides
An Introduction to Ruby on Rails 20100506 by
An Introduction to Ruby on Rails 20100506An Introduction to Ruby on Rails 20100506
An Introduction to Ruby on Rails 20100506Vu Hung Nguyen
651 views28 slides
An introduction-to-ruby-on-rails by
An introduction-to-ruby-on-railsAn introduction-to-ruby-on-rails
An introduction-to-ruby-on-railsvinicorp
1.1K views28 slides
#CNX14 - Using Ruby for Reliability, Consistency, and Speed by
#CNX14 - Using Ruby for Reliability, Consistency, and Speed#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and SpeedSalesforce Marketing Cloud
5.5K views87 slides
Toolbox of a Ruby Team by
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
422 views38 slides

Similar to How to Begin to Develop Ruby Core(20)

The story of language development by Hiroshi SHIBATA
The story of language developmentThe story of language development
The story of language development
Hiroshi SHIBATA11K views
An Introduction to Ruby on Rails 20100506 by Vu Hung Nguyen
An Introduction to Ruby on Rails 20100506An Introduction to Ruby on Rails 20100506
An Introduction to Ruby on Rails 20100506
Vu Hung Nguyen651 views
An introduction-to-ruby-on-rails by vinicorp
An introduction-to-ruby-on-railsAn introduction-to-ruby-on-rails
An introduction-to-ruby-on-rails
vinicorp1.1K views
Toolbox of a Ruby Team by Arto Artnik
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
Arto Artnik422 views
Ruby C extensions at the Ruby drink-up of Sophia, April 2012 by rivierarb
Ruby C extensions at the Ruby drink-up of Sophia, April 2012Ruby C extensions at the Ruby drink-up of Sophia, April 2012
Ruby C extensions at the Ruby drink-up of Sophia, April 2012
rivierarb2.4K views
JRuby, Ruby, Rails and You on the Cloud by Hiro Asari
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the Cloud
Hiro Asari1.3K views
TechDays - IronRuby by Ben Hall
TechDays - IronRubyTechDays - IronRuby
TechDays - IronRuby
Ben Hall1K views
Exploring Ruby on Rails and PostgreSQL by Barry Jones
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
Barry Jones3.2K views
Hacking with ruby2ruby by Marc Chung
Hacking with ruby2rubyHacking with ruby2ruby
Hacking with ruby2ruby
Marc Chung1.4K views
Why Ruby? by IT Weekend
Why Ruby? Why Ruby?
Why Ruby?
IT Weekend850 views
plackdo, plack-like web interface on perl6 by Nobuo Danjou
plackdo, plack-like web interface on perl6plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6
Nobuo Danjou1K views
Rails Presentation (Anton Dmitriyev) by True-Vision
Rails Presentation (Anton Dmitriyev)Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)
True-Vision209 views
Practical Testing of Ruby Core by Hiroshi SHIBATA
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby Core
Hiroshi SHIBATA16.6K views

More from Hiroshi SHIBATA

How resolve Gem dependencies in your code? by
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?Hiroshi SHIBATA
46 views50 slides
How resolve Gem dependencies in your code? by
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?Hiroshi SHIBATA
15 views54 slides
Ruby コミッターと歩む Ruby を用いたプロダクト開発 by
Ruby コミッターと歩む Ruby を用いたプロダクト開発Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発Hiroshi SHIBATA
51 views14 slides
Why ANDPAD commit Ruby and RubyKaigi? by
Why ANDPAD commit Ruby and RubyKaigi?Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?Hiroshi SHIBATA
225 views17 slides
RailsGirls から始める エンジニアリングはじめの一歩 by
RailsGirls から始める エンジニアリングはじめの一歩RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩Hiroshi SHIBATA
846 views16 slides
Roadmap for RubyGems 4 and Bundler 3 by
Roadmap for RubyGems 4 and Bundler 3Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3Hiroshi SHIBATA
794 views23 slides

More from Hiroshi SHIBATA(11)

How resolve Gem dependencies in your code? by Hiroshi SHIBATA
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?
Hiroshi SHIBATA46 views
How resolve Gem dependencies in your code? by Hiroshi SHIBATA
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?
Hiroshi SHIBATA15 views
Ruby コミッターと歩む Ruby を用いたプロダクト開発 by Hiroshi SHIBATA
Ruby コミッターと歩む Ruby を用いたプロダクト開発Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発
Hiroshi SHIBATA51 views
Why ANDPAD commit Ruby and RubyKaigi? by Hiroshi SHIBATA
Why ANDPAD commit Ruby and RubyKaigi?Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?
Hiroshi SHIBATA225 views
RailsGirls から始める エンジニアリングはじめの一歩 by Hiroshi SHIBATA
RailsGirls から始める エンジニアリングはじめの一歩RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩
Hiroshi SHIBATA846 views
Roadmap for RubyGems 4 and Bundler 3 by Hiroshi SHIBATA
Roadmap for RubyGems 4 and Bundler 3Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3
Hiroshi SHIBATA794 views
The Future of library dependency manageement of Ruby by Hiroshi SHIBATA
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of Ruby
Hiroshi SHIBATA988 views
The Future of Bundled Bundler by Hiroshi SHIBATA
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled Bundler
Hiroshi SHIBATA4.7K views
Productive Organization with Ruby by Hiroshi SHIBATA
Productive Organization with RubyProductive Organization with Ruby
Productive Organization with Ruby
Hiroshi SHIBATA545 views

Recently uploaded

Future of AR - Facebook Presentation by
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook PresentationRob McCarty
65 views27 slides
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdf by
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdfAdopting Karpenter for Cost and Simplicity at Grafana Labs.pdf
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdfMichaelOLeary82
13 views74 slides
AI + Memoori = AIM by
AI + Memoori = AIMAI + Memoori = AIM
AI + Memoori = AIMMemoori
14 views9 slides
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...The Digital Insurer
91 views52 slides
NTGapps NTG LowCode Platform by
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform Mustafa Kuğu
437 views30 slides
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023 by
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023BookNet Canada
44 views19 slides

Recently uploaded(20)

Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty65 views
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdf by MichaelOLeary82
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdfAdopting Karpenter for Cost and Simplicity at Grafana Labs.pdf
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdf
MichaelOLeary8213 views
AI + Memoori = AIM by Memoori
AI + Memoori = AIMAI + Memoori = AIM
AI + Memoori = AIM
Memoori14 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu437 views
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023 by BookNet Canada
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
BookNet Canada44 views
Discover Aura Workshop (12.5.23).pdf by Neo4j
Discover Aura Workshop (12.5.23).pdfDiscover Aura Workshop (12.5.23).pdf
Discover Aura Workshop (12.5.23).pdf
Neo4j15 views
The Power of Generative AI in Accelerating No Code Adoption.pdf by Saeed Al Dhaheri
The Power of Generative AI in Accelerating No Code Adoption.pdfThe Power of Generative AI in Accelerating No Code Adoption.pdf
The Power of Generative AI in Accelerating No Code Adoption.pdf
Saeed Al Dhaheri39 views
Innovation & Entrepreneurship strategies in Dairy Industry by PervaizDar1
Innovation & Entrepreneurship strategies in Dairy IndustryInnovation & Entrepreneurship strategies in Dairy Industry
Innovation & Entrepreneurship strategies in Dairy Industry
PervaizDar135 views
Deep Tech and the Amplified Organisation: Core Concepts by Holonomics
Deep Tech and the Amplified Organisation: Core ConceptsDeep Tech and the Amplified Organisation: Core Concepts
Deep Tech and the Amplified Organisation: Core Concepts
Holonomics17 views
"Package management in monorepos", Zoltan Kochan by Fwdays
"Package management in monorepos", Zoltan Kochan"Package management in monorepos", Zoltan Kochan
"Package management in monorepos", Zoltan Kochan
Fwdays34 views
Optimizing Communication to Optimize Human Behavior - LCBM by Yaman Kumar
Optimizing Communication to Optimize Human Behavior - LCBMOptimizing Communication to Optimize Human Behavior - LCBM
Optimizing Communication to Optimize Human Behavior - LCBM
Yaman Kumar38 views
Bronack Skills - Risk Management and SRE v1.0 12-3-2023.pdf by ThomasBronack
Bronack Skills - Risk Management and SRE v1.0 12-3-2023.pdfBronack Skills - Risk Management and SRE v1.0 12-3-2023.pdf
Bronack Skills - Risk Management and SRE v1.0 12-3-2023.pdf
ThomasBronack31 views
Mobile Core Solutions & Successful Cases.pdf by IPLOOK Networks
Mobile Core Solutions & Successful Cases.pdfMobile Core Solutions & Successful Cases.pdf
Mobile Core Solutions & Successful Cases.pdf
IPLOOK Networks14 views
LLMs in Production: Tooling, Process, and Team Structure by Aggregage
LLMs in Production: Tooling, Process, and Team StructureLLMs in Production: Tooling, Process, and Team Structure
LLMs in Production: Tooling, Process, and Team Structure
Aggregage57 views

How to Begin to Develop Ruby Core

  • 1. The secrets of CRuby ecosystem How to Begin to Develop Ruby Core Hiroshi SHIBATA / GMO PEPABO inc. 2016.09.24 Euruko 2016
  • 2. Chief Engineer Hiroshi SHIBATA @hsbt https://www.hsbt.org
  • 5. 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”], }
  • 8. Variation of Ruby Interpreter Implementation: • Ruby(MRI, CRuby) • JRuby • Rubinius • Opal ISO/IEC 30170:2012: • CRuby • mruby
  • 9. Basis of CRuby and YARV “ Throughout most of this book we’ll learn about the original, standard implementation of Ruby, known as Matz’s Ruby Interpreter (MRI) after Yukihiro Matsumoto, who invented Ruby in 1993.” Ruby Under a Microscope, p.4 “ With Ruby 1.9, Koichi Sasada and the Ruby core team introduced Yet Another Ruby Virtual Machine (YARV), which actually executes your Ruby code.” Ruby Under a Microscope, p.33 Ruby 1.8 Ruby 1.9
  • 10. Ruby Committer Heroku • Matz • ko1 • n0kada $ cat ~svn/.ssh/authorized_keys | awk '{print $5}' | sort | uniq | wc -l 93 Total 91 people + 2 bot MoneyForward • shyouhei Full-time commiters
  • 11. Branch maintainers trunk known as 2.4 nurse: Release manager 2.3 nagachika: Stable branch maintainer 2.2, 2.1 unak: Old stable branch maintainer
  • 13. Ruby Core Maintenance scope policy Language core features including security Yukihiro Matsumoto (matz) Ruby VM(YARV) Koichi Sasada (ko1) Core classes Ruby Commiters
  • 14. Ruby Core Maintenance Policy Standard Libraries Each maintainers Bundled Libraries(default/bundled gems) Hiroshi SHIBATA(hsbt), Nobuyoshi Nakada(nobu) Documentation Zachary Scott(zzak)
  • 15. *.ruby-lang.org www.ruby-lang.org Official Website of Ruby language. It’s hosted by Heroku. We welcomed to translate contribution. see http://github.com/ruby/www.ruby-lang.org svn.ruby-lang.org Main repository of Ruby source. bugs.ruby-lang.org Official issue tracker of Ruby. It’s hosted by Heroku
  • 16. *.ruby-lang.org ftp.ruby-lang.org Site of distribute official package docs.ruby-lang.org Hosted document generated from RDoc and rubima project.
  • 17. CDN Our site and package distribution were supported by fastly. • www.ruby-lang.org • cache.ruby-lang.org Statistics of our CDN: • Access ratio: USA: 37.9%, EU: 17.8%, Asia: 39.0%, Others: 5.3% • Bandwidth: 6181 GB/month • Requests: 12,296,848 req/month = 4 req/sec
  • 18. What does mean “official”? “official” means “Matz controllable” Un-controllable examples: • ruby-doc.org • rubygems.org • bundler.io • rvm/rbenv/chruby
  • 19. Licenses of Ruby language • 2-clause BSDL • Ruby License see details of `COPYING` file in ruby source code.
  • 21. Do submit your patch to OSS 2.
  • 22. 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!”
  • 23. Documentation is hard • No-one knows the true behavior of OSS • Only author knows that. • Documentation is tedious work :bow: Because documentation is valuable work.
  • 24. Testing and Running are easy I always start code reading with the following commands I pick out `before_script` and `script` code from .travis.yml and invoke it. For example: $ git clone https://github.com/some/gems $ cd gems $ less .travis.yml $ bundle install $ rake spec $ rake spec:plugins
  • 25. In the case of ruby You will get… $ git clone https://github.com/ruby/ruby $ cd ruby $ less .travis.yml
  • 26. .travis.yml in ruby/ruby before_script: - "uname -a" - "uname -r" - "rm -fr .ext autom4te.cache" - "echo $TERM" - "make -f common.mk BASERUBY=ruby MAKEDIRS='mkdir -p' srcdir=. update-config_files" - "autoconf" - "mkdir config_1st config_2nd" - "./configure -C --disable-install-doc --with-gcc=$CC $CONFIG_FLAG" - "cp -pr config.status .ext/include config_1st" - "make reconfig" - "cp -pr config.status .ext/include config_2nd" - "diff -ru config_1st config_2nd" - "make after-update BASERUBY=ruby" - "make -s $JOBS" - "make update-rubyspec" script: - "make test TESTOPTS=--color=never" - "make test-all TESTOPTS='-q -j3 --color=never --job-status=normal'" - "make test-rubyspec MSPECOPT=-fm"
  • 28. Do submit your patch to ruby core 1. Write code :) 2. Run tests 3. Open bugs.ruby-lang.org and create new account 4. Open https://bugs.ruby-lang.org/projects/ruby-trunk/issues/new 5. Attach your code and write description of your proposal 6. Press “submit”
  • 29. Do submit your patch to ruby core 1. Write code :) 2. Run tests 3. Open bugs.ruby-lang.org and create new account 4. Open https://bugs.ruby-lang.org/projects/ruby-trunk/issues/new 5. Attach your code and write description of your proposal 6. Press “submit”
  • 31. 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:
  • 32. % 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
  • 33. common.mk • check/check-ruby • btest/btest-ruby • test-basic/test-knownbug • test-testframework • test • test-all • test-almost • test-ruby • test-rubyspec
  • 34. 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.
  • 35. 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.
  • 36. `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 )
  • 37. 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)
  • 38. These are for Developer of VM/GC/Syntax/etc
  • 39. 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.
  • 40. 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)
  • 41. 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)
  • 42. 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)
  • 43. These are for “you”
  • 44. 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`
  • 46. Why separated the test framework? The following libraries uses minitest directly in Ruby 2.3: • rubygems • rdoc Other libraries uses test-unit. rubygems and rdoc are developed at github.com/rubygems/rubygems and github.com/rdoc/rdoc. We need to support these libraries and their tests.
  • 47. How to merge upstream from others I merged upstream into ruby/ruby periodically using following instructions. ruby and rubygems guarantee to work to test and code each other. it’s the same situation for ruby and rdoc $ git clone https://github.com/ruby/ruby $ git clone https://github.com/rubygems/rubygems $ cd ruby $ rm -rf lib/rubygems test/rubygtems lib/rubygems.rb $ cp -rf ../../rubygems/rubygems/lib/rubygems ./lib $ cp -rf ../../rubygems/rubygems/lib/rubygems.rb ./lib $ cp -rf ../../rubygems/rubygems/test/rubygems ./test $ git checkout lib/rubygems/LICENSE.txt
  • 48. backport is hard rubygems still supports Ruby 1.8. % g show a34fb569e41cd87866e644d92a9df4be89b3cad2 test/rubygems/test_gem_package.rb commit a34fb569e41cd87866e644d92a9df4be89b3cad2 Author: Eric Hodel <drbrain@segment7.net> (snip) --- test/rubygems/test_gem_package.rb +++ test/rubygems/test_gem_package.rb @@ -638,7 +638,7 @@ class TestGemPackage < Gem::Package::TarTestCase e.message io end - tf.close! + tf.close! if tf.respond_to? :close! end def test_verify_empty
  • 50. RubySpec Q. What’s rubyspec? A. RubySpec is an executable specification for the Ruby programming language. “Matz's Ruby Developers Don't Use RubySpec and It's Hurting Ruby” http://rubini.us/2014/12/31/matz-s-ruby-developers-don-t-use-rubyspec/ “ruby/spec” is not a “specification”. It’s actually a set of “test”. The only real ruby specification is inside of Matz :)
  • 51. 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.
  • 52. 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
  • 53. rubyspec and mspec We approved new or updated examples at github.com/ruby/spec. @headius wrote: “So nice to see RubySpec getting a steady stream of Ruby 2.3 specs.” https://twitter.com/headius/status/667793518098673664 A lot of contributors submitted new specs for Ruby 2.3 and 2.4 features.
  • 54. test coverage % make update-coverage updating simplecov ... remote: Counting objects: 90, done. (snip) updating simplecov-html ... updating doclie … % COVERAGE=1 make test-all TESTS=webrick I added a coverage task using simplecov You can get coverage results for `webrick` under the coverage directory.
  • 56. 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 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 it.
  • 58. How request Ruby core 4.
  • 59. Feature request • We need to focus “Use case” than “function”. • We need to attach patch to feature request. • We need Matz approval.
  • 60. Acceptable requests without usecase • Symmetrical: `Array#shift`, `Array#unshift` • POSIX Socket.gethostbyname • [BUG] [SEGV]
  • 61. Bug report • We need minimum reproduction code • We need to describe expected/unexpected behavior • We need to attach crash log • We need to try different version of ruby
  • 62. Issue tracker Our official tracker is “bugs.ruby-lang.org” Mailing list integration •https://github.com/ruby/redmine_* •This behavior is same as github Continuous Upgrade Ruby and Rails to latest version.
  • 63. Redmine vs GitHub github.com/ruby/ruby is ok for ruby core team [CAUTION] If you hope to ask new feature to Matz, You need to submit bugs.ruby-lang.org . Matz is only available on redmine. Why Ruby does not use GitHub? • GitHub is proprietary service • ruby committers do not have problem with redmine • We start to consider issue of “Why Ruby does not use Git”
  • 64. Monthly Developer Meeting We hope to increase to transparency for Ruby development process. One of our challenges is “Developer Meeting”. It’s open discussion time for feature and issue of Ruby every months. [ruby-core:69550]: https://bugs.ruby-lang.org/projects/ruby/wiki/ DevelopersMeeting20150728Japan
  • 65. Gemification for stdlib • We extract old or un-maintain status stdlibs like net-telnet, xmlrpc, tk to bundled gems. • These are extracted under the https://github.com/ruby/ . And shipped on rubygems.org • Date, CGI, Readline are also extracted at the future(It’s my ideas). • OpenSSL is also extracted default gems. You can update it separated ruby core releases same as rubygems, rdoc, bigdecimal
  • 66. How develop Ruby core 5.
  • 68. What’s Ruby CI Ruby CI is a CI results collector for alternative platforms • http://rubyci.org • https://github.com/nurse/rubyci • https://github.com/ruby/chkbuild Ruby CI goal is entirely supports all of Ruby platform. We can detect a lot of build fails using Ruby CI. It has 2 or 3 versions every linux distribution and BSD, Windows, OS X, Solaris Environments.
  • 70. How to add a new server You can add your server to rubyci.org Requirements: • not yet supported platforms. • ex. linux with ARM, *BSD, icc with OSX, Windows • periodically running every day • It must be possible to access to AWS S3 You should check the following commands on your server $ git clone https://github.com/akr/chkbuild $ cd chkbuild $ ruby start-build
  • 71. Version number and release cycle We plan to release every christmas. • 2.1.0: 2013/12/25 • 2.2.0: 2014/12/25 • 2.3.0: 2015/12/25 • 2.4.0: 2016/12/25(TBD)
  • 72. Ruby core backport model trunk ruby_2_1 ruby_2_0_0 trunk ruby_2_1 ruby_2_0_0 We backport fixes to stable branch from trunk. We do not merge fixes to trunk from stable branch
  • 73. Release management We will release new version of Ruby at “Release Day” by @narse There is no exception to this rule. • If we have incompletion issue or feature, we will revert it. • If we don’t have enough discussion for some issue, we don’t merge or implement it into new version of ruby. • If we found some regression, we need to fix it or revert to related code or issue.
  • 74. Security release We have “security@ruby-lang.org” for security report. We received buffer overflow, memory leak, escape string etc etc… We hard to fix and release these security issue. so all of release maintainer are volunteer work. Our release delayed by preparing new releases of stable and old stable version.
  • 75. HackerOne We’ve been use https://hackerone.com/ruby It has bounty program provided by IBB. We accepts to security report via hackerone too.
  • 78. CRuby secrets •Who develop CRuby •Where is official resource of CRuby •How to develop CRuby •What is important of feature request in CRuby •When release new version of CRuby and…
  • 80. “Ruby is designed to make programmers happy.”