summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-22 12:55:16 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-22 12:55:16 +0000
commit82b69180aa64b97ddf3b55f7911f9094335c1e65 (patch)
treeceab865e13655009669f09d4ecb2d9805356d47c /test
parent482dd826ee0f984c2549e668166461087d60ea81 (diff)
check statfs and skip
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index a0b0a1bcde..4654ec3ea7 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -1666,6 +1666,22 @@ class TestIO < Test::Unit::TestCase
}
end
+ def can_seek_data(f)
+ if /linux/ =~ RUBY_PLATFORM
+ # include/uapi/linux/magic.h
+ case f.statfs.type
+ when 0x9123683E # BTRFS_SUPER_MAGIC
+ when 0x7461636f # OCFS2_SUPER_MAGIC
+ when 0xEF53 # EXT4_SUPER_MAGIC
+ when 0x58465342 # XFS_SUPER_MAGIC
+ when 0x01021994 # TMPFS_MAGIC
+ else
+ return false
+ end
+ end
+ true
+ end
+
def test_seek
make_tempfile {|t|
@@ -1692,6 +1708,7 @@ class TestIO < Test::Unit::TestCase
if defined?(IO::SEEK_DATA)
open(t.path) { |f|
+ break unless can_seek_data(f)
assert_equal("foo\n", f.gets)
assert_nothing_raised("cannot SEEK_DATA on FS(0x%X)" % f.statfs.type) do
f.seek(0, IO::SEEK_DATA)
@@ -1699,6 +1716,7 @@ class TestIO < Test::Unit::TestCase
assert_equal("foo\nbar\nbaz\n", f.read)
}
open(t.path, 'r+') { |f|
+ break unless can_seek_data(f)
pos = f.pos
f.seek(100*1024, IO::SEEK_SET)
f.print("zot\n")
@@ -1740,6 +1758,7 @@ class TestIO < Test::Unit::TestCase
if defined?(IO::SEEK_DATA)
open(t.path) { |f|
+ break unless can_seek_data(f)
assert_equal("foo\n", f.gets)
assert_nothing_raised("cannot SEEK_DATA on FS(0x%X)" % f.statfs.type) do
f.seek(0, :DATA)
@@ -1747,6 +1766,7 @@ class TestIO < Test::Unit::TestCase
assert_equal("foo\nbar\nbaz\n", f.read)
}
open(t.path, 'r+') { |f|
+ break unless can_seek_data(f)
pos = f.pos
f.seek(100*1024, :SET)
f.print("zot\n")