* test/lib/envutil.rb (File.mkfifo): Defined using mkfifo command.

* test/ruby/test_io.rb: Ditto.

* test/ruby/test_file_exhaustive.rb: Use File.mkfifo.

* test/ruby/test_process.rb: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2015-04-13 13:46:10 +00:00
parent 599bfa7233
commit 3024fc235a
5 changed files with 33 additions and 8 deletions

View File

@ -1,3 +1,13 @@
Mon Apr 13 22:44:07 2015 Tanaka Akira <akr@fsij.org>
* test/lib/envutil.rb (File.mkfifo): Defined using mkfifo command.
* test/ruby/test_io.rb: Ditto.
* test/ruby/test_file_exhaustive.rb: Use File.mkfifo.
* test/ruby/test_process.rb: Ditto.
Mon Apr 13 21:20:20 2015 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org> Mon Apr 13 21:20:20 2015 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
* ext/openssl/lib/openssl/ssl.rb: stricter hostname verification * ext/openssl/lib/openssl/ssl.rb: stricter hostname verification

View File

@ -3,6 +3,12 @@ require "open3"
require "timeout" require "timeout"
require_relative "find_executable" require_relative "find_executable"
def File.mkfifo(fn)
raise NotImplementedError, "does not support fifo" if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM
ret = system("mkfifo", fn)
raise NotImplementedError, "mkfifo fails" if !ret
end
module EnvUtil module EnvUtil
def rubybin def rubybin
if ruby = ENV["RUBY"] if ruby = ENV["RUBY"]

View File

@ -131,7 +131,7 @@ class TestFileExhaustive < Test::Unit::TestCase
return @fifo if defined? @fifo return @fifo if defined? @fifo
if POSIX if POSIX
fn = make_tmp_filename("fifo") fn = make_tmp_filename("fifo")
assert(system("mkfifo", fn), "mkfifo fails") File.mkfifo(fn)
@fifo = fn @fifo = fn
else else
@fifo = nil @fifo = nil

View File

@ -3180,7 +3180,7 @@ End
def test_open_fifo_does_not_block_other_threads def test_open_fifo_does_not_block_other_threads
mkcdtmpdir { mkcdtmpdir {
assert(system("mkfifo", "fifo"), "mkfifo fails") File.mkfifo("fifo")
assert_separately([], <<-'EOS') assert_separately([], <<-'EOS')
t1 = Thread.new { t1 = Thread.new {
open("fifo", "r") {|r| open("fifo", "r") {|r|

View File

@ -560,8 +560,11 @@ class TestProcess < Test::Unit::TestCase
def test_execopts_redirect_open_fifo def test_execopts_redirect_open_fifo
with_tmpchdir {|d| with_tmpchdir {|d|
system("mkfifo fifo") begin
return if !$?.success? File.mkfifo("fifo")
rescue NotImplementedError
return
end
assert(FileTest.pipe?("fifo"), "should be pipe") assert(FileTest.pipe?("fifo"), "should be pipe")
t1 = Thread.new { t1 = Thread.new {
system(*ECHO["output to fifo"], :out=>"fifo") system(*ECHO["output to fifo"], :out=>"fifo")
@ -576,8 +579,11 @@ class TestProcess < Test::Unit::TestCase
def test_execopts_redirect_open_fifo_interrupt_raise def test_execopts_redirect_open_fifo_interrupt_raise
with_tmpchdir {|d| with_tmpchdir {|d|
system("mkfifo fifo") begin
return if !$?.success? File.mkfifo("fifo")
rescue NotImplementedError
return
end
IO.popen([RUBY, '-e', <<-'EOS']) {|io| IO.popen([RUBY, '-e', <<-'EOS']) {|io|
class E < StandardError; end class E < StandardError; end
trap(:USR1) { raise E } trap(:USR1) { raise E }
@ -596,8 +602,11 @@ class TestProcess < Test::Unit::TestCase
def test_execopts_redirect_open_fifo_interrupt_print def test_execopts_redirect_open_fifo_interrupt_print
with_tmpchdir {|d| with_tmpchdir {|d|
system("mkfifo fifo") begin
return if !$?.success? File.mkfifo("fifo")
rescue NotImplementedError
return
end
IO.popen([RUBY, '-e', <<-'EOS']) {|io| IO.popen([RUBY, '-e', <<-'EOS']) {|io|
trap(:USR1) { print "trap\n" } trap(:USR1) { print "trap\n" }
system("cat", :in => "fifo") system("cat", :in => "fifo")