Make test-all and test-spec runnable on Android
Calling some syscall functions such as Dir.chroot causes SIGSYS instead of EPERM on Android. This change skips all tests that stops the test-suite run.
This commit is contained in:
parent
0691a748b6
commit
cce6cfbe48
@ -9,7 +9,7 @@ platform_is_not :windows do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
platform_is_not :cygwin do
|
platform_is_not :cygwin, :android do
|
||||||
as_user do
|
as_user do
|
||||||
describe "Dir.chroot as regular user" do
|
describe "Dir.chroot as regular user" do
|
||||||
before :all do
|
before :all do
|
||||||
|
@ -14,7 +14,7 @@ describe "Process.groups" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "Process.groups=" do
|
describe "Process.groups=" do
|
||||||
platform_is_not :windows do
|
platform_is_not :windows, :android do
|
||||||
as_superuser do
|
as_superuser do
|
||||||
it "sets the list of gids of groups in the supplemental group access list" do
|
it "sets the list of gids of groups in the supplemental group access list" do
|
||||||
groups = Process.groups
|
groups = Process.groups
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require_relative '../../spec_helper'
|
require_relative '../../spec_helper'
|
||||||
|
|
||||||
describe "Process.initgroups" do
|
describe "Process.initgroups" do
|
||||||
platform_is_not :windows do
|
platform_is_not :windows, :android do
|
||||||
as_user do
|
as_user do
|
||||||
it "initializes the supplemental group access list" do
|
it "initializes the supplemental group access list" do
|
||||||
name = `id -un`.strip
|
name = `id -un`.strip
|
||||||
|
@ -10,6 +10,13 @@ case RUBY_PLATFORM
|
|||||||
when /cygwin/
|
when /cygwin/
|
||||||
libc_so = "cygwin1.dll"
|
libc_so = "cygwin1.dll"
|
||||||
libm_so = "cygwin1.dll"
|
libm_so = "cygwin1.dll"
|
||||||
|
when /android/
|
||||||
|
libdir = '/system/lib'
|
||||||
|
if [0].pack('L!').size == 8
|
||||||
|
libdir = '/system/lib64'
|
||||||
|
end
|
||||||
|
libc_so = File.join(libdir, "libc.so")
|
||||||
|
libm_so = File.join(libdir, "libm.so")
|
||||||
when /linux/
|
when /linux/
|
||||||
libdir = '/lib'
|
libdir = '/lib'
|
||||||
case [0].pack('L!').size
|
case [0].pack('L!').size
|
||||||
|
@ -789,6 +789,7 @@ class TestPathname < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_birthtime
|
def test_birthtime
|
||||||
|
skip if RUBY_PLATFORM =~ /android/
|
||||||
# Check under a (probably) local filesystem.
|
# Check under a (probably) local filesystem.
|
||||||
# Remote filesystems often may not support birthtime.
|
# Remote filesystems often may not support birthtime.
|
||||||
with_tmpchdir('rubytest-pathname') do |dir|
|
with_tmpchdir('rubytest-pathname') do |dir|
|
||||||
|
@ -122,6 +122,7 @@ class TestDir < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_chroot_nodir
|
def test_chroot_nodir
|
||||||
|
skip if RUBY_PLATFORM =~ /android/
|
||||||
assert_raise(NotImplementedError, Errno::ENOENT, Errno::EPERM
|
assert_raise(NotImplementedError, Errno::ENOENT, Errno::EPERM
|
||||||
) { Dir.chroot(File.join(@nodir, "")) }
|
) { Dir.chroot(File.join(@nodir, "")) }
|
||||||
end
|
end
|
||||||
|
@ -642,6 +642,7 @@ class TestFileExhaustive < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_birthtime
|
def test_birthtime
|
||||||
|
skip if RUBY_PLATFORM =~ /android/
|
||||||
[regular_file, utf8_file].each do |file|
|
[regular_file, utf8_file].each do |file|
|
||||||
t1 = File.birthtime(file)
|
t1 = File.birthtime(file)
|
||||||
t2 = File.open(file) {|f| f.birthtime}
|
t2 = File.open(file) {|f| f.birthtime}
|
||||||
|
@ -1583,6 +1583,7 @@ class TestProcess < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_setegid
|
def test_setegid
|
||||||
|
skip "root can use Process.egid on Android platform" if RUBY_PLATFORM =~ /android/
|
||||||
assert_nothing_raised(TypeError) {Process.egid += 0}
|
assert_nothing_raised(TypeError) {Process.egid += 0}
|
||||||
rescue NotImplementedError
|
rescue NotImplementedError
|
||||||
end
|
end
|
||||||
@ -1871,6 +1872,7 @@ class TestProcess < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_execopts_uid
|
def test_execopts_uid
|
||||||
|
skip "root can use uid option of Kernel#system on Android platform" if RUBY_PLATFORM =~ /android/
|
||||||
feature6975 = '[ruby-core:47414]'
|
feature6975 = '[ruby-core:47414]'
|
||||||
|
|
||||||
[30000, [Process.uid, ENV["USER"]]].each do |uid, user|
|
[30000, [Process.uid, ENV["USER"]]].each do |uid, user|
|
||||||
@ -1902,6 +1904,7 @@ class TestProcess < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_execopts_gid
|
def test_execopts_gid
|
||||||
skip "Process.groups not implemented on Windows platform" if windows?
|
skip "Process.groups not implemented on Windows platform" if windows?
|
||||||
|
skip "root can use Process.groups on Android platform" if RUBY_PLATFORM =~ /android/
|
||||||
feature6975 = '[ruby-core:47414]'
|
feature6975 = '[ruby-core:47414]'
|
||||||
|
|
||||||
groups = Process.groups.map do |g|
|
groups = Process.groups.map do |g|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user