From 3024fc235af08b8637e115692ab595592338a6fa Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 13 Apr 2015 13:46:10 +0000 Subject: * 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 --- test/ruby/test_file_exhaustive.rb | 2 +- test/ruby/test_io.rb | 2 +- test/ruby/test_process.rb | 21 +++++++++++++++------ 3 files changed, 17 insertions(+), 8 deletions(-) (limited to 'test/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") -- cgit v1.2.3