[Groonga-commit] groonga/grntest at 82cbfbf [master] Add --debug

Back to archive index

Kouhei Sutou null+****@clear*****
Mon May 16 15:16:26 JST 2016


Kouhei Sutou	2016-05-16 15:16:26 +0900 (Mon, 16 May 2016)

  New Revision: 82cbfbf2481cb8e7ae0286789a2ab30fc7245b48
  https://github.com/groonga/grntest/commit/82cbfbf2481cb8e7ae0286789a2ab30fc7245b48

  Message:
    Add --debug

  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 (+7 -3)
===================================================================
--- lib/grntest/execution-context.rb    2016-05-16 13:01:27 +0900 (ab47d72)
+++ lib/grntest/execution-context.rb    2016-05-16 15:16:26 +0900 (4a3c9b3)
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012-2015  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2012-2016  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
@@ -25,6 +23,7 @@ module Grntest
     attr_accessor :on_error
     attr_accessor :abort_tag
     attr_writer :collect_query_log
+    attr_writer :debug
     def initialize
       @logging = true
       @base_directory = Pathname(".")
@@ -40,6 +39,7 @@ module Grntest
       @abort_tag = nil
       @omitted = false
       @collect_query_log = false
+      @debug = false
     end
 
     def logging?
@@ -50,6 +50,10 @@ module Grntest
       @collect_query_log
     end
 
+    def debug?
+      @debug
+    end
+
     def execute
       @n_nested += 1
       yield

  Modified: lib/grntest/executors/base-executor.rb (+15 -0)
===================================================================
--- lib/grntest/executors/base-executor.rb    2016-05-16 13:01:27 +0900 (8f22a75)
+++ lib/grntest/executors/base-executor.rb    2016-05-16 15:16:26 +0900 (ee6eb47)
@@ -408,6 +408,7 @@ module Grntest
           content << read_content
           timeout = 0 if read_content.bytesize < request_bytes
         end
+        debug_output(content)
         content
       end
 
@@ -484,6 +485,20 @@ module Grntest
         end
       end
 
+      def debug_input(input)
+        return unles****@conte*****?
+        $stderr.puts("> #{input}")
+      end
+
+      def debug_output(output)
+        if****@conte*****?
+          output.each_line do |line|
+            $stderr.puts("< #{line}")
+          end
+        end
+        output
+      end
+
       def default_timeout
         3
       end

  Modified: lib/grntest/executors/standard-io-executor.rb (+1 -0)
===================================================================
--- lib/grntest/executors/standard-io-executor.rb    2016-05-16 13:01:27 +0900 (9fac4e1)
+++ lib/grntest/executors/standard-io-executor.rb    2016-05-16 15:16:26 +0900 (34cd150)
@@ -32,6 +32,7 @@ module Grntest
           command_line = command_line.sub(/$/, " --output_type #{@output_type}")
         end
         begin
+          debug_input(command_line)
           @input.print(command_line)
           @input.print("\n")
           @input.flush

  Modified: lib/grntest/test-runner.rb (+1 -0)
===================================================================
--- lib/grntest/test-runner.rb    2016-05-16 13:01:27 +0900 (12066bc)
+++ lib/grntest/test-runner.rb    2016-05-16 15:16:26 +0900 (2ad6e2b)
@@ -135,6 +135,7 @@ module Grntest
         context.groonga_suggest_create_dataset =
           @tester.groonga_suggest_create_dataset
         context.output_type =****@teste*****_type
+        context.debug =****@teste*****?
         run_groonga(context) do |executor|
           begin
             Timeout.timeout(@tester.timeout) do

  Modified: lib/grntest/tester.rb (+12 -0)
===================================================================
--- lib/grntest/tester.rb    2016-05-16 13:01:27 +0900 (99fd72d)
+++ lib/grntest/tester.rb    2016-05-16 15:16:26 +0900 (5e6e6cd)
@@ -212,6 +212,12 @@ module Grntest
           tester.timeout = timeout
         end
 
+        parser.on("--[no-]debug",
+                  "Enable debug information",
+                  "(#{tester.debug?})") do |debug|
+          tester.debug = debug
+        end
+
         parser.on("--version",
                   "Show version and exit") do
           puts(VERSION)
@@ -258,6 +264,7 @@ module Grntest
     attr_writer :reporter, :keep_database, :use_color
     attr_writer :stop_on_failure
     attr_writer :suppress_omit_log
+    attr_writer :debug
     attr_reader :test_patterns, :test_suite_patterns
     attr_reader :exclude_test_patterns, :exclude_test_suite_patterns
     def initialize
@@ -279,6 +286,7 @@ module Grntest
       @use_color = nil
       @stop_on_failure = false
       @suppress_omit_log = true
+      @debug = false
       @test_patterns = []
       @test_suite_patterns = []
       @exclude_test_patterns = []
@@ -328,6 +336,10 @@ module Grntest
       @suppress_omit_log
     end
 
+    def debug?
+      @debug
+    end
+
     def valgrind_gen_suppressions?
       @valgrind_gen_suppressions
     end
-------------- next part --------------
HTML����������������������������...
Download 



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