From 3024fc235af08b8637e115692ab595592338a6fa Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 13 Apr 2015 13:46:10 +0000 Subject: [PATCH] * 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 --- ChangeLog | 10 ++++++++++ test/lib/envutil.rb | 6 ++++++ test/ruby/test_file_exhaustive.rb | 2 +- test/ruby/test_io.rb | 2 +- test/ruby/test_process.rb | 21 +++++++++++++++------ 5 files changed, 33 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51a84a9f23..a890c3f5bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Mon Apr 13 22:44:07 2015 Tanaka Akira + + * 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 * ext/openssl/lib/openssl/ssl.rb: stricter hostname verification diff --git a/test/lib/envutil.rb b/test/lib/envutil.rb index 1f43dbdf15..dc94a8f02e 100644 --- a/test/lib/envutil.rb +++ b/test/lib/envutil.rb @@ -3,6 +3,12 @@ require "open3" require "timeout" 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 def rubybin if ruby = ENV["RUBY"] diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index bcf955d85c..b36b6168ee 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -131,7 +131,7 @@ class TestFileExhaustive < Test::Unit::TestCase return @fifo if defined? @fifo if POSIX fn = make_tmp_filename("fifo") - assert(system("mkfifo", fn), "mkfifo fails") + File.mkfifo(fn) @fifo = fn else @fifo = nil diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index a06fce8eb9..873da119be 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -3180,7 +3180,7 @@ End def test_open_fifo_does_not_block_other_threads mkcdtmpdir { - assert(system("mkfifo", "fifo"), "mkfifo fails") + File.mkfifo("fifo") assert_separately([], <<-'EOS') t1 = Thread.new { open("fifo", "r") {|r| diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index e682f851cb..ac5091b278 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -560,8 +560,11 @@ class TestProcess < Test::Unit::TestCase def test_execopts_redirect_open_fifo with_tmpchdir {|d| - system("mkfifo fifo") - return if !$?.success? + begin + File.mkfifo("fifo") + rescue NotImplementedError + return + end assert(FileTest.pipe?("fifo"), "should be pipe") t1 = Thread.new { system(*ECHO["output to fifo"], :out=>"fifo") @@ -576,8 +579,11 @@ class TestProcess < Test::Unit::TestCase def test_execopts_redirect_open_fifo_interrupt_raise with_tmpchdir {|d| - system("mkfifo fifo") - return if !$?.success? + begin + File.mkfifo("fifo") + rescue NotImplementedError + return + end IO.popen([RUBY, '-e', <<-'EOS']) {|io| class E < StandardError; end trap(:USR1) { raise E } @@ -596,8 +602,11 @@ class TestProcess < Test::Unit::TestCase def test_execopts_redirect_open_fifo_interrupt_print with_tmpchdir {|d| - system("mkfifo fifo") - return if !$?.success? + begin + File.mkfifo("fifo") + rescue NotImplementedError + return + end IO.popen([RUBY, '-e', <<-'EOS']) {|io| trap(:USR1) { print "trap\n" } system("cat", :in => "fifo")