summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-09 09:24:35 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-09 09:24:35 +0000
commitfde6de9fc7417e5bafc724f85d8d8b0b050430f1 (patch)
tree0046d3b931e945de4a28440c4076325e00c9537f /test
parent4b58f39dedfb3491aba7e39e5c2dba0876437cc4 (diff)
* test/ruby/test_io.rb (test_advise_pipe): new test to check
io.advise() against anonymous io object don't make crash. made by Eric Wong. [Bug #6081] [ruby-core:42880] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index d1edaaf8a9..f165c640b1 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2436,4 +2436,15 @@ End
assert_equal(data, buf, bug6099)
rescue RuntimeError # can't modify string; temporarily locked
end
+
+ def test_advise_pipe
+ # we don't know if other platforms have a real posix_fadvise()
+ return if /linux/ !~ RUBY_PLATFORM
+ with_pipe do |r,w|
+ # Linux 2.6.15 and earlier returned EINVAL instead of ESPIPE
+ assert_raise(Errno::ESPIPE, Errno::EINVAL) { r.advise(:willneed) }
+ assert_raise(Errno::ESPIPE, Errno::EINVAL) { w.advise(:willneed) }
+ end
+ end
end
+