[前][次][番号順一覧][スレッド一覧]

ruby-changes:36329

From: akr <ko1@a...>
Date: Fri, 14 Nov 2014 01:06:28 +0900 (JST)
Subject: [ruby-changes:36329] akr:r48409 (trunk): * test/lib/envutil.rb: Moved from test/ruby/.

akr	2014-11-14 01:05:37 +0900 (Fri, 14 Nov 2014)

  New Revision: 48409

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48409

  Log:
    * test/lib/envutil.rb: Moved from test/ruby/.
    
    * test/lib/find_executable.rb: Ditto.
    
    * test/lib/memory_status.rb: Ditto.
    
    * test/lib/test/unit.rb: require envutil.
    
    * test/: Don't require envutil in test files.

  Added files:
    trunk/test/lib/envutil.rb
    trunk/test/lib/find_executable.rb
    trunk/test/lib/memory_status.rb
  Removed files:
    trunk/test/ruby/envutil.rb
    trunk/test/ruby/find_executable.rb
    trunk/test/ruby/memory_status.rb
  Modified files:
    trunk/ChangeLog
    trunk/test/-ext-/bug_reporter/test_bug_reporter.rb
    trunk/test/-ext-/exception/test_data_error.rb
    trunk/test/-ext-/exception/test_ensured.rb
    trunk/test/-ext-/marshal/test_usrmarshal.rb
    trunk/test/-ext-/string/test_modify_expand.rb
    trunk/test/-ext-/struct/test_member.rb
    trunk/test/-ext-/test_bug-3571.rb
    trunk/test/-ext-/test_recursion.rb
    trunk/test/-ext-/tracepoint/test_tracepoint.rb
    trunk/test/-ext-/win32/test_dln.rb
    trunk/test/-ext-/win32/test_fd_setsize.rb
    trunk/test/bigdecimal/test_bigdecimal.rb
    trunk/test/bigdecimal/test_bigmath.rb
    trunk/test/cgi/test_cgi_multipart.rb
    trunk/test/drb/drbtest.rb
    trunk/test/dtrace/helper.rb
    trunk/test/fiddle/helper.rb
    trunk/test/fiddle/test_function.rb
    trunk/test/fiddle/test_handle.rb
    trunk/test/fiddle/test_pointer.rb
    trunk/test/fileutils/test_fileutils.rb
    trunk/test/gdbm/test_gdbm.rb
    trunk/test/io/console/test_io_console.rb
    trunk/test/irb/test_completion.rb
    trunk/test/irb/test_option.rb
    trunk/test/irb/test_raise_no_backtrace_exception.rb
    trunk/test/json/test_json_generate.rb
    trunk/test/lib/test/unit.rb
    trunk/test/logger/test_logdevice.rb
    trunk/test/mkmf/test_config.rb
    trunk/test/net/http/test_http.rb
    trunk/test/objspace/test_objspace.rb
    trunk/test/openssl/test_x509store.rb
    trunk/test/openssl/utils.rb
    trunk/test/pathname/test_pathname.rb
    trunk/test/rake/helper.rb
    trunk/test/readline/test_readline.rb
    trunk/test/rinda/test_rinda.rb
    trunk/test/ripper/test_files.rb
    trunk/test/ripper/test_parser_events.rb
    trunk/test/ruby/test_alias.rb
    trunk/test/ruby/test_argf.rb
    trunk/test/ruby/test_array.rb
    trunk/test/ruby/test_autoload.rb
    trunk/test/ruby/test_beginendblock.rb
    trunk/test/ruby/test_case.rb
    trunk/test/ruby/test_class.rb
    trunk/test/ruby/test_comparable.rb
    trunk/test/ruby/test_const.rb
    trunk/test/ruby/test_continuation.rb
    trunk/test/ruby/test_defined.rb
    trunk/test/ruby/test_dir_m17n.rb
    trunk/test/ruby/test_econv.rb
    trunk/test/ruby/test_encoding.rb
    trunk/test/ruby/test_enumerator.rb
    trunk/test/ruby/test_env.rb
    trunk/test/ruby/test_eval.rb
    trunk/test/ruby/test_exception.rb
    trunk/test/ruby/test_fiber.rb
    trunk/test/ruby/test_file.rb
    trunk/test/ruby/test_file_exhaustive.rb
    trunk/test/ruby/test_flip.rb
    trunk/test/ruby/test_float.rb
    trunk/test/ruby/test_fnmatch.rb
    trunk/test/ruby/test_gc.rb
    trunk/test/ruby/test_hash.rb
    trunk/test/ruby/test_io.rb
    trunk/test/ruby/test_io_m17n.rb
    trunk/test/ruby/test_iseq.rb
    trunk/test/ruby/test_keyword.rb
    trunk/test/ruby/test_lazy_enumerator.rb
    trunk/test/ruby/test_literal.rb
    trunk/test/ruby/test_m17n.rb
    trunk/test/ruby/test_method.rb
    trunk/test/ruby/test_module.rb
    trunk/test/ruby/test_numeric.rb
    trunk/test/ruby/test_object.rb
    trunk/test/ruby/test_objectspace.rb
    trunk/test/ruby/test_proc.rb
    trunk/test/ruby/test_process.rb
    trunk/test/ruby/test_rand.rb
    trunk/test/ruby/test_range.rb
    trunk/test/ruby/test_refinement.rb
    trunk/test/ruby/test_regexp.rb
    trunk/test/ruby/test_require.rb
    trunk/test/ruby/test_rubyoptions.rb
    trunk/test/ruby/test_settracefunc.rb
    trunk/test/ruby/test_signal.rb
    trunk/test/ruby/test_string.rb
    trunk/test/ruby/test_struct.rb
    trunk/test/ruby/test_super.rb
    trunk/test/ruby/test_syntax.rb
    trunk/test/ruby/test_system.rb
    trunk/test/ruby/test_thread.rb
    trunk/test/ruby/test_threadgroup.rb
    trunk/test/ruby/test_time.rb
    trunk/test/ruby/test_transcode.rb
    trunk/test/ruby/test_unicode_escape.rb
    trunk/test/ruby/test_variable.rb
    trunk/test/ruby/test_weakmap.rb
    trunk/test/ruby/test_whileuntil.rb
    trunk/test/runner.rb
    trunk/test/sdbm/test_sdbm.rb
    trunk/test/shell/test_command_processor.rb
    trunk/test/test_mathn.rb
    trunk/test/test_open3.rb
    trunk/test/test_pstore.rb
    trunk/test/test_pty.rb
    trunk/test/test_tempfile.rb
    trunk/test/test_time.rb
    trunk/test/test_tracer.rb
    trunk/test/test_weakref.rb
    trunk/test/testunit/test_rake_integration.rb
    trunk/test/thread/test_cv.rb
    trunk/test/thread/test_queue.rb
    trunk/test/uri/test_common.rb
    trunk/test/webrick/utils.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48408)
+++ ChangeLog	(revision 48409)
@@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Nov 14 01:03:17 2014  Tanaka Akira  <akr@f...>
+
+	* test/lib/envutil.rb: Moved from test/ruby/.
+
+	* test/lib/find_executable.rb: Ditto.
+
+	* test/lib/memory_status.rb: Ditto.
+
+	* test/lib/test/unit.rb: require envutil.
+
+	* test/: Don't require envutil in test files.
+
 Thu Nov 13 21:59:58 2014  CHIKANAGA Tomoyuki  <nagachika@r...>
 
 	* lib/rexml/document.rb: add REXML::Document#document.
Index: test/logger/test_logdevice.rb
===================================================================
--- test/logger/test_logdevice.rb	(revision 48408)
+++ test/logger/test_logdevice.rb	(revision 48409)
@@ -3,7 +3,6 @@ require 'test/unit' https://github.com/ruby/ruby/blob/trunk/test/logger/test_logdevice.rb#L3
 require 'logger'
 require 'tempfile'
 require 'tmpdir'
-require_relative '../ruby/envutil'
 
 class TestLogDevice < Test::Unit::TestCase
   class LogExcnRaiser
Index: test/test_tracer.rb
===================================================================
--- test/test_tracer.rb	(revision 48408)
+++ test/test_tracer.rb	(revision 48409)
@@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/test_tracer.rb#L1
 require 'test/unit'
 require 'tmpdir'
-require_relative 'ruby/envutil'
 
 class TestTracer < Test::Unit::TestCase
   include EnvUtil
Index: test/ruby/find_executable.rb
===================================================================
--- test/ruby/find_executable.rb	(revision 48408)
+++ test/ruby/find_executable.rb	(revision 48409)
@@ -1,21 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/find_executable.rb#L0
-require "rbconfig"
-
-module EnvUtil
-  def find_executable(cmd, *args)
-    exts = RbConfig::CONFIG["EXECUTABLE_EXTS"].split | [RbConfig::CONFIG["EXEEXT"]]
-    ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
-      next if path.empty?
-      path = File.join(path, cmd)
-      exts.each do |ext|
-        cmdline = [path + ext, *args]
-        begin
-          return cmdline if yield(IO.popen(cmdline, "r", err: [:child, :out], &:read))
-        rescue
-          next
-        end
-      end
-    end
-    nil
-  end
-  module_function :find_executable
-end
Index: test/ruby/memory_status.rb
===================================================================
--- test/ruby/memory_status.rb	(revision 48408)
+++ test/ruby/memory_status.rb	(revision 48409)
@@ -1,111 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/memory_status.rb#L0
-module Memory
-  keys = []
-  vals = []
-
-  case
-  when File.exist?(procfile = "/proc/self/status") && (pat = /^Vm(\w+):\s+(\d+)/) =~ File.binread(procfile)
-    PROC_FILE = procfile
-    VM_PAT = pat
-    def self.read_status
-      IO.foreach(PROC_FILE, encoding: Encoding::ASCII_8BIT) do |l|
-        yield($1.downcase.intern, $2.to_i * 1024) if VM_PAT =~ l
-      end
-    end
-
-    read_status {|k, v| keys << k; vals << v}
-
-  when /mswin|mingw/ =~ RUBY_PLATFORM
-    require 'fiddle/import'
-    require 'fiddle/types'
-
-    module Win32
-      extend Fiddle::Importer
-      dlload "kernel32.dll", "psapi.dll"
-      include Fiddle::Win32Types
-      typealias "SIZE_T", "size_t"
-
-      PROCESS_MEMORY_COUNTERS = struct [
-        "DWORD  cb",
-        "DWORD  PageFaultCount",
-        "SIZE_T PeakWorkingSetSize",
-        "SIZE_T WorkingSetSize",
-        "SIZE_T QuotaPeakPagedPoolUsage",
-        "SIZE_T QuotaPagedPoolUsage",
-        "SIZE_T QuotaPeakNonPagedPoolUsage",
-        "SIZE_T QuotaNonPagedPoolUsage",
-        "SIZE_T PagefileUsage",
-        "SIZE_T PeakPagefileUsage",
-      ]
-
-      typealias "PPROCESS_MEMORY_COUNTERS", "PROCESS_MEMORY_COUNTERS*"
-
-      extern "HANDLE GetCurrentProcess()", :stdcall
-      extern "BOOL GetProcessMemoryInfo(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD)", :stdcall
-
-      module_function
-      def memory_info
-        size = PROCESS_MEMORY_COUNTERS.size
-        data = PROCESS_MEMORY_COUNTERS.malloc
-        data.cb = size
-        data if GetProcessMemoryInfo(GetCurrentProcess(), data, size)
-      end
-    end
-
-    keys << :peak << :size
-    def self.read_status
-      if info = Win32.memory_info
-        yield :peak, info.PeakPagefileUsage
-        yield :size, info.PagefileUsage
-      end
-    end
-  else
-    PAT = /^\s*(\d+)\s+(\d+)$/
-    require_relative 'find_executable'
-    if PSCMD = EnvUtil.find_executable("ps", "-ovsz=", "-orss=", "-p", $$.to_s) {|out| PAT =~ out}
-      PSCMD.pop
-    end
-    raise MiniTest::Skip, "ps command not found" unless PSCMD
-
-    keys << :size << :rss
-    def self.read_status
-      if PAT =~ IO.popen(PSCMD + [$$.to_s], "r", err: [:child, :out], &:read)
-        yield :size, $1.to_i*1024
-        yield :rss, $2.to_i*1024
-      end
-    end
-  end
-
-  Status = Struct.new(*keys)
-
-  class Status
-    def _update
-      Memory.read_status do |key, val|
-        self[key] = val
-      end
-    end
-  end
-
-  class Status
-    Header = members.map {|k| k.to_s.upcase.rjust(6)}.join('')
-    Format = "%6d"
-
-    def initialize
-      _update
-    end
-
-    def to_s
-      status = each_pair.map {|n,v|
-        "#{n}:#{v}"
-      }
-      "{#{status.join(",")}}"
-    end
-
-    def self.parse(str)
-      status = allocate
-      str.scan(/(?:\A\{|\G,)(#{members.join('|')}):(\d+)(?=,|\}\z)/) do
-        status[$1] = $2.to_i
-      end
-      status
-    end
-  end
-end
Index: test/ruby/envutil.rb
===================================================================
--- test/ruby/envutil.rb	(revision 48408)
+++ test/ruby/envutil.rb	(revision 48409)
@@ -1,597 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/envutil.rb#L0
-# -*- coding: us-ascii -*-
-require "open3"
-require "timeout"
-require "test/unit"
-require_relative "find_executable"
-
-module EnvUtil
-  def rubybin
-    if ruby = ENV["RUBY"]
-      return ruby
-    end
-    ruby = "ruby"
-    exeext = RbConfig::CONFIG["EXEEXT"]
-    rubyexe = (ruby + exeext if exeext and !exeext.empty?)
-    3.times do
-      if File.exist? ruby and File.executable? ruby and !File.directory? ruby
-        return File.expand_path(ruby)
-      end
-      if rubyexe and File.exist? rubyexe and File.executable? rubyexe
-        return File.expand_path(rubyexe)
-      end
-      ruby = File.join("..", ruby)
-    end
-    if defined?(RbConfig.ruby)
-      RbConfig.ruby
-    else
-      "ruby"
-    end
-  end
-  module_function :rubybin
-
-  LANG_ENVS = %w"LANG LC_ALL LC_CTYPE"
-
-  def invoke_ruby(args, stdin_data = "", capture_stdout = false, capture_stderr = false,
-                  encoding: nil, timeout: 10, reprieve: 1,
-                  stdout_filter: nil, stderr_filter: nil,
-                  rubybin: EnvUtil.rubybin,
-                  **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 && capture_stderr != :merge_to_stdout
-    opt[:in] = in_c
-    opt[:out] = out_c if capture_stdout
-    opt[:err] = capture_stderr == :merge_to_stdout ? out_c : err_c if capture_stderr
-    if encoding
-      out_p.set_encoding(encoding) if out_p
-      err_p.set_encoding(encoding) 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)
-    pid = spawn(child_env, rubybin, *args, **opt)
-    in_c.close
-    out_c.close if capture_stdout
-    err_c.close if capture_stderr && capture_stderr != :merge_to_stdout
-    if block_given?
-      return yield in_p, out_p, err_p, pid
-    else
-      th_stdout = Thread.new { out_p.read } if capture_stdout
-      th_stderr = Thread.new { err_p.read } if capture_stderr && capture_stderr != :merge_to_stdout
-      in_p.write stdin_data.to_str unless stdin_data.empty?
-      in_p.close
-      if (!th_stdout || th_stdout.join(timeout)) && (!th_stderr || th_stderr.join(timeout))
-        stdout = th_stdout.value if capture_stdout
-        stderr = th_stderr.value if capture_stderr && capture_stderr != :merge_to_stdout
-      else
-        signal = /mswin|mingw/ =~ RUBY_PLATFORM ? :KILL : :TERM
-        begin
-          Process.kill signal, pid
-          Timeout.timeout((reprieve unless signal == :KILL)) do
-            Process.wait(pid)
-          end
-        rescue Errno::ESRCH
-          break
-        rescue Timeout::Error
-          raise if signal == :KILL
-          signal = :KILL
-        else
-          break
-        end while true
-        bt = caller_locations
-        raise Timeout::Error, "execution of #{bt.shift.label} expired", bt.map(&:to_s)
-      end
-      out_p.close if capture_stdout
-      err_p.close if capture_stderr && capture_stderr != :merge_to_stdout
-      Process.wait pid
-      status = $?
-      stdout = stdout_filter.call(stdout) if stdout_filter
-      stderr = stderr_filter.call(stderr) if stderr_filter
-      return stdout, stderr, status
-    end
-  ensure
-    [th_stdout, th_stderr].each do |th|
-      th.kill if th
-    end
-    [in_c, in_p, out_c, out_p, err_c, err_p].each do |io|
-      io.close if io && !io.closed?
-    end
-    [th_stdout, th_stderr].each do |th|
-      th.join if th
-    end
-  end
-  module_function :invoke_ruby
-
-  alias rubyexec invoke_ruby
-  class << self
-    alias rubyexec invoke_ruby
-  end
-
-  def verbose_warning
-    class << (stderr = "")
-      alias write <<
-    end
-    stderr, $stderr, verbose, $VERBOSE = $stderr, stderr, $VERBOSE, true
-    yield stderr
-    return $stderr
-  ensure
-    stderr, $stderr, $VERBOSE = $stderr, stderr, verbose
-  end
-  module_function :verbose_warning
-
-  def default_warning
-    verbose, $VERBOSE = $VERBOSE, false
-    yield
-  ensure
-    $VERBOSE = verbose
-  end
-  module_function :default_warning
-
-  def suppress_warning
-    verbose, $VERBOSE = $VERBOSE, nil
-    yield
-  ensure
-    $VERBOSE = verbose
-  end
-  module_function :suppress_warning
-
-  def under_gc_stress(stress = true)
-    stress, GC.stress = GC.stress, stress
-    yield
-  ensure
-    GC.stress = stress
-  end
-  module_function :under_gc_stress
-
-  def with_default_external(enc)
-    verbose, $VERBOSE = $VERBOSE, nil
-    origenc, Encoding.default_external = Encoding.default_external, enc
-    $VERBOSE = verbose
-    yield
-  ensure
-    verbose, $VERBOSE = $VERBOSE, nil
-    Encoding.default_external = origenc
-    $VERBOSE = verbose
-  end
-  module_function :with_default_external
-
-  def with_default_internal(enc)
-    verbose, $VERBOSE = $VERBOSE, nil
-    origenc, Encoding.default_internal = Encoding.default_internal, enc
-    $VERBOSE = verbose
-    yield
-  ensure
-    verbose, $VERBOSE = $VERBOSE, nil
-    Encoding.default_internal = origenc
-    $VERBOSE = verbose
-  end
-  module_function :with_default_internal
-
-  def labeled_module(name, &block)
-    Module.new do
-      singleton_class.class_eval {define_method(:to_s) {name}; alias inspect to_s}
-      class_eval(&block) if block
-    end
-  end
-  module_function :labeled_module
-
-  def labeled_class(name, superclass = Object, &block)
-    Class.new(superclass) do
-      singleton_class.class_eval {define_method(:to_s) {name}; alias inspect to_s}
-      class_eval(&block) if block
-    end
-  end
-  module_function :labeled_class
-
-  if /darwin/ =~ RUBY_PLATFORM
-    DIAGNOSTIC_REPORTS_PATH = File.expand_path("~/Library/Logs/DiagnosticReports")
-    DIAGNOSTIC_REPORTS_TIMEFORMAT = '%Y-%m-%d-%H%M%S'
-    def self.diagnostic_reports(signame, cmd, pid, now)
-      return unless %w[ABRT QUIT SEGV ILL].include?(signame)
-      cmd = File.basename(cmd)
-      path = DIAGNOSTIC_REPORTS_PATH
-      timeformat = DIAGNOSTIC_REPORTS_TIMEFORMAT
-      pat = "#{path}/#{cmd}_#{now.strftime(timeformat)}[-_]*.crash"
-      first = true
-      30.times do
-        first ? (first = false) : sleep(0.1)
-        Dir.glob(pat) do |name|
-          log = File.read(name) rescue next
-          if /\AProcess:\s+#{cmd} \[#{pid}\]$/ =~ log
-            File.unlink(name)
-            File.unlink("#{path}/.#{File.basename(name)}.plist") rescue nil
-            return log
-          end
-        end
-      end
-      nil
-    end
-  else
-    def self.diagnostic_reports(signame, cmd, pid, now)
-    end
-  end
-end
-
-module Test
-  module Unit
-    module Assertions
-      public
-      def assert_valid_syntax(code, fname = caller_locations(1, 1)[0], mesg = fname.to_s, verbose: nil)
-        code = code.dup.force_encoding("ascii-8bit")
-        code.sub!(/\A(?:\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) {
-          "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ok}\n"
-        }
-        code.force_encoding(Encoding::UTF_8)
-        verbose, $VERBOSE = $VERBOSE, verbose
-        yield if defined?(yield)
-        case
-        when Array === fname
-          fname, line = *fname
-        when defined?(fname.path) && defined?(fname.lineno)
-          fname, line = fname.path, fname.lineno
-        else
-          line = 0
-        end
-        assert_nothing_raised(SyntaxError, mesg) do
-          assert_equal(:ok, catch {|tag| eval(code, binding, fname, line)}, mesg)
-        end
-      ensure
-        $VERBOSE = verbose
-      end
-
-      def assert_syntax_error(code, error, fname = caller_locations(1, 1)[0], mesg = fname.to_s)
-        code = code.dup.force_encoding("ascii-8bit")
-        code.sub!(/\A(?:\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) {
-          "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ng}\n"
-        }
-        code.force_encoding("us-ascii")
-        verbose, $VERBOSE = $VERBOSE, nil
-        yield if defined?(yield)
-        case
-        when Array === fname
-          fname, line = *fname
-        when defined?(fname.path) && defined?(fname.lineno)
-          fname, line = fname.path, fname.lineno
-        else
-          line = 0
-        end
-        e = assert_raise(SyntaxError, mesg) do
-          catch {|tag| eval(code, binding, fname, line)}
-        end
-        assert_match(error, e.message, mesg)
-      ensure
-        $VERBOSE = verbose
-      end
-
-      def assert_normal_exit(testsrc, message = '', child_env: nil, **opt)
-        assert_valid_syntax(testsrc, caller_locations(1, 1)[0])
-        if child_env
-          child_env = [child_env]
-        else
-          child_env = []
-        end
-        out, _, status = EnvUtil.invoke_ruby(child_env + %W'-W0', testsrc, true, :merge_to_stdout, **opt)
-        assert !status.signaled?, FailDesc[status, message, out]
-      end
-
-      FailDesc = proc do |status, message = "", out = ""|
-        pid = status.pid
-        now = Time.now
-        faildesc = proc do
-          if signo = status.termsig
-            signame = Signal.signame(signo)
-            sigdesc = "signal #{signo}"
-          end
-          log = EnvUtil.diagnostic_reports(signame, EnvUtil.rubybin, pid, now)
-          if signame
-            sigdesc = "SIG#{signame} (#{sigdesc})"
-          end
-          if status.coredump?
-            sigdesc << " (core dumped)"
-          end
-          full_message = ''
-          if message and !message.empty?
-            full_message << message << "\n"
-          end
-          full_message << "pid #{pid} killed by #{sigdesc}"
-          if out and !out.empty?
-            full_message << "\n#{out.gsub(/^/, '| ')}"
-            full_message << "\n" if /\n\z/ !~ full_message
-          end
-          if log
-            full_message << "\n#{log.gsub(/^/, '| ')}"
-          end
-          full_message
-        end
-        faildesc
-      end
-
-      def assert_in_out_err(args, test_stdin = "", test_stdout = [], test_stderr = [], message = nil, **opt)
-        stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, **opt)
-        if signo = status.termsig
-          sleep 0.1
-          EnvUtil.diagnostic_reports(Signal.signame(signo), EnvUtil.rubybin, status.pid, Time.now)
-        end
-        if block_given?
-          raise "test_stdout ignored, use block only or without block" if test_stdout != []
-          raise "test_stderr ignored, use block only or without block" if test_stderr != []
-          yield(stdout.lines.map {|l| l.chomp }, stderr.lines.map {|l| l.chomp }, status)
-        else
-          errs = []
-          [[test_stdout, stdout], [test_stderr, stderr]].each do |exp, act|
-            begin
-              if exp.is_a?(Regexp)
-                assert_match(exp, act, message)
-              else
-                assert_equal(exp, act.lines.map {|l| l.chomp }, message)
-              end
-            rescue MiniTest::Assertion => e
-              errs << e.message
-              message = nil
-            end
-          end
-          raise MiniTest::Assertion, errs.join("\n---\n") unless errs.empty?
-          status
-        end
-      end
-
-      def assert_ruby_status(args, test_stdin="", message=nil, **opt)
-        out, _, status = EnvUtil.invoke_ruby(args, test_stdin, true, :merge_to_stdout, **opt)
-        assert(!status.signaled?, FailDesc[status, message, out])
-        message ||= "ruby exit status is not success:"
-        assert(status.success?, "#{message} (#{status.inspect})")
-      end
-
-      ABORT_SIGNALS = Signal.list.values_at(*%w"ILL ABRT BUS SEGV")
-
-      def assert_separately(args, file = nil, line = nil, src, ignore_stderr: nil, **opt)
-        unless file and line
-          loc, = caller_locations(1,1)
-          file ||= loc.path
-          line ||= loc.lineno
-        end
-        line -= 5 # lines until src
-        src = <<eom
-# -*- coding: #{src.encoding}; -*-
-  require #{__dir__.dump}'/envutil';include Test::Unit::Assertions
-  END {
-    puts [Marshal.dump($!)].pack('m'), "assertions=\#{self._assertions}"
-  }
-#{src}
-  class Test::Unit::Runner
-    @@stop_auto_run = true
-  end
-eom
-        args = args.dup
-        args.insert((Hash === args.first ? 1 : 0), "--disable=gems", *$:.map {|l| "-I#{l}"})
-        stdout, stderr, status = EnvUtil.invoke_ruby(args, src, true, true, **opt)
-        abort = status.coredump? || (status.signaled? && ABORT_SIGNALS.include?(status.termsig))
-        assert(!abort, FailDesc[status, nil, stderr])
-        self._assertions += stdout[/^assertions=(\d+)/, 1].to_i
-        begin
-          res = Marshal.load(stdout.unpack("m")[0])
-        rescue => marshal_error
-          ignore_stderr = nil
-        end
-        if res
-          if bt = res.backtrace
-            bt.each do |l|
-              l.sub!(/\A-:(\d+)/){"#{file}:#{line + $1.to_i}"}
-            end
-            bt.concat(caller)
-          else
-            res.set_backtrace(caller)
-          end
-          raise res
-        end
-
-        # really is it succeed?
-        unless ignore_stderr
-          # the body of assert_separately must not output anything to detect error
-          assert_equal("", stderr, "assert_separately failed with error message")
-        end
-        assert_equal(0, status, "assert_separately failed: '#{stderr}'")
-        raise marshal_error if marshal_error
-      end
-
-      def assert_warning(pat, msg = nil)
-        stderr = EnvUtil.verbose_warning { yield }
-        msg = message(msg) {diff pat, stderr}
-        assert(pat === stderr, msg)
-      end
-
-      def assert_warn(*args)
-        assert_warning(*args) {$VERBOSE = false; yield}
-      end
-
-      case RUBY_PLATFORM
-      when /solaris2\.(?:9|[1-9][0-9])/i # Solaris 9, 10, 11,...
-        bits = [nil].pack('p').size == 8 ? 64 : 32
-        if ENV['LD_PRELOAD'].to_s.empty? &&
-            ENV["LD_PRELOAD_#{bits}"].to_s.empty? &&
-            (ENV['UMEM_OPTIONS'].to_s.empty? ||
-             ENV['UMEM_OPTIONS'] == 'backend=mmap') then
-          envs = {
-            'LD_PRELOAD' => 'libumem.so',
-            'UMEM_OPTIONS' => 'backend=mmap'
-  (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]