summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-02 02:45:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-02 02:45:35 +0000
commitc31e7c1e8b2895ef33204938487597e2b3acaaf7 (patch)
treeab07a9cd77938e5928733bb4e8b30659105c87bf /test
parent2cb7a6c0569cf2f1da791f21f6af4ff9bfcb97ac (diff)
merge revision(s) 25230,34866:
* marshal.c (struct {dump,load}_arg): manage with dfree, instead of using local variable which may be moved by context switch. [ruby-dev:39425] * marshal.c (mark_dump_arg): mark destination string. patch by Vit Ondruch. [Bug #4339] * marshal.c (clear_dump_arg, clear_load_arg): clean up also data tables as same as symbols tables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@34867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_marshal.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb
index 5ae521e4f6..d40c9da4d4 100644
--- a/test/ruby/test_marshal.rb
+++ b/test/ruby/test_marshal.rb
@@ -72,6 +72,34 @@ class TestMarshal < Test::Unit::TestCase
assert_equal("marshal data too short", e.message)
end
+ class DumpTest
+ def marshal_dump
+ loop { Thread.pass }
+ end
+ end
+
+ class LoadTest
+ def marshal_dump
+ nil
+ end
+ def marshal_load(obj)
+ loop { Thread.pass }
+ end
+ end
+
+ def test_context_switch
+ o = DumpTest.new
+ Thread.new { Marshal.dump(o) }
+ GC.start
+ assert(true, '[ruby-dev:39425]')
+
+ o = LoadTest.new
+ m = Marshal.dump(o)
+ Thread.new { Marshal.load(m) }
+ GC.start
+ assert(true, '[ruby-dev:39425]')
+ end
+
def test_taint
x = Object.new
x.taint