[Groonga-commit] groonga/fluent-plugin-groonga [master] Use the actual file descriptors as expected

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Wed Dec 5 17:52:20 JST 2012


Kouhei Sutou	2012-12-05 17:52:20 +0900 (Wed, 05 Dec 2012)

  New Revision: e14d6a2b75205792092beeec90d3bbcd544f3ced
  https://github.com/groonga/fluent-plugin-groonga/commit/e14d6a2b75205792092beeec90d3bbcd544f3ced

  Log:
    Use the actual file descriptors as expected
    
    Because they are changed dynamically. We only need to test --input-fd
    and --outpu-fd options are used.

  Modified files:
    test/test_output.rb

  Modified: test/test_output.rb (+21 -2)
===================================================================
--- test/test_output.rb    2012-12-05 17:50:23 +0900 (547d545)
+++ test/test_output.rb    2012-12-05 17:52:20 +0900 (2eeb7e7)
@@ -117,6 +117,8 @@ EOC
       @groonga_stub_path = File.join(@temporary_directory, "groonga")
       @command_line_path = File.join(@temporary_directory, "command-line")
       @input_path = File.join(@temporary_directory, "input")
+      @input_fd_path = File.join(@temporary_directory, "input-fd")
+      @output_fd_path = File.join(@temporary_directory, "output-fd")
       @database_path = File.join(@temporary_directory, "database")
 
       File.open(@groonga_stub_path, "w") do |groonga_stub|
@@ -130,6 +132,10 @@ end
 input_fd = ARGV[ARGV.index("--input-fd") + 1]
 input = IO.new(input_fd.to_i)
 
+File.open(#{@input_fd_path.inspect}, "a") do |file|
+  file.print(input_fd)
+end
+
 File.open(#{@input_path.inspect}, "a") do |file|
   input.each_line do |line|
     file.print(line)
@@ -138,6 +144,11 @@ end
 
 output_fd = ARGV[ARGV.index("--output-fd") + 1]
 output = IO.new(output_fd.to_i)
+
+File.open(#{@output_fd_path.inspect}, "a") do |file|
+  file.print(output_fd)
+end
+
 output.puts("done")
 output.flush
 EOR
@@ -170,6 +181,14 @@ EOC
       File.read(@input_path)
     end
 
+    def actual_input_fd
+      File.read(@input_fd_path)
+    end
+
+    def actual_output_fd
+      File.read(@output_fd_path)
+    end
+
     class CommandTest < self
       def test_basic_command
         driver = create_driver("groonga.command.table_create")
@@ -178,8 +197,8 @@ EOC
         driver.run
         assert_equal([
                        [
-                         "--input-fd", "5",
-                         "--output-fd", "8",
+                         "--input-fd", actual_input_fd,
+                         "--output-fd", actual_output_fd,
                          "-n", @database_path,
                        ],
                        "/d/table_create?name=Users\n",
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る