* test/ruby/envutil.rb (EnvUtil#invoke_ruby): integrated with
runexec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6957c6d9cf
commit
57ba9de9e0
102
ChangeLog
102
ChangeLog
@ -1,103 +1,7 @@
|
|||||||
Thu Jul 1 16:19:53 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
Thu Jul 1 21:37:11 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* thread_pthread.c (thread_start_func_1): don't call
|
* test/ruby/envutil.rb (EnvUtil#invoke_ruby): integrated with
|
||||||
native_thread_init_stack(th) on cygwin to avoid the segv
|
runexec.
|
||||||
introduced by r27789. Cygwin's signal implementation is half
|
|
||||||
baked so USE_SIGNALSTACK is not defined and it needs another
|
|
||||||
treatment.
|
|
||||||
|
|
||||||
Thu Jul 1 13:00:54 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
||||||
|
|
||||||
* common.mk (test-knownbug): ignore known bugs.
|
|
||||||
|
|
||||||
Thu Jul 1 08:40:26 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
||||||
|
|
||||||
* marshal.c (w_object): suppress empty instance variable entry on
|
|
||||||
compatible dump objects.
|
|
||||||
|
|
||||||
Wed Jun 30 07:29:11 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
||||||
|
|
||||||
* test/ruby/test_rubyoptions.rb (test_script_from_stdin): by using
|
|
||||||
a pipe, get rid of not-well-defined behavior after the child
|
|
||||||
process terminated in pty.
|
|
||||||
|
|
||||||
Wed Jun 30 02:30:26 2010 Yutaka Kanemoto <kanemoto@ruby-lang.org>
|
|
||||||
|
|
||||||
* thread_pthread.c (get_stack): use pthread_getthrds_np() for AIX.
|
|
||||||
|
|
||||||
* configure.in: ditto.
|
|
||||||
|
|
||||||
Tue Jun 29 21:11:15 2010 Masaya Tarui <tarui@ruby-lnag.org>
|
|
||||||
|
|
||||||
* ext/stringio/stringio.c (strio_write): add RB_GC_GUARD.
|
|
||||||
|
|
||||||
Tue Jun 29 19:39:59 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
|
|
||||||
|
|
||||||
* test/win32ole/test_win32ole_method.rb (is_ruby64): check
|
|
||||||
ruby binary is mswin64 or mingw64. [ruby-dev:41756]
|
|
||||||
|
|
||||||
Tue Jun 29 14:18:21 2010 NAKAMURA Usaku <usa@ruby-lang.org>
|
|
||||||
|
|
||||||
* file.c (rb_realpath_internal, realpath_rec): skip UNC share root
|
|
||||||
on DOSISH platforms.
|
|
||||||
http://pc12.2ch.net/test/read.cgi/tech/1272248179/600
|
|
||||||
|
|
||||||
Tue Jun 29 11:52:33 2010 Narihiro Nakamura <authorNari@gmail.com>
|
|
||||||
|
|
||||||
* gc.c (unlink_heap_slot, slot_sweep): unlink heaps_slot of
|
|
||||||
heaps_slot linked list if heaps_slot is empty at slot_sweep.
|
|
||||||
fixed [ruby-dev:41543], [ruby-core:24894].
|
|
||||||
|
|
||||||
Tue Jun 29 01:22:08 2010 Aaron Patterson <aaron@tenderlovemaking.com>
|
|
||||||
|
|
||||||
* ext/fiddle/fiddle.h: added FFI type detection to avoid bug in ffi
|
|
||||||
header files. Thanks Yugui! [ruby-core:30917]
|
|
||||||
|
|
||||||
Mon Jun 28 22:14:22 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
|
||||||
|
|
||||||
* test/rdoc/test_rdoc_ri_driver.rb (TestRDocRIDriver#test_formatter):
|
|
||||||
fix a test accordingly to r28455.
|
|
||||||
|
|
||||||
Mon Jun 28 21:56:14 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
|
||||||
|
|
||||||
* thread.c (rb_fd_resize, rb_fd_copy): avoid NULL dereference upon
|
|
||||||
failed realloc by using xrealloc instead of not realloc. a patch
|
|
||||||
from Jim Meyering <meyering at redhat.com> in [ruby-core:30920]
|
|
||||||
[Bug #3489]
|
|
||||||
|
|
||||||
Mon Jun 28 20:32:33 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
|
|
||||||
|
|
||||||
* test/win32ole/test_win32ole_method.rb (test_offset_vtbl): check
|
|
||||||
that Ruby is 32bit or 64bit binary in order to get correct offset
|
|
||||||
value. [ruby-dev:41741]
|
|
||||||
|
|
||||||
Mon Jun 28 05:32:51 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
|
||||||
|
|
||||||
* lib/rdoc/ri/driver.rb (RDoc::RI::Driver#formatter): should use bs
|
|
||||||
format when stdout is piped. [ruby-core:30734]
|
|
||||||
|
|
||||||
Mon Jun 28 03:12:03 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
|
||||||
|
|
||||||
* bootstraptest/test_class.rb: add a test for [ruby-core:30843].
|
|
||||||
|
|
||||||
Mon Jun 28 02:43:35 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
|
||||||
|
|
||||||
* class.c (rb_mod_init_copy): when class is dup'ed, a metaclass of the
|
|
||||||
class should be attached to the dup'ed class, not the original
|
|
||||||
class. [ruby-core:30843] [Bug #3461]
|
|
||||||
|
|
||||||
Sun Jun 27 23:31:17 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
||||||
|
|
||||||
* include/ruby/io.h, io.c: reverted r21709.
|
|
||||||
|
|
||||||
* ruby.c (load_file_internal): nothing to read if EOF reached
|
|
||||||
while reading shebang. [ruby-core:30910]
|
|
||||||
|
|
||||||
Sun Jun 27 13:25:07 2010 Tanaka Akira <akr@fsij.org>
|
|
||||||
|
|
||||||
* io.c (simple_sendfile): don't try to send data more than SSIZE_MAX
|
|
||||||
with single sendfile call..
|
|
||||||
based on the patch by Eric Wong. [ruby-core:30908]
|
|
||||||
|
|
||||||
Sun Jun 27 10:41:38 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Jun 27 10:41:38 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
@ -30,69 +30,38 @@ module EnvUtil
|
|||||||
|
|
||||||
LANG_ENVS = %w"LANG LC_ALL LC_CTYPE"
|
LANG_ENVS = %w"LANG LC_ALL LC_CTYPE"
|
||||||
|
|
||||||
def rubyexec(*args)
|
|
||||||
ruby = EnvUtil.rubybin
|
|
||||||
c = "C"
|
|
||||||
env = {}
|
|
||||||
LANG_ENVS.each {|lc| env[lc], ENV[lc] = ENV[lc], c}
|
|
||||||
stdin = stdout = stderr = nil
|
|
||||||
Timeout.timeout(10) do
|
|
||||||
stdin, stdout, stderr = Open3.popen3(*([ruby] + args))
|
|
||||||
env.each_pair {|lc, v|
|
|
||||||
if v
|
|
||||||
ENV[lc] = v
|
|
||||||
else
|
|
||||||
ENV.delete(lc)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
env = nil
|
|
||||||
yield(stdin, stdout, stderr)
|
|
||||||
end
|
|
||||||
|
|
||||||
ensure
|
|
||||||
env.each_pair {|lc, v|
|
|
||||||
if v
|
|
||||||
ENV[lc] = v
|
|
||||||
else
|
|
||||||
ENV.delete(lc)
|
|
||||||
end
|
|
||||||
} if env
|
|
||||||
stdin .close unless !stdin || stdin .closed?
|
|
||||||
stdout.close unless !stdout || stdout.closed?
|
|
||||||
stderr.close unless !stderr || stderr.closed?
|
|
||||||
end
|
|
||||||
module_function :rubyexec
|
|
||||||
|
|
||||||
def invoke_ruby(args, stdin_data="", capture_stdout=false, capture_stderr=false, opt={})
|
def invoke_ruby(args, stdin_data="", capture_stdout=false, capture_stderr=false, opt={})
|
||||||
|
in_c, in_p = IO.pipe
|
||||||
|
out_p, out_c = IO.pipe if capture_stdout
|
||||||
|
err_p, err_c = IO.pipe if capture_stderr
|
||||||
|
opt = opt.dup
|
||||||
|
opt[:in] = in_c
|
||||||
|
opt[:out] = out_c if capture_stdout
|
||||||
|
opt[:err] = err_c if capture_stderr
|
||||||
|
if enc = opt.delete(:encoding)
|
||||||
|
out_p.set_encoding(enc) if out_p
|
||||||
|
err_p.set_encoding(enc) if err_p
|
||||||
|
end
|
||||||
|
c = "C"
|
||||||
|
child_env = {}
|
||||||
|
LANG_ENVS.each {|lc| child_env[lc] = c}
|
||||||
|
if Array === args and Hash === args.first
|
||||||
|
child_env.update(args.shift)
|
||||||
|
end
|
||||||
args = [args] if args.kind_of?(String)
|
args = [args] if args.kind_of?(String)
|
||||||
begin
|
pid = spawn(child_env, EnvUtil.rubybin, *args, opt)
|
||||||
in_c, in_p = IO.pipe
|
in_c.close
|
||||||
out_p, out_c = IO.pipe if capture_stdout
|
out_c.close if capture_stdout
|
||||||
err_p, err_c = IO.pipe if capture_stderr
|
err_c.close if capture_stderr
|
||||||
opt = opt.dup
|
if block_given?
|
||||||
opt[:in] = in_c
|
return yield in_p, out_p, err_p
|
||||||
opt[:out] = out_c if capture_stdout
|
else
|
||||||
opt[:err] = err_c if capture_stderr
|
|
||||||
if enc = opt.delete(:encoding)
|
|
||||||
out_p.set_encoding(enc) if out_p
|
|
||||||
err_p.set_encoding(enc) if err_p
|
|
||||||
end
|
|
||||||
c = "C"
|
|
||||||
child_env = {}
|
|
||||||
LANG_ENVS.each {|lc| child_env[lc] = c}
|
|
||||||
case args.first
|
|
||||||
when Hash
|
|
||||||
child_env.update(args.shift)
|
|
||||||
end
|
|
||||||
pid = spawn(child_env, EnvUtil.rubybin, *args, opt)
|
|
||||||
in_c.close
|
|
||||||
out_c.close if capture_stdout
|
|
||||||
err_c.close if capture_stderr
|
|
||||||
th_stdout = Thread.new { out_p.read } if capture_stdout
|
th_stdout = Thread.new { out_p.read } if capture_stdout
|
||||||
th_stderr = Thread.new { err_p.read } if capture_stderr
|
th_stderr = Thread.new { err_p.read } if capture_stderr
|
||||||
in_p.write stdin_data.to_str
|
in_p.write stdin_data.to_str
|
||||||
in_p.close
|
in_p.close
|
||||||
if (!capture_stdout || th_stdout.join(10)) && (!capture_stderr || th_stderr.join(10))
|
timeout = opt.fetch(:timeout, 10)
|
||||||
|
if (!capture_stdout || th_stdout.join(timeout)) && (!capture_stderr || th_stderr.join(timeout))
|
||||||
stdout = th_stdout.value if capture_stdout
|
stdout = th_stdout.value if capture_stdout
|
||||||
stderr = th_stderr.value if capture_stderr
|
stderr = th_stderr.value if capture_stderr
|
||||||
else
|
else
|
||||||
@ -102,20 +71,23 @@ module EnvUtil
|
|||||||
err_p.close if capture_stderr
|
err_p.close if capture_stderr
|
||||||
Process.wait pid
|
Process.wait pid
|
||||||
status = $?
|
status = $?
|
||||||
ensure
|
return stdout, stderr, status
|
||||||
in_c.close if in_c && !in_c.closed?
|
end
|
||||||
in_p.close if in_p && !in_p.closed?
|
ensure
|
||||||
out_c.close if out_c && !out_c.closed?
|
[in_c, in_p, out_c, out_p, err_c, err_p].each do |io|
|
||||||
out_p.close if out_p && !out_p.closed?
|
io.close if io && !io.closed?
|
||||||
err_c.close if err_c && !err_c.closed?
|
end
|
||||||
err_p.close if err_p && !err_p.closed?
|
[th_stdout, th_stderr].each do |th|
|
||||||
(th_stdout.kill; th_stdout.join) if th_stdout
|
(th.kill; th.join) if th
|
||||||
(th_stderr.kill; th_stderr.join) if th_stderr
|
|
||||||
end
|
end
|
||||||
return stdout, stderr, status
|
|
||||||
end
|
end
|
||||||
module_function :invoke_ruby
|
module_function :invoke_ruby
|
||||||
|
|
||||||
|
alias rubyexec invoke_ruby
|
||||||
|
class << self
|
||||||
|
alias rubyexec invoke_ruby
|
||||||
|
end
|
||||||
|
|
||||||
def verbose_warning
|
def verbose_warning
|
||||||
class << (stderr = "")
|
class << (stderr = "")
|
||||||
alias write <<
|
alias write <<
|
||||||
@ -141,20 +113,10 @@ module Test
|
|||||||
module Unit
|
module Unit
|
||||||
module Assertions
|
module Assertions
|
||||||
public
|
public
|
||||||
def assert_normal_exit(testsrc, message = '')
|
def assert_normal_exit(testsrc, message = '', opt = {})
|
||||||
in_c, in_p = IO.pipe
|
stdout, stderr, status = EnvUtil.invoke_ruby(%W'-W0', testsrc, true, true, opt)
|
||||||
out_p, out_c = IO.pipe
|
pid = status.pid
|
||||||
pid = spawn(EnvUtil.rubybin, '-W0', STDIN=>in_c, STDOUT=>out_c, STDERR=>out_c)
|
faildesc = proc do
|
||||||
in_c.close
|
|
||||||
out_c.close
|
|
||||||
in_p.write testsrc
|
|
||||||
in_p.close
|
|
||||||
msg = out_p.read
|
|
||||||
out_p.close
|
|
||||||
Process.wait pid
|
|
||||||
status = $?
|
|
||||||
faildesc = nil
|
|
||||||
if status.signaled?
|
|
||||||
signo = status.termsig
|
signo = status.termsig
|
||||||
signame = Signal.list.invert[signo]
|
signame = Signal.list.invert[signo]
|
||||||
sigdesc = "signal #{signo}"
|
sigdesc = "signal #{signo}"
|
||||||
@ -174,13 +136,9 @@ module Test
|
|||||||
msg << "\n" if /\n\z/ !~ msg
|
msg << "\n" if /\n\z/ !~ msg
|
||||||
full_message << "pid #{pid} killed by #{sigdesc}\n#{msg.gsub(/^/, '| ')}"
|
full_message << "pid #{pid} killed by #{sigdesc}\n#{msg.gsub(/^/, '| ')}"
|
||||||
end
|
end
|
||||||
|
full_message
|
||||||
end
|
end
|
||||||
assert_block(full_message) { !status.signaled? }
|
assert_block(faildesc) { !status.signaled? }
|
||||||
ensure
|
|
||||||
in_c.close if in_c && !in_c.closed?
|
|
||||||
in_p.close if in_p && !in_p.closed?
|
|
||||||
out_c.close if out_c && !out_c.closed?
|
|
||||||
out_p.close if out_p && !out_p.closed?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_in_out_err(args, test_stdin = "", test_stdout = [], test_stderr = [], message = nil, opt={})
|
def assert_in_out_err(args, test_stdin = "", test_stdout = [], test_stderr = [], message = nil, opt={})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user