ceedling 1.1.0 → 1.1.1
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.
- checksums.yaml +4 -4
- data/GIT_COMMIT_SHA +1 -1
- data/README.md +7 -4
- data/docs/Changelog.md +66 -38
- data/docs/KnownIssues.md +9 -0
- data/docs/ReleaseNotes.md +5 -1
- data/docs/mkdocs/getting-started/installation.md +8 -1
- data/docs/mkdocs/getting-started/quick-start.md +20 -2
- data/docs/mkdocs/help.md +2 -2
- data/docs/mkdocs/index.md +13 -6
- data/docs/mkdocs/overview/build-system.md +4 -4
- data/docs/mkdocs/plugins/bullseye.md +6 -0
- data/docs/mkdocs/plugins/command-hooks.md +20 -15
- data/docs/mkdocs/plugins/gcov/gcovr.md +130 -109
- data/docs/mkdocs/plugins/gcov/index.md +6 -0
- data/docs/mkdocs/plugins/index.md +40 -0
- data/docs/mkdocs/plugins/valgrind.md +6 -0
- data/docs/mkdocs/testing-guide/partials/index.md +22 -13
- data/lib/ceedling/config/configurator.rb +2 -1
- data/lib/ceedling/preprocess/preprocessinator.rb +3 -2
- data/lib/ceedling/preprocess/preprocessinator_file_assembler.rb +27 -13
- data/lib/ceedling/test_invoker/test_build_executor.rb +3 -4
- data/lib/ceedling/test_invoker/test_build_planner.rb +0 -2
- data/lib/ceedling/test_invoker/test_invoker_types.rb +1 -1
- data/lib/ceedling/tool_executor.rb +5 -0
- data/lib/version.rb +1 -1
- data/plugins/command_hooks/lib/command_hooks.rb +4 -0
- data/plugins/gcov/lib/console_reportinator.rb +3 -1
- data/plugins/gcov/lib/gcov.rb +3 -3
- data/plugins/gcov/lib/gcov_reportinator.rb +4 -0
- data/plugins/gcov/lib/gcovr_reportinator.rb +61 -14
- data/plugins/gcov/lib/reportgenerator_reportinator.rb +3 -1
- data/site-local/404.html +3 -3
- data/site-local/assets/javascripts/{bundle.79ae519e.min.js → bundle.d7400e89.min.js} +2 -2
- data/site-local/assets/javascripts/{bundle.79ae519e.min.js.map → bundle.d7400e89.min.js.map} +2 -2
- data/site-local/assets/stylesheets/main.ec1eaa64.min.css +1 -0
- data/site-local/assets/stylesheets/{main.484c7ddc.min.css.map → main.ec1eaa64.min.css.map} +1 -1
- data/site-local/configuration/environment-vars.html +3 -3
- data/site-local/configuration/global-collections.html +3 -3
- data/site-local/configuration/index.html +3 -3
- data/site-local/configuration/loading.html +3 -3
- data/site-local/configuration/mixins.html +3 -3
- data/site-local/configuration/parallel-builds.html +3 -3
- data/site-local/configuration/project-file.html +3 -3
- data/site-local/configuration/reference/cexception.html +3 -3
- data/site-local/configuration/reference/cmock.html +3 -3
- data/site-local/configuration/reference/defines.html +3 -3
- data/site-local/configuration/reference/environment.html +3 -3
- data/site-local/configuration/reference/extension.html +3 -3
- data/site-local/configuration/reference/files.html +3 -3
- data/site-local/configuration/reference/flags.html +3 -3
- data/site-local/configuration/reference/index.html +3 -3
- data/site-local/configuration/reference/libraries.html +3 -3
- data/site-local/configuration/reference/mixins.html +3 -3
- data/site-local/configuration/reference/paths.html +3 -3
- data/site-local/configuration/reference/plugins.html +3 -3
- data/site-local/configuration/reference/project.html +3 -3
- data/site-local/configuration/reference/release-build.html +3 -3
- data/site-local/configuration/reference/test-build.html +3 -3
- data/site-local/configuration/reference/test-runner.html +3 -3
- data/site-local/configuration/reference/tools.html +3 -3
- data/site-local/configuration/reference/unity.html +3 -3
- data/site-local/configuration/which-ceedling.html +3 -3
- data/site-local/development/index.html +3 -3
- data/site-local/development/plugins/configuration.html +3 -3
- data/site-local/development/plugins/index.html +3 -3
- data/site-local/development/plugins/plugin-subclass.html +3 -3
- data/site-local/development/plugins/rake-tasks.html +3 -3
- data/site-local/development/workflow.html +3 -3
- data/site-local/getting-started/command-line.html +3 -3
- data/site-local/getting-started/example-projects/cipher-quest.html +3 -3
- data/site-local/getting-started/example-projects/index.html +3 -3
- data/site-local/getting-started/example-projects/temp-sensor.html +3 -3
- data/site-local/getting-started/example-projects/wondrous-forest.html +3 -3
- data/site-local/getting-started/index.html +3 -3
- data/site-local/getting-started/installation.html +12 -4
- data/site-local/getting-started/quick-start.html +18 -4
- data/site-local/help.html +4 -4
- data/site-local/index.html +13 -8
- data/site-local/overview/build-system.html +6 -6
- data/site-local/overview/index.html +3 -3
- data/site-local/overview/test-environments.html +3 -3
- data/site-local/overview/tools-and-frameworks.html +3 -3
- data/site-local/plugins/beep.html +3 -3
- data/site-local/plugins/bullseye.html +9 -3
- data/site-local/plugins/command-hooks.html +42 -38
- data/site-local/plugins/compile-commands-json-db.html +3 -3
- data/site-local/plugins/cppcheck.html +3 -3
- data/site-local/plugins/dependencies.html +3 -3
- data/site-local/plugins/fff.html +3 -3
- data/site-local/plugins/gcov/examples.html +3 -3
- data/site-local/plugins/gcov/gcovr.html +325 -227
- data/site-local/plugins/gcov/index.html +9 -3
- data/site-local/plugins/gcov/overview.html +3 -3
- data/site-local/plugins/gcov/reportgenerator.html +3 -3
- data/site-local/plugins/gcov/reporting.html +3 -3
- data/site-local/plugins/gcov/setup.html +3 -3
- data/site-local/plugins/gcov/tool-versions.html +3 -3
- data/site-local/plugins/gcov/troubleshooting.html +3 -3
- data/site-local/plugins/index.html +79 -15
- data/site-local/plugins/module-generator.html +3 -3
- data/site-local/plugins/report-build-warnings-log.html +3 -3
- data/site-local/plugins/report-tests-gtestlike-stdout.html +3 -3
- data/site-local/plugins/report-tests-ide-stdout.html +3 -3
- data/site-local/plugins/report-tests-log-factory.html +3 -3
- data/site-local/plugins/report-tests-pretty-stdout.html +3 -3
- data/site-local/plugins/report-tests-raw-output-log.html +3 -3
- data/site-local/plugins/report-tests-teamcity-stdout.html +3 -3
- data/site-local/plugins/valgrind.html +9 -3
- data/site-local/project/release-history.html +3 -3
- data/site-local/project/upgrade.html +3 -3
- data/site-local/reference/build-directives.html +3 -3
- data/site-local/reference/command-line.html +3 -3
- data/site-local/reference/environment-vars.html +3 -3
- data/site-local/reference/gcov-plugin.html +3 -3
- data/site-local/reference/global-collections.html +3 -3
- data/site-local/reference/index.html +3 -3
- data/site-local/reference/partials-macros.html +3 -3
- data/site-local/reference/project-configuration.html +3 -3
- data/site-local/sitemap.xml.gz +0 -0
- data/site-local/snapshot/examples/cipher_quest/index.html +3 -3
- data/site-local/snapshot/examples/temp_sensor/index.html +3 -3
- data/site-local/snapshot/examples/wondrous_forest/index.html +3 -3
- data/site-local/testing-guide/build-directives.html +3 -3
- data/site-local/testing-guide/conventions.html +3 -3
- data/site-local/testing-guide/frameworks.html +3 -3
- data/site-local/testing-guide/index.html +3 -3
- data/site-local/testing-guide/partials/configuration.html +3 -3
- data/site-local/testing-guide/partials/conventions.html +3 -3
- data/site-local/testing-guide/partials/directives.html +3 -3
- data/site-local/testing-guide/partials/example.html +3 -3
- data/site-local/testing-guide/partials/index.html +25 -16
- data/site-local/testing-guide/partials/overview.html +3 -3
- data/site-local/testing-guide/partials/variables.html +3 -3
- data/site-local/testing-guide/test-cases.html +3 -3
- data/site-local/testing-guide/test-sample.html +3 -3
- data/site-local/testing-guide/test-suite-anatomy.html +3 -3
- data/spec/support/system/system_context.rb +3 -1
- data/spec/system/support/gcov_common_test_cases.rb +4 -1
- data/spec/units/preprocess/preprocessinator_file_assembler_spec.rb +155 -0
- data/spec/units/test_build_executor_spec.rb +114 -0
- data/vendor/unity/auto/generate_test_runner.rb +55 -5
- data/vendor/unity/src/unity.h +1 -1
- data/vendor/unity/test/testdata/testRunnerGeneratorEmpty.c +13 -0
- data/vendor/unity/test/tests/test_generate_test_runner.rb +11 -0
- metadata +9 -7
- data/site-local/assets/stylesheets/main.484c7ddc.min.css +0 -1
- data/vendor/unity/auto/run_test.erb +0 -37
|
@@ -1,126 +1,61 @@
|
|
|
1
1
|
# GCovr Configuration
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
!!! note
|
|
4
|
+
All reports generated by `gcovr` are found in `<build root>/artifacts/gcov/gcovr/`.
|
|
4
5
|
|
|
5
|
-
|
|
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
|
-
|
|
9
|
+
## GCovr options
|
|
42
10
|
|
|
43
|
-
|
|
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
|
-
|
|
51
|
-
:cobertura_artifact_filename: <filename>
|
|
52
|
-
```
|
|
13
|
+
GCovr can be configured in two ways:
|
|
53
14
|
|
|
54
|
-
|
|
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
|
-
|
|
21
|
+
### Gcovr configuration file
|
|
57
22
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
70
|
-
|
|
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
|
-
|
|
77
|
-
|
|
43
|
+
; Build path exlcude for all generated C files (runners, mocks, partials).
|
|
44
|
+
exclude = .*build/.+\.c$
|
|
78
45
|
```
|
|
79
46
|
|
|
80
|
-
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
|
143
|
-
# patterns in your config file (adjust paths to match your project
|
|
77
|
+
# To preserve the plugin’s base filtering behavior, include the following
|
|
78
|
+
# patterns in your config file (adjust paths to match your project’s
|
|
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
|
|
148
|
+
# Please review Ceedling’s 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
|
|
7
|
+
Partials are useful when you need to test:
|
|
8
8
|
|
|
9
|
-
* **`static` or `inline` functions** — These become accessible
|
|
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
|
|
13
|
-
|
|
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
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
@@ -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
|
|
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?)
|
|
@@ -264,14 +264,15 @@ class Preprocessinator
|
|
|
264
264
|
# `extras` are macro definitions, pragmas, etc. needed for the special case of mocking `inline` function declarations.
|
|
265
265
|
# `extras` are empty for any cases other than mocking `inline` function declarations
|
|
266
266
|
# (We don't want to increase our chances of a badly generated file--extracting extras could fail in complex files.)
|
|
267
|
-
contents, extras = @file_assembler.collect_mockable_header_file_contents( **arg_hash )
|
|
267
|
+
contents, extras, include_guard = @file_assembler.collect_mockable_header_file_contents( **arg_hash )
|
|
268
268
|
|
|
269
269
|
arg_hash = {
|
|
270
270
|
filename: File.basename( filepath ),
|
|
271
271
|
preprocessed_filepath: preprocessed_filepath,
|
|
272
272
|
contents: contents,
|
|
273
273
|
extras: extras,
|
|
274
|
-
includes: includes
|
|
274
|
+
includes: includes,
|
|
275
|
+
include_guard: include_guard
|
|
275
276
|
}
|
|
276
277
|
|
|
277
278
|
# Create a reconstituted header file from preprocessing expansion and preserving any extras
|
|
@@ -60,15 +60,26 @@ class PreprocessinatorFileAssembler
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
# Bail out if no extras are required
|
|
63
|
-
return contents, [] if !extras
|
|
64
|
-
|
|
65
|
-
# Try to find an #include guard in the first 2k of the file text.
|
|
66
|
-
#
|
|
67
|
-
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
|
|
63
|
+
return contents, [], nil if !extras
|
|
64
|
+
|
|
65
|
+
# Try to find an #include guard in the first 2k of the file text. This name is used two ways:
|
|
66
|
+
# 1. To exclude the guard's own #define from the macro definitions preserved as "extras" below
|
|
67
|
+
# (it would be redundant -- assemble_preprocessed_header_file writes its own guard).
|
|
68
|
+
# 2. Returned to the caller so the reconstructed header can reuse this exact guard name (see
|
|
69
|
+
# assemble_preprocessed_header_file) instead of a synthetic one. Reusing the original name keeps
|
|
70
|
+
# the reconstructed file recognized as "the same header" by the preprocessor wherever both the
|
|
71
|
+
# original and a reconstructed/mocked copy are reachable in the same translation unit's include
|
|
72
|
+
# graph. A mismatched synthetic guard was the root cause of enum/type redeclaration errors in
|
|
73
|
+
# https://github.com/ThrowTheSwitch/Ceedling/issues/1064.
|
|
74
|
+
# If no guard is found (e.g. the header uses `#pragma once` or has none), `nil` flows through and
|
|
75
|
+
# assemble_preprocessed_header_file falls back to a synthetic guard, matching prior behavior.
|
|
76
|
+
include_guard =
|
|
77
|
+
@preprocessinator_reconstructor.extract_include_guard(
|
|
78
|
+
@file_wrapper.read(
|
|
79
|
+
filepath,
|
|
80
|
+
2048
|
|
81
|
+
).clean_encoding
|
|
82
|
+
)
|
|
72
83
|
|
|
73
84
|
if fallback
|
|
74
85
|
msg = @reportinator.generate_module_progress(
|
|
@@ -104,7 +115,7 @@ class PreprocessinatorFileAssembler
|
|
|
104
115
|
end
|
|
105
116
|
end
|
|
106
117
|
|
|
107
|
-
return contents, (pragmas + macro_defs)
|
|
118
|
+
return contents, (pragmas + macro_defs), include_guard
|
|
108
119
|
end
|
|
109
120
|
|
|
110
121
|
|
|
@@ -197,9 +208,12 @@ class PreprocessinatorFileAssembler
|
|
|
197
208
|
end
|
|
198
209
|
|
|
199
210
|
|
|
200
|
-
def assemble_preprocessed_header_file(filename:, preprocessed_filepath:, contents:, extras:, includes:)
|
|
201
|
-
#
|
|
202
|
-
|
|
211
|
+
def assemble_preprocessed_header_file(filename:, preprocessed_filepath:, contents:, extras:, includes:, include_guard: nil)
|
|
212
|
+
# Reuse the original header's own #include guard name when we found one so that this
|
|
213
|
+
# reconstructed file is recognized as "the same header" by the preprocessor wherever both
|
|
214
|
+
# are reachable (e.g. once via a mock's shadowed copy, once via the original source path).
|
|
215
|
+
# Fall back to a synthetic guard derived from the filename otherwise.
|
|
216
|
+
guardname = include_guard || FileWrapper.generate_include_guard( filename )
|
|
203
217
|
|
|
204
218
|
# Write contents of final preprocessed file a line at a time
|
|
205
219
|
# ----------------------------------------------------------
|
|
@@ -412,7 +412,6 @@ class TestBuildExecutor
|
|
|
412
412
|
@batchinator.exec(workload: :compile, things: state.objects_list) do |obj|
|
|
413
413
|
src = @file_finder.find_build_input_file( filepath: obj[:obj], context: state.context )
|
|
414
414
|
compile_test_component(
|
|
415
|
-
tool: obj[:tool],
|
|
416
415
|
context: state.context,
|
|
417
416
|
test: obj[:test],
|
|
418
417
|
source: src,
|
|
@@ -546,7 +545,7 @@ class TestBuildExecutor
|
|
|
546
545
|
private
|
|
547
546
|
|
|
548
547
|
# Compile a single C or assembly source file into an object file.
|
|
549
|
-
def compile_test_component(
|
|
548
|
+
def compile_test_component(context:, test:, source:, object:, state:)
|
|
550
549
|
testable = state.testables[test.to_sym]
|
|
551
550
|
defines = testable.compile_defines
|
|
552
551
|
search_paths = tailor_search_paths( search_paths: testable.search_paths, filepath: source )
|
|
@@ -555,7 +554,7 @@ class TestBuildExecutor
|
|
|
555
554
|
flags = testable.compile_flags
|
|
556
555
|
|
|
557
556
|
arg_hash = {
|
|
558
|
-
tool:
|
|
557
|
+
tool: @configurator.tools_test_compiler,
|
|
559
558
|
module_name: test,
|
|
560
559
|
context: context,
|
|
561
560
|
source: source,
|
|
@@ -573,7 +572,7 @@ class TestBuildExecutor
|
|
|
573
572
|
flags = testable.assembler_flags
|
|
574
573
|
|
|
575
574
|
arg_hash = {
|
|
576
|
-
tool:
|
|
575
|
+
tool: @configurator.tools_test_assembler,
|
|
577
576
|
module_name: test,
|
|
578
577
|
context: context,
|
|
579
578
|
source: source,
|
|
@@ -162,7 +162,6 @@ class TestBuildPlanner
|
|
|
162
162
|
testable.no_link_objects = test_no_link_objects
|
|
163
163
|
testable.results_pass = test_pass
|
|
164
164
|
testable.results_fail = test_fail
|
|
165
|
-
testable.tool = TOOLS_TEST_COMPILER
|
|
166
165
|
end
|
|
167
166
|
end
|
|
168
167
|
end
|
|
@@ -172,7 +171,6 @@ class TestBuildPlanner
|
|
|
172
171
|
state.objects_list = state.testables.map do |_, testable|
|
|
173
172
|
testable.objects.map do |obj|
|
|
174
173
|
{
|
|
175
|
-
tool: testable.tool,
|
|
176
174
|
test: testable.name,
|
|
177
175
|
obj: obj
|
|
178
176
|
}
|
|
@@ -37,7 +37,7 @@ module TestInvokerTypes
|
|
|
37
37
|
:mocks, # Hash — mock name → mock info
|
|
38
38
|
:partials, # TestablePartials — configs map + tests/mocks module name lists
|
|
39
39
|
:sources, :frameworks, :core, :objects, :executable,
|
|
40
|
-
:no_link_objects, :results_pass, :results_fail,
|
|
40
|
+
:no_link_objects, :results_pass, :results_fail,
|
|
41
41
|
keyword_init: true
|
|
42
42
|
) do
|
|
43
43
|
def initialize(**kwargs)
|
|
@@ -11,6 +11,11 @@ require 'benchmark'
|
|
|
11
11
|
|
|
12
12
|
class ToolExecutor
|
|
13
13
|
|
|
14
|
+
# Populate a tool config hash's :name key from `default` if the user did not set one explicitly.
|
|
15
|
+
def self.default_name!(tool, default)
|
|
16
|
+
tool[:name] = default if tool[:name].nil?
|
|
17
|
+
end
|
|
18
|
+
|
|
14
19
|
constructor :configurator, :tool_executor_helper, :loginator, :verbosinator, :system_wrapper, :ruby_expandinator
|
|
15
20
|
|
|
16
21
|
# build up a command line from yaml provided config
|
data/lib/version.rb
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
require 'ceedling/constants'
|
|
9
9
|
require 'ceedling/exceptions'
|
|
10
10
|
require 'ceedling/plugins/plugin'
|
|
11
|
+
require 'ceedling/tool_executor'
|
|
11
12
|
|
|
12
13
|
COMMAND_HOOKS_ROOT_NAME = 'command_hooks'.freeze
|
|
13
14
|
COMMAND_HOOKS_SYM = COMMAND_HOOKS_ROOT_NAME.to_sym
|
|
@@ -157,6 +158,9 @@ class CommandHooks < Plugin
|
|
|
157
158
|
raise CeedlingException.new( error )
|
|
158
159
|
end
|
|
159
160
|
|
|
161
|
+
# Populate name if not given
|
|
162
|
+
ToolExecutor.default_name!( entry, keys.join('_') )
|
|
163
|
+
|
|
160
164
|
# Validate the Ceedling tool components of the hook entry config
|
|
161
165
|
@tool_validator.validate( tool: entry, name: name, boom: true )
|
|
162
166
|
|
|
@@ -16,7 +16,9 @@ class ConsoleReportinator < GcovReportinator
|
|
|
16
16
|
|
|
17
17
|
attr_reader :artifacts_path # nil — console output only, no filesystem artifacts
|
|
18
18
|
|
|
19
|
-
def initialize(system_objects)
|
|
19
|
+
def initialize(system_objects, config)
|
|
20
|
+
super(config)
|
|
21
|
+
|
|
20
22
|
@loginator = system_objects[:loginator]
|
|
21
23
|
@plugin_reportinator = system_objects[:plugin_reportinator]
|
|
22
24
|
@test_invoker = system_objects[:test_invoker]
|
data/plugins/gcov/lib/gcov.rb
CHANGED
|
@@ -317,7 +317,7 @@ class Gcov < Plugin
|
|
|
317
317
|
|
|
318
318
|
# Instantiate console summary reportinator if summaries enabled
|
|
319
319
|
@console_reportinator = summaries_enabled?(@project_config) ?
|
|
320
|
-
ConsoleReportinator.new(@ceedling) : nil
|
|
320
|
+
ConsoleReportinator.new(@ceedling, @project_config) : nil
|
|
321
321
|
|
|
322
322
|
# Do not instantiate file reportinators (and tool validation) unless reports enabled
|
|
323
323
|
return reportinators if (!enabled)
|
|
@@ -332,13 +332,13 @@ class Gcov < Plugin
|
|
|
332
332
|
|
|
333
333
|
# Run reports using gcovr
|
|
334
334
|
if utility_enabled?( config, GCOV_UTILITY_NAME_GCOVR )
|
|
335
|
-
reportinator = GcovrReportinator.new( @ceedling )
|
|
335
|
+
reportinator = GcovrReportinator.new( @ceedling, @project_config )
|
|
336
336
|
reportinators << reportinator
|
|
337
337
|
end
|
|
338
338
|
|
|
339
339
|
# Run reports using ReportGenerator
|
|
340
340
|
if utility_enabled?( config, GCOV_UTILITY_NAME_REPORT_GENERATOR )
|
|
341
|
-
reportinator = ReportGeneratorReportinator.new( @ceedling )
|
|
341
|
+
reportinator = ReportGeneratorReportinator.new( @ceedling, @project_config )
|
|
342
342
|
reportinators << reportinator
|
|
343
343
|
end
|
|
344
344
|
|