ceedling 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. checksums.yaml +4 -4
  2. data/GIT_COMMIT_SHA +1 -1
  3. data/README.md +10 -7
  4. data/assets/broken_uncovered_file.c +13 -0
  5. data/assets/test_example_file_2.c +22 -0
  6. data/assets/tests_with_partials_coverage/src/blanks.c +10 -0
  7. data/assets/tests_with_partials_coverage/src/blanks.h +1 -0
  8. data/assets/tests_with_partials_coverage/src/counter.c +12 -0
  9. data/assets/tests_with_partials_coverage/src/counter.h +1 -0
  10. data/assets/tests_with_partials_coverage/src/decorators.c +11 -0
  11. data/assets/tests_with_partials_coverage/src/decorators.h +4 -0
  12. data/assets/tests_with_partials_coverage/test/test_blanks.c +8 -0
  13. data/assets/tests_with_partials_coverage/test/test_counter.c +9 -0
  14. data/assets/tests_with_partials_coverage/test/test_decorators.c +8 -0
  15. data/docs/Changelog.md +80 -38
  16. data/docs/KnownIssues.md +9 -0
  17. data/docs/ReleaseNotes.md +5 -1
  18. data/docs/mkdocs/getting-started/installation.md +8 -1
  19. data/docs/mkdocs/getting-started/quick-start.md +20 -2
  20. data/docs/mkdocs/help.md +2 -2
  21. data/docs/mkdocs/index.md +13 -6
  22. data/docs/mkdocs/overview/build-system.md +4 -4
  23. data/docs/mkdocs/plugins/bullseye.md +6 -0
  24. data/docs/mkdocs/plugins/command-hooks.md +20 -15
  25. data/docs/mkdocs/plugins/gcov/gcovr.md +130 -109
  26. data/docs/mkdocs/plugins/gcov/index.md +6 -0
  27. data/docs/mkdocs/plugins/index.md +40 -0
  28. data/docs/mkdocs/plugins/valgrind.md +6 -0
  29. data/docs/mkdocs/testing-guide/partials/index.md +22 -13
  30. data/lib/ceedling/c_extractor/c_extractor_declarations.rb +3 -1
  31. data/lib/ceedling/c_extractor/c_extractor_preprocessing.rb +20 -7
  32. data/lib/ceedling/config/configurator.rb +2 -1
  33. data/lib/ceedling/generators/generator_partials.rb +13 -3
  34. data/lib/ceedling/objects.yml +1 -0
  35. data/lib/ceedling/preprocess/preprocessinator.rb +3 -2
  36. data/lib/ceedling/preprocess/preprocessinator_file_assembler.rb +37 -15
  37. data/lib/ceedling/preprocess/preprocessinator_reconstructor.rb +23 -15
  38. data/lib/ceedling/test_invoker/test_build_executor.rb +3 -4
  39. data/lib/ceedling/test_invoker/test_build_planner.rb +0 -2
  40. data/lib/ceedling/test_invoker/test_invoker_types.rb +1 -1
  41. data/lib/ceedling/tool_executor.rb +5 -0
  42. data/lib/version.rb +1 -1
  43. data/plugins/command_hooks/lib/command_hooks.rb +4 -0
  44. data/plugins/gcov/lib/console_reportinator.rb +3 -1
  45. data/plugins/gcov/lib/gcov.rb +3 -3
  46. data/plugins/gcov/lib/gcov_reportinator.rb +4 -0
  47. data/plugins/gcov/lib/gcovr_reportinator.rb +61 -14
  48. data/plugins/gcov/lib/reportgenerator_reportinator.rb +3 -1
  49. data/site-local/404.html +3 -3
  50. data/site-local/assets/javascripts/{bundle.79ae519e.min.js → bundle.d7400e89.min.js} +2 -2
  51. data/site-local/assets/javascripts/{bundle.79ae519e.min.js.map → bundle.d7400e89.min.js.map} +2 -2
  52. data/site-local/assets/stylesheets/main.ec1eaa64.min.css +1 -0
  53. data/site-local/assets/stylesheets/{main.484c7ddc.min.css.map → main.ec1eaa64.min.css.map} +1 -1
  54. data/site-local/configuration/environment-vars.html +3 -3
  55. data/site-local/configuration/global-collections.html +3 -3
  56. data/site-local/configuration/index.html +3 -3
  57. data/site-local/configuration/loading.html +3 -3
  58. data/site-local/configuration/mixins.html +3 -3
  59. data/site-local/configuration/parallel-builds.html +3 -3
  60. data/site-local/configuration/project-file.html +3 -3
  61. data/site-local/configuration/reference/cexception.html +3 -3
  62. data/site-local/configuration/reference/cmock.html +3 -3
  63. data/site-local/configuration/reference/defines.html +3 -3
  64. data/site-local/configuration/reference/environment.html +3 -3
  65. data/site-local/configuration/reference/extension.html +3 -3
  66. data/site-local/configuration/reference/files.html +3 -3
  67. data/site-local/configuration/reference/flags.html +3 -3
  68. data/site-local/configuration/reference/index.html +3 -3
  69. data/site-local/configuration/reference/libraries.html +3 -3
  70. data/site-local/configuration/reference/mixins.html +3 -3
  71. data/site-local/configuration/reference/paths.html +3 -3
  72. data/site-local/configuration/reference/plugins.html +3 -3
  73. data/site-local/configuration/reference/project.html +3 -3
  74. data/site-local/configuration/reference/release-build.html +3 -3
  75. data/site-local/configuration/reference/test-build.html +3 -3
  76. data/site-local/configuration/reference/test-runner.html +3 -3
  77. data/site-local/configuration/reference/tools.html +3 -3
  78. data/site-local/configuration/reference/unity.html +3 -3
  79. data/site-local/configuration/which-ceedling.html +3 -3
  80. data/site-local/development/index.html +3 -3
  81. data/site-local/development/plugins/configuration.html +3 -3
  82. data/site-local/development/plugins/index.html +3 -3
  83. data/site-local/development/plugins/plugin-subclass.html +3 -3
  84. data/site-local/development/plugins/rake-tasks.html +3 -3
  85. data/site-local/development/workflow.html +3 -3
  86. data/site-local/getting-started/command-line.html +3 -3
  87. data/site-local/getting-started/example-projects/cipher-quest.html +3 -3
  88. data/site-local/getting-started/example-projects/index.html +3 -3
  89. data/site-local/getting-started/example-projects/temp-sensor.html +3 -3
  90. data/site-local/getting-started/example-projects/wondrous-forest.html +3 -3
  91. data/site-local/getting-started/index.html +3 -3
  92. data/site-local/getting-started/installation.html +12 -4
  93. data/site-local/getting-started/quick-start.html +18 -4
  94. data/site-local/help.html +4 -4
  95. data/site-local/index.html +13 -8
  96. data/site-local/overview/build-system.html +6 -6
  97. data/site-local/overview/index.html +3 -3
  98. data/site-local/overview/test-environments.html +3 -3
  99. data/site-local/overview/tools-and-frameworks.html +3 -3
  100. data/site-local/plugins/beep.html +3 -3
  101. data/site-local/plugins/bullseye.html +9 -3
  102. data/site-local/plugins/command-hooks.html +42 -38
  103. data/site-local/plugins/compile-commands-json-db.html +3 -3
  104. data/site-local/plugins/cppcheck.html +3 -3
  105. data/site-local/plugins/dependencies.html +3 -3
  106. data/site-local/plugins/fff.html +3 -3
  107. data/site-local/plugins/gcov/examples.html +3 -3
  108. data/site-local/plugins/gcov/gcovr.html +325 -227
  109. data/site-local/plugins/gcov/index.html +9 -3
  110. data/site-local/plugins/gcov/overview.html +3 -3
  111. data/site-local/plugins/gcov/reportgenerator.html +3 -3
  112. data/site-local/plugins/gcov/reporting.html +3 -3
  113. data/site-local/plugins/gcov/setup.html +3 -3
  114. data/site-local/plugins/gcov/tool-versions.html +3 -3
  115. data/site-local/plugins/gcov/troubleshooting.html +3 -3
  116. data/site-local/plugins/index.html +79 -15
  117. data/site-local/plugins/module-generator.html +3 -3
  118. data/site-local/plugins/report-build-warnings-log.html +3 -3
  119. data/site-local/plugins/report-tests-gtestlike-stdout.html +3 -3
  120. data/site-local/plugins/report-tests-ide-stdout.html +3 -3
  121. data/site-local/plugins/report-tests-log-factory.html +3 -3
  122. data/site-local/plugins/report-tests-pretty-stdout.html +3 -3
  123. data/site-local/plugins/report-tests-raw-output-log.html +3 -3
  124. data/site-local/plugins/report-tests-teamcity-stdout.html +3 -3
  125. data/site-local/plugins/valgrind.html +9 -3
  126. data/site-local/project/release-history.html +3 -3
  127. data/site-local/project/upgrade.html +3 -3
  128. data/site-local/reference/build-directives.html +3 -3
  129. data/site-local/reference/command-line.html +3 -3
  130. data/site-local/reference/environment-vars.html +3 -3
  131. data/site-local/reference/gcov-plugin.html +3 -3
  132. data/site-local/reference/global-collections.html +3 -3
  133. data/site-local/reference/index.html +3 -3
  134. data/site-local/reference/partials-macros.html +3 -3
  135. data/site-local/reference/project-configuration.html +3 -3
  136. data/site-local/sitemap.xml.gz +0 -0
  137. data/site-local/snapshot/examples/cipher_quest/index.html +3 -3
  138. data/site-local/snapshot/examples/temp_sensor/index.html +3 -3
  139. data/site-local/snapshot/examples/wondrous_forest/index.html +3 -3
  140. data/site-local/testing-guide/build-directives.html +3 -3
  141. data/site-local/testing-guide/conventions.html +3 -3
  142. data/site-local/testing-guide/frameworks.html +3 -3
  143. data/site-local/testing-guide/index.html +3 -3
  144. data/site-local/testing-guide/partials/configuration.html +3 -3
  145. data/site-local/testing-guide/partials/conventions.html +3 -3
  146. data/site-local/testing-guide/partials/directives.html +3 -3
  147. data/site-local/testing-guide/partials/example.html +3 -3
  148. data/site-local/testing-guide/partials/index.html +25 -16
  149. data/site-local/testing-guide/partials/overview.html +3 -3
  150. data/site-local/testing-guide/partials/variables.html +3 -3
  151. data/site-local/testing-guide/test-cases.html +3 -3
  152. data/site-local/testing-guide/test-sample.html +3 -3
  153. data/site-local/testing-guide/test-suite-anatomy.html +3 -3
  154. data/spec/support/system/system_context.rb +3 -1
  155. data/spec/system/gcov_deployment_spec.rb +20 -6
  156. data/spec/system/support/gcov_common_test_cases.rb +34 -45
  157. data/spec/system/support/gcov_partials_test_cases.rb +116 -0
  158. data/spec/units/c_extractor/c_extractor_declarations_spec.rb +128 -0
  159. data/spec/units/c_extractor/c_extractor_definitions_spec.rb +7 -0
  160. data/spec/units/c_extractor/c_extractor_integration_spec.rb +17 -0
  161. data/spec/units/c_extractor/c_extractor_preprocessing_spec.rb +46 -0
  162. data/spec/units/generators/generator_partials_spec.rb +32 -6
  163. data/spec/units/preprocess/preprocessinator_file_assembler_spec.rb +250 -1
  164. data/spec/units/preprocess/preprocessinator_reconstructor_spec.rb +151 -1
  165. data/spec/units/test_build_executor_spec.rb +114 -0
  166. data/vendor/unity/auto/generate_test_runner.rb +55 -5
  167. data/vendor/unity/src/unity.h +1 -1
  168. data/vendor/unity/test/testdata/testRunnerGeneratorEmpty.c +13 -0
  169. data/vendor/unity/test/tests/test_generate_test_runner.rb +11 -0
  170. metadata +22 -7
  171. data/site-local/assets/stylesheets/main.484c7ddc.min.css +0 -1
  172. data/vendor/unity/auto/run_test.erb +0 -37
@@ -4,7 +4,7 @@ Easily run command line tools and scripts at various points in a Ceedling build.
4
4
 
5
5
  ## Plugin Overview
6
6
 
7
- This plugin allows you to skip creating a full Ceedling plugin for many common use cases. It links Ceedling's programmatic `Plugin` code hooks to easily managed tool definitions.
7
+ This plugin allows you to skip creating a full Ceedling plugin for many common use cases. It links Ceedlings programmatic `Plugin` code hooks to easily managed tool definitions.
8
8
 
9
9
  ## Setup
10
10
 
@@ -40,7 +40,9 @@ See the commented examples below.
40
40
 
41
41
  Each Ceedling tool requires an `:executable` string and an optional `:arguments` list. See the [`:tools` configuration reference][tools-doc] to understand how to craft your argument list and other tool options.
42
42
 
43
- This plugin passes one or two runtime parameters for use in a hook's tool argument list depending on the hook. These parameters are referenced with Ceedling tool argument expansion identifiers `${1}`, `${2}`, etc. Wherever you place `${1}` or `${2}` in your tool argument list, they expand in the command line Ceedling constructs with the parameters this plugin provides for that build step hook. The list of build step hooks below documents which parameters are available for each hook.
43
+ This plugin passes one or two runtime parameters for use in a hooks tool argument list depending on the hook. These parameters are referenced with Ceedling tool argument expansion identifiers `${1}`, `${2}`, etc. Wherever you place `${1}` or `${2}` in your tool argument list, they expand in the command line Ceedling constructs with the parameters this plugin provides for that build step hook. The list of build step hooks below documents which parameters are available for each hook.
44
+
45
+ Each tool may optionally include a `:name` — a simple nickname used in log and error messages. If omitted, the plugin forms a default name from the hook’s key (e.g. `pre_mock_generate`). For a hook configured with a list of tools, the default name additionally includes the tool’s position in the list (e.g. `post_link_execute_0`, `post_link_execute_1`). See the commented examples below.
44
46
 
45
47
  [tools-doc]: ../configuration/reference/tools.md
46
48
 
@@ -65,6 +67,7 @@ When logging is enabled and logging conditions are appropriate, any output from
65
67
  :pre_mock_generate:
66
68
  # This tool is organized as a sub-hash beneath the command hook key
67
69
  :executable: python
70
+ :name: 'mock prep script' # Explicit nickname used in log/error messages
68
71
  :arguments:
69
72
  - my_script.py
70
73
  - --some-arg
@@ -74,18 +77,20 @@ When logging is enabled and logging conditions are appropriate, any output from
74
77
  # Hook called for each linking operation
75
78
  # Here, we are performing two tasks for the same build step hook, converting a
76
79
  # binary executable to S-record format and, then, archiving with other artifacts.
80
+ # Neither tool below is given a :name -- the plugin defaults them to
81
+ # "post_link_execute_0" and "post_link_execute_1"
77
82
  :post_link_execute:
78
83
  # These tools are organized in a YAML list beneath the command hook key
79
84
  - :executable: objcopy.exe
80
85
  :arguments:
81
- - ${1} # Replaced with the filepath to the linker's binary artifact output
86
+ - ${1} # Replaced with the filepath to the linkers binary artifact output
82
87
  - output.srec
83
88
  - --strip-all
84
89
  - :executable:
85
90
  :arguments: tar.exe
86
91
  - -acf
87
92
  - awesome_build.zip
88
- - ${1} # Replaced with the filepath to the linker's binary artifact output
93
+ - ${1} # Replaced with the filepath to the linkers binary artifact output
89
94
  - memory_report.txt
90
95
  ```
91
96
 
@@ -102,7 +107,7 @@ As an example, consider a Ceedling project with ten test files and seventeen moc
102
107
  * 10 occurrences of the `:pre_test` and `:post_test` hooks.
103
108
  * 17 occurrences of the `:pre_mock_generate` and `:post_mock_generate` hooks.
104
109
  * 10 occurrences of the `:pre_test_runner_generate` and `:post_test_runner_generate` hooks.
105
- * 27(+) occurrences of the `:pre_compile` and `:post_compile` hooks. These hooks would be called 27 times for test file and mock file compilation. A test suite build will also include compilation of the source files under tests, Unity's source, CMock's source, and generated test runner C files -- easily more than another two dozen compilation hook calls.
110
+ * 27(+) occurrences of the `:pre_compile` and `:post_compile` hooks. These hooks would be called 27 times for test file and mock file compilation. A test suite build will also include compilation of the source files under tests, Unitys source, CMocks source, and generated test runner C files -- easily more than another two dozen compilation hook calls.
106
111
  * 10 occurrences of the `:pre_link` and `:post_link` hooks for test executable creation.
107
112
  * 10 occurrences of the `:pre_test_fixture_execute` and `:post_test_fixture_execute` hooks for running test executables and gathering the results of the tests cases they contain.
108
113
  * 1 occurrence of the `:post_test_build` hook.
@@ -130,17 +135,17 @@ The parameter available to a tool (`${1}`) when the hook is called is a floating
130
135
 
131
136
  Called just before each test begins its build pipeline and just after all context for that build has been gathered.
132
137
 
133
- The parameter available to a tool (`${1}`) when the hook is called is the test's filepath.
138
+ The parameter available to a tool (`${1}`) when the hook is called is the tests filepath.
134
139
 
135
140
  ### `:post_test`
136
141
 
137
142
  Called just after each test completes its build and execution.
138
143
 
139
- The parameter available to a tool (`${1}`) when the hook is called is the test's filepath.
144
+ The parameter available to a tool (`${1}`) when the hook is called is the tests filepath.
140
145
 
141
146
  ### `:pre_test_build`
142
147
 
143
- Called once just before the full test build pipeline begins (before any individual test's configure, preprocess, compile, link, or execute steps).
148
+ Called once just before the full test build pipeline begins (before any individual tests configure, preprocess, compile, link, or execute steps).
144
149
 
145
150
  Two parameters are available to a tool when the hook is called:
146
151
 
@@ -200,7 +205,7 @@ The parameter available to a tool (`${1}`) when the hook is called is the filepa
200
205
 
201
206
  If preprocessing is in use, this is called just before each test file is preprocessed before runner generation.
202
207
 
203
- The parameter available to a tool (`${1}`) when the hook is called is the test's filepath.
208
+ The parameter available to a tool (`${1}`) when the hook is called is the tests filepath.
204
209
 
205
210
  See [_Conventions & Behaviors_][preprocessing] for details on how Ceedling preprocessing operates.
206
211
 
@@ -208,7 +213,7 @@ See [_Conventions & Behaviors_][preprocessing] for details on how Ceedling prepr
208
213
 
209
214
  If preprocessing is in use, this is called just after each test file is preprocessed.
210
215
 
211
- The parameter available to a tool (`${1}`) when the hook is called is the test's filepath.
216
+ The parameter available to a tool (`${1}`) when the hook is called is the tests filepath.
212
217
 
213
218
  See [_Conventions & Behaviors_][preprocessing] for details on how Ceedling preprocessing operates.
214
219
 
@@ -216,13 +221,13 @@ See [_Conventions & Behaviors_][preprocessing] for details on how Ceedling prepr
216
221
 
217
222
  Called just before each test file is processed by test runner generation.
218
223
 
219
- The parameter available to a tool (`${1}`) when the hook is called is the test's filepath.
224
+ The parameter available to a tool (`${1}`) when the hook is called is the tests filepath.
220
225
 
221
226
  ### `:post_runner_generate`
222
227
 
223
228
  Called just after each test runner is generated.
224
229
 
225
- The parameter available to a tool (`${1}`) when the hook is called is the test's filepath.
230
+ The parameter available to a tool (`${1}`) when the hook is called is the tests filepath.
226
231
 
227
232
  ### `:pre_compile_execute`
228
233
 
@@ -240,13 +245,13 @@ The parameter available to a tool (`${1}`) when the hook is called is the filepa
240
245
 
241
246
  Called just before any binary artifact—test or release—is linked.
242
247
 
243
- The parameter available to a tool (`${1}`) when the hook is called is the binary output artifact's filepath.
248
+ The parameter available to a tool (`${1}`) when the hook is called is the binary output artifacts filepath.
244
249
 
245
250
  ### `:post_link_execute`
246
251
 
247
252
  Called just after a binary artifact is linked.
248
253
 
249
- The parameter available to a tool (`${1}`) when the hook is called is the binary output artifact's filepath.
254
+ The parameter available to a tool (`${1}`) when the hook is called is the binary output artifacts filepath.
250
255
 
251
256
  ### `:pre_test_fixture_execute`
252
257
 
@@ -256,7 +261,7 @@ The parameter available to a tool (`${1}`) when the hook is called is the filepa
256
261
 
257
262
  ### `:post_test_fixture_execute`
258
263
 
259
- Called just after each test's fixture is executed and test results are collected.
264
+ Called just after each tests fixture is executed and test results are collected.
260
265
 
261
266
  The parameter available to a tool (`${1}`) when the hook is called is the filepath of the binary artifact that was executed by the fixture.
262
267
 
@@ -1,126 +1,61 @@
1
1
  # GCovr Configuration
2
2
 
3
- All reports generated by `gcovr` are found in `<build root>/artifacts/gcov/gcovr/`.
3
+ !!! note
4
+ All reports generated by `gcovr` are found in `<build root>/artifacts/gcov/gcovr/`.
4
5
 
5
- ## HTML reports
6
-
7
- Generation of HTML reports may be modified with the following configuration items.
8
-
9
- ```yaml
10
- :gcov:
11
- :gcovr:
12
- # HTML report filename.
13
- :html_artifact_filename: <filename>
14
-
15
- # Use 'title' as title for the HTML report.
16
- # Default is 'Head'. (gcovr --html-title)
17
- :html_title: <title>
18
-
19
- # If the coverage is below MEDIUM, the value is marked as low coverage in the HTML report.
20
- # MEDIUM has to be lower than or equal to value of html_high_threshold.
21
- # If MEDIUM is equal to value of html_high_threshold the report has only high and low coverage.
22
- # Default is 75.0. (gcovr --html-medium-threshold)
23
- :html_medium_threshold: 75
24
-
25
- # If the coverage is below HIGH, the value is marked as medium coverage in the HTML report.
26
- # HIGH has to be greater than or equal to value of html_medium_threshold.
27
- # If HIGH is equal to value of html_medium_threshold the report has only high and low coverage.
28
- # Default is 90.0. (gcovr -html-high-threshold)
29
- :html_high_threshold: 90
30
-
31
- # Set to 'true' to use absolute paths to link the 'detailed' reports.
32
- # Defaults to relative links. (gcovr --html-absolute-paths)
33
- :html_absolute_paths: <true|false>
34
-
35
- # Override the declared HTML report encoding. Defaults to UTF-8. (gcovr --html-encoding)
36
- :html_encoding: <html_encoding>
37
- ```
38
-
39
- ## Cobertura XML reports
6
+ The following sections first discuss GCovr options in common across reports
7
+ and then break out report-specific options.
40
8
 
41
- Generation of Cobertura XML reports may be modified with the following configuration items.
9
+ ## GCovr options
42
10
 
43
- ```yaml
44
- :gcov:
45
- :gcovr:
46
- # Set to 'true' to pretty-print the Cobertura XML report, otherwise set to 'false'.
47
- # Defaults to disabled. (gcovr --xml-pretty)
48
- :cobertura_pretty: <true|false>
11
+ ### Project config vs. GCovr config file
49
12
 
50
- # Override default Cobertura XML report filename.
51
- :cobertura_artifact_filename: <filename>
52
- ```
13
+ GCovr can be configured in two ways:
53
14
 
54
- ## SonarQube XML reports
15
+ 1. Using one or more of the options documented below in the `:gcov` section
16
+ of your project configuration.
17
+ 1. Through a Gcovr configuration file (.ini format) provided to Gcovr via
18
+ the speciial `:config_file` value in the `:gcov` section of your project
19
+ configuration.
55
20
 
56
- Generation of SonarQube XML reports may be modified with the following configuration items.
21
+ ### Gcovr configuration file
57
22
 
58
- ```yaml
59
- :gcov:
60
- :gcovr:
61
- # Override default SonarQube XML report filename.
62
- :sonarqube_artifact_filename: <filename>
63
- ```
23
+ !!! warning "Using a gcovr configuration file"
24
+ When `:config_file` is set, Ceedling passes only `--root` (`:report_root`)
25
+ and `--config` (`:config_file`) to `gcovr` at the command line from your
26
+ plugin configuration. This prevents overriding config file settings with
27
+ CLI arguments. You must provide any settings that would have been provided
28
+ by the Gcov plugin.
64
29
 
65
- ## JSON reports
30
+ To preserve filtering of test and build files from coverage results when
31
+ using a Gcovr config file, you must provide explicit exclusion patterns matching
32
+ your project layout (example below).
66
33
 
67
- Generation of JSON reports may be modified with the following configuration items.
34
+ ```ini
35
+ [gcovr]
36
+ ; You will need to revise these example exclude patterns to match your
37
+ ; project directories and file naming as they cannot be automatically
38
+ ; provided to Gcovr when a Gcovr configuration file is in use.
68
39
 
69
- ```yaml
70
- :gcov:
71
- :gcovr:
72
- # Set to 'true' to pretty-print the JSON report, otherwise set 'false'.
73
- # Defaults to disabled. (gcovr --json-pretty)
74
- :json_pretty: <true|false>
40
+ ; Test path(s) exclusions for 'test_' files with .c extensions.
41
+ exclude = .*test.*/test_.+\.c$
75
42
 
76
- # Override default JSON report filename.
77
- :json_artifact_filename: <filename>
43
+ ; Build path exlcude for all generated C files (runners, mocks, partials).
44
+ exclude = .*build/.+\.c$
78
45
  ```
79
46
 
80
- ## Text reports
81
-
82
- Generation of text reports may be modified with the following configuration items.
83
- Text reports may be printed to the console or output to a file.
47
+ ### Plugin project configuration
84
48
 
85
- ```yaml
86
- :gcov:
87
- :gcovr:
88
- # Override default text report filename.
89
- :text_artifact_filename: <filename>
90
- ```
49
+ The following is an exhaustive commented version of all GCovr configuration
50
+ options exposed through your project configuration file. Only specify those
51
+ you need or those whose defaults you need to override. You do not need to
52
+ include all these options in your Gcov plugin configuration.
91
53
 
92
- ## Common GCovr options
93
-
94
- A number of options exist to control which files are considered part of a
95
- coverage report. This Ceedling gcov plugin itself handles the most important
96
- aspect only source files under test are compiled with coverage. Tests, mocks,
97
- and test runners, are not compiled with coverage.
98
-
99
- !!! note "`gcovr` accepts only one report root path"
100
- `gcovr` will only accept a single path for `:report_root`. In typical usage,
101
- this is of no concern as it is handled automatically. In unusual project
102
- layouts, you may need to specify a folder that encompasses _all_ build folders
103
- containing coverage result files and optionally, selectively exclude patterns
104
- of paths or files. For instance, if your Ceedling project file is not at the
105
- root of your project, you may need set `:report_root` as well as
106
- `:report_exclude` and `:exclude_directories`.
107
-
108
- !!! note "Using a gcovr configuration file"
109
- When `:config_file:` is set, Ceedling passes only `--root` and `--config`
110
- to gcovr and defers all other settings to that file. This prevents Ceedling
111
- from overriding config file values with its CLI arguments. Only `:report_root:`
112
- is still applied because Ceedling may invoke gcovr from a different working
113
- directory than your project root.
114
-
115
- To preserve the plugin's default filtering of test and build files, include
116
- equivalent exclusion patterns in your gcovr config file (adjust for your
117
- project's `:test_file_prefix`, test paths, and `:build_root` settings):
118
-
119
- ```ini
120
- [gcovr]
121
- exclude = .*test.*/test_.+\.c$
122
- exclude = .*build/.+\.c$
123
- ```
54
+ !!! warning "`gcovr` accepts only one reporting root path"
55
+ `gcovr` accepts only a single path for `:report_root`. In unusual project
56
+ layouts, you may need to specify as root a parent folder that includes
57
+ _all_ source files and selectively exclude paths or files from coverage
58
+ reporting (see `:report_exclude` and `:exclude_directories`).
124
59
 
125
60
  ```yaml
126
61
  :gcov:
@@ -139,8 +74,8 @@ and test runners, are not compiled with coverage.
139
74
  # :report_root is still applied because Ceedling may invoke gcovr from a
140
75
  # different working directory than your project root.
141
76
  #
142
- # To preserve the plugin's base filtering behavior, include the following
143
- # patterns in your config file (adjust paths to match your project's
77
+ # To preserve the plugins base filtering behavior, include the following
78
+ # patterns in your config file (adjust paths to match your projects
144
79
  # :test_file_prefix, test paths, and :build_root settings):
145
80
  #
146
81
  # [gcovr]
@@ -210,7 +145,7 @@ and test runners, are not compiled with coverage.
210
145
 
211
146
  # Use a particular gcov executable. (gcovr --gcov-executable).
212
147
  # (This may be appropriate and necessary in special circumstances.
213
- # Please review Ceedling's options for modifying tools first.)
148
+ # Please review Ceedlings options for modifying tools first.)
214
149
  :gcov_executable: <cmd>
215
150
 
216
151
  # Exclude branch coverage from lines without useful
@@ -247,5 +182,91 @@ and test runners, are not compiled with coverage.
247
182
  # Set the number of threads to use in parallel. (gcovr -j).
248
183
  :threads: <count>
249
184
  ```
185
+ ## HTML reports
186
+
187
+ Generation of HTML reports may be modified with the following configuration items.
188
+
189
+ ```yaml
190
+ :gcov:
191
+ :gcovr:
192
+ # HTML report filename.
193
+ :html_artifact_filename: <filename>
194
+
195
+ # Use 'title' as title for the HTML report.
196
+ # Default is 'Head'. (gcovr --html-title)
197
+ :html_title: <title>
198
+
199
+ # If the coverage is below MEDIUM, the value is marked as low coverage in the HTML report.
200
+ # MEDIUM has to be lower than or equal to value of html_high_threshold.
201
+ # If MEDIUM is equal to value of html_high_threshold the report has only high and low coverage.
202
+ # Default is 75.0. (gcovr --html-medium-threshold)
203
+ :html_medium_threshold: 75
204
+
205
+ # If the coverage is below HIGH, the value is marked as medium coverage in the HTML report.
206
+ # HIGH has to be greater than or equal to value of html_medium_threshold.
207
+ # If HIGH is equal to value of html_medium_threshold the report has only high and low coverage.
208
+ # Default is 90.0. (gcovr -html-high-threshold)
209
+ :html_high_threshold: 90
210
+
211
+ # Set to 'true' to use absolute paths to link the 'detailed' reports.
212
+ # Defaults to relative links. (gcovr --html-absolute-paths)
213
+ :html_absolute_paths: <true|false>
214
+
215
+ # Override the declared HTML report encoding. Defaults to UTF-8. (gcovr --html-encoding)
216
+ :html_encoding: <html_encoding>
217
+ ```
218
+
219
+ ## Cobertura XML reports
220
+
221
+ Generation of Cobertura XML reports may be modified with the following configuration items.
222
+
223
+ ```yaml
224
+ :gcov:
225
+ :gcovr:
226
+ # Set to 'true' to pretty-print the Cobertura XML report, otherwise set to 'false'.
227
+ # Defaults to disabled. (gcovr --xml-pretty)
228
+ :cobertura_pretty: <true|false>
229
+
230
+ # Override default Cobertura XML report filename.
231
+ :cobertura_artifact_filename: <filename>
232
+ ```
233
+
234
+ ## SonarQube XML reports
235
+
236
+ Generation of SonarQube XML reports may be modified with the following configuration items.
237
+
238
+ ```yaml
239
+ :gcov:
240
+ :gcovr:
241
+ # Override default SonarQube XML report filename.
242
+ :sonarqube_artifact_filename: <filename>
243
+ ```
244
+
245
+ ## JSON reports
246
+
247
+ Generation of JSON reports may be modified with the following configuration items.
248
+
249
+ ```yaml
250
+ :gcov:
251
+ :gcovr:
252
+ # Set to 'true' to pretty-print the JSON report, otherwise set 'false'.
253
+ # Defaults to disabled. (gcovr --json-pretty)
254
+ :json_pretty: <true|false>
255
+
256
+ # Override default JSON report filename.
257
+ :json_artifact_filename: <filename>
258
+ ```
259
+
260
+ ## Text reports
261
+
262
+ Generation of text reports may be modified with the following configuration items.
263
+ Text reports may be printed to the console or output to a file.
264
+
265
+ ```yaml
266
+ :gcov:
267
+ :gcovr:
268
+ # Override default text report filename.
269
+ :text_artifact_filename: <filename>
270
+ ```
250
271
 
251
272
  <br/><br/>
@@ -4,6 +4,12 @@ The `gcov` plugin integrates the code coverage abilities of the GNU compiler
4
4
  collection with test builds. It provides simple coverage metrics by default and
5
5
  can optionally produce sophisticated coverage reports.
6
6
 
7
+ !!! note
8
+ The Gcov plugin creates a duplicate test build with `gcov:` command line
9
+ plugin tasks. [This is intentional and needed](../index.md#understanding-plugin-build-duplication).
10
+
11
+ ---
12
+
7
13
  <div class="grid cards" markdown>
8
14
 
9
15
  - :material-information-outline: **[Overview][overview]**
@@ -16,6 +16,46 @@ includes full documentation of its capabilities and configuration options.
16
16
  See the [`:plugins` configuration reference](../configuration/reference/plugins.md)
17
17
  for how to enable built-in plugins and load custom plugins in your project.
18
18
 
19
+ ---
20
+
21
+ ## Understanding plugin build duplication
22
+
23
+ !!! warning
24
+ Build-related plugins intentionally execute duplicated builds.
25
+
26
+ Plugins including [Gcov](gcov/index.md), [Bullseye](bullseye.md), and [Valgrind](valgrind.md)
27
+ recreate test build tasks. That is, the command line build task `test:foo` also exists
28
+ as `gcov:foo`, `bullseye:foo`, and/or `valgrind:foo` if these plugins are enabled.
29
+ Each of these triggers a full rebuild of the named test with instrumentation
30
+ activated. **This duplication is intentional and very necessary.**
31
+
32
+ These plugins modify executable code or the environment in which a test suite
33
+ executable runs. Duplicating and segregating the build tasks addresses several
34
+ important issues:
35
+
36
+ 1. **Conflicting interactions**. Enabling multiple plugins without
37
+ duplicated tasks (i.e. integrated build tasks) can bring about conflicts and
38
+ undefined behavior. For instance, Gcov’s instrumentation does not
39
+ necessarily play nice with Valgrind’s memory-instrumented emulation
40
+ runtime, and the two should be kept entirely segregated.
41
+ 2. **Unforeseen effects**. These plugins can directly alter the functioning of
42
+ the code under test. For instance, coverage instrumentation inserted into
43
+ your compiled code can alter its function or timing. As such, it is vital
44
+ to maintain distinct builds to compare them. Your vanilla test suite build
45
+ may function slightly differently than the coverage-instrumented build.
46
+ 3. **Optional instrumentation**. The `<plugin>:` command line task convention
47
+ also provides a very simple opt-in scheme. Plugins automatically enabled
48
+ for every build drives the desire to optional disable them. Valgrind testing
49
+ can require 25-50x the execution time of a test suite, and you likely will
50
+ want the option to easily disable it. While Ceedling could certainly provide
51
+ that option at the command line for otherwise always-on plugins, this
52
+ plugin task namespacing scheme naturally accomplished this along with the
53
+ needs of (1) and (2).
54
+
55
+ ---
56
+
57
+ ## Directory
58
+
19
59
  ### Console Test Results
20
60
 
21
61
  <div class="grid cards" markdown>
@@ -4,6 +4,12 @@ Adds Ceedling tasks to run test executables under [Valgrind] memory error
4
4
  detection to help find memory leaks, invalid memory accesses, and
5
5
  use-after-free bugs in your C code.
6
6
 
7
+ !!! note
8
+ The Valgrind plugin creates a duplicate test build with `valgrind:`
9
+ command line plugin tasks. [This is intentional and needed](index.md#understanding-plugin-build-duplication).
10
+
11
+ ---
12
+
7
13
  ## Plugin overview
8
14
 
9
15
  !!! note "Linux only"
@@ -4,23 +4,25 @@ A _Partial_ is your C code sliced and diced to expose elements for testing
4
4
  that you could not otherwise access without rewriting your source code.
5
5
  Think of Partials as a unit testing scalpel.
6
6
 
7
- Partials are useful when a module under test contains:
7
+ Partials are useful when you need to test:
8
8
 
9
- * **`static` or `inline` functions** — These become accessible within
10
- your test code.
9
+ * **`static` or `inline` functions** — These become accessible to
10
+ your test code without modifying your source.
11
11
  * **File-scoped `static` variables** — The `static` keyword is stripped,
12
- and the variable is automatically made `extern` for easy access within
13
- your test code.
12
+ and the variable is automatically made `extern` for your test code
13
+ with no changes to the source under test.
14
14
  * **Function-scoped `static` variables** — These are promoted from
15
15
  function scope to module scope so they can be accessed in your
16
- test code. Apart from necessary renaming, this works identically to
17
- file-scoped `static` variables.
18
-
19
- !!! warning "Limitations of Partials"
20
- Partials are new to Ceedling with 1.1.0. Carving up C code is tricky
21
- business. Complex code _may_ break Ceedling’s lexing or its assumptions
22
- on symbol ordering. Some issues may be [bugs to be reported](../../help.md)
23
- while others may be complexities that Partials are simply unable to resolve.
16
+ test code just like file-scoped `static` variables.
17
+ * **Same-module mocked functions** — You can mix and match tested and
18
+ mocked functions from the same source module. Partials allow mocking
19
+ functions inside a module that are called by other functions inside
20
+ the same module.
21
+
22
+ !!! tip
23
+ See the [`wondrous_forest`](../../getting-started/example-projects/wondrous-forest.md)
24
+ example available within Ceedling for a working example project
25
+ demonstrating Partials in action.
24
26
 
25
27
  ---
26
28
 
@@ -69,6 +71,13 @@ Partials are useful when a module under test contains:
69
71
 
70
72
  </div>
71
73
 
74
+ !!! warning "Limitations of Partials"
75
+ Partials are new to Ceedling with 1.1.0. Carving up C code is tricky
76
+ business. Complex code _may_ break Ceedling’s lexing or certain assumptions.
77
+ Some issues may be [bugs to be reported](../../help.md) while others may
78
+ be complexities that Partials are simply unable to resolve.
79
+
80
+
72
81
  [overview]: overview.md
73
82
  [conventions]: conventions.md
74
83
  [directives]: directives.md
@@ -167,7 +167,9 @@ class CExtractorDeclarations
167
167
  # Verify this looks like a valid declaration
168
168
  # Must have at least a type and identifier
169
169
  # Can end with: word character, ], ), }, or " (for string initializers)
170
- if declaration =~ /\w+.*[\w\]\)\}"']\s*;$/
170
+ # `/m` flag: declaration may span multiple lines (e.g. a multiline brace
171
+ # initializer), so '.' must match embedded newlines too
172
+ if declaration =~ /\w+.*[\w\]\)\}"']\s*;$/m
171
173
  return [true, expand_and_parse(declaration)]
172
174
  else
173
175
  scanner.pos = start_pos
@@ -142,8 +142,9 @@ class CExtractorPreprocessing
142
142
  return [false, nil] unless success
143
143
  text << args
144
144
 
145
- # Consume optional whitespace before ';'
146
- text << (scanner.scan(/[ \t]*/) || '')
145
+ # Consume optional whitespace before ';' (including newlines, for statements formatted
146
+ # with the terminating ';' on its own line)
147
+ text << (scanner.scan(/\s*/) || '')
147
148
 
148
149
  # Consume the required terminating ';'
149
150
  return [false, nil] unless scanner.scan(/;/)
@@ -231,20 +232,32 @@ class CExtractorPreprocessing
231
232
 
232
233
  # Collect and return the full text of a preprocessing directive starting at '#'.
233
234
  # Returns nil if not positioned at '#'. Handles backslash-newline continuations.
235
+ # String/char literals are consumed verbatim via skip_c_string() so an in-string
236
+ # escape (e.g. "\n", "\"", "\\") is never mistaken for a line continuation.
234
237
  # Trailing whitespace and newlines are stripped from the returned text.
235
238
  def _collect_directive(scanner)
236
239
  return nil unless scanner.check(/#/)
237
240
 
238
241
  text = scanner.scan(/#/)
239
242
 
240
- loop do
241
- text += scanner.scan(/[^\n\\]*/) || ''
243
+ until scanner.eos?
244
+ text << (scanner.scan(/[^"'\\\n]*/) || '')
245
+
246
+ if (ch = scanner.peek(1)) == '"' || ch == "'"
247
+ before = scanner.pos
248
+ @c_extractor_code_text.skip_c_string(scanner, ch)
249
+ text << scanner.string[before...scanner.pos]
250
+
251
+ elsif scanner.scan(/\\\n/)
252
+ text << "\\\n"
242
253
 
243
- if scanner.scan(/\\\n/)
244
- text += "\\\n"
245
254
  elsif scanner.scan(/\n/)
246
- text += "\n"
255
+ text << "\n"
247
256
  break
257
+
258
+ elsif scanner.scan(/\\/)
259
+ text << '\\'
260
+
248
261
  else
249
262
  break # EOS — no trailing newline
250
263
  end
@@ -11,6 +11,7 @@ require 'ceedling/file_path_utils'
11
11
  require 'ceedling/exceptions'
12
12
  require 'ceedling/rake_app/rakefile_component_resolver'
13
13
  require 'ceedling/config/config_matchinator'
14
+ require 'ceedling/tool_executor'
14
15
  require 'deep_merge'
15
16
 
16
17
  class Configurator
@@ -431,7 +432,7 @@ class Configurator
431
432
  end
432
433
 
433
434
  # Populate name if not given
434
- tool[:name] = name.to_s if (tool[:name].nil?)
435
+ ToolExecutor.default_name!( tool, name.to_s )
435
436
 
436
437
  # Populate $stderr redirect option
437
438
  tool[:stderr_redirect] = StdErrRedirect::NONE if (tool[:stderr_redirect].nil?)