summaryrefslogtreecommitdiff
path: root/rubytest.rb
diff options
context:
space:
mode:
Diffstat (limited to 'rubytest.rb')
-rw-r--r--rubytest.rb23
1 files changed, 19 insertions, 4 deletions
diff --git a/rubytest.rb b/rubytest.rb
index 3bf11b3ba5..32b2844a9f 100644
--- a/rubytest.rb
+++ b/rubytest.rb
@@ -1,12 +1,27 @@
#! ./miniruby -I.
-x = ENV["LD_LIBRARY_PATH"]
-x = x ? x+":." : "."
-ENV["LD_LIBRARY_PATH"] = x
-
require 'rbconfig'
include Config
+if File.exist? CONFIG['LIBRUBY_SO']
+ case RUBY_PLATFORM
+ when /-hpux/
+ dldpath = "SHLIB_PATH"
+ when /-aix/
+ dldpath = "LIBPATH"
+ else
+ dldpath = "LD_LIBRARY_PATH"
+ end
+ x = ENV[dldpath]
+ x = x ? ".:"+x : "."
+ ENV[dldpath] = x
+end
+
+if File.exist? CONFIG['LIBRUBY_SO']
+ ENV["LD_PRELOAD"] ||= ""
+ ENV["LD_PRELOAD"] += " ./#{CONFIG['LIBRUBY_SO']}"
+end
+
$stderr.reopen($stdout)
error = ''
`./#{CONFIG["ruby_install_name"]} #{CONFIG["srcdir"]}/sample/test.rb`.each do |line|