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_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.
-
#interface ⇒ Object
Returns the value of attribute interface.
-
#keep_database ⇒ Object
writeonly
Sets the attribute keep_database.
-
#n_workers ⇒ Object
Returns the value of attribute n_workers.
-
#output ⇒ Object
Returns the value of attribute output.
-
#output_type ⇒ Object
Returns the value of attribute output_type.
- #reporter ⇒ Object
-
#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.
-
#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
- #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
- #valgrind_gen_suppressions? ⇒ Boolean
Constructor Details
#initialize ⇒ Tester
Returns a new instance of Tester.
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/grntest/tester.rb', line 277 def initialize @groonga = "groonga" @groonga_httpd = "groonga-httpd" @groonga_suggest_create_dataset = "groonga-suggest-create-dataset" unless command_exist?(@groonga_suggest_create_dataset) @groonga_suggest_create_dataset = nil end @interface = :stdio @output_type = "json" @testee = "groonga" @base_directory = Pathname(".") @database_path = nil @reporter = nil @n_workers = 1 @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 end |
Instance Attribute Details
#base_directory ⇒ Object
Returns the value of attribute base_directory.
263 264 265 |
# File 'lib/grntest/tester.rb', line 263 def base_directory @base_directory end |
#database_path ⇒ Object
Returns the value of attribute database_path.
263 264 265 |
# File 'lib/grntest/tester.rb', line 263 def database_path @database_path end |
#debug=(value) ⇒ Object (writeonly)
Sets the attribute debug
274 275 276 |
# File 'lib/grntest/tester.rb', line 274 def debug=(value) @debug = value end |
#default_gdb ⇒ Object
Returns the value of attribute default_gdb.
266 267 268 |
# File 'lib/grntest/tester.rb', line 266 def default_gdb @default_gdb end |
#default_valgrind ⇒ Object
Returns the value of attribute default_valgrind.
267 268 269 |
# File 'lib/grntest/tester.rb', line 267 def default_valgrind @default_valgrind end |
#diff ⇒ Object
Returns the value of attribute diff.
263 264 265 |
# File 'lib/grntest/tester.rb', line 263 def diff @diff end |
#diff_options ⇒ Object
Returns the value of attribute diff_options.
263 264 265 |
# File 'lib/grntest/tester.rb', line 263 def @diff_options end |
#exclude_test_patterns ⇒ Object (readonly)
Returns the value of attribute exclude_test_patterns.
276 277 278 |
# File 'lib/grntest/tester.rb', line 276 def exclude_test_patterns @exclude_test_patterns end |
#exclude_test_suite_patterns ⇒ Object (readonly)
Returns the value of attribute exclude_test_suite_patterns.
276 277 278 |
# File 'lib/grntest/tester.rb', line 276 def exclude_test_suite_patterns @exclude_test_suite_patterns end |
#gdb ⇒ Object
Returns the value of attribute gdb.
266 267 268 |
# File 'lib/grntest/tester.rb', line 266 def gdb @gdb end |
#groonga ⇒ Object
Returns the value of attribute groonga.
261 262 263 |
# File 'lib/grntest/tester.rb', line 261 def groonga @groonga end |
#groonga_httpd ⇒ Object
Returns the value of attribute groonga_httpd.
261 262 263 |
# File 'lib/grntest/tester.rb', line 261 def groonga_httpd @groonga_httpd end |
#groonga_suggest_create_dataset ⇒ Object
Returns the value of attribute groonga_suggest_create_dataset.
261 262 263 |
# File 'lib/grntest/tester.rb', line 261 def groonga_suggest_create_dataset @groonga_suggest_create_dataset end |
#interface ⇒ Object
Returns the value of attribute interface.
262 263 264 |
# File 'lib/grntest/tester.rb', line 262 def interface @interface end |
#keep_database=(value) ⇒ Object (writeonly)
Sets the attribute keep_database
270 271 272 |
# File 'lib/grntest/tester.rb', line 270 def keep_database=(value) @keep_database = value end |
#n_workers ⇒ Object
Returns the value of attribute n_workers.
264 265 266 |
# File 'lib/grntest/tester.rb', line 264 def n_workers @n_workers end |
#output ⇒ Object
Returns the value of attribute output.
265 266 267 |
# File 'lib/grntest/tester.rb', line 265 def output @output end |
#output_type ⇒ Object
Returns the value of attribute output_type.
262 263 264 |
# File 'lib/grntest/tester.rb', line 262 def output_type @output_type end |
#reporter ⇒ Object
316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/grntest/tester.rb', line 316 def reporter if @reporter.nil? if @n_workers == 1 :mark else :inplace end else @reporter end end |
#stop_on_failure=(value) ⇒ Object (writeonly)
Sets the attribute stop_on_failure
271 272 273 |
# File 'lib/grntest/tester.rb', line 271 def stop_on_failure=(value) @stop_on_failure = value end |
#suppress_backtrace=(value) ⇒ Object (writeonly)
Sets the attribute suppress_backtrace
273 274 275 |
# File 'lib/grntest/tester.rb', line 273 def suppress_backtrace=(value) @suppress_backtrace = value end |
#suppress_omit_log=(value) ⇒ Object (writeonly)
Sets the attribute suppress_omit_log
272 273 274 |
# File 'lib/grntest/tester.rb', line 272 def suppress_omit_log=(value) @suppress_omit_log = value end |
#test_patterns ⇒ Object (readonly)
Returns the value of attribute test_patterns.
275 276 277 |
# File 'lib/grntest/tester.rb', line 275 def test_patterns @test_patterns end |
#test_suite_patterns ⇒ Object (readonly)
Returns the value of attribute test_suite_patterns.
275 276 277 |
# File 'lib/grntest/tester.rb', line 275 def test_suite_patterns @test_suite_patterns end |
#testee ⇒ Object
Returns the value of attribute testee.
262 263 264 |
# File 'lib/grntest/tester.rb', line 262 def testee @testee end |
#timeout ⇒ Object
Returns the value of attribute timeout.
268 269 270 |
# File 'lib/grntest/tester.rb', line 268 def timeout @timeout end |
#use_color=(value) ⇒ Object (writeonly)
Sets the attribute use_color
270 271 272 |
# File 'lib/grntest/tester.rb', line 270 def use_color=(value) @use_color = value end |
#valgrind ⇒ Object
Returns the value of attribute valgrind.
267 268 269 |
# File 'lib/grntest/tester.rb', line 267 def valgrind @valgrind end |
#valgrind_gen_suppressions=(value) ⇒ Object (writeonly)
Sets the attribute valgrind_gen_suppressions
269 270 271 |
# File 'lib/grntest/tester.rb', line 269 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
351 352 353 |
# File 'lib/grntest/tester.rb', line 351 def debug? @debug end |
#excluded_test?(test_name) ⇒ Boolean
370 371 372 373 374 |
# File 'lib/grntest/tester.rb', line 370 def excluded_test?(test_name) @exclude_test_patterns.any? do |pattern| pattern === test_name end end |
#excluded_test_suite?(test_suite_name) ⇒ Boolean
388 389 390 391 392 |
# File 'lib/grntest/tester.rb', line 388 def excluded_test_suite?(test_suite_name) @exclude_test_suite_patterns.any? do |pattern| pattern === test_suite_name end end |
#keep_database? ⇒ Boolean
328 329 330 |
# File 'lib/grntest/tester.rb', line 328 def keep_database? @keep_database end |
#run(*targets) ⇒ Object
308 309 310 311 312 313 314 |
# File 'lib/grntest/tester.rb', line 308 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
363 364 365 366 367 368 |
# File 'lib/grntest/tester.rb', line 363 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
381 382 383 384 385 386 |
# File 'lib/grntest/tester.rb', line 381 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
339 340 341 |
# File 'lib/grntest/tester.rb', line 339 def stop_on_failure? @stop_on_failure end |
#suppress_backtrace? ⇒ Boolean
347 348 349 |
# File 'lib/grntest/tester.rb', line 347 def suppress_backtrace? @suppress_backtrace end |
#suppress_omit_log? ⇒ Boolean
343 344 345 |
# File 'lib/grntest/tester.rb', line 343 def suppress_omit_log? @suppress_omit_log end |
#target_test?(test_name) ⇒ Boolean
359 360 361 |
# File 'lib/grntest/tester.rb', line 359 def target_test?(test_name) selected_test?(test_name) and not excluded_test?(test_name) end |
#target_test_suite?(test_suite_name) ⇒ Boolean
376 377 378 379 |
# File 'lib/grntest/tester.rb', line 376 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
332 333 334 335 336 337 |
# File 'lib/grntest/tester.rb', line 332 def use_color? if @use_color.nil? @use_color = guess_color_availability end @use_color end |
#valgrind_gen_suppressions? ⇒ Boolean
355 356 357 |
# File 'lib/grntest/tester.rb', line 355 def valgrind_gen_suppressions? @valgrind_gen_suppressions end |