From cd5f49d0942e19a5854a325941918fca02fdb409 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Tue, 3 Oct 2017 17:28:49 -0700 Subject: Fix ruby segment fault (#3708) * Fix ruby segment fault 1) rb_ary_new cannot be called during allocate function. During allocate fucntion, the containing object hasn't been marked and rb_ary_new may invoke gc to collect containing object. 2) The global map should be marked before allocating it. Otherwise it may be garbage collected. * Add test * Remove commented code * Fix grammer error --- ruby/Rakefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ruby/Rakefile') diff --git a/ruby/Rakefile b/ruby/Rakefile index a329a777..e30a75a3 100644 --- a/ruby/Rakefile +++ b/ruby/Rakefile @@ -99,7 +99,13 @@ Gem::PackageTask.new(spec) do |pkg| end Rake::TestTask.new(:test => :build) do |t| - t.test_files = FileList["tests/*.rb"] + t.test_files = FileList["tests/*.rb"].exclude("tests/gc_test.rb") +end + +# gc_test needs to be split out to ensure the generated file hasn't been +# imported by other tests. +Rake::TestTask.new(:gc_test => :build) do |t| + t.test_files = FileList["tests/gc_test.rb"] end task :build => [:clean, :compile, :genproto] -- cgit v1.2.3