mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_rinda.rb: use spawn
* test/rinda/test_rinda.rb (TupleSpaceProxyTest#test_take_bug_8215): use more portable spawn instead of fork. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4987e84932
commit
df9e72b22e
1 changed files with 9 additions and 5 deletions
|
@ -479,12 +479,15 @@ class TupleSpaceProxyTest < Test::Unit::TestCase
|
|||
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::TestCase
|
|||
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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue