mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_process.rb: skips tests need fd inheritance.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
564517840e
commit
c9cc612c09
1 changed files with 22 additions and 11 deletions
|
@ -218,8 +218,11 @@ class TestProcess < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
MANDATORY_ENVS = %w[RUBYLIB]
|
MANDATORY_ENVS = %w[RUBYLIB]
|
||||||
if /linux/ =~ RbConfig::CONFIG['target_os']
|
case RbConfig::CONFIG['target_os']
|
||||||
|
when /linux/
|
||||||
MANDATORY_ENVS << 'LD_PRELOAD'
|
MANDATORY_ENVS << 'LD_PRELOAD'
|
||||||
|
when /mswin|mingw/
|
||||||
|
MANDATORY_ENVS.concat(%w[HOME USER TMPDIR])
|
||||||
end
|
end
|
||||||
if e = RbConfig::CONFIG['LIBPATHENV']
|
if e = RbConfig::CONFIG['LIBPATHENV']
|
||||||
MANDATORY_ENVS << e
|
MANDATORY_ENVS << e
|
||||||
|
@ -286,6 +289,7 @@ class TestProcess < Test::Unit::TestCase
|
||||||
UMASK = [RUBY, '-e', 'printf "%04o\n", File.umask']
|
UMASK = [RUBY, '-e', 'printf "%04o\n", File.umask']
|
||||||
|
|
||||||
def test_execopts_umask
|
def test_execopts_umask
|
||||||
|
skip "umask is not supported" if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
|
||||||
IO.popen([*UMASK, :umask => 0]) {|io|
|
IO.popen([*UMASK, :umask => 0]) {|io|
|
||||||
assert_equal("0000", io.read.chomp)
|
assert_equal("0000", io.read.chomp)
|
||||||
}
|
}
|
||||||
|
@ -466,6 +470,9 @@ class TestProcess < Test::Unit::TestCase
|
||||||
STDERR=>"out", STDOUT=>[:child, STDERR])
|
STDERR=>"out", STDOUT=>[:child, STDERR])
|
||||||
assert_equal("errout", File.read("out"))
|
assert_equal("errout", File.read("out"))
|
||||||
|
|
||||||
|
if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
|
||||||
|
skip "inheritance of fd other than stdin,stdout and stderr is not supported"
|
||||||
|
end
|
||||||
Process.wait spawn(RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'",
|
Process.wait spawn(RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'",
|
||||||
STDOUT=>"out",
|
STDOUT=>"out",
|
||||||
STDERR=>[:child, 3],
|
STDERR=>[:child, 3],
|
||||||
|
@ -508,6 +515,9 @@ class TestProcess < Test::Unit::TestCase
|
||||||
assert_raise(ArgumentError) {
|
assert_raise(ArgumentError) {
|
||||||
IO.popen([*ECHO["fuga"], STDOUT=>"out"]) {|io| }
|
IO.popen([*ECHO["fuga"], STDOUT=>"out"]) {|io| }
|
||||||
}
|
}
|
||||||
|
if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
|
||||||
|
skip "inheritance of fd other than stdin,stdout and stderr is not supported"
|
||||||
|
end
|
||||||
with_pipe {|r, w|
|
with_pipe {|r, w|
|
||||||
IO.popen([RUBY, '-e', 'IO.new(3, "w").puts("a"); puts "b"', 3=>w]) {|io|
|
IO.popen([RUBY, '-e', 'IO.new(3, "w").puts("a"); puts "b"', 3=>w]) {|io|
|
||||||
assert_equal("b\n", io.read)
|
assert_equal("b\n", io.read)
|
||||||
|
@ -536,6 +546,9 @@ class TestProcess < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_fd_inheritance
|
def test_fd_inheritance
|
||||||
|
if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
|
||||||
|
skip "inheritance of fd other than stdin,stdout and stderr is not supported"
|
||||||
|
end
|
||||||
with_pipe {|r, w|
|
with_pipe {|r, w|
|
||||||
system(RUBY, '-e', 'IO.new(ARGV[0].to_i, "w").puts(:ba)', w.fileno.to_s)
|
system(RUBY, '-e', 'IO.new(ARGV[0].to_i, "w").puts(:ba)', w.fileno.to_s)
|
||||||
w.close
|
w.close
|
||||||
|
@ -577,6 +590,9 @@ class TestProcess < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_execopts_close_others
|
def test_execopts_close_others
|
||||||
|
if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
|
||||||
|
skip "inheritance of fd other than stdin,stdout and stderr is not supported"
|
||||||
|
end
|
||||||
with_tmpchdir {|d|
|
with_tmpchdir {|d|
|
||||||
with_pipe {|r, w|
|
with_pipe {|r, w|
|
||||||
system(RUBY, '-e', 'STDERR.reopen("err", "w"); IO.new(ARGV[0].to_i, "w").puts("ma")', w.fileno.to_s, :close_others=>true)
|
system(RUBY, '-e', 'STDERR.reopen("err", "w"); IO.new(ARGV[0].to_i, "w").puts("ma")', w.fileno.to_s, :close_others=>true)
|
||||||
|
@ -692,22 +708,17 @@ class TestProcess < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_exec_noshell
|
def test_exec_noshell
|
||||||
with_tmpchdir {|d|
|
with_tmpchdir {|d|
|
||||||
with_pipe {|r, w|
|
|
||||||
write_file("s", <<-"End")
|
write_file("s", <<-"End")
|
||||||
str = "echo non existing command name which contains spaces"
|
str = "echo non existing command name which contains spaces"
|
||||||
w = IO.new(#{w.fileno}, "w")
|
STDERR.reopen(STDOUT)
|
||||||
STDOUT.reopen(w)
|
|
||||||
STDERR.reopen(w)
|
|
||||||
begin
|
begin
|
||||||
exec [str, str]
|
exec [str, str]
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
w.write "Errno::ENOENT success"
|
print "Errno::ENOENT success"
|
||||||
end
|
end
|
||||||
End
|
End
|
||||||
system(RUBY, "s", :close_others=>false)
|
r = IO.popen([RUBY, "s", :close_others=>false], "r") {|f| f.read}
|
||||||
w.close
|
assert_equal("Errno::ENOENT success", r)
|
||||||
assert_equal("Errno::ENOENT success", r.read)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue