summaryrefslogtreecommitdiff
path: root/test/vendor/ceedling/lib
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-11-01 17:48:59 +0700
committerhathach <[email protected]>2019-11-01 17:48:59 +0700
commitb25faa97c2881f6f759188a8e104f1d9f5c18999 (patch)
tree2d15f4ddd835ab1c992f4a71ff62d3ea20d134bb /test/vendor/ceedling/lib
parent774a9f63ab1c41b589fffa13b56e78bdfe121d96 (diff)
update ceedling to 0.29.0
Diffstat (limited to 'test/vendor/ceedling/lib')
-rw-r--r--test/vendor/ceedling/lib/ceedling/cacheinator.rb11
-rw-r--r--test/vendor/ceedling/lib/ceedling/cacheinator_helper.rb21
-rw-r--r--test/vendor/ceedling/lib/ceedling/configurator.rb9
-rw-r--r--test/vendor/ceedling/lib/ceedling/configurator_builder.rb7
-rw-r--r--test/vendor/ceedling/lib/ceedling/constants.rb2
-rw-r--r--test/vendor/ceedling/lib/ceedling/dependinator.rb23
-rw-r--r--test/vendor/ceedling/lib/ceedling/generator.rb9
-rw-r--r--test/vendor/ceedling/lib/ceedling/generator_test_results.rb18
-rw-r--r--test/vendor/ceedling/lib/ceedling/generator_test_runner.rb8
-rw-r--r--test/vendor/ceedling/lib/ceedling/objects.yml3
-rw-r--r--test/vendor/ceedling/lib/ceedling/preprocessinator.rb3
-rw-r--r--test/vendor/ceedling/lib/ceedling/preprocessinator_includes_handler.rb91
-rw-r--r--test/vendor/ceedling/lib/ceedling/project_config_manager.rb13
-rw-r--r--test/vendor/ceedling/lib/ceedling/rules_tests.rake4
-rw-r--r--test/vendor/ceedling/lib/ceedling/stream_wrapper.rb10
-rw-r--r--test/vendor/ceedling/lib/ceedling/task_invoker.rb26
-rw-r--r--test/vendor/ceedling/lib/ceedling/tasks_base.rake1
-rw-r--r--test/vendor/ceedling/lib/ceedling/tasks_filesystem.rake5
-rw-r--r--test/vendor/ceedling/lib/ceedling/tasks_tests.rake7
-rw-r--r--test/vendor/ceedling/lib/ceedling/test_invoker.rb32
-rw-r--r--test/vendor/ceedling/lib/ceedling/tool_executor.rb10
-rw-r--r--test/vendor/ceedling/lib/ceedling/version.rb39
22 files changed, 293 insertions, 59 deletions
diff --git a/test/vendor/ceedling/lib/ceedling/cacheinator.rb b/test/vendor/ceedling/lib/ceedling/cacheinator.rb
index 47953dd99..519a4aab4 100644
--- a/test/vendor/ceedling/lib/ceedling/cacheinator.rb
+++ b/test/vendor/ceedling/lib/ceedling/cacheinator.rb
@@ -26,16 +26,21 @@ class Cacheinator
return cached_filepath
end
-
def diff_cached_test_config?(hash)
cached_filepath = @file_path_utils.form_test_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE)
-
+
return @cacheinator_helper.diff_cached_config?( cached_filepath, hash )
end
+ def diff_cached_test_defines?(files)
+ cached_filepath = @file_path_utils.form_test_build_cache_path(DEFINES_DEPENDENCY_CACHE_FILE)
+
+ return @cacheinator_helper.diff_cached_defines?( cached_filepath, files )
+ end
+
def diff_cached_release_config?(hash)
cached_filepath = @file_path_utils.form_release_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE)
-
+
return @cacheinator_helper.diff_cached_config?( cached_filepath, hash )
end
diff --git a/test/vendor/ceedling/lib/ceedling/cacheinator_helper.rb b/test/vendor/ceedling/lib/ceedling/cacheinator_helper.rb
index cb0ef7813..2a161854b 100644
--- a/test/vendor/ceedling/lib/ceedling/cacheinator_helper.rb
+++ b/test/vendor/ceedling/lib/ceedling/cacheinator_helper.rb
@@ -8,5 +8,24 @@ class CacheinatorHelper
return true if ( (@file_wrapper.exist?(cached_filepath)) and (!(@yaml_wrapper.load(cached_filepath) == hash)) )
return false
end
-
+
+ def diff_cached_defines?(cached_filepath, files)
+ current_defines = COLLECTION_DEFINES_TEST_AND_VENDOR.reject(&:empty?)
+
+ current_dependency = Hash[files.collect { |source| [source, current_defines.dup] }]
+ if not @file_wrapper.exist?(cached_filepath)
+ @yaml_wrapper.dump(cached_filepath, current_dependency)
+ return false
+ end
+
+ dependencies = @yaml_wrapper.load(cached_filepath)
+ if dependencies.values_at(*current_dependency.keys) != current_dependency.values
+ dependencies.merge!(current_dependency)
+ @yaml_wrapper.dump(cached_filepath, dependencies)
+ return true
+ end
+
+ return false
+ end
+
end
diff --git a/test/vendor/ceedling/lib/ceedling/configurator.rb b/test/vendor/ceedling/lib/ceedling/configurator.rb
index 672609b3b..b5ad8982e 100644
--- a/test/vendor/ceedling/lib/ceedling/configurator.rb
+++ b/test/vendor/ceedling/lib/ceedling/configurator.rb
@@ -64,6 +64,8 @@ class Configurator
end
+ # The default values defined in defaults.rb (eg. DEFAULT_TOOLS_TEST) are populated
+ # into @param config
def populate_defaults(config)
new_config = DEFAULT_CEEDLING_CONFIG.deep_clone
new_config.deep_merge!(config)
@@ -184,7 +186,8 @@ class Configurator
plugin_defaults = @configurator_plugins.find_plugin_defaults(config, paths_hash)
config_plugins.each do |plugin|
- config.deep_merge!( @yaml_wrapper.load(plugin) )
+ plugin_config = @yaml_wrapper.load(plugin)
+ config.deep_merge(plugin_config)
end
plugin_defaults.each do |defaults|
@@ -346,6 +349,10 @@ class Configurator
end
def eval_path_list( paths )
+ if paths.kind_of?(Array)
+ paths = Array.new(paths)
+ end
+
paths.flatten.each do |path|
path.replace( @system_wrapper.module_eval( path ) ) if (path =~ RUBY_STRING_REPLACEMENT_PATTERN)
end
diff --git a/test/vendor/ceedling/lib/ceedling/configurator_builder.rb b/test/vendor/ceedling/lib/ceedling/configurator_builder.rb
index cd7d3eb8b..da8a816f5 100644
--- a/test/vendor/ceedling/lib/ceedling/configurator_builder.rb
+++ b/test/vendor/ceedling/lib/ceedling/configurator_builder.rb
@@ -274,10 +274,17 @@ class ConfiguratorBuilder
return {:collection_all_assembly => all_assembly} if ((not in_hash[:release_build_use_assembly]) && (not in_hash[:test_build_use_assembly]))
+ # Sprinkle in all assembly files we can find in the source folders
in_hash[:collection_paths_source].each do |path|
all_assembly.include( File.join(path, "*#{in_hash[:extension_assembly]}") )
end
+ # Also add all assembly files we can find in the support folders
+ in_hash[:collection_paths_support].each do |path|
+ all_assembly.include( File.join(path, "*#{in_hash[:extension_assembly]}") )
+ end
+
+ # Also add files that we are explicitly adding via :files:assembly: section
@file_system_utils.revise_file_list( all_assembly, in_hash[:files_assembly] )
return {:collection_all_assembly => all_assembly}
diff --git a/test/vendor/ceedling/lib/ceedling/constants.rb b/test/vendor/ceedling/lib/ceedling/constants.rb
index 5df68368b..993ce8db2 100644
--- a/test/vendor/ceedling/lib/ceedling/constants.rb
+++ b/test/vendor/ceedling/lib/ceedling/constants.rb
@@ -63,7 +63,7 @@ DEFAULT_CEEDLING_MAIN_PROJECT_FILE = 'project.yml' unless defined?(DEFAULT_CEEDL
DEFAULT_CEEDLING_USER_PROJECT_FILE = 'user.yml' unless defined?(DEFAULT_CEEDLING_USER_PROJECT_FILE) # supplemental user config file
INPUT_CONFIGURATION_CACHE_FILE = 'input.yml' unless defined?(INPUT_CONFIGURATION_CACHE_FILE) # input configuration file dump
-
+DEFINES_DEPENDENCY_CACHE_FILE = 'defines_dependency.yml' unless defined?(DEFINES_DEPENDENCY_CACHE_FILE) # preprocessor definitions for files
TEST_ROOT_NAME = 'test' unless defined?(TEST_ROOT_NAME)
TEST_TASK_ROOT = TEST_ROOT_NAME + ':' unless defined?(TEST_TASK_ROOT)
diff --git a/test/vendor/ceedling/lib/ceedling/dependinator.rb b/test/vendor/ceedling/lib/ceedling/dependinator.rb
index dd6b92737..ebd123772 100644
--- a/test/vendor/ceedling/lib/ceedling/dependinator.rb
+++ b/test/vendor/ceedling/lib/ceedling/dependinator.rb
@@ -38,20 +38,23 @@ class Dependinator
def enhance_runner_dependencies(runner_filepath)
- @rake_wrapper[runner_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
+ @rake_wrapper[runner_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
+ @project_config_manager.test_defines_changed)
end
def enhance_shallow_include_lists_dependencies(include_lists)
include_lists.each do |include_list_filepath|
- @rake_wrapper[include_list_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
+ @rake_wrapper[include_list_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
+ @project_config_manager.test_defines_changed)
end
end
def enhance_preprocesed_file_dependencies(files)
files.each do |filepath|
- @rake_wrapper[filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
+ @rake_wrapper[filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
+ @project_config_manager.test_defines_changed)
end
end
@@ -59,7 +62,8 @@ class Dependinator
def enhance_mock_dependencies(mocks_list)
# if input configuration or ceedling changes, make sure these guys get rebuilt
mocks_list.each do |mock_filepath|
- @rake_wrapper[mock_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
+ @rake_wrapper[mock_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
+ @project_config_manager.test_defines_changed)
@rake_wrapper[mock_filepath].enhance( @configurator.cmock_unity_helper ) if (@configurator.cmock_unity_helper)
end
end
@@ -67,25 +71,28 @@ class Dependinator
def enhance_dependencies_dependencies(dependencies)
dependencies.each do |dependencies_filepath|
- @rake_wrapper[dependencies_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
+ @rake_wrapper[dependencies_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
+ @project_config_manager.test_defines_changed)
end
end
def enhance_test_build_object_dependencies(objects)
objects.each do |object_filepath|
- @rake_wrapper[object_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
+ @rake_wrapper[object_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
+ @project_config_manager.test_defines_changed)
end
end
def enhance_results_dependencies(result_filepath)
- @rake_wrapper[result_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
+ @rake_wrapper[result_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
+ @project_config_manager.test_defines_changed)
end
def setup_test_executable_dependencies(test, objects)
- @rake_wrapper.create_file_task( @file_path_utils.form_test_executable_filepath(test), objects)
+ @rake_wrapper.create_file_task( @file_path_utils.form_test_executable_filepath(test), objects )
end
end
diff --git a/test/vendor/ceedling/lib/ceedling/generator.rb b/test/vendor/ceedling/lib/ceedling/generator.rb
index a2c94ec5e..828a0c025 100644
--- a/test/vendor/ceedling/lib/ceedling/generator.rb
+++ b/test/vendor/ceedling/lib/ceedling/generator.rb
@@ -19,6 +19,7 @@ class Generator
def generate_shallow_includes_list(context, file)
+ @streaminator.stdout_puts("Generating include list for #{File.basename(file)}...", Verbosity::NORMAL)
@preprocessinator.preprocess_shallow_includes(file)
end
@@ -92,6 +93,8 @@ class Generator
arg_hash[:list],
arg_hash[:dependencies])
+ @streaminator.stdout_puts("Command: #{command}", Verbosity::DEBUG)
+
begin
shell_result = @tool_executor.exec( command[:line], command[:options] )
rescue ShellExecutionException => ex
@@ -124,6 +127,7 @@ class Generator
arg_hash[:map],
arg_hash[:libraries]
)
+ @streaminator.stdout_puts("Command: #{command}", Verbosity::DEBUG)
begin
shell_result = @tool_executor.exec( command[:line], command[:options] )
@@ -157,9 +161,12 @@ class Generator
# Unity's exit code is equivalent to the number of failed tests, so we tell @tool_executor not to fail out if there are failures
# so that we can run all tests and collect all results
command = @tool_executor.build_command_line(arg_hash[:tool], [], arg_hash[:executable])
+ @streaminator.stdout_puts("Command: #{command}", Verbosity::DEBUG)
command[:options][:boom] = false
shell_result = @tool_executor.exec( command[:line], command[:options] )
- shell_result[:exit_code] = 0 #Don't Let The Failure Count Make Us Believe Things Aren't Working
+
+ #Don't Let The Failure Count Make Us Believe Things Aren't Working
+ shell_result[:exit_code] = 0
@generator_helper.test_results_error_handler(executable, shell_result)
processed = @generator_test_results.process_and_write_results( shell_result,
diff --git a/test/vendor/ceedling/lib/ceedling/generator_test_results.rb b/test/vendor/ceedling/lib/ceedling/generator_test_results.rb
index 67bfce130..1d0c5201f 100644
--- a/test/vendor/ceedling/lib/ceedling/generator_test_results.rb
+++ b/test/vendor/ceedling/lib/ceedling/generator_test_results.rb
@@ -7,7 +7,7 @@ class GeneratorTestResults
constructor :configurator, :generator_test_results_sanity_checker, :yaml_wrapper
def process_and_write_results(unity_shell_result, results_file, test_file)
- output_file = results_file
+ output_file = results_file
results = get_results_structure
@@ -17,10 +17,10 @@ class GeneratorTestResults
# process test statistics
if (unity_shell_result[:output] =~ TEST_STDOUT_STATISTICS_PATTERN)
- results[:counts][:total] = $1.to_i
- results[:counts][:failed] = $2.to_i
+ results[:counts][:total] = $1.to_i
+ results[:counts][:failed] = $2.to_i
results[:counts][:ignored] = $3.to_i
- results[:counts][:passed] = (results[:counts][:total] - results[:counts][:failed] - results[:counts][:ignored])
+ results[:counts][:passed] = (results[:counts][:total] - results[:counts][:failed] - results[:counts][:ignored])
end
# remove test statistics lines
@@ -31,16 +31,16 @@ class GeneratorTestResults
case line
when /(:IGNORE)/
elements = extract_line_elements(line, results[:source][:file])
- results[:ignores] << elements[0]
- results[:stdout] << elements[1] if (!elements[1].nil?)
+ results[:ignores] << elements[0]
+ results[:stdout] << elements[1] if (!elements[1].nil?)
when /(:PASS$)/
elements = extract_line_elements(line, results[:source][:file])
results[:successes] << elements[0]
- results[:stdout] << elements[1] if (!elements[1].nil?)
+ results[:stdout] << elements[1] if (!elements[1].nil?)
when /(:FAIL)/
elements = extract_line_elements(line, results[:source][:file])
- results[:failures] << elements[0]
- results[:stdout] << elements[1] if (!elements[1].nil?)
+ results[:failures] << elements[0]
+ results[:stdout] << elements[1] if (!elements[1].nil?)
else # collect up all other
results[:stdout] << line.chomp
end
diff --git a/test/vendor/ceedling/lib/ceedling/generator_test_runner.rb b/test/vendor/ceedling/lib/ceedling/generator_test_runner.rb
index d3f0a92bc..6999faf96 100644
--- a/test/vendor/ceedling/lib/ceedling/generator_test_runner.rb
+++ b/test/vendor/ceedling/lib/ceedling/generator_test_runner.rb
@@ -15,7 +15,9 @@ class GeneratorTestRunner
pre_test_file = @file_path_utils.form_preprocessed_file_filepath(test_file)
#actually look for the tests using Unity's test runner generator
- tests_and_line_numbers = @test_runner_generator.find_tests(@file_wrapper.read(pre_test_file))
+ contents = @file_wrapper.read(pre_test_file)
+ tests_and_line_numbers = @test_runner_generator.find_tests(contents)
+ @test_runner_generator.find_setup_and_teardown(contents)
#look up the line numbers in the original file
source_lines = @file_wrapper.read(test_file).split("\n")
@@ -31,7 +33,9 @@ class GeneratorTestRunner
end
else
#Just look for the tests using Unity's test runner generator
- tests_and_line_numbers = @test_runner_generator.find_tests(@file_wrapper.read(test_file))
+ contents = @file_wrapper.read(test_file)
+ tests_and_line_numbers = @test_runner_generator.find_tests(contents)
+ @test_runner_generator.find_setup_and_teardown(contents)
end
return tests_and_line_numbers
diff --git a/test/vendor/ceedling/lib/ceedling/objects.yml b/test/vendor/ceedling/lib/ceedling/objects.yml
index a6f189b6c..2e2e9b9d2 100644
--- a/test/vendor/ceedling/lib/ceedling/objects.yml
+++ b/test/vendor/ceedling/lib/ceedling/objects.yml
@@ -41,7 +41,9 @@ project_file_loader:
project_config_manager:
compose:
- cacheinator
+ - configurator
- yaml_wrapper
+ - file_wrapper
cacheinator:
compose:
@@ -172,6 +174,7 @@ task_invoker:
- dependinator
- rake_utils
- rake_wrapper
+ - project_config_manager
flaginator:
compose:
diff --git a/test/vendor/ceedling/lib/ceedling/preprocessinator.rb b/test/vendor/ceedling/lib/ceedling/preprocessinator.rb
index e5c46c373..f07750dd2 100644
--- a/test/vendor/ceedling/lib/ceedling/preprocessinator.rb
+++ b/test/vendor/ceedling/lib/ceedling/preprocessinator.rb
@@ -28,8 +28,7 @@ class Preprocessinator
end
def preprocess_shallow_includes(filepath)
- dependencies_rule = @preprocessinator_includes_handler.form_shallow_dependencies_rule(filepath)
- includes = @preprocessinator_includes_handler.extract_shallow_includes(dependencies_rule)
+ includes = @preprocessinator_includes_handler.extract_includes(filepath)
@preprocessinator_includes_handler.write_shallow_includes_list(
@file_path_utils.form_preprocessed_includes_list_filepath(filepath), includes)
diff --git a/test/vendor/ceedling/lib/ceedling/preprocessinator_includes_handler.rb b/test/vendor/ceedling/lib/ceedling/preprocessinator_includes_handler.rb
index 686add0e0..703c84f3c 100644
--- a/test/vendor/ceedling/lib/ceedling/preprocessinator_includes_handler.rb
+++ b/test/vendor/ceedling/lib/ceedling/preprocessinator_includes_handler.rb
@@ -3,6 +3,7 @@
class PreprocessinatorIncludesHandler
constructor :configurator, :tool_executor, :task_invoker, :file_path_utils, :yaml_wrapper, :file_wrapper
+ @@makefile_cache = {}
# shallow includes: only those headers a source file explicitly includes
@@ -20,6 +21,9 @@ class PreprocessinatorIncludesHandler
# === Return
# _String_:: The text of the dependency rule generated by the preprocessor.
def form_shallow_dependencies_rule(filepath)
+ if @@makefile_cache.has_key?(filepath)
+ return @@makefile_cache[filepath]
+ end
# change filename (prefix of '_') to prevent preprocessor from finding
# include files in temp directory containing file it's scanning
temp_filepath = @file_path_utils.form_temp_path(filepath, '_')
@@ -44,6 +48,7 @@ class PreprocessinatorIncludesHandler
command = @tool_executor.build_command_line(@configurator.tools_test_includes_preprocessor, [], temp_filepath)
shell_result = @tool_executor.exec(command[:line], command[:options])
+ @@makefile_cache[filepath] = shell_result[:output]
return shell_result[:output]
end
@@ -52,19 +57,52 @@ class PreprocessinatorIncludesHandler
# provided, annotated Make dependency rule.
#
# === Arguments
- # +make_rule+ _String_:: Annotated Make dependency rule.
+ # +filepath+ _String_:: C source or header file to extract includes for.
#
# === Return
# _Array_ of _String_:: Array of the direct dependencies for the source file.
- def extract_shallow_includes(make_rule)
+ def extract_includes(filepath)
+ to_process = [filepath]
+ ignore_list = []
+ list = []
+
+ include_paths = @configurator.project_config_hash[:collection_paths_include]
+ include_paths = [] if include_paths.nil?
+ include_paths.map! {|path| File.expand_path(path)}
+
+ while to_process.length > 0
+ target = to_process.shift()
+ ignore_list << target
+ # puts "[HELL] Processing: \t\t#{target}"
+ new_deps, new_to_process = extract_includes_helper(target, include_paths, ignore_list)
+ list += new_deps
+ to_process += new_to_process
+ if ([email protected]_config_hash.has_key?(:project_auto_link_deep_dependencies) or
+ [email protected]_config_hash[:project_auto_link_deep_dependencies])
+ break
+ else
+ list = list.uniq()
+ to_process = to_process.uniq()
+ end
+ end
+
+ return list
+ end
+
+ def extract_includes_helper(filepath, include_paths, ignore_list)
# Extract the dependencies from the make rule
hdr_ext = @configurator.extension_header
+ make_rule = self.form_shallow_dependencies_rule(filepath)
dependencies = make_rule.split.find_all {|path| path.end_with?(hdr_ext) }.uniq
dependencies.map! {|hdr| hdr.gsub('\\','/') }
# Separate the real files form the annotated ones and remove the '@@@@'
annotated_headers, real_headers = dependencies.partition {|hdr| hdr =~ /^@@@@/ }
annotated_headers.map! {|hdr| hdr.gsub('@@@@','') }
+ # Matching annotated_headers values against real_headers to ensure that
+ # annotated_headers contain full path entries (as returned by make rule)
+ annotated_headers.map! {|hdr| real_headers.find {|real_hdr| !real_hdr.match(/(.*\/)?#{Regexp.escape(hdr)}/).nil? } }
+ annotated_headers = annotated_headers.compact
# Find which of our annotated headers are "real" dependencies. This is
# intended to weed out dependencies that have been removed due to build
@@ -87,7 +125,54 @@ class PreprocessinatorIncludesHandler
sdependencies.map! {|hdr| hdr.gsub('\\','/') }
list += sdependencies
- list
+ to_process = []
+
+ if @configurator.project_config_hash.has_key?(:project_auto_link_deep_dependencies) && @configurator.project_config_hash[:project_auto_link_deep_dependencies]
+ # Creating list of mocks
+ mocks = annotated_headers.find_all do |annotated_header|
+ File.basename(annotated_header) =~ /^#{@configurator.project_config_hash[:cmock_mock_prefix]}.*$/
+ end.compact
+
+ # Creating list of headers that should be recursively pre-processed
+ # Skipping mocks and unity.h
+ headers_to_deep_link = annotated_headers.select do |annotated_header|
+ !(mocks.include? annotated_header) and (annotated_header.match(/^(.*\/)?unity\.h$/).nil?)
+ end
+ headers_to_deep_link.map! {|hdr| File.expand_path(hdr)}
+
+ mocks.each do |mock|
+ dirname = File.dirname(mock)
+ #basename = File.basename(mock).delete_prefix(@configurator.project_config_hash[:cmock_mock_prefix])
+ basename = File.basename(mock).sub(@configurator.project_config_hash[:cmock_mock_prefix], '')
+ if dirname != "."
+ ignore_list << File.join(dirname, basename)
+ else
+ ignore_list << basename
+ end
+ end.compact
+
+ # Filtering list of final includes to only include mocks and anything that is NOT in the ignore_list
+ list = list.select do |item|
+ mocks.include? item or !(ignore_list.any? { |ignore_item| !item.match(/^(.*\/)?#{Regexp.escape(ignore_item)}$/).nil? })
+ end
+
+ headers_to_deep_link.each do |hdr|
+ if (ignore_list.none? {|ignore_header| hdr.match(/^(.*\/)?#{Regexp.escape(ignore_header)}$/)} and
+ include_paths.none? {|include_path| hdr =~ /^#{include_path}\.*/})
+ if File.exist?(hdr)
+ to_process << hdr
+ #source_file = hdr.delete_suffix(hdr_ext) + src_ext
+ source_file = hdr.chomp(hdr_ext) + src_ext
+ if source_file != hdr and File.exist?(source_file)
+ to_process << source_file
+ end
+ end
+ end
+ end
+ end
+
+ return list, to_process
+
end
def write_shallow_includes_list(filepath, list)
diff --git a/test/vendor/ceedling/lib/ceedling/project_config_manager.rb b/test/vendor/ceedling/lib/ceedling/project_config_manager.rb
index 801c206d8..31f7e3a68 100644
--- a/test/vendor/ceedling/lib/ceedling/project_config_manager.rb
+++ b/test/vendor/ceedling/lib/ceedling/project_config_manager.rb
@@ -3,16 +3,17 @@ require 'ceedling/constants'
class ProjectConfigManager
- attr_reader :options_files, :release_config_changed, :test_config_changed
+ attr_reader :options_files, :release_config_changed, :test_config_changed, :test_defines_changed
attr_accessor :config_hash
- constructor :cacheinator, :yaml_wrapper
+ constructor :cacheinator, :configurator, :yaml_wrapper, :file_wrapper
def setup
@options_files = []
@release_config_changed = false
@test_config_changed = false
+ @test_defines_changed = false
end
@@ -34,4 +35,12 @@ class ProjectConfigManager
@test_config_changed = @cacheinator.diff_cached_test_config?( @config_hash )
end
+ def process_test_defines_change(files)
+ # has definitions changed since last test build
+ @test_defines_changed = @cacheinator.diff_cached_test_defines?( files )
+ if @test_defines_changed
+ # update timestamp for rake task prerequisites
+ @file_wrapper.touch( @configurator.project_test_force_rebuild_filepath )
+ end
+ end
end
diff --git a/test/vendor/ceedling/lib/ceedling/rules_tests.rake b/test/vendor/ceedling/lib/ceedling/rules_tests.rake
index 67d8a500c..2b8f7af5b 100644
--- a/test/vendor/ceedling/lib/ceedling/rules_tests.rake
+++ b/test/vendor/ceedling/lib/ceedling/rules_tests.rake
@@ -35,8 +35,7 @@ end
rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_EXECUTABLE}$/) do |bin_file|
- lib_args = ((defined? LIBRARIES_SYSTEM) ? LIBRARIES_SYSTEM : [])
- lib_args.map! {|v| LIBRARIES_FLAG.gsub(/\$\{1\}/, v) } if (defined? LIBRARIES_FLAG)
+ lib_args = @ceedling[:test_invoker].convert_libraries_to_arguments()
@ceedling[:generator].generate_executable_file(
TOOLS_TEST_LINKER,
@@ -67,6 +66,7 @@ namespace TEST_SYM do
@ceedling[:file_finder].find_test_from_file_path(test)
end
]) do |test|
+ @ceedling[:rake_wrapper][:directories].reenable if @ceedling[:task_invoker].first_run == false && @ceedling[:project_config_manager].test_defines_changed
@ceedling[:rake_wrapper][:directories].invoke
@ceedling[:test_invoker].setup_and_invoke([test.source])
end
diff --git a/test/vendor/ceedling/lib/ceedling/stream_wrapper.rb b/test/vendor/ceedling/lib/ceedling/stream_wrapper.rb
index 33d3c10b1..7e160527f 100644
--- a/test/vendor/ceedling/lib/ceedling/stream_wrapper.rb
+++ b/test/vendor/ceedling/lib/ceedling/stream_wrapper.rb
@@ -1,8 +1,16 @@
class StreamWrapper
+ def stdout_override(&fnc)
+ @stdout_overide_fnc = fnc
+ end
+
def stdout_puts(string)
- $stdout.puts(string)
+ if @stdout_overide_fnc
+ @stdout_overide_fnc.call(string)
+ else
+ $stdout.puts(string)
+ end
end
def stdout_flush
diff --git a/test/vendor/ceedling/lib/ceedling/task_invoker.rb b/test/vendor/ceedling/lib/ceedling/task_invoker.rb
index 4e91b2ea1..642695c46 100644
--- a/test/vendor/ceedling/lib/ceedling/task_invoker.rb
+++ b/test/vendor/ceedling/lib/ceedling/task_invoker.rb
@@ -2,11 +2,14 @@ require 'ceedling/par_map'
class TaskInvoker
- constructor :dependinator, :rake_utils, :rake_wrapper
+ attr_accessor :first_run
+
+ constructor :dependinator, :rake_utils, :rake_wrapper, :project_config_manager
def setup
@test_regexs = [/^#{TEST_ROOT_NAME}:/]
@release_regexs = [/^#{RELEASE_ROOT_NAME}(:|$)/]
+ @first_run = true
end
def add_test_task_regex(regex)
@@ -46,17 +49,22 @@ class TaskInvoker
def invoke_test_mocks(mocks)
@dependinator.enhance_mock_dependencies( mocks )
- mocks.each { |mock| @rake_wrapper[mock].invoke }
+ mocks.each { |mock|
+ @rake_wrapper[mock].reenable if @first_run == false && @project_config_manager.test_defines_changed
+ @rake_wrapper[mock].invoke
+ }
end
def invoke_test_runner(runner)
@dependinator.enhance_runner_dependencies( runner )
+ @rake_wrapper[runner].reenable if @first_run == false && @project_config_manager.test_defines_changed
@rake_wrapper[runner].invoke
end
def invoke_test_shallow_include_lists(files)
@dependinator.enhance_shallow_include_lists_dependencies( files )
par_map(PROJECT_COMPILE_THREADS, files) do |file|
+ @rake_wrapper[file].reenable if @first_run == false && @project_config_manager.test_defines_changed
@rake_wrapper[file].invoke
end
end
@@ -64,6 +72,7 @@ class TaskInvoker
def invoke_test_preprocessed_files(files)
@dependinator.enhance_preprocesed_file_dependencies( files )
par_map(PROJECT_COMPILE_THREADS, files) do |file|
+ @rake_wrapper[file].reenable if @first_run == false && @project_config_manager.test_defines_changed
@rake_wrapper[file].invoke
end
end
@@ -71,30 +80,37 @@ class TaskInvoker
def invoke_test_dependencies_files(files)
@dependinator.enhance_dependencies_dependencies( files )
par_map(PROJECT_COMPILE_THREADS, files) do |file|
+ @rake_wrapper[file].reenable if @first_run == false && @project_config_manager.test_defines_changed
@rake_wrapper[file].invoke
end
end
def invoke_test_objects(objects)
par_map(PROJECT_COMPILE_THREADS, objects) do |object|
- @rake_wrapper[object].invoke
+ @rake_wrapper[object].reenable if @first_run == false && @project_config_manager.test_defines_changed
+ @rake_wrapper[object].invoke
end
end
+ def invoke_test_executable(file)
+ @rake_wrapper[file].invoke
+ end
+
def invoke_test_results(result)
@dependinator.enhance_results_dependencies( result )
+ @rake_wrapper[result].reenable if @first_run == false && @project_config_manager.test_defines_changed
@rake_wrapper[result].invoke
end
def invoke_release_dependencies_files(files)
par_map(PROJECT_COMPILE_THREADS, files) do |file|
- @rake_wrapper[file].invoke
+ @rake_wrapper[file].invoke
end
end
def invoke_release_objects(objects)
par_map(PROJECT_COMPILE_THREADS, objects) do |object|
- @rake_wrapper[object].invoke
+ @rake_wrapper[object].invoke
end
end
diff --git a/test/vendor/ceedling/lib/ceedling/tasks_base.rake b/test/vendor/ceedling/lib/ceedling/tasks_base.rake
index 29074534e..8c8253099 100644
--- a/test/vendor/ceedling/lib/ceedling/tasks_base.rake
+++ b/test/vendor/ceedling/lib/ceedling/tasks_base.rake
@@ -89,7 +89,6 @@ namespace :options do
desc "Merge #{option} project options."
task option.downcase.to_sym do
- # @ceedling[:setupinator].reset_defaults( @ceedling[:setupinator].config_hash )
hash = @ceedling[:project_config_manager].merge_options( @ceedling[:setupinator].config_hash, option_path )
@ceedling[:setupinator].do_setup( hash )
if @ceedling[:configurator].project_release_build
diff --git a/test/vendor/ceedling/lib/ceedling/tasks_filesystem.rake b/test/vendor/ceedling/lib/ceedling/tasks_filesystem.rake
index 4c9172979..58fa6511f 100644
--- a/test/vendor/ceedling/lib/ceedling/tasks_filesystem.rake
+++ b/test/vendor/ceedling/lib/ceedling/tasks_filesystem.rake
@@ -81,7 +81,10 @@ namespace :files do
['source', COLLECTION_ALL_SOURCE],
['header', COLLECTION_ALL_HEADERS]
]
- categories << ['assembly', COLLECTION_ALL_ASSEMBLY] if (RELEASE_BUILD_USE_ASSEMBLY)
+
+ using_assembly = (defined?(TEST_BUILD_USE_ASSEMBLY) && TEST_BUILD_USE_ASSEMBLY) ||
+ (defined?(RELEASE_BUILD_USE_ASSEMBLY) && RELEASE_BUILD_USE_ASSEMBLY)
+ categories << ['assembly', COLLECTION_ALL_ASSEMBLY] if using_assembly
categories.each do |category|
name = category[0]
diff --git a/test/vendor/ceedling/lib/ceedling/tasks_tests.rake b/test/vendor/ceedling/lib/ceedling/tasks_tests.rake
index 13e97133e..5d09c1aff 100644
--- a/test/vendor/ceedling/lib/ceedling/tasks_tests.rake
+++ b/test/vendor/ceedling/lib/ceedling/tasks_tests.rake
@@ -1,7 +1,7 @@
require 'ceedling/constants'
task :test => [:directories] do
- @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS)
+ Rake.application['test:all'].invoke
end
namespace TEST_SYM do
@@ -25,6 +25,11 @@ namespace TEST_SYM do
@ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS, TEST_SYM, {:force_run => false})
end
+ desc "Just build tests without running."
+ task :build_only => [:directories] do
+ @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS, TEST_SYM, {:build_only => true})
+ end
+
desc "Run tests by matching regular expression pattern."
task :pattern, [:regex] => [:directories] do |t, args|
matches = []
diff --git a/test/vendor/ceedling/lib/ceedling/test_invoker.rb b/test/vendor/ceedling/lib/ceedling/test_invoker.rb
index 01287ef89..652cb318b 100644
--- a/test/vendor/ceedling/lib/ceedling/test_invoker.rb
+++ b/test/vendor/ceedling/lib/ceedling/test_invoker.rb
@@ -54,7 +54,20 @@ class TestInvoker
end
end
- def setup_and_invoke(tests, context=TEST_SYM, options={:force_run => true})
+ # Convert libraries configuration form YAML configuration
+ # into a string that can be given to the compiler.
+ def convert_libraries_to_arguments()
+ if @configurator.project_config_hash.has_key?(:libraries_test)
+ lib_args = @configurator.project_config_hash[:libraries_test]
+ lib_args.flatten!
+ lib_flag = @configurator.project_config_hash[:libraries_flag]
+ lib_args.map! {|v| lib_flag.gsub(/\$\{1\}/, v) } if (defined? lib_flag)
+ return lib_args
+ end
+ end
+
+
+ def setup_and_invoke(tests, context=TEST_SYM, options={:force_run => true, :build_only => false})
@tests = tests
@@ -68,7 +81,7 @@ class TestInvoker
begin
@plugin_manager.pre_test( test )
test_name ="#{File.basename(test)}".chomp('.c')
- def_test_key="defines_#{test_name}"
+ def_test_key="defines_#{test_name.downcase}"
# Re-define the project out path and pre-processor defines.
if @configurator.project_config_hash.has_key?(def_test_key.to_sym)
@@ -94,6 +107,8 @@ class TestInvoker
results_pass = @file_path_utils.form_pass_results_filepath( test )
results_fail = @file_path_utils.form_fail_results_filepath( test )
+ @project_config_manager.process_test_defines_change(sources)
+
# add the definition value in the build option for the unit test
if @configurator.defines_use_test_definition
add_test_definition(test)
@@ -119,8 +134,15 @@ class TestInvoker
# build test objects
@task_invoker.invoke_test_objects( objects )
- # 3, 2, 1... launch
- @task_invoker.invoke_test_results( results_pass )
+ # if the option build_only has been specified, build only the executable
+ # but don't run the test
+ if (options[:build_only])
+ executable = @file_path_utils.form_test_executable_filepath( test )
+ @task_invoker.invoke_test_executable( executable )
+ else
+ # 3, 2, 1... launch
+ @task_invoker.invoke_test_results( results_pass )
+ end
rescue => e
@build_invoker_utils.process_exception( e, context )
ensure
@@ -142,6 +164,8 @@ class TestInvoker
# store away what's been processed
@mocks.concat( mock_list )
@sources.concat( sources )
+
+ @task_invoker.first_run = false
end
# post-process collected mock list
diff --git a/test/vendor/ceedling/lib/ceedling/tool_executor.rb b/test/vendor/ceedling/lib/ceedling/tool_executor.rb
index a5b3f579e..0ab5ddcac 100644
--- a/test/vendor/ceedling/lib/ceedling/tool_executor.rb
+++ b/test/vendor/ceedling/lib/ceedling/tool_executor.rb
@@ -18,6 +18,8 @@ class ToolExecutor
end
# build up a command line from yaml provided config
+
+ # @param extra_params is an array of parameters to append to executable
def build_command_line(tool_config, extra_params, *args)
@tool_name = tool_config[:name]
@executable = tool_config[:executable]
@@ -50,7 +52,6 @@ class ToolExecutor
options[:boom] = true if (options[:boom].nil?)
options[:stderr_redirect] = StdErrRedirect::NONE if (options[:stderr_redirect].nil?)
options[:background_exec] = BackgroundExec::NONE if (options[:background_exec].nil?)
-
# build command line
command_line = [
@tool_executor_helper.background_exec_cmdline_prepend( options ),
@@ -60,6 +61,8 @@ class ToolExecutor
@tool_executor_helper.background_exec_cmdline_append( options ),
].flatten.compact.join(' ')
+ @streaminator.stderr_puts("Verbose: #{__method__.to_s}(): #{command_line}", Verbosity::DEBUG)
+
shell_result = {}
# depending on background exec option, we shell out differently
@@ -73,7 +76,10 @@ class ToolExecutor
shell_result[:time] = time
#scrub the string for illegal output
- shell_result[:output].scrub! unless (!("".respond_to? :scrub!) || (shell_result[:output].nil?))
+ unless shell_result[:output].nil?
+ shell_result[:output] = shell_result[:output].scrub if "".respond_to?(:scrub)
+ shell_result[:output].gsub!(/\033\[\d\dm/,'')
+ end
@tool_executor_helper.print_happy_results( command_line, shell_result, options[:boom] )
@tool_executor_helper.print_error_results( command_line, shell_result, options[:boom] )
diff --git a/test/vendor/ceedling/lib/ceedling/version.rb b/test/vendor/ceedling/lib/ceedling/version.rb
index 3dfdf3624..ba917df5a 100644
--- a/test/vendor/ceedling/lib/ceedling/version.rb
+++ b/test/vendor/ceedling/lib/ceedling/version.rb
@@ -1,15 +1,36 @@
+
# @private
module Ceedling
module Version
- # @private
- GEM = "0.28.3"
- # @private
+ # Check for local or global version of vendor directory in order to look up versions
+ {
+ "CEXCEPTION" => File.join("vendor","c_exception","lib","CException.h"),
+ "CMOCK" => File.join("vendor","cmock","src","cmock.h"),
+ "UNITY" => File.join("vendor","unity","src","unity.h"),
+ }.each_pair do |name, path|
+ filename = if (File.exist?(File.join("..","..",path)))
+ File.join("..","..",path)
+ elsif (File.exist?(File.join(File.dirname(__FILE__),"..","..",path)))
+ File.join(File.dirname(__FILE__),"..","..",path)
+ else
+ eval "#{name} = 'unknown'"
+ continue
+ end
+
+ # Actually look up the versions
+ a = [0,0,0]
+ File.readlines(filename) do |line|
+ ["VERSION_MAJOR", "VERSION_MINOR", "VERSION_BUILD"].each_with_index do |field, i|
+ m = line.match(/#{name}_#{field}\s+(\d+)/)
+ a[i] = m[1] unless (m.nil?)
+ end
+ end
+
+ # Make a constant from each, so that we can use it elsewhere
+ eval "#{name} = '#{a.join(".")}'"
+ end
+
+ GEM = "0.29.0"
CEEDLING = GEM
- # @private
- CEXCEPTION = "1.3.1"
- # @private
- CMOCK = "2.4.5"
- # @private
- UNITY = "2.4.2"
end
end