ceedling 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/Rakefile +55 -6
  2. data/examples/temp_sensor/project.yml +2 -2
  3. data/lib/ceedling/version.rb +3 -3
  4. data/lib/ceedling/version.rb.erb +1 -1
  5. data/new_project_template/project.yml +1 -1
  6. data/new_project_template/vendor/ceedling/{vendor/c_exception/docs → docs}/CExceptionSummary.pdf +0 -0
  7. data/new_project_template/vendor/ceedling/vendor/cmock/docs/CMock Summary.pdf b/data/new_project_template/vendor/ceedling/docs/CMock → Summary.pdf +0 -0
  8. data/new_project_template/vendor/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf b/data/new_project_template/vendor/ceedling/docs/Unity → Summary.pdf +0 -0
  9. data/new_project_template/vendor/ceedling/lib/configurator.rb +65 -16
  10. data/new_project_template/vendor/ceedling/lib/configurator_builder.rb +1 -8
  11. data/new_project_template/vendor/ceedling/lib/configurator_plugins.rb +8 -1
  12. data/new_project_template/vendor/ceedling/lib/configurator_setup.rb +30 -34
  13. data/new_project_template/vendor/ceedling/lib/configurator_validator.rb +32 -5
  14. data/new_project_template/vendor/ceedling/lib/constants.rb +17 -4
  15. data/new_project_template/vendor/ceedling/lib/defaults.rb +120 -106
  16. data/new_project_template/vendor/ceedling/lib/file_path_utils.rb +1 -1
  17. data/new_project_template/vendor/ceedling/lib/generator.rb +14 -6
  18. data/new_project_template/vendor/ceedling/lib/objects.yml +5 -0
  19. data/new_project_template/vendor/ceedling/lib/plugin.rb +2 -1
  20. data/new_project_template/vendor/ceedling/lib/plugin_manager.rb +6 -1
  21. data/new_project_template/vendor/ceedling/lib/preprocessinator_file_handler.rb +2 -2
  22. data/new_project_template/vendor/ceedling/lib/preprocessinator_includes_handler.rb +2 -2
  23. data/new_project_template/vendor/ceedling/lib/rules_cmock.rake +1 -1
  24. data/new_project_template/vendor/ceedling/lib/rules_preprocess.rake +2 -2
  25. data/new_project_template/vendor/ceedling/lib/rules_release.rake +4 -4
  26. data/new_project_template/vendor/ceedling/lib/rules_release_aux_dependencies.rake +1 -1
  27. data/new_project_template/vendor/ceedling/lib/rules_tests.rake +5 -5
  28. data/new_project_template/vendor/ceedling/lib/rules_tests_aux_dependencies.rake +1 -1
  29. data/new_project_template/vendor/ceedling/lib/setupinator.rb +10 -3
  30. data/new_project_template/vendor/ceedling/lib/system_utils.rb +32 -0
  31. data/new_project_template/vendor/ceedling/lib/system_wrapper.rb +13 -5
  32. data/new_project_template/vendor/ceedling/lib/tasks_base.rake +2 -2
  33. data/new_project_template/vendor/ceedling/lib/tasks_release.rake +1 -1
  34. data/new_project_template/vendor/ceedling/lib/tasks_tests.rake +1 -1
  35. data/new_project_template/vendor/ceedling/lib/tool_executor.rb +38 -10
  36. data/new_project_template/vendor/ceedling/lib/tool_executor_helper.rb +68 -10
  37. data/new_project_template/vendor/ceedling/plugins/bullseye/bullseye.rake +142 -0
  38. data/new_project_template/vendor/ceedling/plugins/bullseye/bullseye.rb +145 -0
  39. data/new_project_template/vendor/ceedling/plugins/bullseye/defaults.yml +49 -0
  40. data/new_project_template/vendor/ceedling/plugins/bullseye/template.erb +15 -0
  41. data/new_project_template/vendor/ceedling/plugins/gcov/defaults.yml +34 -0
  42. data/new_project_template/vendor/ceedling/plugins/gcov/gcov.rake +136 -0
  43. data/new_project_template/vendor/ceedling/plugins/gcov/gcov.rb +115 -0
  44. data/new_project_template/vendor/ceedling/plugins/gcov/template.erb +15 -0
  45. data/new_project_template/vendor/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb +1 -1
  46. data/new_project_template/vendor/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb +3 -63
  47. data/new_project_template/vendor/ceedling/plugins/stdout_pretty_tests_report/template.erb +59 -0
  48. data/new_project_template/vendor/ceedling/plugins/warnings_report/warnings_report.rb +71 -0
  49. data/new_project_template/vendor/ceedling/release/build.info +1 -1
  50. data/new_project_template/vendor/ceedling/vendor/c_exception/release/version.info +1 -1
  51. data/new_project_template/vendor/ceedling/vendor/unity/src/unity.c +30 -21
  52. metadata +18 -27
  53. data/new_project_template/vendor/ceedling/docs/Ceedling Packet.odt +0 -0
  54. data/new_project_template/vendor/ceedling/docs/CeedlingLogo.png +0 -0
  55. data/new_project_template/vendor/ceedling/rakefile.rb +0 -59
  56. data/new_project_template/vendor/ceedling/rakefile_helper.rb +0 -23
  57. data/new_project_template/vendor/ceedling/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
  58. data/new_project_template/vendor/ceedling/vendor/c_exception/docs/license.txt +0 -30
  59. data/new_project_template/vendor/ceedling/vendor/c_exception/docs/readme.txt +0 -236
  60. data/new_project_template/vendor/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +0 -217
  61. data/new_project_template/vendor/ceedling/vendor/cmock/docs/CMock Summary.odt +0 -0
  62. data/new_project_template/vendor/ceedling/vendor/cmock/docs/license.txt +0 -31
  63. data/new_project_template/vendor/ceedling/vendor/deep_merge/MIT-LICENSE +0 -20
  64. data/new_project_template/vendor/ceedling/vendor/deep_merge/README +0 -94
  65. data/new_project_template/vendor/ceedling/vendor/deep_merge/Rakefile +0 -28
  66. data/new_project_template/vendor/ceedling/vendor/deep_merge/test/test_deep_merge.rb +0 -553
  67. data/new_project_template/vendor/ceedling/vendor/diy/History.txt +0 -28
  68. data/new_project_template/vendor/ceedling/vendor/diy/README.rdoc +0 -233
  69. data/new_project_template/vendor/ceedling/vendor/unity/docs/Unity Summary.odt +0 -0
  70. data/new_project_template/vendor/ceedling/vendor/unity/docs/Unity Summary.pdf +0 -0
  71. data/new_project_template/vendor/ceedling/vendor/unity/docs/Unity Summary.txt +0 -217
  72. data/new_project_template/vendor/ceedling/vendor/unity/docs/license.txt +0 -31
@@ -0,0 +1,142 @@
1
+
2
+ directory(BULLSEYE_BUILD_OUTPUT_PATH)
3
+ directory(BULLSEYE_RESULTS_PATH)
4
+ directory(BULLSEYE_ARTIFACTS_PATH)
5
+ directory(BULLSEYE_DEPENDENCIES_PATH)
6
+
7
+ CLEAN.include(File.join(BULLSEYE_BUILD_OUTPUT_PATH, '*'))
8
+ CLEAN.include(File.join(BULLSEYE_RESULTS_PATH, '*'))
9
+ CLEAN.include(File.join(BULLSEYE_DEPENDENCIES_PATH, '*'))
10
+
11
+ CLOBBER.include(File.join(BULLSEYE_BUILD_PATH, '**/*'))
12
+
13
+
14
+ rule(/#{BULLSEYE_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [
15
+ proc do |task_name|
16
+ @ceedling[:file_finder].find_compilation_input_file(task_name)
17
+ end
18
+ ]) do |object|
19
+
20
+ if (File.basename(object.source) =~ /^(#{PROJECT_TEST_FILE_PREFIX}|#{CMOCK_MOCK_PREFIX}|unity|cmock|cexception)/i)
21
+ @ceedling[:generator].generate_object_file(TOOLS_BULLSEYE_COMPILER, BULLSEYE_CONTEXT, object.source, object.name)
22
+ else
23
+ @ceedling[BULLSEYE_CONTEXT].generate_coverage_object_file(object.source, object.name)
24
+ end
25
+
26
+ end
27
+
28
+ rule(/#{BULLSEYE_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_EXECUTABLE}$/) do |bin_file|
29
+ @ceedling[:generator].generate_executable_file(TOOLS_BULLSEYE_LINKER, BULLSEYE_CONTEXT, bin_file.prerequisites, bin_file.name)
30
+ end
31
+
32
+ rule(/#{BULLSEYE_RESULTS_PATH}\/#{'.+\\'+EXTENSION_TESTPASS}$/ => [
33
+ proc do |task_name|
34
+ @ceedling[:file_path_utils].form_test_executable_filepath(task_name)
35
+ end
36
+ ]) do |test_result|
37
+ @ceedling[:generator].generate_test_results(TOOLS_BULLSEYE_FIXTURE, BULLSEYE_CONTEXT, test_result.source, test_result.name)
38
+ end
39
+
40
+ rule(/#{BULLSEYE_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [
41
+ proc do |task_name|
42
+ @ceedling[:file_finder].find_compilation_input_file(task_name)
43
+ end
44
+ ]) do |dep|
45
+ @ceedling[:generator].generate_dependencies_file(
46
+ TOOLS_TEST_DEPENDENCIES_GENERATOR,
47
+ BULLSEYE_CONTEXT,
48
+ dep.source,
49
+ File.join(BULLSEYE_BUILD_OUTPUT_PATH, File.basename(dep.source).ext(EXTENSION_OBJECT) ),
50
+ dep.name)
51
+ end
52
+
53
+ task :directories => [BULLSEYE_BUILD_OUTPUT_PATH, BULLSEYE_RESULTS_PATH, BULLSEYE_DEPENDENCIES_PATH, BULLSEYE_ARTIFACTS_PATH]
54
+
55
+ namespace BULLSEYE_CONTEXT do
56
+
57
+ task :source_coverage => COLLECTION_ALL_SOURCE.pathmap("#{BULLSEYE_BUILD_OUTPUT_PATH}/%n#{@ceedling[:configurator].extension_object}")
58
+
59
+ desc "Run code coverage for all tests"
60
+ task :all => [:directories] do
61
+ @ceedling[:configurator].replace_flattened_config(@ceedling[BULLSEYE_CONTEXT].config)
62
+ @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS)
63
+ @ceedling[:configurator].restore_config
64
+ end
65
+
66
+ desc "Run single test w/ coverage ([*] real test or source file name, no path)."
67
+ task :* do
68
+ message = "\nOops! '#{BULLSEYE_ROOT_NAME}:*' isn't a real task. " +
69
+ "Use a real test or source file name (no path) in place of the wildcard.\n" +
70
+ "Example: rake #{BULLSEYE_ROOT_NAME}:foo.c\n\n"
71
+
72
+ @ceedling[:streaminator].stdout_puts( message )
73
+ end
74
+
75
+ desc "Run tests by matching regular expression pattern."
76
+ task :pattern, [:regex] => [:directories] do |t, args|
77
+ matches = []
78
+
79
+ COLLECTION_ALL_TESTS.each do |test|
80
+ matches << test if test =~ /#{args.regex}/
81
+ end
82
+
83
+ if (matches.size > 0)
84
+ @ceedling[:configurator].replace_flattened_config(@ceedling[BULLSEYE_CONTEXT].config)
85
+ @ceedling[:test_invoker].setup_and_invoke(matches, {:force_run => false})
86
+ @ceedling[:configurator].restore_config
87
+ else
88
+ @ceedling[:streaminator].stdout_puts("\nFound no tests matching pattern /#{args.regex}/.")
89
+ end
90
+ end
91
+
92
+ desc "Run tests whose test path contains [dir] or [dir] substring."
93
+ task :path, [:dir] => [:directories] do |t, args|
94
+ matches = []
95
+
96
+ COLLECTION_ALL_TESTS.each do |test|
97
+ matches << test if File.dirname(test).include?(args.dir.gsub(/\\/, '/'))
98
+ end
99
+
100
+ if (matches.size > 0)
101
+ @ceedling[:configurator].replace_flattened_config(@ceedling[BULLSEYE_CONTEXT].config)
102
+ @ceedling[:test_invoker].setup_and_invoke(matches, {:force_run => false})
103
+ @ceedling[:configurator].restore_config
104
+ else
105
+ @ceedling[:streaminator].stdout_puts("\nFound no tests including the given path or path component.")
106
+ end
107
+ end
108
+
109
+ desc "Run code coverage for changed files"
110
+ task :delta => [:directories] do
111
+ @ceedling[:configurator].replace_flattened_config(@ceedling[BULLSEYE_CONTEXT].config)
112
+ @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS, {:force_run => false})
113
+ @ceedling[:configurator].restore_config
114
+ end
115
+
116
+ # use a rule to increase efficiency for large projects
117
+ # bullseye test tasks by regex
118
+ rule(/^#{BULLSEYE_TASK_ROOT}\S+$/ => [
119
+ proc do |task_name|
120
+ test = task_name.sub(/#{BULLSEYE_TASK_ROOT}/, '')
121
+ test = "#{PROJECT_TEST_FILE_PREFIX}#{test}" if not (test.start_with?(PROJECT_TEST_FILE_PREFIX))
122
+ @ceedling[:file_finder].find_test_from_file_path(test)
123
+ end
124
+ ]) do |test|
125
+ @ceedling[:rake_wrapper][:directories].invoke
126
+ @ceedling[:configurator].replace_flattened_config(@ceedling[BULLSEYE_CONTEXT].config)
127
+ @ceedling[:test_invoker].setup_and_invoke([test.source])
128
+ @ceedling[:configurator].restore_config
129
+ end
130
+
131
+ end
132
+
133
+ namespace UTILS_SYM do
134
+
135
+ desc "Open Bullseye code coverage browser"
136
+ task BULLSEYE_CONTEXT do
137
+ command = @ceedling[:tool_executor].build_command_line(TOOLS_BULLSEYE_BROWSER)
138
+ @ceedling[:tool_executor].exec(command[:line], command[:options])
139
+ end
140
+
141
+ end
142
+
@@ -0,0 +1,145 @@
1
+ require 'plugin'
2
+ require 'constants'
3
+
4
+ BULLSEYE_ROOT_NAME = 'bullseye'
5
+ BULLSEYE_TASK_ROOT = BULLSEYE_ROOT_NAME + ':'
6
+ BULLSEYE_CONTEXT = BULLSEYE_ROOT_NAME.to_sym
7
+
8
+ BULLSEYE_BUILD_PATH = "#{PROJECT_BUILD_ROOT}/#{BULLSEYE_ROOT_NAME}"
9
+ BULLSEYE_BUILD_OUTPUT_PATH = "#{BULLSEYE_BUILD_PATH}/out"
10
+ BULLSEYE_RESULTS_PATH = "#{BULLSEYE_BUILD_PATH}/results"
11
+ BULLSEYE_DEPENDENCIES_PATH = "#{BULLSEYE_BUILD_PATH}/dependencies"
12
+ BULLSEYE_ARTIFACTS_PATH = "#{PROJECT_BUILD_ARTIFACTS_ROOT}/#{BULLSEYE_ROOT_NAME}"
13
+
14
+
15
+ class Bullseye < Plugin
16
+
17
+ attr_reader :config
18
+
19
+ def setup
20
+ @result_list = []
21
+
22
+ @config = {
23
+ :project_test_build_output_path => BULLSEYE_BUILD_OUTPUT_PATH,
24
+ :project_test_results_path => BULLSEYE_RESULTS_PATH,
25
+ :project_test_dependencies_path => BULLSEYE_DEPENDENCIES_PATH
26
+ }
27
+
28
+ @environment = [ {:covfile => File.join( BULLSEYE_ARTIFACTS_PATH, 'test.cov' )} ]
29
+
30
+ @coverage_template_all = @ceedling[:file_wrapper].read( File.join( PLUGINS_BULLSEYE_PATH, 'template.erb') )
31
+ end
32
+
33
+ def generate_coverage_object_file(source, object)
34
+ arg_hash = {:tool => TOOLS_BULLSEYE_INSTRUMENTATION, :context => BULLSEYE_CONTEXT, :source => source, :object => object}
35
+ @ceedling[:plugin_manager].pre_compile_execute(arg_hash)
36
+
37
+ @ceedling[:streaminator].stdout_puts("Compiling #{File.basename(source)} with coverage...")
38
+ compile_command = @ceedling[:tool_executor].build_command_line(TOOLS_BULLSEYE_COMPILER, source, object)
39
+ coverage_command = @ceedling[:tool_executor].build_command_line(TOOLS_BULLSEYE_INSTRUMENTATION, compile_command[:line] )
40
+
41
+ shell_result = @ceedling[:tool_executor].exec( coverage_command[:line], coverage_command[:options] )
42
+
43
+ arg_hash[:shell_result] = shell_result
44
+ @ceedling[:plugin_manager].post_compile_execute(arg_hash)
45
+ end
46
+
47
+ def post_test_execute(arg_hash)
48
+ result_file = arg_hash[:result_file]
49
+
50
+ if ((result_file =~ /#{BULLSEYE_RESULTS_PATH}/) and (not @result_list.include?(result_file)))
51
+ @result_list << arg_hash[:result_file]
52
+ end
53
+ end
54
+
55
+ def post_build
56
+ return if (not @ceedling[:task_invoker].invoked?(/^#{BULLSEYE_TASK_ROOT}/))
57
+
58
+ # test results
59
+ results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list)
60
+ hash = {
61
+ :header => BULLSEYE_ROOT_NAME.upcase,
62
+ :results => results
63
+ }
64
+
65
+ @ceedling[:plugin_reportinator].run_test_results_report(hash) do
66
+ message = ''
67
+ message = 'Unit test failures.' if (results[:counts][:failed] > 0)
68
+ message
69
+ end
70
+
71
+ # coverage results
72
+ if (@ceedling[:task_invoker].invoked?(/^#{BULLSEYE_TASK_ROOT}(all|delta)/))
73
+ command = @ceedling[:tool_executor].build_command_line(TOOLS_BULLSEYE_REPORT_COVSRC)
74
+ shell_result = @ceedling[:tool_executor].exec(command[:line], command[:options])
75
+ report_coverage_results_all(shell_result[:output])
76
+ else
77
+ report_per_function_coverage_results(@ceedling[:test_invoker].sources)
78
+ end
79
+ end
80
+
81
+ def summary
82
+ result_list = @ceedling[:file_path_utils].form_pass_results_filelist( BULLSEYE_RESULTS_PATH, COLLECTION_ALL_TESTS )
83
+
84
+ # test results
85
+ # get test results for only those tests in our configuration and of those only tests with results on disk
86
+ hash = {
87
+ :header => BULLSEYE_ROOT_NAME.upcase,
88
+ :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false})
89
+ }
90
+
91
+ @ceedling[:plugin_reportinator].run_test_results_report(hash)
92
+
93
+ # coverage results
94
+ command = @ceedling[:tool_executor].build_command_line(TOOLS_BULLSEYE_REPORT_COVSRC)
95
+ shell_result = @ceedling[:tool_executor].exec(command[:line], command[:options])
96
+ report_coverage_results_all(shell_result[:output])
97
+ end
98
+
99
+ private ###################################
100
+
101
+ def report_coverage_results_all(coverage)
102
+ results = {
103
+ :coverage => {
104
+ :functions => nil,
105
+ :branches => nil
106
+ }
107
+ }
108
+
109
+ if (coverage =~ /^Total.*?=\s+([0-9]+)\%/)
110
+ results[:coverage][:functions] = $1.to_i
111
+ end
112
+
113
+ if (coverage =~ /^Total.*=\s+([0-9]+)\%\s*$/)
114
+ results[:coverage][:branches] = $1.to_i
115
+ end
116
+
117
+ @ceedling[:plugin_reportinator].run_report($stdout, @coverage_template_all, results)
118
+ end
119
+
120
+ def report_per_function_coverage_results(sources)
121
+ banner = @ceedling[:plugin_reportinator].generate_banner "#{BULLSEYE_ROOT_NAME.upcase}: CODE COVERAGE SUMMARY"
122
+ @ceedling[:streaminator].stdout_puts "\n" + banner
123
+
124
+ sources.each do |source|
125
+ command = @ceedling[:tool_executor].build_command_line(TOOLS_BULLSEYE_REPORT_COVFN, source)
126
+ shell_results = @ceedling[:tool_executor].exec(command[:line], command[:options])
127
+ coverage_results = shell_results[:output]
128
+ coverage_results.sub!(/.*\n.*\n/,'') # Remove the Bullseye tool banner
129
+ if (coverage_results =~ /warning cov814: report is empty/)
130
+ coverage_results = "WARNING: #{source} contains no coverage data!\n\n"
131
+ @ceedling[:streaminator].stdout_puts(coverage_results, Verbosity::COMPLAIN)
132
+ else
133
+ coverage_results += "\n"
134
+ @ceedling[:streaminator].stdout_puts(coverage_results)
135
+ end
136
+ end
137
+ end
138
+
139
+ end
140
+
141
+ # end blocks always executed following rake run
142
+ END {
143
+ # cache our input configurations to use in comparison upon next execution
144
+ @ceedling[:cacheinator].cache_test_config( @ceedling[:setupinator].config_hash ) if (@ceedling[:task_invoker].invoked?(/^#{BULLSEYE_TASK_ROOT}/))
145
+ }
@@ -0,0 +1,49 @@
1
+ ---
2
+
3
+ :tools:
4
+ :bullseye_instrumentation:
5
+ :executable: covc
6
+ :arguments:
7
+ - '--file $': ENVIRONMENT_COVFILE
8
+ - ${1}
9
+ :bullseye_compiler:
10
+ :executable: gcc
11
+ :arguments:
12
+ - -g
13
+ - -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR
14
+ - -I"$": COLLECTION_PATHS_BULLSEYE_TOOLCHAIN_INCLUDE
15
+ - -D$: COLLECTION_DEFINES_TEST_AND_VENDOR
16
+ - -DCODE_COVERAGE
17
+ - -c "${1}"
18
+ - -o "${2}"
19
+ :bullseye_linker:
20
+ :executable: gcc
21
+ :arguments:
22
+ - ${1}
23
+ - -o ${2}
24
+ - -L$: PLUGINS_BULLSEYE_LIB_PATH
25
+ - -lcov
26
+ :bullseye_fixture:
27
+ :executable: ${1}
28
+ :bullseye_report_covsrc:
29
+ :executable: covsrc
30
+ :arguments:
31
+ - '--file $': ENVIRONMENT_COVFILE
32
+ - -q
33
+ - -w140
34
+ :bullseye_report_covfn:
35
+ :executable: covfn
36
+ :stderr_redirect: :auto
37
+ :arguments:
38
+ - '--file $': ENVIRONMENT_COVFILE
39
+ - --width 120
40
+ - --no-source
41
+ - '"${1}"'
42
+ :bullseye_browser:
43
+ :executable: CoverageBrowser
44
+ :background_exec: :auto
45
+ :optional: TRUE
46
+ :arguments:
47
+ - '"$"': ENVIRONMENT_COVFILE
48
+
49
+ ...
@@ -0,0 +1,15 @@
1
+ % function_string = hash[:coverage][:functions].to_s
2
+ % branch_string = hash[:coverage][:branches].to_s
3
+ % format_string = "%#{[function_string.length, branch_string.length].max}i"
4
+ <%=@ceedling[:plugin_reportinator].generate_banner("#{BULLSEYE_ROOT_NAME.upcase}: CODE COVERAGE SUMMARY")%>
5
+ % if (!hash[:coverage][:functions].nil?)
6
+ FUNCTIONS: <%=sprintf(format_string, hash[:coverage][:functions])%>%
7
+ % else
8
+ FUNCTIONS: none
9
+ % end
10
+ % if (!hash[:coverage][:branches].nil?)
11
+ BRANCHES: <%=sprintf(format_string, hash[:coverage][:branches])%>%
12
+ % else
13
+ BRANCHES: none
14
+ % end
15
+
@@ -0,0 +1,34 @@
1
+ ---
2
+
3
+ :tools:
4
+ :gcov_compiler:
5
+ :executable: gcc
6
+ :arguments:
7
+ - -g
8
+ - -fprofile-arcs
9
+ - -ftest-coverage
10
+ - -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR
11
+ - -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE
12
+ - -D$: COLLECTION_DEFINES_TEST_AND_VENDOR
13
+ - -DCODE_COVERAGE
14
+ - -c "${1}"
15
+ - -o "${2}"
16
+ :gcov_linker:
17
+ :executable: gcc
18
+ :arguments:
19
+ - -fprofile-arcs
20
+ - -ftest-coverage
21
+ - ${1}
22
+ - -o ${2}
23
+ :gcov_fixture:
24
+ :executable: ${1}
25
+ :gcov_report:
26
+ :executable: gcov
27
+ :arguments:
28
+ - -n
29
+ - -p
30
+ - -b
31
+ - -o "$": GCOV_BUILD_OUTPUT_PATH
32
+ - "\"${1}\""
33
+
34
+ ...
@@ -0,0 +1,136 @@
1
+
2
+ directory(GCOV_BUILD_OUTPUT_PATH)
3
+ directory(GCOV_RESULTS_PATH)
4
+ directory(GCOV_ARTIFACTS_PATH)
5
+ directory(GCOV_DEPENDENCIES_PATH)
6
+
7
+ CLEAN.include(File.join(GCOV_BUILD_OUTPUT_PATH, '*'))
8
+ CLEAN.include(File.join(GCOV_RESULTS_PATH, '*'))
9
+ CLEAN.include(File.join(GCOV_DEPENDENCIES_PATH, '*'))
10
+
11
+ CLOBBER.include(File.join(GCOV_BUILD_PATH, '**/*'))
12
+
13
+
14
+ rule(/#{GCOV_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [
15
+ proc do |task_name|
16
+ @ceedling[:file_finder].find_compilation_input_file(task_name)
17
+ end
18
+ ]) do |object|
19
+
20
+ if (File.basename(object.source) =~ /^(#{PROJECT_TEST_FILE_PREFIX}|#{CMOCK_MOCK_PREFIX}|unity|cmock|cexception)/i)
21
+ @ceedling[:generator].generate_object_file(TOOLS_GCOV_COMPILER, GCOV_CONTEXT, object.source, object.name)
22
+ else
23
+ @ceedling[GCOV_CONTEXT].generate_coverage_object_file(object.source, object.name)
24
+ end
25
+
26
+ end
27
+
28
+ rule(/#{GCOV_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_EXECUTABLE}$/) do |bin_file|
29
+ @ceedling[:generator].generate_executable_file(TOOLS_GCOV_LINKER, GCOV_CONTEXT, bin_file.prerequisites, bin_file.name)
30
+ end
31
+
32
+ rule(/#{GCOV_RESULTS_PATH}\/#{'.+\\'+EXTENSION_TESTPASS}$/ => [
33
+ proc do |task_name|
34
+ @ceedling[:file_path_utils].form_test_executable_filepath(task_name)
35
+ end
36
+ ]) do |test_result|
37
+ @ceedling[:generator].generate_test_results(TOOLS_GCOV_FIXTURE, GCOV_CONTEXT, test_result.source, test_result.name)
38
+ end
39
+
40
+ rule(/#{GCOV_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [
41
+ proc do |task_name|
42
+ @ceedling[:file_finder].find_compilation_input_file(task_name)
43
+ end
44
+ ]) do |dep|
45
+ @ceedling[:generator].generate_dependencies_file(
46
+ TOOLS_TEST_DEPENDENCIES_GENERATOR,
47
+ GCOV_CONTEXT,
48
+ dep.source,
49
+ File.join(GCOV_BUILD_OUTPUT_PATH, File.basename(dep.source).ext(EXTENSION_OBJECT) ),
50
+ dep.name)
51
+ end
52
+
53
+ task :directories => [GCOV_BUILD_OUTPUT_PATH, GCOV_RESULTS_PATH, GCOV_DEPENDENCIES_PATH, GCOV_ARTIFACTS_PATH]
54
+
55
+ namespace GCOV_CONTEXT do
56
+
57
+ task :source_coverage => COLLECTION_ALL_SOURCE.pathmap("#{GCOV_BUILD_OUTPUT_PATH}/%n#{@ceedling[:configurator].extension_object}")
58
+
59
+ desc "Run code coverage for all tests"
60
+ task :all => [:directories] do
61
+ @ceedling[:configurator].replace_flattened_config(@ceedling[GCOV_CONTEXT].config)
62
+ @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS)
63
+ @ceedling[:configurator].restore_config
64
+ end
65
+
66
+ desc "Run single test w/ coverage ([*] real test or source file name, no path)."
67
+ task :* do
68
+ message = "\nOops! '#{GCOV_ROOT_NAME}:*' isn't a real task. " +
69
+ "Use a real test or source file name (no path) in place of the wildcard.\n" +
70
+ "Example: rake #{GCOV_ROOT_NAME}:foo.c\n\n"
71
+
72
+ @ceedling[:streaminator].stdout_puts( message )
73
+ end
74
+
75
+ desc "Run tests by matching regular expression pattern."
76
+ task :pattern, [:regex] => [:directories] do |t, args|
77
+ matches = []
78
+
79
+ COLLECTION_ALL_TESTS.each do |test|
80
+ matches << test if test =~ /#{args.regex}/
81
+ end
82
+
83
+ if (matches.size > 0)
84
+ @ceedling[:configurator].replace_flattened_config(@ceedling[GCOV_CONTEXT].config)
85
+ @ceedling[:test_invoker].setup_and_invoke(matches, {:force_run => false})
86
+ @ceedling[:configurator].restore_config
87
+ else
88
+ @ceedling[:streaminator].stdout_puts("\nFound no tests matching pattern /#{args.regex}/.")
89
+ end
90
+ end
91
+
92
+ desc "Run tests whose test path contains [dir] or [dir] substring."
93
+ task :path, [:dir] => [:directories] do |t, args|
94
+ matches = []
95
+
96
+ COLLECTION_ALL_TESTS.each do |test|
97
+ matches << test if File.dirname(test).include?(args.dir.gsub(/\\/, '/'))
98
+ end
99
+
100
+ if (matches.size > 0)
101
+ @ceedling[:configurator].replace_flattened_config(@ceedling[GCOV_CONTEXT].config)
102
+ @ceedling[:test_invoker].setup_and_invoke(matches, {:force_run => false})
103
+ @ceedling[:configurator].restore_config
104
+ else
105
+ @ceedling[:streaminator].stdout_puts("\nFound no tests including the given path or path component.")
106
+ end
107
+ end
108
+
109
+ desc "Run code coverage for changed files"
110
+ task :delta => [:directories] do
111
+ @ceedling[:configurator].replace_flattened_config(@ceedling[GCOV_CONTEXT].config)
112
+ @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS, {:force_run => false})
113
+ @ceedling[:configurator].restore_config
114
+ end
115
+
116
+ # use a rule to increase efficiency for large projects
117
+ # gcov test tasks by regex
118
+ rule(/^#{GCOV_TASK_ROOT}\S+$/ => [
119
+ proc do |task_name|
120
+ test = task_name.sub(/#{GCOV_TASK_ROOT}/, '')
121
+ test = "#{PROJECT_TEST_FILE_PREFIX}#{test}" if not (test.start_with?(PROJECT_TEST_FILE_PREFIX))
122
+ @ceedling[:file_finder].find_test_from_file_path(test)
123
+ end
124
+ ]) do |test|
125
+ @ceedling[:rake_wrapper][:directories].invoke
126
+ @ceedling[:configurator].replace_flattened_config(@ceedling[GCOV_CONTEXT].config)
127
+ @ceedling[:test_invoker].setup_and_invoke([test.source])
128
+ @ceedling[:configurator].restore_config
129
+ end
130
+
131
+ desc "Open code coverage browser"
132
+ task :open do
133
+ sh "start CoverageBrowser.exe #{ENVIRONMENT_COVFILE}"
134
+ end
135
+
136
+ end