Class: Grntest::Tester
- Inherits:
-
Object
- Object
- Grntest::Tester
- Defined in:
- lib/grntest/tester.rb
Instance Attribute Summary collapse
-
#base_directory ⇒ Object
Returns the value of attribute base_directory.
-
#database_path ⇒ Object
Returns the value of attribute database_path.
-
#debug ⇒ Object
writeonly
Sets the attribute debug.
-
#default_gdb ⇒ Object
Returns the value of attribute default_gdb.
-
#default_rr ⇒ Object
Returns the value of attribute default_rr.
-
#default_valgrind ⇒ Object
Returns the value of attribute default_valgrind.
-
#diff ⇒ Object
Returns the value of attribute diff.
-
#diff_options ⇒ Object
Returns the value of attribute diff_options.
-
#exclude_test_patterns ⇒ Object
readonly
Returns the value of attribute exclude_test_patterns.
-
#exclude_test_suite_patterns ⇒ Object
readonly
Returns the value of attribute exclude_test_suite_patterns.
-
#gdb ⇒ Object
Returns the value of attribute gdb.
-
#groonga ⇒ Object
Returns the value of attribute groonga.
-
#groonga_httpd ⇒ Object
Returns the value of attribute groonga_httpd.
-
#groonga_suggest_create_dataset ⇒ Object
Returns the value of attribute groonga_suggest_create_dataset.
-
#groonga_synonym_generate ⇒ Object
Returns the value of attribute groonga_synonym_generate.
-
#input_type ⇒ Object
Returns the value of attribute input_type.
-
#interface ⇒ Object
Returns the value of attribute interface.
-
#keep_database ⇒ Object
writeonly
Sets the attribute keep_database.
-
#n_retries ⇒ Object
Returns the value of attribute n_retries.
-
#n_workers ⇒ Object
Returns the value of attribute n_workers.
-
#ngx_http_groonga_module_so ⇒ Object
Returns the value of attribute ngx_http_groonga_module_so.
-
#output ⇒ Object
Returns the value of attribute output.
-
#output_type ⇒ Object
Returns the value of attribute output_type.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
- #reporter ⇒ Object
-
#rr ⇒ Object
Returns the value of attribute rr.
-
#shutdown_wait_timeout ⇒ Object
Returns the value of attribute shutdown_wait_timeout.
-
#stop_on_failure ⇒ Object
writeonly
Sets the attribute stop_on_failure.
-
#suppress_backtrace ⇒ Object
writeonly
Sets the attribute suppress_backtrace.
-
#suppress_omit_log ⇒ Object
writeonly
Sets the attribute suppress_omit_log.
-
#test_patterns ⇒ Object
readonly
Returns the value of attribute test_patterns.
-
#test_suite_patterns ⇒ Object
readonly
Returns the value of attribute test_suite_patterns.
-
#testee ⇒ Object
Returns the value of attribute testee.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#use_color ⇒ Object
writeonly
Sets the attribute use_color.
-
#use_http_chunked ⇒ Object
writeonly
Sets the attribute use_http_chunked.
-
#use_http_post ⇒ Object
writeonly
Sets the attribute use_http_post.
-
#valgrind ⇒ Object
Returns the value of attribute valgrind.
-
#valgrind_gen_suppressions ⇒ Object
writeonly
Sets the attribute valgrind_gen_suppressions.
Class Method Summary collapse
Instance Method Summary collapse
- #debug? ⇒ Boolean
- #excluded_test?(test_name) ⇒ Boolean
- #excluded_test_suite?(test_suite_name) ⇒ Boolean
-
#initialize ⇒ Tester
constructor
A new instance of Tester.
- #keep_database? ⇒ Boolean
- #plugins_directory ⇒ Object
- #run(*targets) ⇒ Object
- #selected_test?(test_name) ⇒ Boolean
- #selected_test_suite?(test_suite_name) ⇒ Boolean
- #stop_on_failure? ⇒ Boolean
- #suppress_backtrace? ⇒ Boolean
- #suppress_omit_log? ⇒ Boolean
- #target_test?(test_name) ⇒ Boolean
- #target_test_suite?(test_suite_name) ⇒ Boolean
- #use_color? ⇒ Boolean
- #use_http_chunked? ⇒ Boolean
- #use_http_post? ⇒ Boolean
- #valgrind_gen_suppressions? ⇒ Boolean
Constructor Details
#initialize ⇒ Tester
Returns a new instance of Tester.
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
# File 'lib/grntest/tester.rb', line 374 def initialize @groonga = "groonga" @groonga_httpd = "groonga-httpd" @ngx_http_groonga_module_so = nil @groonga_suggest_create_dataset = "groonga-suggest-create-dataset" unless command_exist?(@groonga_suggest_create_dataset) @groonga_suggest_create_dataset = nil end @groonga_synonym_generate = "groonga-synonym-generate" unless command_exist?(@groonga_synonym_generate) @groonga_synonym_generate = nil end @interface = "stdio" @use_http_post = false @use_http_chunked = false @input_type = "json" @output_type = "json" @testee = "groonga" @base_directory = Pathname(".") @database_path = nil @reporter = nil @n_workers = guess_n_cores @output = $stdout @keep_database = false @use_color = nil @stop_on_failure = false @suppress_omit_log = true @suppress_backtrace = true @debug = false @test_patterns = [] @test_suite_patterns = [] @exclude_test_patterns = [] @exclude_test_suite_patterns = [] detect_suitable_diff initialize_debuggers initialize_memory_checkers @timeout = 5 @read_timeout = 3 @n_retries = 0 @shutdown_wait_timeout = 5 end |
Instance Attribute Details
#base_directory ⇒ Object
Returns the value of attribute base_directory.
356 357 358 |
# File 'lib/grntest/tester.rb', line 356 def base_directory @base_directory end |
#database_path ⇒ Object
Returns the value of attribute database_path.
356 357 358 |
# File 'lib/grntest/tester.rb', line 356 def database_path @database_path end |
#debug=(value) ⇒ Object (writeonly)
Sets the attribute debug
369 370 371 |
# File 'lib/grntest/tester.rb', line 369 def debug=(value) @debug = value end |
#default_gdb ⇒ Object
Returns the value of attribute default_gdb.
359 360 361 |
# File 'lib/grntest/tester.rb', line 359 def default_gdb @default_gdb end |
#default_rr ⇒ Object
Returns the value of attribute default_rr.
360 361 362 |
# File 'lib/grntest/tester.rb', line 360 def default_rr @default_rr end |
#default_valgrind ⇒ Object
Returns the value of attribute default_valgrind.
361 362 363 |
# File 'lib/grntest/tester.rb', line 361 def default_valgrind @default_valgrind end |
#diff ⇒ Object
Returns the value of attribute diff.
356 357 358 |
# File 'lib/grntest/tester.rb', line 356 def diff @diff end |
#diff_options ⇒ Object
Returns the value of attribute diff_options.
356 357 358 |
# File 'lib/grntest/tester.rb', line 356 def @diff_options end |
#exclude_test_patterns ⇒ Object (readonly)
Returns the value of attribute exclude_test_patterns.
371 372 373 |
# File 'lib/grntest/tester.rb', line 371 def exclude_test_patterns @exclude_test_patterns end |
#exclude_test_suite_patterns ⇒ Object (readonly)
Returns the value of attribute exclude_test_suite_patterns.
371 372 373 |
# File 'lib/grntest/tester.rb', line 371 def exclude_test_suite_patterns @exclude_test_suite_patterns end |
#gdb ⇒ Object
Returns the value of attribute gdb.
359 360 361 |
# File 'lib/grntest/tester.rb', line 359 def gdb @gdb end |
#groonga ⇒ Object
Returns the value of attribute groonga.
345 346 347 |
# File 'lib/grntest/tester.rb', line 345 def groonga @groonga end |
#groonga_httpd ⇒ Object
Returns the value of attribute groonga_httpd.
346 347 348 |
# File 'lib/grntest/tester.rb', line 346 def groonga_httpd @groonga_httpd end |
#groonga_suggest_create_dataset ⇒ Object
Returns the value of attribute groonga_suggest_create_dataset.
348 349 350 |
# File 'lib/grntest/tester.rb', line 348 def groonga_suggest_create_dataset @groonga_suggest_create_dataset end |
#groonga_synonym_generate ⇒ Object
Returns the value of attribute groonga_synonym_generate.
349 350 351 |
# File 'lib/grntest/tester.rb', line 349 def groonga_synonym_generate @groonga_synonym_generate end |
#input_type ⇒ Object
Returns the value of attribute input_type.
353 354 355 |
# File 'lib/grntest/tester.rb', line 353 def input_type @input_type end |
#interface ⇒ Object
Returns the value of attribute interface.
350 351 352 |
# File 'lib/grntest/tester.rb', line 350 def interface @interface end |
#keep_database=(value) ⇒ Object (writeonly)
Sets the attribute keep_database
365 366 367 |
# File 'lib/grntest/tester.rb', line 365 def keep_database=(value) @keep_database = value end |
#n_retries ⇒ Object
Returns the value of attribute n_retries.
372 373 374 |
# File 'lib/grntest/tester.rb', line 372 def n_retries @n_retries end |
#n_workers ⇒ Object
Returns the value of attribute n_workers.
357 358 359 |
# File 'lib/grntest/tester.rb', line 357 def n_workers @n_workers end |
#ngx_http_groonga_module_so ⇒ Object
Returns the value of attribute ngx_http_groonga_module_so.
347 348 349 |
# File 'lib/grntest/tester.rb', line 347 def ngx_http_groonga_module_so @ngx_http_groonga_module_so end |
#output ⇒ Object
Returns the value of attribute output.
358 359 360 |
# File 'lib/grntest/tester.rb', line 358 def output @output end |
#output_type ⇒ Object
Returns the value of attribute output_type.
354 355 356 |
# File 'lib/grntest/tester.rb', line 354 def output_type @output_type end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
363 364 365 |
# File 'lib/grntest/tester.rb', line 363 def read_timeout @read_timeout end |
#reporter ⇒ Object
424 425 426 427 428 429 430 431 432 433 434 |
# File 'lib/grntest/tester.rb', line 424 def reporter if @reporter.nil? if @n_workers == 1 :mark else :progress end else @reporter end end |
#rr ⇒ Object
Returns the value of attribute rr.
360 361 362 |
# File 'lib/grntest/tester.rb', line 360 def rr @rr end |
#shutdown_wait_timeout ⇒ Object
Returns the value of attribute shutdown_wait_timeout.
373 374 375 |
# File 'lib/grntest/tester.rb', line 373 def shutdown_wait_timeout @shutdown_wait_timeout end |
#stop_on_failure=(value) ⇒ Object (writeonly)
Sets the attribute stop_on_failure
366 367 368 |
# File 'lib/grntest/tester.rb', line 366 def stop_on_failure=(value) @stop_on_failure = value end |
#suppress_backtrace=(value) ⇒ Object (writeonly)
Sets the attribute suppress_backtrace
368 369 370 |
# File 'lib/grntest/tester.rb', line 368 def suppress_backtrace=(value) @suppress_backtrace = value end |
#suppress_omit_log=(value) ⇒ Object (writeonly)
Sets the attribute suppress_omit_log
367 368 369 |
# File 'lib/grntest/tester.rb', line 367 def suppress_omit_log=(value) @suppress_omit_log = value end |
#test_patterns ⇒ Object (readonly)
Returns the value of attribute test_patterns.
370 371 372 |
# File 'lib/grntest/tester.rb', line 370 def test_patterns @test_patterns end |
#test_suite_patterns ⇒ Object (readonly)
Returns the value of attribute test_suite_patterns.
370 371 372 |
# File 'lib/grntest/tester.rb', line 370 def test_suite_patterns @test_suite_patterns end |
#testee ⇒ Object
Returns the value of attribute testee.
355 356 357 |
# File 'lib/grntest/tester.rb', line 355 def testee @testee end |
#timeout ⇒ Object
Returns the value of attribute timeout.
362 363 364 |
# File 'lib/grntest/tester.rb', line 362 def timeout @timeout end |
#use_color=(value) ⇒ Object (writeonly)
Sets the attribute use_color
365 366 367 |
# File 'lib/grntest/tester.rb', line 365 def use_color=(value) @use_color = value end |
#use_http_chunked=(value) ⇒ Object (writeonly)
Sets the attribute use_http_chunked
352 353 354 |
# File 'lib/grntest/tester.rb', line 352 def use_http_chunked=(value) @use_http_chunked = value end |
#use_http_post=(value) ⇒ Object (writeonly)
Sets the attribute use_http_post
351 352 353 |
# File 'lib/grntest/tester.rb', line 351 def use_http_post=(value) @use_http_post = value end |
#valgrind ⇒ Object
Returns the value of attribute valgrind.
361 362 363 |
# File 'lib/grntest/tester.rb', line 361 def valgrind @valgrind end |
#valgrind_gen_suppressions=(value) ⇒ Object (writeonly)
Sets the attribute valgrind_gen_suppressions
364 365 366 |
# File 'lib/grntest/tester.rb', line 364 def valgrind_gen_suppressions=(value) @valgrind_gen_suppressions = value end |
Class Method Details
.run(argv = nil) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/grntest/tester.rb', line 26 def run(argv=nil) argv ||= ARGV.dup tester = new catch do |tag| parser = create_option_parser(tester, tag) targets = parser.parse!(argv) tester.run(*targets) end end |
Instance Method Details
#debug? ⇒ Boolean
467 468 469 |
# File 'lib/grntest/tester.rb', line 467 def debug? @debug end |
#excluded_test?(test_name) ⇒ Boolean
486 487 488 489 490 |
# File 'lib/grntest/tester.rb', line 486 def excluded_test?(test_name) @exclude_test_patterns.any? do |pattern| pattern === test_name end end |
#excluded_test_suite?(test_suite_name) ⇒ Boolean
504 505 506 507 508 |
# File 'lib/grntest/tester.rb', line 504 def excluded_test_suite?(test_suite_name) @exclude_test_suite_patterns.any? do |pattern| pattern === test_suite_name end end |
#keep_database? ⇒ Boolean
444 445 446 |
# File 'lib/grntest/tester.rb', line 444 def keep_database? @keep_database end |
#plugins_directory ⇒ Object
510 511 512 513 514 515 516 517 518 519 520 521 522 523 |
# File 'lib/grntest/tester.rb', line 510 def plugins_directory groonga_path = Pathname(@groonga) unless groonga_path.absolute? groonga_path = Pathname(resolve_command_path(@groonga)). end base_dir = groonga_path.parent.parent installed_plugins_dir = base_dir + "lib" + "groonga" + "plugins" build_plugins_dir = base_dir + "plugins" if installed_plugins_dir.exist? installed_plugins_dir else build_plugins_dir end end |
#run(*targets) ⇒ Object
416 417 418 419 420 421 422 |
# File 'lib/grntest/tester.rb', line 416 def run(*targets) succeeded = true return succeeded if targets.empty? test_suites = load_tests(*targets) run_test_suites(test_suites) end |
#selected_test?(test_name) ⇒ Boolean
479 480 481 482 483 484 |
# File 'lib/grntest/tester.rb', line 479 def selected_test?(test_name) return true if @test_patterns.empty? @test_patterns.any? do |pattern| pattern === test_name end end |
#selected_test_suite?(test_suite_name) ⇒ Boolean
497 498 499 500 501 502 |
# File 'lib/grntest/tester.rb', line 497 def selected_test_suite?(test_suite_name) return true if @test_suite_patterns.empty? @test_suite_patterns.any? do |pattern| pattern === test_suite_name end end |
#stop_on_failure? ⇒ Boolean
455 456 457 |
# File 'lib/grntest/tester.rb', line 455 def stop_on_failure? @stop_on_failure end |
#suppress_backtrace? ⇒ Boolean
463 464 465 |
# File 'lib/grntest/tester.rb', line 463 def suppress_backtrace? @suppress_backtrace end |
#suppress_omit_log? ⇒ Boolean
459 460 461 |
# File 'lib/grntest/tester.rb', line 459 def suppress_omit_log? @suppress_omit_log end |
#target_test?(test_name) ⇒ Boolean
475 476 477 |
# File 'lib/grntest/tester.rb', line 475 def target_test?(test_name) selected_test?(test_name) and not excluded_test?(test_name) end |
#target_test_suite?(test_suite_name) ⇒ Boolean
492 493 494 495 |
# File 'lib/grntest/tester.rb', line 492 def target_test_suite?(test_suite_name) selected_test_suite?(test_suite_name) and not excluded_test_suite?(test_suite_name) end |
#use_color? ⇒ Boolean
448 449 450 451 452 453 |
# File 'lib/grntest/tester.rb', line 448 def use_color? if @use_color.nil? @use_color = guess_color_availability end @use_color end |
#use_http_chunked? ⇒ Boolean
440 441 442 |
# File 'lib/grntest/tester.rb', line 440 def use_http_chunked? @use_http_chunked end |
#use_http_post? ⇒ Boolean
436 437 438 |
# File 'lib/grntest/tester.rb', line 436 def use_http_post? @use_http_post end |
#valgrind_gen_suppressions? ⇒ Boolean
471 472 473 |
# File 'lib/grntest/tester.rb', line 471 def valgrind_gen_suppressions? @valgrind_gen_suppressions end |