2000-08-03 13:50:41 +04:00
|
|
|
#! ./miniruby
|
1999-01-20 07:59:39 +03:00
|
|
|
|
2004-04-15 14:57:16 +04:00
|
|
|
exit if defined?(CROSS_COMPILING)
|
2000-08-03 13:50:41 +04:00
|
|
|
load './rbconfig.rb'
|
* mkconfig.rb: generate RbConfig instead of Config.
* instruby.rb, rubytest.rb, runruby.rb, bcc32/Makefile.sub,
ext/extmk.rb, ext/dl/extconf.rb, ext/iconv/charset_alias.rb,
lib/mkmf.rb, lib/rdoc/ri/ri_paths.rb,
lib/webrick/httpservlet/cgihandler.rb,
test/dbm/test_dbm.rb, test/gdbm/test_gdbm.rb,
test/ruby/envutil.rb, test/soap/calc/test_calc_cgi.rb,
test/soap/header/test_authheader_cgi.rb, test/soap/ssl/test_ssl.rb,
win32/mkexports.rb, win32/resource.rb: Use RbConfig instead of
Config.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-20 11:34:53 +03:00
|
|
|
include RbConfig
|
1998-01-16 15:19:09 +03:00
|
|
|
|
2004-04-15 14:57:16 +04:00
|
|
|
ruby = "./#{CONFIG['ruby_install_name']}#{CONFIG['EXEEXT']}"
|
|
|
|
unless File.exist? ruby
|
|
|
|
print "#{ruby} is not found.\n"
|
2000-06-12 11:48:31 +04:00
|
|
|
print "Try `make' first, then `make test', please.\n"
|
2004-04-15 14:57:16 +04:00
|
|
|
exit false
|
2000-06-12 11:48:31 +04:00
|
|
|
end
|
|
|
|
|
1999-08-13 09:45:20 +04:00
|
|
|
if File.exist? CONFIG['LIBRUBY_SO']
|
|
|
|
case RUBY_PLATFORM
|
|
|
|
when /-hpux/
|
|
|
|
dldpath = "SHLIB_PATH"
|
|
|
|
when /-aix/
|
|
|
|
dldpath = "LIBPATH"
|
1999-10-13 10:44:42 +04:00
|
|
|
when /-beos/
|
|
|
|
dldpath = "LIBRARY_PATH"
|
2003-08-01 18:35:51 +04:00
|
|
|
when /-darwin/
|
|
|
|
dldpath = "DYLD_LIBRARY_PATH"
|
1999-08-13 09:45:20 +04:00
|
|
|
else
|
|
|
|
dldpath = "LD_LIBRARY_PATH"
|
|
|
|
end
|
|
|
|
x = ENV[dldpath]
|
|
|
|
x = x ? ".:"+x : "."
|
|
|
|
ENV[dldpath] = x
|
|
|
|
end
|
|
|
|
|
|
|
|
if /linux/ =~ RUBY_PLATFORM and File.exist? CONFIG['LIBRUBY_SO']
|
|
|
|
ENV["LD_PRELOAD"] = "./#{CONFIG['LIBRUBY_SO']}"
|
|
|
|
end
|
|
|
|
|
1998-01-16 15:19:09 +03:00
|
|
|
$stderr.reopen($stdout)
|
|
|
|
error = ''
|
2000-06-12 11:48:31 +04:00
|
|
|
|
2004-03-18 13:49:20 +03:00
|
|
|
srcdir = File.dirname(__FILE__)
|
2008-01-14 16:49:29 +03:00
|
|
|
`#{ruby} -I.ext/#{RUBY_PLATFORM} -I#{srcdir}/lib #{srcdir}/sample/test.rb`.each_line do |line|
|
1998-01-16 15:19:09 +03:00
|
|
|
if line =~ /^end of test/
|
2007-07-06 13:23:53 +04:00
|
|
|
print "\ntest succeeded\n"
|
2004-04-15 14:57:16 +04:00
|
|
|
exit true
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
2006-12-31 18:02:22 +03:00
|
|
|
error << line if %r:^(sample/test.rb|not): =~ line
|
1998-01-16 15:19:09 +03:00
|
|
|
end
|
|
|
|
print error
|
|
|
|
print "test failed\n"
|
2004-04-15 14:57:16 +04:00
|
|
|
exit false
|