ruby-changes:28578
From: nobu <ko1@a...>
Date: Fri, 10 May 2013 10:48:32 +0900 (JST)
Subject: [ruby-changes:28578] nobu:r40630 (trunk): * test/dtrace/helper.rb: ignore empty SUDO. reuse SUDO value by using
nobu 2013-05-10 10:48:20 +0900 (Fri, 10 May 2013) New Revision: 40630 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40630 Log: * test/dtrace/helper.rb: ignore empty SUDO. reuse SUDO value by using class variable. use test/unit instead of minitest/autorun. dispose `Interrupted system call' error messages at parallel test. Modified files: trunk/test/dtrace/helper.rb Index: test/dtrace/helper.rb =================================================================== --- test/dtrace/helper.rb (revision 40629) +++ test/dtrace/helper.rb (revision 40630) @@ -1,26 +1,26 @@ https://github.com/ruby/ruby/blob/trunk/test/dtrace/helper.rb#L1 # -*- coding: us-ascii -*- -require 'minitest/autorun' +require 'test/unit' require 'tempfile' require_relative '../ruby/envutil' if Process.euid == 0 ok = true -elsif (sudo = ENV["SUDO"]) and (`#{sudo} echo ok` rescue false) +elsif (sudo = ENV["SUDO"]) and !sudo.empty? and (`#{sudo} echo ok` rescue false) ok = true else ok = false end ok &= (`dtrace -V` rescue false) module DTrace - class TestCase < MiniTest::Unit::TestCase + class TestCase < Test::Unit::TestCase INCLUDE = File.expand_path('..', File.dirname(__FILE__)) def trap_probe d_program, ruby_program - d = Tempfile.new('probe.d') + d = Tempfile.new(%w'probe .d') d.write d_program d.flush - rb = Tempfile.new('probed.rb') + rb = Tempfile.new(%w'probed .rb') rb.write ruby_program rb.flush @@ -28,7 +28,7 @@ module DTrace https://github.com/ruby/ruby/blob/trunk/test/dtrace/helper.rb#L28 rb_path = rb.path cmd = ["dtrace", "-q", "-s", d_path, "-c", "#{EnvUtil.rubybin} -I#{INCLUDE} #{rb_path}"] - if sudo = ENV["SUDO"] + if sudo = @@sudo [RbConfig::CONFIG["LIBPATHENV"], "RUBY", "RUBYOPT"].each do |name| if name and val = ENV[name] cmd.unshift("#{name}=#{val}") @@ -36,7 +36,7 @@ module DTrace https://github.com/ruby/ruby/blob/trunk/test/dtrace/helper.rb#L36 end cmd.unshift(sudo) end - probes = IO.popen(cmd) do |io| + probes = IO.popen(cmd, err: [:child, :out]) do |io| io.readlines end d.close(true) @@ -45,3 +45,7 @@ module DTrace https://github.com/ruby/ruby/blob/trunk/test/dtrace/helper.rb#L45 end end end if ok + +if ok + DTrace::TestCase.class_variable_set(:@@sudo, sudo) +end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/