ceedling 1.1.6 → 1.1.8

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/GIT_COMMIT_SHA +1 -1
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +2 -0
  5. data/README.md +4 -1
  6. data/docs/Changelog.md +41 -0
  7. data/docs/KnownIssues.md +3 -0
  8. data/docs/mkdocs/configuration/project-file.md +25 -7
  9. data/docs/mkdocs/configuration/reference/cexception.md +1 -1
  10. data/docs/mkdocs/configuration/reference/cmock.md +1 -1
  11. data/docs/mkdocs/configuration/reference/unity.md +1 -1
  12. data/docs/mkdocs/getting-started/quick-start.md +11 -8
  13. data/docs/mkdocs/plugins/gcov/gcovr.md +329 -189
  14. data/docs/mkdocs/plugins/gcov/reportgenerator.md +113 -31
  15. data/docs/mkdocs/reference/gcov-plugin.md +29 -6
  16. data/docs/mkdocs/snapshot/plugins/gcov/config/defaults.yml +0 -1
  17. data/lib/ceedling/c_extractor/c_extractor_declarations.rb +11 -10
  18. data/lib/ceedling/c_extractor/c_extractor_preprocessing.rb +39 -2
  19. data/lib/ceedling/generators/generator_test_results_backtrace.rb +21 -11
  20. data/lib/ceedling/generators/generator_test_runner.rb +5 -1
  21. data/lib/ceedling/plugins/plugin_reportinator.rb +9 -0
  22. data/lib/ceedling/plugins/report_tests_stdout_plugin.rb +1 -1
  23. data/lib/ceedling/preprocess/preprocessinator_line_marker_includes_extractor.rb +6 -1
  24. data/lib/ceedling/preprocess/preprocessinator_reconstructor.rb +18 -5
  25. data/lib/version.rb +1 -1
  26. data/plugins/gcov/config/defaults.yml +0 -1
  27. data/plugins/gcov/lib/console_reportinator.rb +7 -0
  28. data/plugins/gcov/lib/gcov.rb +64 -26
  29. data/plugins/gcov/lib/gcovr_reportinator.rb +91 -47
  30. data/plugins/gcov/lib/reportgenerator_reportinator.rb +10 -6
  31. data/plugins/valgrind/lib/valgrind.rb +1 -1
  32. data/site-local/configuration/project-file.html +78 -8
  33. data/site-local/configuration/reference/cexception.html +5 -5
  34. data/site-local/configuration/reference/cmock.html +5 -5
  35. data/site-local/configuration/reference/unity.html +5 -5
  36. data/site-local/getting-started/quick-start.html +13 -9
  37. data/site-local/plugins/gcov/gcovr.html +1220 -255
  38. data/site-local/plugins/gcov/reportgenerator.html +404 -46
  39. data/site-local/reference/gcov-plugin.html +48 -10
  40. data/site-local/sitemap.xml.gz +0 -0
  41. data/site-local/snapshot/plugins/gcov/config/defaults.yml +0 -1
  42. data/spec/support/system/system_context.rb +7 -3
  43. data/spec/system/deployment_as_gem_spec.rb +2 -0
  44. data/spec/system/deployment_as_vendor_spec.rb +2 -0
  45. data/spec/system/gcov_deployment_spec.rb +3 -0
  46. data/spec/system/support/common_test_cases.rb +42 -0
  47. data/spec/system/support/gcov_common_test_cases.rb +70 -0
  48. data/spec/units/c_extractor/c_extractor_declarations_spec.rb +16 -0
  49. data/spec/units/c_extractor/c_extractor_integration_spec.rb +53 -0
  50. data/spec/units/c_extractor/c_extractor_preprocessing_spec.rb +45 -0
  51. data/spec/units/generators/generator_partials_spec.rb +98 -0
  52. data/spec/units/generators/generator_test_results_backtrace_spec.rb +77 -0
  53. data/spec/units/generators/generator_test_runner_spec.rb +23 -0
  54. data/spec/units/plugin_reportinator_spec.rb +38 -0
  55. data/spec/units/preprocess/preprocessinator_line_marker_includes_extractor_spec.rb +64 -0
  56. data/spec/units/preprocess/preprocessinator_reconstructor_spec.rb +74 -0
  57. metadata +6 -2
@@ -0,0 +1,64 @@
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_helper'
9
+ require 'ceedling/preprocess/preprocessinator_line_marker_includes_extractor'
10
+ require 'ceedling/includes/includes'
11
+
12
+ # Regression coverage for GH #1268 only -- this class otherwise has no unit spec on this
13
+ # branch. Built on #extract_includes_from_string, a StringIO wrapper around the same
14
+ # private #extract_includes every production call eventually reaches.
15
+ describe PreprocessinatorLineMarkerIncludesExtractor do
16
+ before(:each) do
17
+ @include_factory = double('include_factory')
18
+
19
+ allow(@include_factory).to receive(:user_include_from_filepath) do |filepath|
20
+ UserInclude.new(filepath)
21
+ end
22
+ allow(@include_factory).to receive(:system_include_from_filepath) do |filepath|
23
+ SystemInclude.new(filepath)
24
+ end
25
+
26
+ @extractor = described_class.new(
27
+ :include_factory => @include_factory
28
+ )
29
+ end
30
+
31
+ def paths_of(includes)
32
+ includes.map(&:filepath)
33
+ end
34
+
35
+ describe '#extract_includes_from_string' do
36
+ # #1268: GCC's -fdirectives-only output preserves the ORIGINAL indentation of a
37
+ # top-level #include when it replaces that directive with a line marker entering
38
+ # the included file -- an indented ` #include "widget.h"` produces an indented
39
+ # ` # 1 "widget.h" 1`, not the flush-left marker every other marker GCC
40
+ # generates uses. LINE_MARKER_REGEX must recognize that marker too, or the include
41
+ # is silently missing from the extracted list entirely.
42
+ it 'recognizes a line marker that is itself indented (e.g. from an indented #include)' do
43
+ content = <<~OUTPUT
44
+ # 1 "test.c"
45
+ # 1 "widget.h" 1
46
+ OUTPUT
47
+
48
+ includes = @extractor.extract_includes_from_string( content, 'test.c', described_class::USER )
49
+
50
+ expect( paths_of(includes) ).to eq( ['widget.h'] )
51
+ end
52
+
53
+ it 'still recognizes an ordinary, flush-left line marker' do
54
+ content = <<~OUTPUT
55
+ # 1 "test.c"
56
+ # 1 "widget.h" 1
57
+ OUTPUT
58
+
59
+ includes = @extractor.extract_includes_from_string( content, 'test.c', described_class::USER )
60
+
61
+ expect( paths_of(includes) ).to eq( ['widget.h'] )
62
+ end
63
+ end
64
+ end
@@ -211,6 +211,41 @@ describe PreprocessinatorReconstructor do
211
211
  expect( @extractor.extract_file_as_array_from_expansion(input, filepath) ).to eq expected
212
212
  end
213
213
 
214
+ # #1268: GCC's -fdirectives-only output preserves the ORIGINAL indentation of a
215
+ # top-level #include when it replaces that directive with a line marker entering
216
+ # the included file -- e.g. a source line " #include \"Module3.h\"" produces
217
+ # " # 1 \"Module3.h\" 1", not the flush-left "# 1 ..." this method's marker
218
+ # regexes assumed every marker would be. An unrecognized entering-marker leaves
219
+ # `extract` stuck at whatever it already was instead of turning off, so the
220
+ # marker line itself (and everything up to the NEXT recognized marker, e.g. one
221
+ # from a nested system include triggered from inside the ignored file) leaks into
222
+ # the extracted output before the ping-pong finally self-corrects.
223
+ it "does not leak file content when the marker entering an included file is itself indented" do
224
+ filepath = "dir/our_file.c"
225
+
226
+ file_contents = [
227
+ '# 1 "dir/our_file.c"',
228
+ 'void wanted_before(void);',
229
+ ' # 1 "dir/included.h" 1', # indented entering-marker (leading whitespace from source)
230
+ 'int leaked_from_included_h;',
231
+ '# 1 "/usr/include/nested.h" 1 3 4', # a normal, flush-left marker from within included.h
232
+ 'int also_should_not_leak;',
233
+ '# 2 "dir/included.h" 2', # returning from nested.h back into included.h (still not our file)
234
+ 'int still_should_not_leak;',
235
+ '# 3 "dir/our_file.c" 2', # returning to our file
236
+ 'void wanted_after(void);',
237
+ ]
238
+
239
+ expected = [
240
+ 'void wanted_before(void);',
241
+ 'void wanted_after(void);',
242
+ ]
243
+
244
+ input = StringIO.new( file_contents.join( "\n" ) )
245
+
246
+ expect( @extractor.extract_file_as_array_from_expansion( input, filepath ) ).to eq expected
247
+ end
248
+
214
249
  it "should extract text of original file from preprocessed expansion ignoring embedded expansions having similar names" do
215
250
  filepath = "dir1/dir2/our_file.c"
216
251
 
@@ -798,6 +833,45 @@ describe PreprocessinatorReconstructor do
798
833
  expect( @extractor.extract_macro_defs( file_text, '_INCLUDE_GUARD_' ) ).to eq expected
799
834
  end
800
835
 
836
+ # #1266: a plain substring test against the include guard rejected any macro whose
837
+ # name OR value merely contained the guard string, not only the guard macro itself.
838
+ # RTC_HOUR_SECONDS' own name contains the guard "RTC_H", and RTC_DAY_SECONDS'
839
+ # *value* references RTC_HOUR_SECONDS, so its captured text also contains "RTC_H" --
840
+ # both were silently dropped from the reconstructed header, breaking compilation.
841
+ it "does not reject an ordinary macro whose name or value merely contains the include guard as a substring (GH #1266)" do
842
+ file_text = <<~FILE_TEXT
843
+ #ifndef RTC_H
844
+ #define RTC_H
845
+
846
+ #define RTC_MINUTE_SECONDS 60u
847
+ #define RTC_HOUR_SECONDS (60u * RTC_MINUTE_SECONDS)
848
+ #define RTC_DAY_SECONDS (24u * RTC_HOUR_SECONDS)
849
+
850
+ #endif
851
+ FILE_TEXT
852
+
853
+ expected = [
854
+ "#define RTC_MINUTE_SECONDS 60u",
855
+ "#define RTC_HOUR_SECONDS (60u * RTC_MINUTE_SECONDS)",
856
+ "#define RTC_DAY_SECONDS (24u * RTC_HOUR_SECONDS)"
857
+ ]
858
+
859
+ expect( @extractor.extract_macro_defs( file_text, 'RTC_H' ) ).to eq expected
860
+ end
861
+
862
+ it "still rejects the include guard when it appears with trailing whitespace instead of a value" do
863
+ file_text = <<~FILE_TEXT
864
+ #ifndef RTC_H
865
+ #define RTC_H
866
+
867
+ #define RTC_MINUTE_SECONDS 60u
868
+ FILE_TEXT
869
+
870
+ expected = [ "#define RTC_MINUTE_SECONDS 60u" ]
871
+
872
+ expect( @extractor.extract_macro_defs( file_text, 'RTC_H' ) ).to eq expected
873
+ end
874
+
801
875
  end
802
876
 
803
877
  context "#compact_file_from_expansion" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ceedling
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark VanderVoord
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2026-08-25 00:00:00.000000000 Z
13
+ date: 2026-09-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -996,6 +996,7 @@ files:
996
996
  - spec/units/partials/partializer_spec.rb
997
997
  - spec/units/partials/partializer_utils_spec.rb
998
998
  - spec/units/plugin_manager_spec.rb
999
+ - spec/units/plugin_reportinator_spec.rb
999
1000
  - spec/units/plugins/cppcheck_spec.rb
1000
1001
  - spec/units/preprocess/c_comment_scanner_spec.rb
1001
1002
  - spec/units/preprocess/c_preprocessor_conditionals_spec.rb
@@ -1003,6 +1004,7 @@ files:
1003
1004
  - spec/units/preprocess/preprocessinator_comment_stripper_spec.rb
1004
1005
  - spec/units/preprocess/preprocessinator_file_assembler_spec.rb
1005
1006
  - spec/units/preprocess/preprocessinator_includes_handler_spec.rb
1007
+ - spec/units/preprocess/preprocessinator_line_marker_includes_extractor_spec.rb
1006
1008
  - spec/units/preprocess/preprocessinator_reconstructor_spec.rb
1007
1009
  - spec/units/preprocess/preprocessinator_spec.rb
1008
1010
  - spec/units/reportinator_spec.rb
@@ -1847,6 +1849,7 @@ test_files:
1847
1849
  - spec/units/partials/partializer_spec.rb
1848
1850
  - spec/units/partials/partializer_utils_spec.rb
1849
1851
  - spec/units/plugin_manager_spec.rb
1852
+ - spec/units/plugin_reportinator_spec.rb
1850
1853
  - spec/units/plugins/cppcheck_spec.rb
1851
1854
  - spec/units/preprocess/c_comment_scanner_spec.rb
1852
1855
  - spec/units/preprocess/c_preprocessor_conditionals_spec.rb
@@ -1854,6 +1857,7 @@ test_files:
1854
1857
  - spec/units/preprocess/preprocessinator_comment_stripper_spec.rb
1855
1858
  - spec/units/preprocess/preprocessinator_file_assembler_spec.rb
1856
1859
  - spec/units/preprocess/preprocessinator_includes_handler_spec.rb
1860
+ - spec/units/preprocess/preprocessinator_line_marker_includes_extractor_spec.rb
1857
1861
  - spec/units/preprocess/preprocessinator_reconstructor_spec.rb
1858
1862
  - spec/units/preprocess/preprocessinator_spec.rb
1859
1863
  - spec/units/reportinator_spec.rb