summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-13 13:46:10 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-13 13:46:10 +0000
commit3024fc235af08b8637e115692ab595592338a6fa (patch)
treef9918220c1f052841d91c0940a90f383c9d73df6 /test
parent599bfa72332cf9dba6fff25dde5b17270c058635 (diff)
* 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
Diffstat (limited to 'test')
-rw-r--r--test/lib/envutil.rb6
-rw-r--r--test/ruby/test_file_exhaustive.rb2
-rw-r--r--test/ruby/test_io.rb2
-rw-r--r--test/ruby/test_process.rb21
4 files changed, 23 insertions, 8 deletions
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")