From fa7a5d5477dd8015b9bc0be9dc7ef2bf583e46d8 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 8 Apr 2004 10:45:21 +0000 Subject: * ext/extmk.rb (extmake): skip uncompiled extensions. * lib/mkmf.rb (create_makefile): emit no rules for static library if $static is nil, e.g., outside of ext/. * lib/test/unit/ui/console/testrunner.rb (test_started): show test name via $0. * runruby.rb: set environments to use the compiled binary. * test/runner.rb: do nothing while cross-compiling. * test/drb/drbtest.rb, test/soap/calc/test_calc_cgi.rb: use envutil to know ruby binary. * test/ruby/envutil.rb: give priority to RUBY environment variable to use just compiled binary and libraries. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 20 ++++++++++++++++++++ ext/extmk.rb | 2 ++ lib/mkmf.rb | 12 +++++++----- lib/test/unit/ui/console/testrunner.rb | 1 + runruby.rb | 2 ++ test/drb/drbtest.rb | 8 +++----- test/ruby/envutil.rb | 1 + test/runner.rb | 1 + test/soap/calc/test_calc_cgi.rb | 9 +++------ 9 files changed, 40 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 026fd56531..828067bff1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +Thu Apr 8 19:45:08 2004 Nobuyoshi Nakada + + * ext/extmk.rb (extmake): skip uncompiled extensions. + + * lib/mkmf.rb (create_makefile): emit no rules for static library if + $static is nil, e.g., outside of ext/. + + * lib/test/unit/ui/console/testrunner.rb (test_started): show test + name via $0. + + * runruby.rb: set environments to use the compiled binary. + + * test/runner.rb: do nothing while cross-compiling. + + * test/drb/drbtest.rb, test/soap/calc/test_calc_cgi.rb: use envutil to + know ruby binary. + + * test/ruby/envutil.rb: give priority to RUBY environment variable to + use just compiled binary and libraries. + Thu Apr 8 19:03:33 2004 Nobuyoshi Nakada * io.c (rb_io_binmode): inverted condition. [ruby-dev:23349] diff --git a/ext/extmk.rb b/ext/extmk.rb index f6f5224652..84c378fcc7 100644 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -103,6 +103,8 @@ def extmake(target) else if $static m = File.read(makefile) + $target = m[/^TARGET[ \s]*=[ \s]*(\S*)/, 1] or $static = nil + /^STATIC_LIB[ \t]*=[ \t]*\S+/ =~ m or $static = nil $preload = Shellwords.shellwords(m[/^preload[ \t]*=[ \t]*(.*)/, 1] || "") $DLDFLAGS += " " + (m[/^DLDFLAGS[ \t]*=[ \t]*(.*)/, 1] || "") if s = m[/^LIBS[ \t]*=[ \t]*(.*)/, 1] diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 8dbd064930..307c5b314f 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -884,7 +884,7 @@ LIBS = #{$LIBRUBYARG} #{$libs} #{$LIBS} OBJS = #{$objs} TARGET = #{target} DLLIB = #{dllib} -STATIC_LIB = #{staticlib} +STATIC_LIB = #{staticlib unless $static.nil?} } if $extout mfile.print %{ @@ -976,10 +976,12 @@ site-install-rb: install-rb mfile.print "@-$(RM) $@\n\t" mfile.print "@-$(MAKEDIRS) $(@D)\n\t" mfile.print LINK_SO, "\n\n" - mfile.print "$(STATIC_LIB): $(OBJS)\n\t" - mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS)" - if ranlib = config_string('RANLIB') - mfile.print "\n\t@-#{ranlib} $(DLLIB) 2> /dev/null || true" + unless $static.nil? + mfile.print "$(STATIC_LIB): $(OBJS)\n\t" + mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS)" + config_string('RANLIB') do |ranlib| + mfile.print "\n\t@-#{ranlib} $(DLLIB) 2> /dev/null || true" + end end mfile.print "\n\n" if makedef diff --git a/lib/test/unit/ui/console/testrunner.rb b/lib/test/unit/ui/console/testrunner.rb index f20ae9775b..5f38776403 100644 --- a/lib/test/unit/ui/console/testrunner.rb +++ b/lib/test/unit/ui/console/testrunner.rb @@ -90,6 +90,7 @@ module Test end def test_started(name) + $0 = $0.sub(/(?:\0.*)?\z/) {"\0"+name} output_single(name + ": ", VERBOSE) end diff --git a/runruby.rb b/runruby.rb index 4eaa133224..ca831410f0 100755 --- a/runruby.rb +++ b/runruby.rb @@ -36,6 +36,8 @@ if extout libs << abs_extout << File.expand_path(RUBY_PLATFORM, abs_extout) end config["bindir"] = abs_archdir +ENV["RUBY"] = File.expand_path(ruby) +ENV["PATH"] = [abs_archdir, ENV["PATH"]].compact.join(File::PATH_SEPARATOR) if e = ENV["RUBYLIB"] libs |= e.split(File::PATH_SEPARATOR) diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb index c95b900235..dad26759c0 100644 --- a/test/drb/drbtest.rb +++ b/test/drb/drbtest.rb @@ -2,14 +2,12 @@ require 'test/unit' require 'drb/drb' require 'drb/extservm' require 'timeout' -require 'rbconfig' +$:.replace($: | [File.expand_path("../ruby", File.dirname(__FILE__))]) +require 'envutil' 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.manager diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb index 4bae3d9e3b..38dba96c93 100644 --- a/test/ruby/envutil.rb +++ b/test/ruby/envutil.rb @@ -9,6 +9,7 @@ module EnvUtil end begin require "rbconfig" + ENV["RUBY"] or File.join( Config::CONFIG["bindir"], Config::CONFIG["ruby_install_name"] + Config::CONFIG["EXEEXT"] diff --git a/test/runner.rb b/test/runner.rb index 4ecc35aecc..d491b053a8 100644 --- a/test/runner.rb +++ b/test/runner.rb @@ -1,3 +1,4 @@ +exit if defined?(CROSS_COMPILING) require 'test/unit' rcsid = %w$Id$ diff --git a/test/soap/calc/test_calc_cgi.rb b/test/soap/calc/test_calc_cgi.rb index d1655b0b01..6b26329460 100644 --- a/test/soap/calc/test_calc_cgi.rb +++ b/test/soap/calc/test_calc_cgi.rb @@ -2,7 +2,8 @@ require 'test/unit' require 'soap/rpc/driver' require 'logger' require 'webrick' -require 'rbconfig' +$:.replace($: | [File.expand_path("../ruby", File.dirname(__FILE__))]) +require 'envutil' module SOAP @@ -10,11 +11,7 @@ module Calc class TestCalcCGI < Test::Unit::TestCase - # This test shuld be run after installing ruby. - RUBYBIN = File.join( - Config::CONFIG["bindir"], - Config::CONFIG["ruby_install_name"] + Config::CONFIG["EXEEXT"] - ) + RUBYBIN = EnvUtil.rubybin RUBYBIN << " -d" if $DEBUG Port = 17171 -- cgit v1.2.3