[前][次][番号順一覧][スレッド一覧]

ruby-changes:40092

From: nobu <ko1@a...>
Date: Sun, 18 Oct 2015 12:07:45 +0900 (JST)
Subject: [ruby-changes:40092] nobu:r52173 (trunk): test_require.rb: no guarantees to load FIFO

nobu	2015-10-18 12:07:39 +0900 (Sun, 18 Oct 2015)

  New Revision: 52173

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52173

  Log:
    test_require.rb: no guarantees to load FIFO
    
    * test/ruby/test_require.rb (loading_fifo): loading from FIFO is
      not guaranteed, it just should not block the whole process.

  Modified files:
    trunk/test/ruby/test_require.rb
Index: test/ruby/test_require.rb
===================================================================
--- test/ruby/test_require.rb	(revision 52172)
+++ test/ruby/test_require.rb	(revision 52173)
@@ -699,11 +699,12 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L699
       f.close
       File.unlink(f.path)
       File.mkfifo(f.path)
-      assert_separately(["-", f.path], <<-END, timeout: 3)
+      assert_ruby_status(["-", f.path], <<-END, timeout: 3)
       th = Thread.current
       Thread.start {begin sleep(0.001) end until th.stop?; th.raise(IOError)}
-      assert_raise(IOError) do
+      begin
         load(ARGV[0])
+      rescue IOError
       end
       END
     }
@@ -715,7 +716,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L716
       File.unlink(f.path)
       File.mkfifo(f.path)
 
-      assert_separately(["-", f.path], <<-INPUT, timeout: 3)
+      assert_ruby_status(["-", f.path], <<-INPUT, timeout: 3)
       path = ARGV[0]
       th = Thread.current
       Thread.start {
@@ -723,12 +724,11 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L724
           sleep(0.001)
         end until th.stop?
         open(path, File::WRONLY | File::NONBLOCK) {|fifo_w|
-          fifo_w.puts "class C1; FOO='foo'; end"
+          fifo_w.print "__END__\n" # ensure finishing
         }
       }
 
       load(path)
-      assert_equal(C1::FOO, "foo")
     INPUT
     }
   end if defined?(File.mkfifo)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]