[前][次][番号順一覧][スレッド一覧]

ruby-changes:28306

From: nobu <ko1@a...>
Date: Fri, 19 Apr 2013 00:29:42 +0900 (JST)
Subject: [ruby-changes:28306] nobu:r40358 (trunk): test_rinda.rb: use spawn

nobu	2013-04-19 00:29:32 +0900 (Fri, 19 Apr 2013)

  New Revision: 40358

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40358

  Log:
    test_rinda.rb: use spawn
    
    * test/rinda/test_rinda.rb (TupleSpaceProxyTest#test_take_bug_8215):
      use more portable spawn instead of fork.

  Modified files:
    trunk/test/rinda/test_rinda.rb

Index: test/rinda/test_rinda.rb
===================================================================
--- test/rinda/test_rinda.rb	(revision 40357)
+++ test/rinda/test_rinda.rb	(revision 40358)
@@ -479,12 +479,15 @@ class TupleSpaceProxyTest < Test::Unit:: https://github.com/ruby/ruby/blob/trunk/test/rinda/test_rinda.rb#L479
   end
 
   def test_take_bug_8215
-    skip 'missing fork' unless have_fork?
+    require_relative '../ruby/envutil'
     service = DRb.start_service(nil, @ts_base)
 
     uri = service.uri
 
-    take = fork do
+    args = [EnvUtil.rubybin, *%W[-rdrb/drb -rdrb/eq -rrinda/ring -rrinda/tuplespace -e]]
+
+    take = spawn(*args, <<-'end;', uri)
+      uri = ARGV[0]
       DRb.start_service
       ro = DRbObject.new_with_uri(uri)
       ts = Rinda::TupleSpaceProxy.new(ro)
@@ -495,16 +498,17 @@ class TupleSpaceProxyTest < Test::Unit:: https://github.com/ruby/ruby/blob/trunk/test/rinda/test_rinda.rb#L498
       th.raise(Interrupt) # causes loss of the taken tuple
       ts.write([:barrier, :continue])
       Kernel.sleep
-    end
+    end;
 
     @ts_base.take([:barrier, :continue])
 
-    write = fork do
+    write = spawn(*args, <<-'end;', uri)
+      uri = ARGV[0]
       DRb.start_service
       ro = DRbObject.new_with_uri(uri)
       ts = Rinda::TupleSpaceProxy.new(ro)
       ts.write([:test_take, 42])
-    end
+    end;
 
     status = Process.wait(write)
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]