ruby-changes:16499
From: nobu <ko1@a...>
Date: Wed, 30 Jun 2010 07:29:46 +0900 (JST)
Subject: [ruby-changes:16499] Ruby:r28489 (trunk, ruby_1_9_2): * test/ruby/test_rubyoptions.rb (test_script_from_stdin): by using
nobu 2010-06-30 07:29:12 +0900 (Wed, 30 Jun 2010) New Revision: 28489 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28489 Log: * test/ruby/test_rubyoptions.rb (test_script_from_stdin): by using a pipe, get rid of not-well-defined behavior after the child process terminated in pty. Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/test/ruby/test_rubyoptions.rb trunk/ChangeLog trunk/test/ruby/test_rubyoptions.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 28488) +++ ChangeLog (revision 28489) @@ -1,3 +1,9 @@ +Wed Jun 30 07:29:11 2010 Nobuyoshi Nakada <nobu@r...> + + * test/ruby/test_rubyoptions.rb (test_script_from_stdin): by using + a pipe, get rid of not-well-defined behavior after the child + process terminated in pty. + Wed Jun 30 02:30:26 2010 Yutaka Kanemoto <kanemoto@r...> * thread_pthread.c (get_stack): use pthread_getthrds_np() for AIX. Index: test/ruby/test_rubyoptions.rb =================================================================== --- test/ruby/test_rubyoptions.rb (revision 28488) +++ test/ruby/test_rubyoptions.rb (revision 28489) @@ -431,18 +431,25 @@ end require 'timeout' result = nil - PTY.spawn(EnvUtil.rubybin) do |s, m| + s, w = IO.pipe + PTY.spawn(EnvUtil.rubybin, out: w) do |r, m| + w.close m.print("\C-d") assert_nothing_raised('[ruby-dev:37798]') do - Timeout.timeout(3) {s.read} + result = Timeout.timeout(3) {s.read} end end - PTY.spawn(EnvUtil.rubybin) do |s, m| + s.close + assert_equal("", result, '[ruby-dev:37798]') + s, w = IO.pipe + PTY.spawn(EnvUtil.rubybin, out: w) do |r, m| + w.close m.print("$stdin.read; p $stdin.gets\n\C-d") m.print("abc\n\C-d") m.print("zzz\n") result = s.read end - assert_match(/zzz\r\n"zzz\\n"\r\n\z/, result, '[ruby-core:30910]') + s.close + assert_equal("\"zzz\\n\"\n", result, '[ruby-core:30910]') end end Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 28488) +++ ruby_1_9_2/ChangeLog (revision 28489) @@ -1,3 +1,9 @@ +Wed Jun 30 07:29:11 2010 Nobuyoshi Nakada <nobu@r...> + + * test/ruby/test_rubyoptions.rb (test_script_from_stdin): by using + a pipe, get rid of not-well-defined behavior after the child + process terminated in pty. + Wed Jun 30 02:37:30 2010 Yutaka Kanemoto <kanemoto@r...> * thread_pthread.c (get_stack): use pthread_getthrds_np() for AIX. Index: ruby_1_9_2/test/ruby/test_rubyoptions.rb =================================================================== --- ruby_1_9_2/test/ruby/test_rubyoptions.rb (revision 28488) +++ ruby_1_9_2/test/ruby/test_rubyoptions.rb (revision 28489) @@ -424,18 +424,25 @@ end require 'timeout' result = nil - PTY.spawn(EnvUtil.rubybin) do |s, m| + s, w = IO.pipe + PTY.spawn(EnvUtil.rubybin, out: w) do |r, m| + w.close m.print("\C-d") assert_nothing_raised('[ruby-dev:37798]') do - Timeout.timeout(3) {s.read} + result = Timeout.timeout(3) {s.read} end end - PTY.spawn(EnvUtil.rubybin) do |s, m| + s.close + assert_equal("", result, '[ruby-dev:37798]') + s, w = IO.pipe + PTY.spawn(EnvUtil.rubybin, out: w) do |r, m| + w.close m.print("$stdin.read; p $stdin.gets\n\C-d") m.print("abc\n\C-d") m.print("zzz\n") result = s.read end - assert_match(/zzz\r\n"zzz\\n"\r\n\z/, result, '[ruby-core:30910]') + s.close + assert_equal("\"zzz\\n\"\n", result, '[ruby-core:30910]') end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/