[Groonga-commit] groonga/grntest at 47a709d [master] Add --read-timeout

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Jan 18 12:57:25 JST 2018


Kouhei Sutou	2018-01-18 12:57:25 +0900 (Thu, 18 Jan 2018)

  New Revision: 47a709d0505e716443bf70087616173bf1799e9c
  https://github.com/groonga/grntest/commit/47a709d0505e716443bf70087616173bf1799e9c

  Message:
    Add --read-timeout

  Modified files:
    lib/grntest/execution-context.rb
    lib/grntest/executors/base-executor.rb
    lib/grntest/executors/standard-io-executor.rb
    lib/grntest/test-runner.rb
    lib/grntest/tester.rb

  Modified: lib/grntest/execution-context.rb (+6 -2)
===================================================================
--- lib/grntest/execution-context.rb    2018-01-18 12:30:33 +0900 (5adb1e3)
+++ lib/grntest/execution-context.rb    2018-01-18 12:57:25 +0900 (e3445a4)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2016  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2012-2018  Kouhei Sutou <kou �� clear-code.com>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -23,7 +23,9 @@ module Grntest
     attr_accessor :on_error
     attr_accessor :abort_tag
     attr_accessor :timeout
+    attr_accessor :read_timeout
     attr_accessor :default_timeout
+    attr_accessor :default_read_timeout
     attr_writer :suppress_backtrace
     attr_writer :collect_query_log
     attr_writer :debug
@@ -41,7 +43,9 @@ module Grntest
       @on_error = :default
       @abort_tag = nil
       @timeout = 0
-      @default_timeout = 0
+      @read_timeout = 3
+      @default_timeout = @timeout
+      @default_read_timeout = @read_timeout
       @omitted = false
       @suppress_backtrace = true
       @collect_query_log = false

  Modified: lib/grntest/executors/base-executor.rb (+4 -10)
===================================================================
--- lib/grntest/executors/base-executor.rb    2018-01-18 12:30:33 +0900 (31cba75)
+++ lib/grntest/executors/base-executor.rb    2018-01-18 12:57:25 +0900 (0a9ebb3)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2017  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2012-2018  Kouhei Sutou <kou �� clear-code.com>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -39,9 +39,7 @@ module Grntest
         @loading = false
         @pending_command = ""
         @pending_load_command = nil
-        @current_command_name = nil
         @output_type = nil
-        @read_timeout = default_read_timeout
         @long_read_timeout = default_long_read_timeout
         @context = context
         @custom_important_log_levels = []
@@ -223,8 +221,8 @@ module Grntest
         new_value = timeout_value("read-timeout",
                                   line,
                                   timeout,
-                                  default_read_timeout)
-        @read_timeout = new_value unless new_value.nil?
+                                  @context.default_read_timeout)
+        @context.read_timeout = new_value unless new_value.nil?
       end
 
       def execute_directive_long_read_timeout(line, content, options)
@@ -441,7 +439,7 @@ module Grntest
 
       def read_all_readable_content(output, options={})
         content = ""
-        first_timeout = options[:first_timeout] || @read_timeout
+        first_timeout = options[:first_timeout] || @context.read_timeout
         timeout = first_timeout
         while IO.select([output], [], [], timeout)
           break if output.eof?
@@ -552,10 +550,6 @@ module Grntest
         output
       end
 
-      def default_read_timeout
-        3
-      end
-
       def default_long_read_timeout
         180
       end

  Modified: lib/grntest/executors/standard-io-executor.rb (+1 -3)
===================================================================
--- lib/grntest/executors/standard-io-executor.rb    2018-01-18 12:30:33 +0900 (d8796bc)
+++ lib/grntest/executors/standard-io-executor.rb    2018-01-18 12:57:25 +0900 (4add769)
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012-2013  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2012-2018  Kouhei Sutou <kou �� clear-code.com>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by

  Modified: lib/grntest/test-runner.rb (+2 -0)
===================================================================
--- lib/grntest/test-runner.rb    2018-01-18 12:30:33 +0900 (026da8e)
+++ lib/grntest/test-runner.rb    2018-01-18 12:57:25 +0900 (8f978e0)
@@ -140,7 +140,9 @@ module Grntest
         context.output_type =****@teste*****_type
         context.timeout =****@teste*****
         context.timeout = 0 if****@teste*****
+        context.read_timeout =****@teste*****_timeout
         context.default_timeout = context.timeout
+        context.default_read_timeout = context.read_timeout
         context.suppress_backtrace =****@teste*****_backtrace?
         context.debug =****@teste*****?
         run_groonga(context) do |executor|

  Modified: lib/grntest/tester.rb (+8 -0)
===================================================================
--- lib/grntest/tester.rb    2018-01-18 12:30:33 +0900 (8946493)
+++ lib/grntest/tester.rb    2018-01-18 12:57:25 +0900 (0088c9f)
@@ -218,6 +218,12 @@ module Grntest
           tester.timeout = timeout
         end
 
+        parser.on("--read-timeout=SECOND", Float,
+                  "Timeout for each read in test",
+                  "(#{tester.read_timeout})") do |timeout|
+          tester.read_timeout = timeout
+        end
+
         parser.on("--[no-]debug",
                   "Enable debug information",
                   "(#{tester.debug?})") do |debug|
@@ -266,6 +272,7 @@ module Grntest
     attr_accessor :gdb, :default_gdb
     attr_accessor :valgrind, :default_valgrind
     attr_accessor :timeout
+    attr_accessor :read_timeout
     attr_writer :valgrind_gen_suppressions
     attr_writer :reporter, :keep_database, :use_color
     attr_writer :stop_on_failure
@@ -303,6 +310,7 @@ module Grntest
       initialize_debuggers
       initialize_memory_checkers
       @timeout = 5
+      @read_timeout = 3
     end
 
     def run(*targets)
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180118/436b8d3e/attachment-0001.htm 



More information about the Groonga-commit mailing list
Back to archive index