summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-15 05:54:40 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-15 05:54:40 +0000
commitef46ac506d1f48a769848ceaf73cd0db26d0159e (patch)
tree5cf8db195248f5766cf1b003b6ffd6f424ed6452
parent97d00bcdeeb3f4009a6ac5ae9f5cb9463f2e10f8 (diff)
merge revision(s) 32799:
* test/ruby/test_process.rb (TestProcess#windows?): new method. * test/ruby/test_process.rb (TestProcess#*): use above method. * test/ruby/test_process.rb (TestProcess#test_execopts_redirect): windows doesn't support FD_CLOEXEC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--test/ruby/test_process.rb54
-rw-r--r--version.h2
3 files changed, 34 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index 32b8d8dc9b..a7f6f907d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Sun Apr 15 14:54:16 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_process.rb (TestProcess#windows?): new method.
+
+ * test/ruby/test_process.rb (TestProcess#*): use above method.
+
+ * test/ruby/test_process.rb (TestProcess#test_execopts_redirect):
+ windows doesn't support FD_CLOEXEC.
+
Sun Apr 15 06:40:28 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
* include/ruby/win32.h (rb_w32_aspawn_flags): add the declaration of
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index e184b85366..d1e2e1984d 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -16,6 +16,10 @@ class TestProcess < Test::Unit::TestCase
Process.waitall
end
+ def windows?
+ return /mswin|mingw|bccwin/ =~ RUBY_PLATFORM
+ end
+
def write_file(filename, content)
File.open(filename, "w") {|f|
f << content
@@ -154,7 +158,7 @@ class TestProcess < Test::Unit::TestCase
end
def test_execopts_pgroup
- skip "system(:pgroup) is not supported" if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ skip "system(:pgroup) is not supported" if windows?
assert_nothing_raised { system(*TRUECOMMAND, :pgroup=>false) }
io = IO.popen([RUBY, "-e", "print Process.getpgrp"])
@@ -326,7 +330,7 @@ class TestProcess < Test::Unit::TestCase
UMASK = [RUBY, '-e', 'printf "%04o\n", File.umask']
def test_execopts_umask
- skip "umask is not supported" if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ skip "umask is not supported" if windows?
IO.popen([*UMASK, :umask => 0]) {|io|
assert_equal("0000", io.read.chomp)
}
@@ -368,7 +372,7 @@ class TestProcess < Test::Unit::TestCase
with_tmpchdir {|d|
Process.wait Process.spawn(*ECHO["a"], STDOUT=>["out", File::WRONLY|File::CREAT|File::TRUNC, 0644])
assert_equal("a", File.read("out").chomp)
- if /mswin|mingw/ =~ RUBY_PLATFORM
+ if windows?
# currently telling to child the file modes is not supported.
open("out", "a") {|f| f.write "0\n"}
else
@@ -391,18 +395,14 @@ class TestProcess < Test::Unit::TestCase
assert_equal("d", File.read("out").chomp)
}
opts = {STDOUT=>["out", File::WRONLY|File::CREAT|File::TRUNC, 0644]}
- if /mswin|mingw/ !~ RUBY_PLATFORM
- opts.merge(3=>STDOUT, 4=>STDOUT, 5=>STDOUT, 6=>STDOUT, 7=>STDOUT)
- end
+ opts.merge(3=>STDOUT, 4=>STDOUT, 5=>STDOUT, 6=>STDOUT, 7=>STDOUT) unless windows?
Process.wait Process.spawn(*ECHO["e"], opts)
assert_equal("e", File.read("out").chomp)
opts = {STDOUT=>["out", File::WRONLY|File::CREAT|File::TRUNC, 0644]}
- if /mswin|mingw/ !~ RUBY_PLATFORM
- opts.merge(3=>0, 4=>:in, 5=>STDIN, 6=>1, 7=>:out, 8=>STDOUT, 9=>2, 10=>:err, 11=>STDERR)
- end
+ opts.merge(3=>0, 4=>:in, 5=>STDIN, 6=>1, 7=>:out, 8=>STDOUT, 9=>2, 10=>:err, 11=>STDERR) unless windows?
Process.wait Process.spawn(*ECHO["ee"], opts)
assert_equal("ee", File.read("out").chomp)
- if /mswin|mingw/ !~ RUBY_PLATFORM
+ unless windows?
# passing non-stdio fds is not supported on Windows
File.open("out", "w") {|f|
h = {STDOUT=>f, f=>STDOUT}
@@ -428,7 +428,7 @@ class TestProcess < Test::Unit::TestCase
Process.wait Process.spawn(*SORT, STDIN=>"out", STDOUT=>"out2")
assert_equal("ggg\nhhh\n", File.read("out2"))
- if /mswin|mingw/ !~ RUBY_PLATFORM
+ unless windows?
# passing non-stdio fds is not supported on Windows
assert_raise(Errno::ENOENT) {
Process.wait Process.spawn("non-existing-command", (3..60).to_a=>["err", File::WRONLY|File::CREAT])
@@ -443,7 +443,9 @@ class TestProcess < Test::Unit::TestCase
with_pipe {|r1, w1|
with_pipe {|r2, w2|
- pid = spawn(*SORT, STDIN=>r1, STDOUT=>w2, w1=>:close, r2=>:close)
+ opts = {STDIN=>r1, STDOUT=>w2}
+ opts.merge(w1=>:close, r2=>:close) unless windows?
+ pid = spawn(*SORT, opts)
r1.close
w2.close
w1.puts "c"
@@ -456,7 +458,7 @@ class TestProcess < Test::Unit::TestCase
}
}
- if /mswin|mingw/ !~ RUBY_PLATFORM
+ unless windows?
# passing non-stdio fds is not supported on Windows
with_pipes(5) {|pipes|
ios = pipes.flatten
@@ -528,9 +530,7 @@ class TestProcess < Test::Unit::TestCase
STDERR=>"out", STDOUT=>[:child, STDERR])
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
+ skip "inheritance of fd other than stdin,stdout and stderr is not supported" if windows?
Process.wait spawn(RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'",
STDOUT=>"out",
STDERR=>[:child, 3],
@@ -573,9 +573,7 @@ class TestProcess < Test::Unit::TestCase
assert_raise(ArgumentError) {
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
+ skip "inheritance of fd other than stdin,stdout and stderr is not supported" if windows?
with_pipe {|r, w|
IO.popen([RUBY, '-e', 'IO.new(3, "w").puts("a"); puts "b"', 3=>w]) {|io|
assert_equal("b\n", io.read)
@@ -604,9 +602,7 @@ class TestProcess < Test::Unit::TestCase
end
def test_fd_inheritance
- if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
- skip "inheritance of fd other than stdin,stdout and stderr is not supported"
- end
+ skip "inheritance of fd other than stdin,stdout and stderr is not supported" if windows?
with_pipe {|r, w|
system(RUBY, '-e', 'IO.new(ARGV[0].to_i, "w").puts(:ba)', w.fileno.to_s)
w.close
@@ -648,9 +644,7 @@ class TestProcess < Test::Unit::TestCase
end
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
+ skip "inheritance of fd other than stdin,stdout and stderr is not supported" if windows?
with_tmpchdir {|d|
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)
@@ -854,7 +848,7 @@ class TestProcess < Test::Unit::TestCase
assert_equal(pid, status.pid)
assert(status.exited?)
assert_equal(6, status.exitstatus)
- if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ if windows?
expected = "hehe ppid=#{status.pid}"
else
expected = "hehe pid=#{status.pid} ppid=#{$$}"
@@ -883,7 +877,7 @@ class TestProcess < Test::Unit::TestCase
assert_match(/\Ataki pid=\d+ ppid=\d+\z/, result2)
assert_not_equal(result1[/\d+/].to_i, status.pid)
- if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ if windows?
Dir.mkdir(path = "path with space")
write_file(bat = path + "/bat test.bat", "@echo %1>out")
system(bat, "foo 'bar'")
@@ -915,7 +909,7 @@ class TestProcess < Test::Unit::TestCase
assert_match(/\Atake pid=\d+ ppid=\d+\z/, result2)
assert_not_equal(result1[/\d+/].to_i, status.pid)
- if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ if windows?
Dir.mkdir(path = "path with space")
write_file(bat = path + "/bat test.bat", "@echo %1>out")
pid = spawn(bat, "foo 'bar'")
@@ -953,7 +947,7 @@ class TestProcess < Test::Unit::TestCase
assert_match(/\Atako pid=\d+ ppid=\d+\ntika pid=\d+ ppid=\d+\n\z/, result)
assert_not_equal(result[/\d+/].to_i, status.pid)
- if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ if windows?
Dir.mkdir(path = "path with space")
write_file(bat = path + "/bat test.bat", "@echo %1")
r = IO.popen([bat, "foo 'bar'"]) {|f| f.read}
@@ -1258,7 +1252,7 @@ class TestProcess < Test::Unit::TestCase
end
def test_system_sigpipe
- return if /mswin|mingw/ =~ RUBY_PLATFORM
+ return if windows?
pid = 0
diff --git a/version.h b/version.h
index 7b29721ae9..b255e86065 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 182
+#define RUBY_PATCHLEVEL 183
#define RUBY_RELEASE_DATE "2012-04-15"
#define RUBY_RELEASE_YEAR 2012