Class: TestInvoker

Inherits:
Object show all
Includes:
TestInvokerTypes
Defined in:
lib/ceedling/test_invoker/test_invoker.rb

Instance Method Summary collapse

Instance Method Details

#each_test_with_sourcesObject



83
84
85
86
87
# File 'lib/ceedling/test_invoker/test_invoker.rb', line 83

def each_test_with_sources
  @state.testables.each do |test, _|
    yield( test.to_s, lookup_sources( test: test ) )
  end
end

#lookup_sources(test:) ⇒ Object



89
90
91
# File 'lib/ceedling/test_invoker/test_invoker.rb', line 89

def lookup_sources(test:)
  return @state.testables[test.to_sym].sources
end

#setupObject



31
32
33
# File 'lib/ceedling/test_invoker/test_invoker.rb', line 31

def setup
  @state = nil
end

#setup_and_invoke(tests:, context: TEST_SYM, options: {}) ⇒ Object

Run the test-build pipeline for the given tests.

options: — free-form hash forwarded to every pipeline stage as state.options. Recognized keys (stages not listed read nothing from options):

:build_only   — Boolean. Skip stage 17 (Executing) only. Compile and link
              test executables but do not run them.
:sources_only — Boolean. Skip stages 15-17 (Building Objects, Building Test
              Executables, Executing). Runs only context-extraction/metadata
              stages 1-14, enough to populate each testable's `.sources` —
              i.e. no compiler, linker, or test fixture is invoked.
:test_linker  — Tool config for stage 16 (Building Test Executables). Ignored
              when :sources_only or :build_only skips that stage.
:test_fixture — Tool config for stage 17 (Executing). Ignored when :sources_only
              or :build_only skips that stage.

Other keys occasionally merged in by callers (e.g. :test_compiler, :force_run) are currently not read by any pipeline stage; tool selection for compiling is instead resolved per-context via the pre_compile_execute plugin hook.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/ceedling/test_invoker/test_invoker.rb', line 56

def setup_and_invoke(tests:, context: TEST_SYM, options: {})
  timestamp_s = SystemWrapper.time_stopwatch_s()
  @plugin_manager.pre_test_build( context, timestamp_s )

  @state = PipelineState.new(
    tests:            tests,
    testables:        {},
    context:          context,
    options:          options,
    partials_headers: [],
    partials_sources: [],
    mocks_list:       [],
    objects_list:     [],
    lock:             Mutex.new
  )

  begin
    run_pipeline( build_stage_sequence(), @state )
  rescue StandardError => ex
    @application.register_build_failure
    @loginator.log( ex.message, Verbosity::ERRORS, LogLabels::EXCEPTION )
    @loginator.log_debug_backtrace( ex )
  ensure
    @plugin_manager.post_test_build( context, SystemWrapper.time_stopwatch_s() )
  end
end