[前][次][番号順一覧][スレッド一覧]

ruby-changes:38219

From: akr <ko1@a...>
Date: Mon, 13 Apr 2015 22:46:41 +0900 (JST)
Subject: [ruby-changes:38219] akr:r50300 (trunk): * test/lib/envutil.rb (File.mkfifo): Defined using mkfifo command.

akr	2015-04-13 22:46:10 +0900 (Mon, 13 Apr 2015)

  New Revision: 50300

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50300

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/test/lib/envutil.rb
    trunk/test/ruby/test_file_exhaustive.rb
    trunk/test/ruby/test_io.rb
    trunk/test/ruby/test_process.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50299)
+++ ChangeLog	(revision 50300)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Apr 13 22:44:07 2015  Tanaka Akira  <akr@f...>
+
+	* 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@r...>
 
 	* ext/openssl/lib/openssl/ssl.rb: stricter hostname verification
Index: test/ruby/test_file_exhaustive.rb
===================================================================
--- test/ruby/test_file_exhaustive.rb	(revision 50299)
+++ test/ruby/test_file_exhaustive.rb	(revision 50300)
@@ -131,7 +131,7 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L131
     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
Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 50299)
+++ test/ruby/test_io.rb	(revision 50300)
@@ -3180,7 +3180,7 @@ End https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L3180
 
   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|
Index: test/ruby/test_process.rb
===================================================================
--- test/ruby/test_process.rb	(revision 50299)
+++ test/ruby/test_process.rb	(revision 50300)
@@ -560,8 +560,11 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L560
 
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L579
 
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L602
 
   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")
Index: test/lib/envutil.rb
===================================================================
--- test/lib/envutil.rb	(revision 50299)
+++ test/lib/envutil.rb	(revision 50300)
@@ -3,6 +3,12 @@ require "open3" https://github.com/ruby/ruby/blob/trunk/test/lib/envutil.rb#L3
 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"]

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]