diff options
Diffstat (limited to 'spec/ruby/core/file/atime_spec.rb')
-rw-r--r-- | spec/ruby/core/file/atime_spec.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/spec/ruby/core/file/atime_spec.rb b/spec/ruby/core/file/atime_spec.rb index 5663e47266..e47e70e5ac 100644 --- a/spec/ruby/core/file/atime_spec.rb +++ b/spec/ruby/core/file/atime_spec.rb @@ -16,15 +16,20 @@ describe "File.atime" do end platform_is :linux, :windows do - ## 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 - supports_subseconds = Integer(`stat -c%x '#{__FILE__}'`[/\.(\d+)/, 1], 10) - if supports_subseconds != 0 - expected_time = Time.at(Time.now.to_i + 0.123456) - File.utime expected_time, 0, @file - File.atime(@file).usec.should == expected_time.usec - else - File.atime(__FILE__).usec.should == 0 + 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 + supports_subseconds = Integer(`stat -c%x '#{__FILE__}'`[/\.(\d{1,6})/, 1], 10) + if supports_subseconds != 0 + expected_time = Time.at(Time.now.to_i + 0.123456) + File.utime expected_time, 0, @file + File.atime(@file).usec.should == expected_time.usec + else + File.atime(__FILE__).usec.should == 0 + end + rescue Errno::ENOENT => e + # Native Windows don't have stat command. + skip e.message end end end |