2000-08-03 09:50:41 +00:00
|
|
|
#! ./miniruby
|
1999-01-20 04:59:39 +00:00
|
|
|
|
2012-12-11 18:09:10 +00:00
|
|
|
exit if defined?(CROSS_COMPILING) and CROSS_COMPILING
|
2009-01-09 03:29:10 +00:00
|
|
|
ruby = ENV["RUBY"]
|
|
|
|
unless ruby
|
|
|
|
load './rbconfig.rb'
|
|
|
|
ruby = "./#{RbConfig::CONFIG['ruby_install_name']}#{RbConfig::CONFIG['EXEEXT']}"
|
|
|
|
end
|
2004-04-15 10:57:16 +00:00
|
|
|
unless File.exist? ruby
|
|
|
|
print "#{ruby} is not found.\n"
|
2000-06-12 07:48:31 +00:00
|
|
|
print "Try `make' first, then `make test', please.\n"
|
2004-04-15 10:57:16 +00:00
|
|
|
exit false
|
2000-06-12 07:48:31 +00:00
|
|
|
end
|
2013-09-20 14:24:10 +00:00
|
|
|
ARGV[0] and opt = ARGV[0][/\A--run-opt=(.*)/, 1] and ARGV.shift
|
2000-06-12 07:48:31 +00:00
|
|
|
|
1998-01-16 12:19:09 +00:00
|
|
|
$stderr.reopen($stdout)
|
|
|
|
error = ''
|
2000-06-12 07:48:31 +00:00
|
|
|
|
2009-05-22 11:48:42 +00:00
|
|
|
srcdir = File.expand_path('..', File.dirname(__FILE__))
|
2016-10-19 05:22:51 +00:00
|
|
|
if env = ENV["RUBYOPT"]
|
|
|
|
ENV["RUBYOPT"] = env + " -W1"
|
2016-08-07 10:34:11 +00:00
|
|
|
end
|
2016-04-12 03:49:03 +00:00
|
|
|
`#{ruby} #{opt} -W1 #{srcdir}/basictest/test.rb #{ARGV.join(' ')}`.each_line do |line|
|
1998-01-16 12:19:09 +00:00
|
|
|
if line =~ /^end of test/
|
2007-07-06 09:23:53 +00:00
|
|
|
print "\ntest succeeded\n"
|
2004-04-15 10:57:16 +00:00
|
|
|
exit true
|
1998-01-16 12:19:09 +00:00
|
|
|
end
|
2016-01-16 01:37:47 +00:00
|
|
|
error << line if %r:^(basictest/test.rb|not): =~ line
|
1998-01-16 12:19:09 +00:00
|
|
|
end
|
2012-02-20 15:59:15 +00:00
|
|
|
puts
|
1998-01-16 12:19:09 +00:00
|
|
|
print error
|
|
|
|
print "test failed\n"
|
2004-04-15 10:57:16 +00:00
|
|
|
exit false
|