ceedling 1.1.8 → 1.1.10

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/GIT_COMMIT_SHA +1 -1
  3. data/README.md +4 -3
  4. data/docs/Changelog.md +28 -0
  5. data/docs/KnownIssues.md +12 -2
  6. data/docs/SECURITY.md +40 -2
  7. data/docs/mkdocs/development/index.md +11 -0
  8. data/docs/mkdocs/plugins/fff.md +1 -1
  9. data/docs/mkdocs/plugins/gcov/gcovr.md +117 -3
  10. data/docs/mkdocs/plugins/gcov/reportgenerator.md +110 -4
  11. data/lib/ceedling/c_extractor/c_extractor_preprocessing.rb +29 -1
  12. data/lib/ceedling/file_path_utils.rb +4 -0
  13. data/lib/ceedling/generators/generator.rb +11 -6
  14. data/lib/ceedling/generators/generator_partials.rb +54 -18
  15. data/lib/ceedling/includes/includes.rb +8 -1
  16. data/lib/ceedling/objects.yml +2 -0
  17. data/lib/ceedling/partials/partializer.rb +204 -96
  18. data/lib/ceedling/test_invoker/test_build_executor.rb +21 -7
  19. data/lib/version.rb +1 -1
  20. data/site-local/development/index.html +7 -0
  21. data/site-local/plugins/fff.html +1 -1
  22. data/site-local/plugins/gcov/gcovr.html +156 -3
  23. data/site-local/plugins/gcov/reportgenerator.html +201 -14
  24. data/site-local/sitemap.xml.gz +0 -0
  25. data/spec/system/partials_types_header_spec.rb +166 -0
  26. data/spec/units/c_extractor/c_extractor_integration_spec.rb +18 -0
  27. data/spec/units/c_extractor/c_extractor_preprocessing_spec.rb +77 -0
  28. data/spec/units/generators/generator_partials_spec.rb +130 -17
  29. data/spec/units/includes/includes_spec.rb +21 -3
  30. data/spec/units/partials/partializer_spec.rb +225 -0
  31. data/vendor/unity/auto/generate_test_runner.rb +3 -1
  32. data/vendor/unity/auto/unity_test_summary.rb +2 -2
  33. data/vendor/unity/docs/UnityChangeLog.md +7 -0
  34. data/vendor/unity/docs/UnityConfigurationGuide.md +4 -0
  35. data/vendor/unity/src/unity_internals.h +21 -7
  36. data/vendor/unity/test/Makefile +9 -2
  37. data/vendor/unity/test/rakefile_helper.rb +1 -0
  38. data/vendor/unity/test/tests/test_generate_test_runner.rb +49 -0
  39. data/vendor/unity/test/tests/test_unity_test_summary.rb +58 -0
  40. metadata +5 -2
@@ -2999,6 +2999,34 @@
2999
2999
  </ul>
3000
3000
  </nav>
3001
3001
 
3002
+ </li>
3003
+
3004
+ <li class="md-nav__item">
3005
+ <a href="#results-filtering" class="md-nav__link">
3006
+ <span class="md-ellipsis">
3007
+
3008
+ Results filtering
3009
+
3010
+ </span>
3011
+ </a>
3012
+
3013
+ <nav class="md-nav" aria-label="Results filtering">
3014
+ <ul class="md-nav__list">
3015
+
3016
+ <li class="md-nav__item">
3017
+ <a href="#overriding-the-defaults" class="md-nav__link">
3018
+ <span class="md-ellipsis">
3019
+
3020
+ Overriding the defaults
3021
+
3022
+ </span>
3023
+ </a>
3024
+
3025
+ </li>
3026
+
3027
+ </ul>
3028
+ </nav>
3029
+
3002
3030
  </li>
3003
3031
 
3004
3032
  <li class="md-nav__item">
@@ -4641,6 +4669,34 @@
4641
4669
  </ul>
4642
4670
  </nav>
4643
4671
 
4672
+ </li>
4673
+
4674
+ <li class="md-nav__item">
4675
+ <a href="#results-filtering" class="md-nav__link">
4676
+ <span class="md-ellipsis">
4677
+
4678
+ Results filtering
4679
+
4680
+ </span>
4681
+ </a>
4682
+
4683
+ <nav class="md-nav" aria-label="Results filtering">
4684
+ <ul class="md-nav__list">
4685
+
4686
+ <li class="md-nav__item">
4687
+ <a href="#overriding-the-defaults" class="md-nav__link">
4688
+ <span class="md-ellipsis">
4689
+
4690
+ Overriding the defaults
4691
+
4692
+ </span>
4693
+ </a>
4694
+
4695
+ </li>
4696
+
4697
+ </ul>
4698
+ </nav>
4699
+
4644
4700
  </li>
4645
4701
 
4646
4702
  <li class="md-nav__item">
@@ -5297,9 +5353,14 @@ plugin configuration. This prevents overriding config file settings with
5297
5353
  CLI arguments. You must provide any settings that would have been provided
5298
5354
  by the Gcov plugin.</p>
5299
5355
  </div>
5300
- <p>To preserve filtering of test and build files from coverage results when
5301
- using a Gcovr config file, you must provide explicit exclusion patterns matching
5302
- your project layout (example below).</p>
5356
+ <p>A Gcovr config file replaces Ceedling's own automatically generated exclusion
5357
+ patterns (see <a href="#results-filtering">Results filtering</a> below) entirely — it is
5358
+ the only way to override or remove one of those defaults, since the
5359
+ project-configuration <code>:report_exclude</code> option can only add further
5360
+ exclusions on top of them, never take one away. To preserve the same
5361
+ filtering of test and build files when switching to a Gcovr config file, you
5362
+ must provide equivalent explicit exclusion patterns matching your project
5363
+ layout yourself (example below).</p>
5303
5364
  <div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="c1">; You will need to revise these example exclude patterns to match your</span>
5304
5365
  <a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="c1">; project directories and file naming as they cannot be automatically </span>
5305
5366
  <a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="c1">; provided to Gcovr when a Gcovr configuration file is in use.</span>
@@ -5312,6 +5373,84 @@ your project layout (example below).</p>
5312
5373
  <a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a><span class="c1">; Build path exlcude for all generated C files (runners, mocks, partials).</span>
5313
5374
  <a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a><span class="na">exclude</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">.*build/.+\.c$</span>
5314
5375
  </code></pre></div>
5376
+ <h2 id="results-filtering">Results filtering</h2>
5377
+ <p>By default, this plugin configures <code>gcovr</code> to excludes three categories of
5378
+ <code>.c</code> files from coverage results. These defaults exist because a
5379
+ coverage percentage is typically only meaningful over the production code
5380
+ you're actually trying to exercise with test coverage. Test code, test
5381
+ support code, and every file Ceedling itself generates as part of a build
5382
+ will skew that number if left in coverage reporting.</p>
5383
+ <p>The list that follows details the filtering this plugin injects into
5384
+ Gcovr coverage report generation. The examples are usable regular
5385
+ expressions that mirror the defaults in use. The plugin dynamically
5386
+ generates these regular expressions from your project configuration.
5387
+ When creating them youself, you will need to match your project
5388
+ configuration settings with static strings.</p>
5389
+ <ol>
5390
+ <li>
5391
+ <p><strong>Test files</strong> — matched by <code>:test_file_prefix</code> within your configured
5392
+ <code>:paths</code> ↳ <code>:test</code> directories.</p>
5393
+ <p>Given <code>:test_file_prefix</code> ⇒ <code>test_</code> and a <code>:paths</code> ↳ <code>:test</code> entry of
5394
+ <code>test/</code>:</p>
5395
+ <div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a>.*test/.*/test_.+\.c$
5396
+ </code></pre></div>
5397
+ </li>
5398
+ <li>
5399
+ <p><strong>Test support files</strong> — any <code>.c</code> file within your configured <code>:paths</code> ↳
5400
+ <code>:support</code> directories, regardless of name. Helpers, stubs, and fixtures
5401
+ living there are no more production code than the test files themselves.</p>
5402
+ <p>Given a <code>:paths</code> ↳ <code>:support</code> entry of <code>test/support/</code>:</p>
5403
+ <div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a>.*test/support/.+\.c$
5404
+ </code></pre></div>
5405
+ </li>
5406
+ <li>
5407
+ <p><strong>Generated and vendored files</strong> — any <code>.c</code> file anywhere below your
5408
+ <code>:build_root</code>: generated mocks, test runners, Partials output, and the
5409
+ vendored Unity/CMock/CException framework sources Ceedling copies in to
5410
+ build against. This pattern always matches a literal <code>.c</code> extension
5411
+ regardless of your project's own <code>:extension</code> ↳ <code>:source</code> setting, since
5412
+ every file it catches is one Ceedling itself writes in plain C.</p>
5413
+ <p>Given <code>:build_root</code> ⇒ <code>build/</code>:</p>
5414
+ <div class="highlight"><pre><span></span><code><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a>.*build/.+\.c$
5415
+ </code></pre></div>
5416
+ </li>
5417
+ </ol>
5418
+ <p>These patterns are generated automatically and combined with whatever you
5419
+ provide via <a href="#report_exclude"><code>:report_exclude</code></a> below.</p>
5420
+ <div class="admonition warning">
5421
+ <p class="admonition-title">Not applied when using a Gcovr configuration file</p>
5422
+ <p>These defaults are only generated when Ceedling builds <code>gcovr</code>'s command
5423
+ line directly. As covered in
5424
+ <a href="#gcovr-configuration-file">Gcovr configuration file</a> above, setting
5425
+ <code>:config_file</code> bypasses this entirely — none of the three patterns above
5426
+ are applied, and you must supply equivalent exclusions in the config file
5427
+ yourself.</p>
5428
+ </div>
5429
+ <h3 id="overriding-the-defaults">Overriding the defaults</h3>
5430
+ <p><a href="#report_exclude"><code>:report_exclude</code></a> can only add exclusions on top of the
5431
+ three defaults above — <code>gcovr --exclude</code> is a deny-list with no way to
5432
+ "un-exclude" a pattern already passed to it, and this plugin always passes its
5433
+ own three patterns ahead of anything you configure there. Setting
5434
+ <a href="#report_include"><code>:report_include</code></a> doesn't help either; it narrows which
5435
+ files are considered at all, but an exclude pattern still wins over it for
5436
+ any file matching both.</p>
5437
+ <p>The only way to actually remove or replace one of these defaults — for
5438
+ example, to include test files in coverage results so you can confirm a
5439
+ conditional test build compiled the branches you expect — is a
5440
+ <a href="#gcovr-configuration-file">Gcovr configuration file</a>. Setting <code>:config_file</code>
5441
+ stops Ceedling from generating any of the three patterns at all, handing you
5442
+ full control:</p>
5443
+ <div class="highlight"><pre><span></span><code><a id="__codelineno-4-1" name="__codelineno-4-1" href="#__codelineno-4-1"></a><span class="c1">; gcovr.cfg — omits the test-file exclude pattern so test files remain in</span>
5444
+ <a id="__codelineno-4-2" name="__codelineno-4-2" href="#__codelineno-4-2"></a><span class="c1">; coverage results, while still keeping generated/vendored build output out.</span>
5445
+ <a id="__codelineno-4-3" name="__codelineno-4-3" href="#__codelineno-4-3"></a><span class="na">exclude</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">.*build/.+\.c$</span>
5446
+ </code></pre></div>
5447
+ <div class="highlight"><pre><span></span><code><a id="__codelineno-5-1" name="__codelineno-5-1" href="#__codelineno-5-1"></a><span class="nt">:gcov</span><span class="p">:</span>
5448
+ <a id="__codelineno-5-2" name="__codelineno-5-2" href="#__codelineno-5-2"></a><span class="w"> </span><span class="nt">:gcovr</span><span class="p">:</span>
5449
+ <a id="__codelineno-5-3" name="__codelineno-5-3" href="#__codelineno-5-3"></a><span class="w"> </span><span class="nt">:config_file</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">gcovr.cfg</span>
5450
+ </code></pre></div>
5451
+ <p>Note that this isn't scoped per category. Once a default is dropped, any
5452
+ file it would have excluded is folded into the same combined report as your
5453
+ production code, not broken out separately.</p>
5315
5454
  <h2 id="plugin-configuration">Plugin configuration</h2>
5316
5455
  <p>The following options are exposed through your project configuration file, all
5317
5456
  beneath <code>:gcov</code> ↳ <code>:gcovr</code>. Only specify those you need or those whose defaults
@@ -5409,11 +5548,25 @@ is in addition to any other configured reports. (<code>gcovr --print-summary</co
5409
5548
  <h3 id="report_include"><code>:report_include</code></h3>
5410
5549
  <p>Keep only source files that match this filter. Filters are regular
5411
5550
  expressions. (<code>gcovr --filter</code>)</p>
5551
+ <p>This narrows which files are considered at all, but does not override
5552
+ <a href="#results-filtering">Results filtering</a>'s automatic exclusion defaults — a
5553
+ file excluded by one of those three default patterns stays excluded even if
5554
+ it also matches <code>:report_include</code>. See
5555
+ <a href="#overriding-the-defaults">Overriding the defaults</a> if you need to remove one
5556
+ of them.</p>
5412
5557
  <p><strong>Example:</strong> <code>"^src"</code></p>
5413
5558
  <hr />
5414
5559
  <h3 id="report_exclude"><code>:report_exclude</code></h3>
5415
5560
  <p>Exclude source files that match this filter. Filters are regular expressions.
5416
5561
  (<code>gcovr --exclude</code>)</p>
5562
+ <p>Ceedling automatically generates and prepends its own exclusion patterns for
5563
+ test files, test support files, and generated/vendored build files — see
5564
+ <a href="#results-filtering">Results filtering</a> above for exactly what these cover
5565
+ and why. Anything you provide here is combined with those defaults, not a
5566
+ replacement for them. This option can only add further exclusions, never
5567
+ remove or override one of the three defaults.
5568
+ See <a href="#overriding-the-defaults">Overriding the defaults</a> for how to do
5569
+ that instead.</p>
5417
5570
  <p><strong>Example:</strong> <code>"^vendor.*|^build.*|^test.*|^lib.*"</code></p>
5418
5571
  <hr />
5419
5572
  <h3 id="gcov_filter"><code>:gcov_filter</code></h3>
@@ -2999,6 +2999,56 @@
2999
2999
  </span>
3000
3000
  </a>
3001
3001
 
3002
+ </li>
3003
+
3004
+ <li class="md-nav__item">
3005
+ <a href="#results-filtering" class="md-nav__link">
3006
+ <span class="md-ellipsis">
3007
+
3008
+ Results filtering
3009
+
3010
+ </span>
3011
+ </a>
3012
+
3013
+ <nav class="md-nav" aria-label="Results filtering">
3014
+ <ul class="md-nav__list">
3015
+
3016
+ <li class="md-nav__item">
3017
+ <a href="#coverage-generation-filtering" class="md-nav__link">
3018
+ <span class="md-ellipsis">
3019
+
3020
+ Coverage generation filtering
3021
+
3022
+ </span>
3023
+ </a>
3024
+
3025
+ </li>
3026
+
3027
+ <li class="md-nav__item">
3028
+ <a href="#report-filtering" class="md-nav__link">
3029
+ <span class="md-ellipsis">
3030
+
3031
+ Report filtering
3032
+
3033
+ </span>
3034
+ </a>
3035
+
3036
+ </li>
3037
+
3038
+ <li class="md-nav__item">
3039
+ <a href="#overriding-the-defaults" class="md-nav__link">
3040
+ <span class="md-ellipsis">
3041
+
3042
+ Overriding the defaults
3043
+
3044
+ </span>
3045
+ </a>
3046
+
3047
+ </li>
3048
+
3049
+ </ul>
3050
+ </nav>
3051
+
3002
3052
  </li>
3003
3053
 
3004
3054
  <li class="md-nav__item">
@@ -4170,6 +4220,56 @@
4170
4220
  </span>
4171
4221
  </a>
4172
4222
 
4223
+ </li>
4224
+
4225
+ <li class="md-nav__item">
4226
+ <a href="#results-filtering" class="md-nav__link">
4227
+ <span class="md-ellipsis">
4228
+
4229
+ Results filtering
4230
+
4231
+ </span>
4232
+ </a>
4233
+
4234
+ <nav class="md-nav" aria-label="Results filtering">
4235
+ <ul class="md-nav__list">
4236
+
4237
+ <li class="md-nav__item">
4238
+ <a href="#coverage-generation-filtering" class="md-nav__link">
4239
+ <span class="md-ellipsis">
4240
+
4241
+ Coverage generation filtering
4242
+
4243
+ </span>
4244
+ </a>
4245
+
4246
+ </li>
4247
+
4248
+ <li class="md-nav__item">
4249
+ <a href="#report-filtering" class="md-nav__link">
4250
+ <span class="md-ellipsis">
4251
+
4252
+ Report filtering
4253
+
4254
+ </span>
4255
+ </a>
4256
+
4257
+ </li>
4258
+
4259
+ <li class="md-nav__item">
4260
+ <a href="#overriding-the-defaults" class="md-nav__link">
4261
+ <span class="md-ellipsis">
4262
+
4263
+ Overriding the defaults
4264
+
4265
+ </span>
4266
+ </a>
4267
+
4268
+ </li>
4269
+
4270
+ </ul>
4271
+ </nav>
4272
+
4173
4273
  </li>
4174
4274
 
4175
4275
  <li class="md-nav__item">
@@ -4401,6 +4501,82 @@
4401
4501
  <a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a><span class="w"> </span><span class="nt">:custom_args</span><span class="p">:</span>
4402
4502
  <a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="s">&quot;-title:MyProject&quot;</span>
4403
4503
  </code></pre></div>
4504
+ <h2 id="results-filtering">Results filtering</h2>
4505
+ <p>This plugin filters coverage results for <code>reportgenerator</code> coverage reporting
4506
+ in two separate stages, each with its own defaults.</p>
4507
+ <h3 id="coverage-generation-filtering">Coverage generation filtering</h3>
4508
+ <p>Before <code>reportgenerator</code> ever runs, this plugin runs <code>gcov</code> itself against each
4509
+ <code>.gcno</code> file produced by the coverage test build, skipping any that match an
4510
+ exclusion pattern — no <code>.gcov</code> data is ever produced for a skipped file, so
4511
+ nothing downstream can put it back into a report.</p>
4512
+ <p>By default this skips:</p>
4513
+ <ul>
4514
+ <li><strong>Test files</strong> — matched by <code>:test_file_prefix</code>.</li>
4515
+ <li><strong>Mocks</strong> — matched by <code>:mock_prefix</code>.</li>
4516
+ <li><strong>Test runners</strong> — any filename containing <code>_runner</code>.</li>
4517
+ <li><strong>Vendored Unity and CMock sources</strong> — <code>unity.gcno</code> and <code>cmock.gcno</code> by
4518
+ name.</li>
4519
+ </ul>
4520
+ <p>Given <code>:test_file_prefix</code> ⇒ <code>test_</code> and CMock's default <code>:mock_prefix</code> ⇒
4521
+ <code>Mock</code>, the equivalent filename-fragment patterns are:</p>
4522
+ <div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a>test_[^\/\\]*
4523
+ <a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a>Mock[^\/\\]*
4524
+ <a id="__codelineno-1-3" name="__codelineno-1-3" href="#__codelineno-1-3"></a>[^\/\\]*_runner[^\/\\]*
4525
+ <a id="__codelineno-1-4" name="__codelineno-1-4" href="#__codelineno-1-4"></a>unity
4526
+ <a id="__codelineno-1-5" name="__codelineno-1-5" href="#__codelineno-1-5"></a>cmock
4527
+ </code></pre></div>
4528
+ <p>These combine with whatever you add via <a href="#gcov_exclude"><code>:gcov_exclude</code></a>
4529
+ below. Your patterns extend this list, they don't replace it.</p>
4530
+ <h3 id="report-filtering">Report filtering</h3>
4531
+ <p>Separately, once <code>.gcov</code> files exist, ReportGenerator's own <code>-filefilters:</code>
4532
+ argument controls which of them actually appear in the generated report(s).
4533
+ By default this excludes:</p>
4534
+ <ol>
4535
+ <li>
4536
+ <p><strong>Test paths</strong> — every file anywhere under each of your configured
4537
+ <code>:paths</code> ↳ <code>:test</code> directories, not only files matching
4538
+ <code>:test_file_prefix</code>. A support subdirectory nested under a test path
4539
+ (e.g. <code>test/support/</code>) is excluded as a side effect of this — the whole
4540
+ tree goes, not just prefixed test files.</p>
4541
+ <p>Given a <code>:paths</code> ↳ <code>:test</code> entry of <code>test/</code>:
4542
+ <div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a>-./test/**/*
4543
+ </code></pre></div></p>
4544
+ </li>
4545
+ <li>
4546
+ <p><strong>The build root</strong> — every generated and vendored file: mocks, test
4547
+ runners, Partials output, Unity, CMock, CException.</p>
4548
+ <p>Given <code>:build_root</code> ⇒ <code>build/</code>:
4549
+ <div class="highlight"><pre><span></span><code><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a>-./build/**/*
4550
+ </code></pre></div></p>
4551
+ </li>
4552
+ <li>
4553
+ <p><strong>Partial-generated files</strong> — only when <code>:use_partials</code> is enabled, any
4554
+ file whose name starts with Ceedling's Partial filename prefix, wherever
4555
+ it's found (not only under the build root).</p>
4556
+ <div class="highlight"><pre><span></span><code><a id="__codelineno-4-1" name="__codelineno-4-1" href="#__codelineno-4-1"></a>-ceedling_partial_*
4557
+ </code></pre></div>
4558
+ </li>
4559
+ </ol>
4560
+ <p>These patterns are generated automatically and placed ahead of whatever you
4561
+ provide via <a href="#file_filters"><code>:file_filters</code></a> below.</p>
4562
+ <h3 id="overriding-the-defaults">Overriding the defaults</h3>
4563
+ <p>Neither filtering stage above can be overridden or narrowed by plugin
4564
+ configuration — only added to.</p>
4565
+ <p>For <a href="#coverage-generation-filtering">coverage generation filtering</a>,
4566
+ <a href="#gcov_exclude"><code>:gcov_exclude</code></a> only ever adds more exclusion patterns; there
4567
+ is no plugin option to disable one of the built-in exclusions, and no way to
4568
+ resurrect <code>.gcov</code> data for a file <code>gcov</code> was never run against in the first
4569
+ place.</p>
4570
+ <p>For <a href="#report-filtering">report filtering</a>, the natural instinct is to reach
4571
+ for <a href="#custom_args"><code>:custom_args</code></a> to pass a second, conflicting
4572
+ <code>-filefilters:</code> argument, but this is not an option because of ReportGenerator's
4573
+ rules and the order in which the filters are provided by the plugin.</p>
4574
+ <p>In short, there's no supported way to broaden what this plugin reports
4575
+ beyond its defaults. If you need to override coverage reporting filtering,
4576
+ use the <a href="gcovr.html">Gcovr option for this pluing</a> instead. Its
4577
+ <code>:config_file</code> option hands full control to a <code>gcovr</code> configuration file,
4578
+ bypassing Ceedling's generated exclusions entirely (see
4579
+ <a href="gcovr.html#results-filtering">Gcovr's Results filtering</a>).</p>
4404
4580
  <h2 id="plugin-configuration">Plugin configuration</h2>
4405
4581
  <h3 id="history_directory"><code>:history_directory</code></h3>
4406
4582
  <p>Optional directory for storing persistent coverage information. Can be used
@@ -4426,10 +4602,15 @@ filters. Wildcards are allowed, but not regular expressions.</p>
4426
4602
  <h3 id="file_filters"><code>:file_filters</code></h3>
4427
4603
  <p>Optional list of files that should be included or excluded in the report
4428
4604
  (separated by semicolon). Exclusion filters take precedence over inclusion
4429
- filters. Wildcards are allowed, but not regular expressions. Ceedling places
4430
- your own patterns first, ahead of the exclusions it generates automatically
4431
- for test paths, the build root, and (when Partials are in use) Partial
4432
- source files, so your patterns take precedence.</p>
4605
+ filters regardless of order. Wildcards are allowed, but not regular
4606
+ expressions.</p>
4607
+ <p>This plugin places your own patterns first, ahead of the exclusions it
4608
+ generates automatically for test paths, the build root, and (when Partials
4609
+ are in use) Partial-generated files (see
4610
+ <a href="#report-filtering">Report filtering</a> above for exactly what those defaults
4611
+ cover). Because exclusions always win, your patterns can add further
4612
+ exclusions or includes but cannot override or remove one of those defaults;
4613
+ see <a href="#overriding-the-defaults">Overriding the defaults</a> above.</p>
4433
4614
  <p><strong>Example:</strong> <code>"-./vendor/*;-./build/*;-./test/*;-./lib/*;+./src/*"</code></p>
4434
4615
  <hr />
4435
4616
  <h3 id="verbosity"><code>:verbosity</code></h3>
@@ -4445,11 +4626,17 @@ source files, so your patterns take precedence.</p>
4445
4626
  (<code>.gcno</code>) files that match these filters from coverage processing — these
4446
4627
  files are never run through <code>gcov</code> at all. A trailing <code>.gcov</code> or <code>.gcno</code>
4447
4628
  suffix on a pattern is stripped automatically, so either form works.</p>
4448
- <div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a><span class="nt">:gcov</span><span class="p">:</span>
4449
- <a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a><span class="w"> </span><span class="nt">:report_generator</span><span class="p">:</span>
4450
- <a id="__codelineno-1-3" name="__codelineno-1-3" href="#__codelineno-1-3"></a><span class="w"> </span><span class="nt">:gcov_exclude</span><span class="p">:</span>
4451
- <a id="__codelineno-1-4" name="__codelineno-1-4" href="#__codelineno-1-4"></a><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">&lt;regex&gt;</span>
4452
- <a id="__codelineno-1-5" name="__codelineno-1-5" href="#__codelineno-1-5"></a><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">...</span>
4629
+ <p>Ceedling combines your patterns with exclusions it generates automatically
4630
+ for test files, mocks, test runners, and vendored Unity/CMock sources (see
4631
+ <a href="#coverage-generation-filtering">Coverage generation filtering</a> above for
4632
+ exactly what these cover). Your patterns can only add further exclusions;
4633
+ there's no way to override or remove one of the defaults — see
4634
+ <a href="#overriding-the-defaults">Overriding the defaults</a> above.</p>
4635
+ <div class="highlight"><pre><span></span><code><a id="__codelineno-5-1" name="__codelineno-5-1" href="#__codelineno-5-1"></a><span class="nt">:gcov</span><span class="p">:</span>
4636
+ <a id="__codelineno-5-2" name="__codelineno-5-2" href="#__codelineno-5-2"></a><span class="w"> </span><span class="nt">:report_generator</span><span class="p">:</span>
4637
+ <a id="__codelineno-5-3" name="__codelineno-5-3" href="#__codelineno-5-3"></a><span class="w"> </span><span class="nt">:gcov_exclude</span><span class="p">:</span>
4638
+ <a id="__codelineno-5-4" name="__codelineno-5-4" href="#__codelineno-5-4"></a><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">&lt;regex&gt;</span>
4639
+ <a id="__codelineno-5-5" name="__codelineno-5-5" href="#__codelineno-5-5"></a><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">...</span>
4453
4640
  </code></pre></div>
4454
4641
  <p><strong>Default:</strong> <code>[]</code></p>
4455
4642
  <hr />
@@ -4467,11 +4654,11 @@ covered by the options above. See the
4467
4654
  <p>Note: This can be accomplished with Ceedling's tool configuration options
4468
4655
  outside of plugin configuration but is supported here to collect
4469
4656
  configuration options in one place.</p>
4470
- <div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a><span class="nt">:gcov</span><span class="p">:</span>
4471
- <a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a><span class="w"> </span><span class="nt">:report_generator</span><span class="p">:</span>
4472
- <a id="__codelineno-2-3" name="__codelineno-2-3" href="#__codelineno-2-3"></a><span class="w"> </span><span class="nt">:custom_args</span><span class="p">:</span>
4473
- <a id="__codelineno-2-4" name="__codelineno-2-4" href="#__codelineno-2-4"></a><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">&lt;argument&gt;</span>
4474
- <a id="__codelineno-2-5" name="__codelineno-2-5" href="#__codelineno-2-5"></a><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">...</span>
4657
+ <div class="highlight"><pre><span></span><code><a id="__codelineno-6-1" name="__codelineno-6-1" href="#__codelineno-6-1"></a><span class="nt">:gcov</span><span class="p">:</span>
4658
+ <a id="__codelineno-6-2" name="__codelineno-6-2" href="#__codelineno-6-2"></a><span class="w"> </span><span class="nt">:report_generator</span><span class="p">:</span>
4659
+ <a id="__codelineno-6-3" name="__codelineno-6-3" href="#__codelineno-6-3"></a><span class="w"> </span><span class="nt">:custom_args</span><span class="p">:</span>
4660
+ <a id="__codelineno-6-4" name="__codelineno-6-4" href="#__codelineno-6-4"></a><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">&lt;argument&gt;</span>
4661
+ <a id="__codelineno-6-5" name="__codelineno-6-5" href="#__codelineno-6-5"></a><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">...</span>
4475
4662
  </code></pre></div>
4476
4663
  <p><strong>Default:</strong> <code>[]</code></p>
4477
4664
  <p><br/><br/></p>
Binary file
@@ -0,0 +1,166 @@
1
+ # =========================================================================
2
+ # Ceedling - Test-Centered Build System for C
3
+ # ThrowTheSwitch.org
4
+ # Copyright (c) 2010-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
5
+ # SPDX-License-Identifier: MIT
6
+ # =========================================================================
7
+
8
+ require 'spec_system_helper'
9
+
10
+ ##
11
+ ## Shared Partials Types Header (issue #1319)
12
+ ## ==========================================
13
+ ##
14
+ ## Partials lifts a module's type definitions into one shared header so a module tested and
15
+ ## mocked in the same test file still gets exactly one C definition of each type. That header
16
+ ## lands in the generated include lists at the position the module's own header occupied, which
17
+ ## is earlier than the module's own source placed its dependencies.
18
+ ##
19
+ ## Until this fix the shared header emitted no #include directives at all, so it compiled only
20
+ ## where something earlier in the translation unit happened to have declared the names its
21
+ ## extracted types reference. A module whose header declares a type in terms of one another
22
+ ## header supplies failed with `unknown type name`, and the same gap applied to a macro an
23
+ ## extracted type names.
24
+ ##
25
+ ## The header now carries those dependencies itself, and states the real module header's include
26
+ ## guard deliberately so a transitive reach at that header finds it already satisfied.
27
+ ##
28
+
29
+ ceedling_system_tests do
30
+
31
+ before :all do
32
+ @c = SystemContext.new
33
+ @c.deploy_gem
34
+ end
35
+
36
+ after :all do
37
+ @c.done!
38
+ end
39
+
40
+ before { @proj_name = unique_proj_name("partials_types") }
41
+
42
+ describe "Deployed as a gem" do
43
+ before do
44
+ @c.with_context do
45
+ @c.ceedling_appcmd_exec("new #{@proj_name}")
46
+ end
47
+ end
48
+
49
+ # =========================================================================
50
+ describe "a Partial's extracted types depending on another header" do
51
+ # =========================================================================
52
+
53
+ before do
54
+ @c.with_context do
55
+ Dir.chdir @proj_name do
56
+ File.write('src/units.h', <<~C)
57
+ #ifndef UNITS_H
58
+ #define UNITS_H
59
+
60
+ typedef signed short Celsius;
61
+
62
+ #endif // UNITS_H
63
+ C
64
+ File.write('src/sensor.h', <<~C)
65
+ #ifndef SENSOR_H
66
+ #define SENSOR_H
67
+
68
+ #include "units.h"
69
+
70
+ typedef struct
71
+ {
72
+ Celsius limit;
73
+ } SensorConfig;
74
+
75
+ int sensor_over_limit(Celsius reading);
76
+
77
+ #endif // SENSOR_H
78
+ C
79
+ File.write('src/sensor.c', <<~C)
80
+ #include "sensor.h"
81
+
82
+ static SensorConfig config = { .limit = 30 };
83
+
84
+ static Celsius sensor_limit(void)
85
+ {
86
+ return config.limit;
87
+ }
88
+
89
+ int sensor_over_limit(Celsius reading)
90
+ {
91
+ return reading > sensor_limit();
92
+ }
93
+ C
94
+ File.write('test/test_sensor.c', <<~C)
95
+ #ifdef TEST
96
+
97
+ #include "unity.h"
98
+ #include "ceedling.h"
99
+
100
+ #include TEST_PARTIAL_ALL_MODULE(sensor)
101
+
102
+ void setUp(void) {}
103
+ void tearDown(void) {}
104
+
105
+ void test_sensor_reads_its_own_file_scope_config(void)
106
+ {
107
+ TEST_ASSERT_EQUAL_INT(30, sensor_limit());
108
+ }
109
+
110
+ void test_sensor_over_limit_uses_the_exposed_limit(void)
111
+ {
112
+ config.limit = 10;
113
+ TEST_ASSERT_TRUE(sensor_over_limit(11));
114
+ TEST_ASSERT_FALSE(sensor_over_limit(9));
115
+ }
116
+
117
+ #endif // TEST
118
+ C
119
+
120
+ @c.merge_project_yml_for_test( :project => { :use_partials => true } )
121
+ end
122
+ end
123
+ end
124
+
125
+ # Exercises the whole chain at once: the carried dependency makes the shared types header
126
+ # compile, the stripped `static` on a file-scope variable makes it reachable from the test,
127
+ # and the stripped `static` on a function makes it callable.
128
+ it "builds and passes, reaching the module's exposed statics" do
129
+ @c.with_context do
130
+ Dir.chdir @proj_name do
131
+ output = @c.ceedling_build_exec("test:all")
132
+
133
+ expect(@c.last_exit_status).to eq(0), "build failed:\n#{output}"
134
+ expect(output).to match(/TESTED:\s+2/)
135
+ expect(output).to match(/PASSED:\s+2/)
136
+ expect(output).to match(/FAILED:\s+0/)
137
+ end
138
+ end
139
+ end
140
+
141
+ # The dependency the shared header carries, and the guard it spoofs, are both emitted into
142
+ # the generated file. Reading it directly states what the build result alone cannot show.
143
+ it "carries the dependency and spoofs the real header's guard" do
144
+ @c.with_context do
145
+ Dir.chdir @proj_name do
146
+ @c.ceedling_build_exec("test:all")
147
+
148
+ generated = Dir.glob('build/test/partials/**/*sensor_types.h').first
149
+ expect(generated).not_to be_nil, 'no shared types header was generated'
150
+
151
+ contents = File.read(generated)
152
+ expect(contents).to match(/#include\s+"units\.h"/)
153
+ expect(contents).to match(/^#define SENSOR_H$/)
154
+
155
+ # The spoof has to precede the carried include: that include can reach the real
156
+ # module header in turn, and the guard must already be satisfied when it does.
157
+ expect(contents.index('#define SENSOR_H')).to be < contents.index('#include "units.h"')
158
+ end
159
+ end
160
+ end
161
+
162
+ end
163
+
164
+ end
165
+
166
+ end