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

ruby-changes:47590

From: sorah <ko1@a...>
Date: Fri, 1 Sep 2017 00:42:00 +0900 (JST)
Subject: [ruby-changes:47590] sorah:r59706 (trunk): Skip test_open_tempfile_path on EINVAL

sorah	2017-09-01 00:41:54 +0900 (Fri, 01 Sep 2017)

  New Revision: 59706

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

  Log:
    Skip test_open_tempfile_path on EINVAL
    
    Looks like File::Constants::TMPFILE could be defined even when not
    supported on system.  Just skip the test when we get EINVAL on open(2).
    
    * test/ruby/test_file.rb(test_open_tempfile_path):
      Skip when EINVAL occured on File.open.

  Modified files:
    trunk/test/ruby/test_file.rb
Index: test/ruby/test_file.rb
===================================================================
--- test/ruby/test_file.rb	(revision 59705)
+++ test/ruby/test_file.rb	(revision 59706)
@@ -471,12 +471,18 @@ class TestFile < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file.rb#L471
 
   def test_open_tempfile_path
     Dir.mktmpdir(__method__.to_s) do |tmpdir|
-      File.open(tmpdir, File::RDWR | File::TMPFILE) do |io|
-        io.write "foo"
-        io.flush
-        assert_equal 3, io.size
-        assert_raise(IOError) { io.path }
+      begin
+        io = File.open(tmpdir, File::RDWR | File::TMPFILE)
+      rescue Errno::EINVAL
+        skip 'O_TMPFILE not supported (EINVAL)'
       end
+
+      io.write "foo"
+      io.flush
+      assert_equal 3, io.size
+      assert_raise(IOError) { io.path }
+    ensure
+      io&.close
     end
   end if File::Constants.const_defined?(:TMPFILE)
 

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

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