summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-12 00:07:50 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-12 00:07:50 +0000
commit6311ee1166ad3920042f9f3f2718ce60e18e825d (patch)
tree98ebf4776e0d6134b0e7dd55e8e247ef1c25232e /test
parent353b5e9a5be04cb348edbf9acd312d87f05456c8 (diff)
* test/ruby/envutil.rb, test/drb/drbtest.rb: can test drb
before install. (backported from HEAD) [ruby-Bugs-1672] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/drb/drbtest.rb22
-rw-r--r--test/ruby/envutil.rb3
2 files changed, 16 insertions, 9 deletions
diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb
index 6c4cfe6..432c7a7 100644
--- a/test/drb/drbtest.rb
+++ b/test/drb/drbtest.rb
@@ -2,21 +2,25 @@ require 'test/unit'
require 'drb/drb'
require 'drb/extservm'
require 'timeout'
-require 'rbconfig'
-
-DRb::DRbServer.new(nil)
+begin
+ loadpath = $:.dup
+ $:.replace($: | [File.expand_path("../ruby", File.dirname(__FILE__))])
+ require 'envutil'
+ensure
+ $:.replace(loadpath)
+end
class DRbService
@@manager = DRb::ExtServManager.new
- @@ruby = File.join(
- Config::CONFIG["bindir"],
- Config::CONFIG["ruby_install_name"] + Config::CONFIG["EXEEXT"]
- )
+ @@ruby = EnvUtil.rubybin
@@ruby += " -d" if $DEBUG
- @@dir = File.dirname(File.expand_path(__FILE__))
+ def self.add_service_command(nm)
+ dir = File.dirname(File.expand_path(__FILE__))
+ DRb::ExtServManager.command[nm] = "#{@@ruby} #{dir}/#{nm}"
+ end
%w(ut_drb.rb ut_array.rb ut_port.rb ut_large.rb ut_safe1.rb ut_eval.rb).each do |nm|
- DRb::ExtServManager.command[nm] = "#{@@ruby} #{@@dir}/#{nm}"
+ add_service_command(nm)
end
@server = @@server = DRb::DRbServer.new(nil, @@manager, {})
@@manager.uri = @@server.uri
diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb
index 4bae3d9..09c8e3f 100644
--- a/test/ruby/envutil.rb
+++ b/test/ruby/envutil.rb
@@ -1,5 +1,8 @@
module EnvUtil
def rubybin
+ if ruby = ENV["RUBY"]
+ return ruby
+ end
miniruby = "miniruby"
3.times do
if File.exist? miniruby or File.exist? miniruby+".exe"