Skip to content

Instantly share code, notes, and snippets.

@luislavena
Created July 7, 2013 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luislavena/5945088 to your computer and use it in GitHub Desktop.
Save luislavena/5945088 to your computer and use it in GitHub Desktop.
Test script for Bug #8594: https://bugs.ruby-lang.org/issues/8594
def try
yield
print '.'
rescue Errno::EINVAL
print 'i'
sleep 1
rescue Errno::ENOENT
print 'n'
sleep 1
rescue Errno::EACCES
print 'a'
sleep 1
rescue Errno::EBADF
print 'b'
sleep 1
rescue Errno::ENETDOWN
print 'd'
sleep 1
rescue Errno::ERANGE
print 'r'
sleep 1
end
50.times do
filebase = 'shakeshake-' + Time.new.to_i.to_s
print "\ncreate " ; 50.times { |i| try { File.write('%s_%d' % [filebase, i], 'a' * 100_000) } }
print "\nrename " ; 50.times { |i| try { File.rename('%s_%d' % [filebase, i], 'deleteme_%d' % [i]) } }
print "\ndelete " ; 50.times { |i| try { File.unlink('deleteme_%d' % [i]) } }
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment