Skip to content

Commit

Permalink
refactor gcov to run using new flow (and tweak flow to support it)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandervoord committed Oct 19, 2024
1 parent 61fb4a5 commit 80601ce
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 20 deletions.
7 changes: 4 additions & 3 deletions lib/ceedling/build_batchinator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def exec(workload:, things:, &block)
yield @queue.pop(true)
end
end
# First, handle thread exceptions (should always be due to empty queue)

# First, handle thread exceptions (should always be due to empty queue)
rescue ThreadError => e
# Typical case: do nothing and allow thread to wind down

Expand All @@ -70,7 +71,7 @@ def exec(workload:, things:, &block)
@loginator.log(e.message, Verbosity::ERRORS)

# Shutdown all worker threads
shutdown_threads(threads) #TODO IT SEEMS LIKE threads MIGHT NOT BE VALID YET
shutdown_threads(threads)

raise(e) # Raise exception again
end
Expand All @@ -84,7 +85,7 @@ def exec(workload:, things:, &block)
@loginator.log(e.message, Verbosity::ERRORS)

# Shutdown all worker threads
shutdown_threads(threads) #TODO IT SEEMS LIKE threads MIGHT NOT BE VALID YET
shutdown_threads(threads)

raise(e) # Raise exception again after intervening
end
Expand Down
5 changes: 3 additions & 2 deletions lib/ceedling/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,13 @@ def generate_object_file_c(
:flags => flags,
:defines => defines,
:list => list,
:dependencies => dependencies
:dependencies => dependencies,
:msg => String(msg)
}

@plugin_manager.pre_compile_execute(arg_hash)

msg = String(msg)
msg = arg_hash[:msg]
msg = @reportinator.generate_module_progress(
operation: "Compiling",
module_name: module_name,
Expand Down
4 changes: 4 additions & 0 deletions lib/ceedling/loginator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,7 @@ def logfile(string, stream='')
end

end

END {
@ceedling[:loginator].wrapup
}
2 changes: 1 addition & 1 deletion lib/ceedling/plugin_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def load_programmatic_plugins(plugins, system_objects)

# Add plugins to hash of all system objects
system_objects[hash[:plugin].downcase().to_sym()] = object
rescue
rescue
@loginator.log( "Exception raised while trying to load plugin: #{hash[:plugin]}", Verbosity::ERRORS )
raise # Raise again for backtrace, etc.
end
Expand Down
10 changes: 5 additions & 5 deletions lib/ceedling/test_invoker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def setup_and_invoke(tests:, context:TEST_SYM, options:{})
testable = mock[:testable]

arg_hash = {
context: TEST_SYM,
context: context,
mock: mock[:name],
test: testable[:name],
input_filepath: details[:input],
Expand Down Expand Up @@ -287,7 +287,7 @@ def setup_and_invoke(tests:, context:TEST_SYM, options:{})
@batchinator.build_step("Test Runners") do
@batchinator.exec(workload: :compile, things: @testables) do |_, details|
arg_hash = {
context: TEST_SYM,
context: context,
mock_list: details[:mock_list],
includes_list: @test_context_extractor.lookup_header_includes_list( details[:filepath] ),
test_filepath: details[:filepath],
Expand Down Expand Up @@ -349,7 +349,7 @@ def setup_and_invoke(tests:, context:TEST_SYM, options:{})
details[:no_link_objects] = test_no_link_objects
details[:results_pass] = test_pass
details[:results_fail] = test_fail
details[:tool] = TOOLS_TEST_COMPILER #TODO: VERIFY THIS GETS REPLACED WHEN IN GCOV OR BULLSEYE MODE
details[:tool] = TOOLS_TEST_COMPILER
end
end
end
Expand All @@ -358,8 +358,8 @@ def setup_and_invoke(tests:, context:TEST_SYM, options:{})
@batchinator.build_step("Building Objects") do
@testables.each do |_, details|
details[:objects].each do |obj|
src = @file_finder.find_build_input_file(filepath: obj, context: TEST_SYM)
compile_test_component(tool: details[:tool], context: TEST_SYM, test: details[:name], source: src, object: obj, msg: details[:msg])
src = @file_finder.find_build_input_file(filepath: obj, context: context)
compile_test_component(tool: details[:tool], context: context, test: details[:name], source: src, object: obj, msg: details[:msg])
end
end
end
Expand Down
23 changes: 14 additions & 9 deletions plugins/gcov/lib/gcov.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,20 @@ def automatic_reporting_enabled?
end

def pre_compile_execute(arg_hash)
source = arg_hash[:source]

# Handle assembly file that comes through
if File.extname(source) == EXTENSION_ASSEMBLY
arg_hash[:tool] = TOOLS_TEST_ASSEMBLER
# If a source file (not unity, mocks, etc.) is to be compiled use code coverage compiler
elsif @configurator.collection_all_source.include?(source)
arg_hash[:tool] = TOOLS_GCOV_COMPILER
arg_hash[:msg] = "Compiling #{File.basename(source)} with coverage..."
if arg_hash[:context] == GCOV_SYM
source = arg_hash[:source]

# If a source file (not unity, mocks, etc.) is to be compiled use code coverage compiler
if (File.extname(source) != EXTENSION_ASSEMBLY) && @configurator.collection_all_source.include?(source)
arg_hash[:tool] = TOOLS_GCOV_COMPILER
arg_hash[:msg] = "Compiling #{File.basename(source)} with coverage..."
end
end
end

def pre_link_execute(arg_hash)
if arg_hash[:context] == GCOV_SYM
arg_hash[:tool] = TOOLS_GCOV_LINKER
end
end

Expand Down

0 comments on commit 80601ce

Please sign in to comment.