From 9ff3d9dec9c1bb1783591de212c9deb5d542f98f Mon Sep 17 00:00:00 2001 From: normal Date: Fri, 11 Dec 2015 22:49:27 +0000 Subject: IO#advise should not raise Errno::ENOSYS As it is just a hint the kernel is free to ignore, IO#advise already succeeds when posix_fadvise is not available build time at all. Following that, if posix_fadvise was available at build time but not implemented in the running kernel, we should also ignore it. * io.c (do_io_advise): do not raise on ENOSYS * test/ruby/test_io.rb (test_advise): do not skip on Errno::ENOSYS (test_advise_pipe): ditto [ruby-core:72066] [Feature #11806] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index a237fa3b87..ad9e4fa08f 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -2565,8 +2565,6 @@ End ret = assert_nothing_raised(lambda { os_and_fs(tf.path) }) { begin t.advise(adv, offset, len) - rescue Errno::ENOSYS - skip rescue Errno::EINVAL => e if /linux/ =~ RUBY_PLATFORM && (Etc.uname[:release].split('.').map(&:to_i) <=> [3,6]) < 0 next # [ruby-core:65355] tmpfs is not supported @@ -3007,8 +3005,8 @@ End # we don't know if other platforms have a real posix_fadvise() with_pipe do |r,w| # Linux 2.6.15 and earlier returned EINVAL instead of ESPIPE - assert_raise(Errno::ESPIPE, Errno::EINVAL, Errno::ENOSYS) { r.advise(:willneed) } - assert_raise(Errno::ESPIPE, Errno::EINVAL, Errno::ENOSYS) { w.advise(:willneed) } + assert_raise(Errno::ESPIPE, Errno::EINVAL) { r.advise(:willneed) } + assert_raise(Errno::ESPIPE, Errno::EINVAL) { w.advise(:willneed) } end end if /linux/ =~ RUBY_PLATFORM -- cgit v1.2.3