ruby-changes:24881
From: kosaki <ko1@a...>
Date: Sun, 9 Sep 2012 18:26:22 +0900 (JST)
Subject: [ruby-changes:24881] kosaki:r36933 (trunk): * test/ruby/test_io.rb (test_advise_pipe): new test to check
kosaki 2012-09-09 18:24:35 +0900 (Sun, 09 Sep 2012) New Revision: 36933 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36933 Log: * 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] Modified files: trunk/ChangeLog trunk/test/ruby/test_io.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 36932) +++ ChangeLog (revision 36933) @@ -1,3 +1,9 @@ +Sun Sep 9 18:21:03 2012 KOSAKI Motohiro <kosaki.motohiro@g...> + + * 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] + Sun Sep 9 16:47:12 2012 KOSAKI Motohiro <kosaki.motohiro@g...> * io.c (nogvl_close, maygvl_close, nogvl_fclose, maygvl_fclose): Index: test/ruby/test_io.rb =================================================================== --- test/ruby/test_io.rb (revision 36932) +++ test/ruby/test_io.rb (revision 36933) @@ -2436,4 +2436,15 @@ 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 + -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/