Class: Grntest::Tester

Inherits:
Object
  • Object
show all
Defined in:
lib/grntest/tester.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTester

Returns a new instance of Tester.



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/grntest/tester.rb', line 238

def initialize
  @groonga = "groonga"
  @groonga_httpd = "groonga-httpd"
  @groonga_suggest_create_dataset = "groonga-suggest-create-dataset"
  @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
  @test_patterns = []
  @test_suite_patterns = []
  @exclude_test_patterns = []
  @exclude_test_suite_patterns = []
  detect_suitable_diff
  initialize_debuggers
  initialize_memory_checkers
end

Instance Attribute Details

#base_directoryObject

Returns the value of attribute base_directory.



227
228
229
# File 'lib/grntest/tester.rb', line 227

def base_directory
  @base_directory
end

#database_pathObject

Returns the value of attribute database_path.



227
228
229
# File 'lib/grntest/tester.rb', line 227

def database_path
  @database_path
end

#default_gdbObject

Returns the value of attribute default_gdb.



230
231
232
# File 'lib/grntest/tester.rb', line 230

def default_gdb
  @default_gdb
end

#default_valgrindObject

Returns the value of attribute default_valgrind.



231
232
233
# File 'lib/grntest/tester.rb', line 231

def default_valgrind
  @default_valgrind
end

#diffObject

Returns the value of attribute diff.



227
228
229
# File 'lib/grntest/tester.rb', line 227

def diff
  @diff
end

#diff_optionsObject

Returns the value of attribute diff_options.



227
228
229
# File 'lib/grntest/tester.rb', line 227

def diff_options
  @diff_options
end

#exclude_test_patternsObject (readonly)

Returns the value of attribute exclude_test_patterns.



237
238
239
# File 'lib/grntest/tester.rb', line 237

def exclude_test_patterns
  @exclude_test_patterns
end

#exclude_test_suite_patternsObject (readonly)

Returns the value of attribute exclude_test_suite_patterns.



237
238
239
# File 'lib/grntest/tester.rb', line 237

def exclude_test_suite_patterns
  @exclude_test_suite_patterns
end

#gdbObject

Returns the value of attribute gdb.



230
231
232
# File 'lib/grntest/tester.rb', line 230

def gdb
  @gdb
end

#groongaObject

Returns the value of attribute groonga.



225
226
227
# File 'lib/grntest/tester.rb', line 225

def groonga
  @groonga
end

#groonga_httpdObject

Returns the value of attribute groonga_httpd.



225
226
227
# File 'lib/grntest/tester.rb', line 225

def groonga_httpd
  @groonga_httpd
end

#groonga_suggest_create_datasetObject

Returns the value of attribute groonga_suggest_create_dataset.



225
226
227
# File 'lib/grntest/tester.rb', line 225

def groonga_suggest_create_dataset
  @groonga_suggest_create_dataset
end

#interfaceObject

Returns the value of attribute interface.



226
227
228
# File 'lib/grntest/tester.rb', line 226

def interface
  @interface
end

#keep_database=(value) ⇒ Object (writeonly)

Sets the attribute keep_database

Parameters:

  • value

    the value to set the attribute keep_database to.



233
234
235
# File 'lib/grntest/tester.rb', line 233

def keep_database=(value)
  @keep_database = value
end

#n_workersObject

Returns the value of attribute n_workers.



228
229
230
# File 'lib/grntest/tester.rb', line 228

def n_workers
  @n_workers
end

#outputObject

Returns the value of attribute output.



229
230
231
# File 'lib/grntest/tester.rb', line 229

def output
  @output
end

#output_typeObject

Returns the value of attribute output_type.



226
227
228
# File 'lib/grntest/tester.rb', line 226

def output_type
  @output_type
end

#reporterObject



271
272
273
274
275
276
277
278
279
280
281
# File 'lib/grntest/tester.rb', line 271

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

Parameters:

  • value

    the value to set the attribute stop_on_failure to.



234
235
236
# File 'lib/grntest/tester.rb', line 234

def stop_on_failure=(value)
  @stop_on_failure = value
end

#suppress_omit_log=(value) ⇒ Object (writeonly)

Sets the attribute suppress_omit_log

Parameters:

  • value

    the value to set the attribute suppress_omit_log to.



235
236
237
# File 'lib/grntest/tester.rb', line 235

def suppress_omit_log=(value)
  @suppress_omit_log = value
end

#test_patternsObject (readonly)

Returns the value of attribute test_patterns.



236
237
238
# File 'lib/grntest/tester.rb', line 236

def test_patterns
  @test_patterns
end

#test_suite_patternsObject (readonly)

Returns the value of attribute test_suite_patterns.



236
237
238
# File 'lib/grntest/tester.rb', line 236

def test_suite_patterns
  @test_suite_patterns
end

#testeeObject

Returns the value of attribute testee.



226
227
228
# File 'lib/grntest/tester.rb', line 226

def testee
  @testee
end

#use_color=(value) ⇒ Object (writeonly)

Sets the attribute use_color

Parameters:

  • value

    the value to set the attribute use_color to.



233
234
235
# File 'lib/grntest/tester.rb', line 233

def use_color=(value)
  @use_color = value
end

#valgrindObject

Returns the value of attribute valgrind.



231
232
233
# File 'lib/grntest/tester.rb', line 231

def valgrind
  @valgrind
end

#valgrind_gen_suppressions=(value) ⇒ Object (writeonly)

Sets the attribute valgrind_gen_suppressions

Parameters:

  • value

    the value to set the attribute valgrind_gen_suppressions to.



232
233
234
# File 'lib/grntest/tester.rb', line 232

def valgrind_gen_suppressions=(value)
  @valgrind_gen_suppressions = value
end

Class Method Details

.run(argv = nil) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/grntest/tester.rb', line 25

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

#excluded_test?(test_name) ⇒ Boolean

Returns:

  • (Boolean)


317
318
319
320
321
# File 'lib/grntest/tester.rb', line 317

def excluded_test?(test_name)
  @exclude_test_patterns.any? do |pattern|
    pattern === test_name
  end
end

#excluded_test_suite?(test_suite_name) ⇒ Boolean

Returns:

  • (Boolean)


335
336
337
338
339
# File 'lib/grntest/tester.rb', line 335

def excluded_test_suite?(test_suite_name)
  @exclude_test_suite_patterns.any? do |pattern|
    pattern === test_suite_name
  end
end

#keep_database?Boolean

Returns:

  • (Boolean)


283
284
285
# File 'lib/grntest/tester.rb', line 283

def keep_database?
  @keep_database
end

#run(*targets) ⇒ Object



263
264
265
266
267
268
269
# File 'lib/grntest/tester.rb', line 263

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

Returns:

  • (Boolean)


310
311
312
313
314
315
# File 'lib/grntest/tester.rb', line 310

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

Returns:

  • (Boolean)


328
329
330
331
332
333
# File 'lib/grntest/tester.rb', line 328

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

Returns:

  • (Boolean)


294
295
296
# File 'lib/grntest/tester.rb', line 294

def stop_on_failure?
  @stop_on_failure
end

#suppress_omit_log?Boolean

Returns:

  • (Boolean)


298
299
300
# File 'lib/grntest/tester.rb', line 298

def suppress_omit_log?
  @suppress_omit_log
end

#target_test?(test_name) ⇒ Boolean

Returns:

  • (Boolean)


306
307
308
# File 'lib/grntest/tester.rb', line 306

def target_test?(test_name)
  selected_test?(test_name) and not excluded_test?(test_name)
end

#target_test_suite?(test_suite_name) ⇒ Boolean

Returns:

  • (Boolean)


323
324
325
326
# File 'lib/grntest/tester.rb', line 323

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

Returns:

  • (Boolean)


287
288
289
290
291
292
# File 'lib/grntest/tester.rb', line 287

def use_color?
  if @use_color.nil?
    @use_color = guess_color_availability
  end
  @use_color
end

#valgrind_gen_suppressions?Boolean

Returns:

  • (Boolean)


302
303
304
# File 'lib/grntest/tester.rb', line 302

def valgrind_gen_suppressions?
  @valgrind_gen_suppressions
end