summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-18 08:45:37 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-18 08:45:37 +0000
commitbd4fdb714ff6cf3d42d5a7e6597e83cbe4de65b8 (patch)
treeb1835a1f7262a48f1af5789bba8511a543b0e8a8 /test/ruby
parent0b373d6bbb6cc00c41a5e74a809394aeb9d24994 (diff)
Use Etc.uname instead of uname command invocation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_io.rb6
-rw-r--r--test/ruby/test_sleep.rb3
2 files changed, 5 insertions, 4 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 9d89772d99..1324a2c2fa 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -1673,14 +1673,14 @@ class TestIO < Test::Unit::TestCase
when 0x9123683E # BTRFS_SUPER_MAGIC
when 0x7461636f # OCFS2_SUPER_MAGIC
when 0xEF53 # EXT2_SUPER_MAGIC EXT3_SUPER_MAGIC EXT4_SUPER_MAGIC
- return false if (`/bin/uname -r`.split('.').map(&:to_i) <=> [3,8]) < 0
+ return false if (Etc.uname[:release].split('.').map(&:to_i) <=> [3,8]) < 0
# ext3's timestamp resolution is seconds
s = f.stat
s.mtime.nsec != 0 || s.atime.nsec != 0 || s.ctime.nsec != 0
when 0x58465342 # XFS_SUPER_MAGIC
- return false if (`/bin/uname -r`.split('.').map(&:to_i) <=> [3,5]) < 0
+ return false if (Etc.uname[:release].split('.').map(&:to_i) <=> [3,5]) < 0
when 0x01021994 # TMPFS_MAGIC
- return false if (`/bin/uname -r`.split('.').map(&:to_i) <=> [3,8]) < 0
+ return false if (Etc.uname[:release].split('.').map(&:to_i) <=> [3,8]) < 0
else
return false
end
diff --git a/test/ruby/test_sleep.rb b/test/ruby/test_sleep.rb
index 82c7e0ff49..a2e50739fb 100644
--- a/test/ruby/test_sleep.rb
+++ b/test/ruby/test_sleep.rb
@@ -1,4 +1,5 @@
require 'test/unit'
+require 'etc'
class TestSleep < Test::Unit::TestCase
def test_sleep_5sec
@@ -9,7 +10,7 @@ class TestSleep < Test::Unit::TestCase
bottom =
case RUBY_PLATFORM
when /linux/
- 4.98 if /Linux ([\d.]+)/ =~ `uname -sr` && ($1.split('.').map(&:to_i)<=>[2,6,18])<1
+ 4.98 if (Etc.uname[:release].split('.').map(&:to_i)<=>[2,6,18]) <= 0
when /mswin|mingw/
4.98
end