Skip failing tests with mingw platform

https://github.com/ruby/ruby/actions/runs/15159221855/job/42621232822?pr=13397

```
  1)
  File.atime returns the last access time for the named file with microseconds FAILED
  Expected 0 == 123456
  to be truthy but was false
  D:/a/ruby/ruby/src/spec/ruby/core/file/atime_spec.rb:26:in `block (3 levels) in <top (required)>'
  D:/a/ruby/ruby/src/spec/ruby/core/file/atime_spec.rb:3:in `<top (required)>'

  2)
  File.ctime returns the change time for the named file (the time at which directory information about the file was changed, not the file itself) with microseconds. FAILED
  Expected 0 > 0
  to be truthy but was false
  D:/a/ruby/ruby/src/spec/ruby/core/file/ctime_spec.rb:21:in `block (3 levels) in <top (required)>'
  D:/a/ruby/ruby/src/spec/ruby/core/file/ctime_spec.rb:3:in `<top (required)>'

  3)
  File.utime sets the access and modification time of each file FAILED
  Expected 2025-05-21 10:30:54 +0000
  to be within 2025-05-21 10:30:54 +0000 +/- 0.0001
  D:/a/ruby/ruby/src/spec/ruby/core/file/utime_spec.rb:25:in `block (2 levels) in <top (required)>'
  D:/a/ruby/ruby/src/spec/ruby/core/file/utime_spec.rb:3:in `<top (required)>'

  4)
  File.mtime returns the modification Time of the file with microseconds FAILED
  Expected 0 == 123456
  to be truthy but was false
  D:/a/ruby/ruby/src/spec/ruby/core/file/mtime_spec.rb:25:in `block (3 levels) in <top (required)>'
  D:/a/ruby/ruby/src/spec/ruby/core/file/mtime_spec.rb:3:in `<top (required)>'
```

It may be fixed with 7aea269b89.
But Ruby 3.2 is now security maintenance status. We can't backport it.
This commit is contained in:
Hiroshi SHIBATA 2025-05-22 15:27:34 +09:00
parent b7aca78cee
commit 5862be0e89
4 changed files with 17 additions and 15 deletions

View File

@ -15,7 +15,7 @@ describe "File.atime" do
File.atime(@file).should be_kind_of(Time)
end
platform_is :linux, :windows do
platform_is :linux do
unless ENV.key?('TRAVIS') # https://bugs.ruby-lang.org/issues/17926
## NOTE also that some Linux systems disable atime (e.g. via mount params) for better filesystem speed.
it "returns the last access time for the named file with microseconds" do

View File

@ -14,7 +14,7 @@ describe "File.ctime" do
File.ctime(@file).should be_kind_of(Time)
end
platform_is :linux, :windows do
platform_is :linux do
it "returns the change time for the named file (the time at which directory information about the file was changed, not the file itself) with microseconds." do
supports_subseconds = Integer(`stat -c%z '#{__FILE__}'`[/\.(\d{1,6})/, 1], 10)
if supports_subseconds != 0

View File

@ -15,7 +15,7 @@ describe "File.mtime" do
File.mtime(@filename).should be_close(@mtime, TIME_TOLERANCE)
end
platform_is :linux, :windows do
platform_is :linux do
unless ENV.key?('TRAVIS') # https://bugs.ruby-lang.org/issues/17926
it "returns the modification Time of the file with microseconds" do
supports_subseconds = Integer(`stat -c%y '#{__FILE__}'`[/\.(\d{1,6})/, 1], 10)

View File

@ -19,18 +19,20 @@ describe "File.utime" do
rm_r @file1, @file2
end
it "sets the access and modification time of each file" do
File.utime(@atime, @mtime, @file1, @file2)
if @time_is_float
File.atime(@file1).should be_close(@atime, 0.0001)
File.mtime(@file1).should be_close(@mtime, 0.0001)
File.atime(@file2).should be_close(@atime, 0.0001)
File.mtime(@file2).should be_close(@mtime, 0.0001)
else
File.atime(@file1).to_i.should be_close(@atime.to_i, TIME_TOLERANCE)
File.mtime(@file1).to_i.should be_close(@mtime.to_i, TIME_TOLERANCE)
File.atime(@file2).to_i.should be_close(@atime.to_i, TIME_TOLERANCE)
File.mtime(@file2).to_i.should be_close(@mtime.to_i, TIME_TOLERANCE)
platform_is_not :windows do
it "sets the access and modification time of each file" do
File.utime(@atime, @mtime, @file1, @file2)
if @time_is_float
File.atime(@file1).should be_close(@atime, 0.0001)
File.mtime(@file1).should be_close(@mtime, 0.0001)
File.atime(@file2).should be_close(@atime, 0.0001)
File.mtime(@file2).should be_close(@mtime, 0.0001)
else
File.atime(@file1).to_i.should be_close(@atime.to_i, TIME_TOLERANCE)
File.mtime(@file1).to_i.should be_close(@mtime.to_i, TIME_TOLERANCE)
File.atime(@file2).to_i.should be_close(@atime.to_i, TIME_TOLERANCE)
File.mtime(@file2).to_i.should be_close(@mtime.to_i, TIME_TOLERANCE)
end
end
end