* re.c (unescape_nonascii): make regexp fixed_encoding if \p is used.
[ruby-svn.git] / rubytest.rb
blob6c3939a0ac38b9eb1c06827ba060133ef7896605
1 #! ./miniruby
3 exit if defined?(CROSS_COMPILING)
4 load './rbconfig.rb'
5 include RbConfig
7 ruby = "./#{CONFIG['ruby_install_name']}#{CONFIG['EXEEXT']}"
8 unless File.exist? ruby
9   print "#{ruby} is not found.\n"
10   print "Try `make' first, then `make test', please.\n"
11   exit false
12 end
14 if File.exist? CONFIG['LIBRUBY_SO']
15   case RUBY_PLATFORM
16   when /-hpux/
17     dldpath = "SHLIB_PATH"
18   when /-aix/
19     dldpath = "LIBPATH"
20   when /-beos/
21     dldpath = "LIBRARY_PATH"
22   when /-darwin/
23     dldpath = "DYLD_LIBRARY_PATH"
24   else
25     dldpath = "LD_LIBRARY_PATH"
26   end
27   x = ENV[dldpath]
28   x = x ? ".:"+x : "."
29   ENV[dldpath] = x
30 end
32 if /linux/ =~ RUBY_PLATFORM and File.exist? CONFIG['LIBRUBY_SO']
33   ENV["LD_PRELOAD"] = "./#{CONFIG['LIBRUBY_SO']}"
34 end
36 $stderr.reopen($stdout)
37 error = ''
39 srcdir = File.dirname(__FILE__)
40 `#{ruby} -I.ext/#{RUBY_PLATFORM} -I#{srcdir}/lib #{srcdir}/sample/test.rb`.each_line do |line|
41   if line =~ /^end of test/
42     print "\ntest succeeded\n"
43     exit true
44   end
45   error << line if %r:^(sample/test.rb|not): =~ line
46 end
47 print error
48 print "test failed\n"
49 exit false