class Grntest::ExecutionContext
Attributes
abort_tag[RW]
base_directory[RW]
benchmarks[RW]
collect_query_log[W]
db_path[RW]
debug[W]
default_read_timeout[RW]
default_timeout[RW]
groonga_suggest_create_dataset[RW]
groonga_synonym_generate[RW]
input_type[RW]
interface[RW]
logging[W]
on_error[RW]
output_type[RW]
platform[RW]
plugin_extension[RW]
plugins_directory[RW]
read_timeout[RW]
result[RW]
shutdown_wait_timeout[RW]
suppress_backtrace[W]
temporary_directory_path[RW]
testee[RW]
timeout[RW]
use_http_chunked[W]
use_http_post[W]
Public Class Methods
new()
click to toggle source
# File lib/grntest/execution-context.rb, line 43 def initialize @logging = true @base_directory = Pathname(".") @temporary_directory_path = Pathname("tmp") @db_path = Pathname("db") @plugins_directory = nil @plugin_extension = guess_plugin_extension @groonga_suggest_create_dataset = "groonga-suggest-create-dataset" @groonga_synonym_generate = "groonga-synonym-generate" @testee = "groonga" @interface = "stdio" @n_nested = 0 @result = [] @use_http_post = false @use_http_chunked = false @input_type = "json" @output_type = "json" @log = nil @query_log = nil @on_error = :default @abort_tag = nil @timeout = 0 @read_timeout = 5 @default_timeout = @timeout @default_read_timeout = @read_timeout @shutdown_wait_timeout = 5 @omitted = false @suppress_backtrace = true @collect_query_log = false @debug = false @platform = guess_platform @benchmarks = [] end
Public Instance Methods
abort()
click to toggle source
# File lib/grntest/execution-context.rb, line 157 def abort throw @abort_tag end
close_logs()
click to toggle source
# File lib/grntest/execution-context.rb, line 161 def close_logs if @log @log.close @log = nil end if @query_log @query_log.close @query_log = nil end end
collect_query_log?()
click to toggle source
# File lib/grntest/execution-context.rb, line 93 def collect_query_log? @collect_query_log end
debug?()
click to toggle source
# File lib/grntest/execution-context.rb, line 97 def debug? @debug end
error()
click to toggle source
# File lib/grntest/execution-context.rb, line 145 def error case @on_error when :omit omit end end
execute() { || ... }
click to toggle source
# File lib/grntest/execution-context.rb, line 101 def execute @n_nested += 1 yield ensure @n_nested -= 1 end
libtool_directory()
click to toggle source
# File lib/grntest/execution-context.rb, line 132 def libtool_directory @plugins_directory.find do |sub_path| if sub_path.directory? and sub_path.basename.to_s == ".libs" return ".libs/" end end "" end
log()
click to toggle source
# File lib/grntest/execution-context.rb, line 116 def log @log ||= File.open(log_path.to_s, "a+") end
log_path()
click to toggle source
# File lib/grntest/execution-context.rb, line 112 def log_path @temporary_directory_path + "groonga.log" end
logging?()
click to toggle source
# File lib/grntest/execution-context.rb, line 77 def logging? @logging end
omit()
click to toggle source
# File lib/grntest/execution-context.rb, line 152 def omit @omitted = true abort end
omitted?()
click to toggle source
# File lib/grntest/execution-context.rb, line 141 def omitted? @omitted end
query_log()
click to toggle source
# File lib/grntest/execution-context.rb, line 124 def query_log @query_log ||= File.open(query_log_path.to_s, "a+") end
query_log_path()
click to toggle source
# File lib/grntest/execution-context.rb, line 120 def query_log_path @temporary_directory_path + "groonga.query.log" end
relative_db_path()
click to toggle source
# File lib/grntest/execution-context.rb, line 128 def relative_db_path @db_path.relative_path_from(@temporary_directory_path) end
suppress_backtrace?()
click to toggle source
# File lib/grntest/execution-context.rb, line 89 def suppress_backtrace? @suppress_backtrace or debug? end
top_level?()
click to toggle source
# File lib/grntest/execution-context.rb, line 108 def top_level? @n_nested == 1 end
use_http_chunked?()
click to toggle source
# File lib/grntest/execution-context.rb, line 85 def use_http_chunked? @use_http_chunked end
use_http_post?()
click to toggle source
# File lib/grntest/execution-context.rb, line 81 def use_http_post? @use_http_post end
Private Instance Methods
guess_platform()
click to toggle source
# File lib/grntest/execution-context.rb, line 183 def guess_platform case RUBY_PLATFORM when /mingw|mswin/ "windows" when /darwin/ "macos" when /linux/ "linux" else "unknown" end end
guess_plugin_extension()
click to toggle source
# File lib/grntest/execution-context.rb, line 174 def guess_plugin_extension case RUBY_PLATFORM when /mingw|mswin/ "dll" else "so" end end