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

ruby-changes:47769

From: hsbt <ko1@a...>
Date: Thu, 14 Sep 2017 14:04:44 +0900 (JST)
Subject: [ruby-changes:47769] hsbt:r59887 (trunk): added workaround for APFS file format.

hsbt	2017-09-14 14:04:38 +0900 (Thu, 14 Sep 2017)

  New Revision: 59887

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

  Log:
    added workaround for APFS file format.
    
      * TestFileExhaustive#test_atime: It fails with nano-sec precise.
        I changed to use unixtime for this assertion for APFS.
      * TestFileExhaustive#test_expand_path: skip assertion when given
        invalid charactor on APFS.
    
      [Bug #13816][ruby-core:82383]

  Modified files:
    trunk/test/ruby/test_file_exhaustive.rb
Index: test/ruby/test_file_exhaustive.rb
===================================================================
--- test/ruby/test_file_exhaustive.rb	(revision 59886)
+++ test/ruby/test_file_exhaustive.rb	(revision 59887)
@@ -3,6 +3,7 @@ require "test/unit" https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L3
 require "fileutils"
 require "tmpdir"
 require "socket"
+require '-test-/file'
 
 class TestFileExhaustive < Test::Unit::TestCase
   DRIVE = Dir.pwd[%r'\A(?:[a-z]:|//[^/]+/[^/]+)'i]
@@ -572,7 +573,13 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L573
       t2 = File.open(file) {|f| f.atime}
       assert_kind_of(Time, t1)
       assert_kind_of(Time, t2)
-      assert_equal(t1, t2)
+      # High Sierra's APFS can handle nano-sec precise.
+      # t1 value is difference from t2 on APFS.
+      if Bug::File::Fs.fsname(Dir.tmpdir) == "apfs"
+        assert_equal(t1.to_i, t2.to_i)
+      else
+        assert_equal(t1, t2)
+      end
     end
     assert_raise(Errno::ENOENT) { File.atime(nofile) }
   end
@@ -749,6 +756,8 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L756
         begin
           open(file) {}
         rescue
+          # High Sierra's APFS cannot use filenames with undefined character
+          next if Bug::File::Fs.fsname(Dir.tmpdir) == "apfs"
           assert_equal(file, full_path, mesg)
         else
           assert_equal(regular_file, full_path, mesg)

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

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