summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-12 08:05:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-12 08:05:56 +0000
commit2eadce6743ffa0609a4c6968935815d9fc966f87 (patch)
treea0ccf262648c546d9c5521a6b55b849bfe1b9e7e
parent221496de7cb970c67de14766c4aecb314626ded1 (diff)
test_io.rb: fix test error
* test/ruby/test_io.rb (TestIO#test_write_32bit_boundary): retry to remove the temporary file while EACCES occurs because of syncing in the system probably. rescue ENOSPC from IO#tell. [ruby-core:55457] [Bug #8519] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_io.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 6fccf81621..959982f1d5 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2690,6 +2690,23 @@ End
def test_write_32bit_boundary
bug8431 = '[ruby-core:55098] [Bug #8431]'
make_tempfile {|t|
+ def t.close(unlink_now = false)
+ # TODO: Tempfile should deal with this delay on Windows?
+ # NOTE: re-opening with O_TEMPORARY does not work.
+ path = self.path
+ ret = super
+ if unlink_now
+ begin
+ File.unlink(path)
+ rescue Errno::ENOENT
+ rescue Errno::EACCES
+ sleep(2)
+ retry
+ end
+ end
+ ret
+ end
+
assert_separately(["-", bug8431, t.path], <<-"end;", timeout: 30)
msg = ARGV.shift
f = open(ARGV[0], "wb")
@@ -2698,9 +2715,12 @@ End
# this will consume very long time or fail by ENOSPC on a
# filesystem which sparse file is not supported
f.write('1')
+ pos = f.tell
+ rescue Errno::ENOSPC
+ skip "non-sparse file system"
rescue SystemCallError
else
- assert_equal(0x1_0000_0000, f.tell, msg)
+ assert_equal(0x1_0000_0000, pos, msg)
end
end;
}