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
@@ -200,8 +200,10 @@ class UnityTestRunnerGenerator
200
200
  source_lines = source.split("\n")
201
201
  source_index = 0
202
202
  tests_and_line_numbers.size.times do |i|
203
+ # Compile once per test
204
+ name_regex = /(?:^|\s)#{tests_and_line_numbers[i][:test]}(?:\s|\()/
203
205
  source_lines[source_index..].each_with_index do |line, index|
204
- next unless line =~ /\s+#{tests_and_line_numbers[i][:test]}(?:\s|\()/
206
+ next unless line =~ name_regex
205
207
 
206
208
  source_index += index
207
209
  tests_and_line_numbers[i][:line_number] = source_index + 1
@@ -124,7 +124,7 @@ if $0 == __FILE__
124
124
  begin
125
125
  # look in the specified or current directory for result files
126
126
  args[0] ||= './'
127
- targets = "#{ARGV[0].tr('\\', '/')}**/*.test*"
127
+ targets = "#{args[0].tr('\\', '/')}**/*.test*"
128
128
  results = Dir[targets]
129
129
 
130
130
  raise "No *.testpass, *.testfail, or *.testresults files found in '#{targets}'" if results.empty?
@@ -133,7 +133,7 @@ if $0 == __FILE__
133
133
 
134
134
  # set the root path
135
135
  args[1] ||= "#{Dir.pwd}/"
136
- uts.root = ARGV[1]
136
+ uts.root = args[1]
137
137
 
138
138
  # run the summarizer
139
139
  puts uts.run
@@ -13,6 +13,13 @@ Prior to 2008, the project was an internal project and not released to the publi
13
13
 
14
14
  ## Log
15
15
 
16
+ ### Unity 2.7.2
17
+
18
+ Significant Bugfixes:
19
+
20
+ - Default `UNITY_INCLUDE_EXEC_TIME` macros compile as ISO C99, are statement-safe, and accept `-Wsign-conversion` (#838)
21
+ - `unity_test_summary.rb` honors its own default result directory and root path again. @youdie006
22
+
16
23
  ### Unity 2.7.0 (July 2026)
17
24
 
18
25
  New Features:
@@ -488,6 +488,10 @@ Define this to measure and report execution time for each test in the suite. Whe
488
488
  it's best to automatically find a way to determine the time in milliseconds. On most Windows, macos, or
489
489
  Linux environments, this is automatic. If not, you can give Unity more information.
490
490
 
491
+ On Unix and macOS, the default uses POSIX `clock_gettime(CLOCK_MONOTONIC)` when that clock is available.
492
+ If it is not (strict ISO C with no POSIX clocks in `<time.h>`), it falls back to the standard `clock()` function,
493
+ which is also the Windows default.
494
+
491
495
  #### `UNITY_CLOCK_MS`
492
496
 
493
497
  If you're working on a system (embedded or otherwise) which has an accessible millisecond timer. You can
@@ -395,33 +395,34 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
395
395
  !defined(UNITY_EXEC_TIME_STOP) && \
396
396
  !defined(UNITY_PRINT_EXEC_TIME) && \
397
397
  !defined(UNITY_TIME_TYPE)
398
- /* If none any of these macros are defined then try to provide a default implementation */
398
+ /* If none of these macros are defined then try to provide a default implementation */
399
399
 
400
400
  #if defined(UNITY_CLOCK_MS)
401
401
  /* This is a simple way to get a default implementation on platforms that support getting a millisecond counter */
402
402
  #define UNITY_TIME_TYPE UNITY_UINT
403
403
  #define UNITY_EXEC_TIME_START() Unity.CurrentTestStartTime = UNITY_CLOCK_MS()
404
404
  #define UNITY_EXEC_TIME_STOP() Unity.CurrentTestStopTime = UNITY_CLOCK_MS()
405
- #define UNITY_PRINT_EXEC_TIME() { \
405
+ #define UNITY_PRINT_EXEC_TIME() do { \
406
406
  UNITY_UINT execTimeMs = (Unity.CurrentTestStopTime - Unity.CurrentTestStartTime); \
407
407
  UnityPrint(" ("); \
408
408
  UnityPrintNumberUnsigned(execTimeMs); \
409
409
  UnityPrint(" ms)"); \
410
- }
410
+ } while (0)
411
411
  #elif defined(_WIN32)
412
412
  #include <time.h>
413
413
  #define UNITY_TIME_TYPE clock_t
414
414
  #define UNITY_GET_TIME(t) t = (clock_t)((clock() * 1000) / CLOCKS_PER_SEC)
415
415
  #define UNITY_EXEC_TIME_START() UNITY_GET_TIME(Unity.CurrentTestStartTime)
416
416
  #define UNITY_EXEC_TIME_STOP() UNITY_GET_TIME(Unity.CurrentTestStopTime)
417
- #define UNITY_PRINT_EXEC_TIME() { \
418
- UNITY_UINT execTimeMs = (Unity.CurrentTestStopTime - Unity.CurrentTestStartTime); \
417
+ #define UNITY_PRINT_EXEC_TIME() do { \
418
+ UNITY_UINT execTimeMs = (UNITY_UINT)(Unity.CurrentTestStopTime - Unity.CurrentTestStartTime); \
419
419
  UnityPrint(" ("); \
420
420
  UnityPrintNumberUnsigned(execTimeMs); \
421
421
  UnityPrint(" ms)"); \
422
- }
422
+ } while (0)
423
423
  #elif defined(__unix__) || defined(__APPLE__)
424
424
  #include <time.h>
425
+ #if defined(CLOCK_MONOTONIC)
425
426
  #define UNITY_TIME_TYPE struct timespec
426
427
  #define UNITY_GET_TIME(t) clock_gettime(CLOCK_MONOTONIC, &t)
427
428
  #define UNITY_EXEC_TIME_START() UNITY_GET_TIME(Unity.CurrentTestStartTime)
@@ -432,7 +433,20 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
432
433
  UnityPrint(" ("); \
433
434
  UnityPrintNumberUnsigned(execTimeMs); \
434
435
  UnityPrint(" ms)"); \
435
- } while(0)
436
+ } while (0)
437
+ #else
438
+ /* CLOCK_MONOTONIC is POSIX, not ISO C. Fall back so -std=c99 still compiles. */
439
+ #define UNITY_TIME_TYPE clock_t
440
+ #define UNITY_GET_TIME(t) t = (clock_t)((clock() * 1000) / CLOCKS_PER_SEC)
441
+ #define UNITY_EXEC_TIME_START() UNITY_GET_TIME(Unity.CurrentTestStartTime)
442
+ #define UNITY_EXEC_TIME_STOP() UNITY_GET_TIME(Unity.CurrentTestStopTime)
443
+ #define UNITY_PRINT_EXEC_TIME() do { \
444
+ UNITY_UINT execTimeMs = (UNITY_UINT)(Unity.CurrentTestStopTime - Unity.CurrentTestStartTime); \
445
+ UnityPrint(" ("); \
446
+ UnityPrintNumberUnsigned(execTimeMs); \
447
+ UnityPrint(" ms)"); \
448
+ } while (0)
449
+ #endif
436
450
  #endif
437
451
  #endif
438
452
  #endif
@@ -43,7 +43,7 @@ TARGET = build/testunity-cov.exe
43
43
  # To generate coverage, call 'make -s', the default target runs.
44
44
  # For verbose output of all the tests, run 'make test'.
45
45
  default: test
46
- .PHONY: default coverage test clean
46
+ .PHONY: default coverage test clean intDetection execTimeDetection
47
47
  coverage: $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5) $(SRC6) $(SRC7) $(SRC8)
48
48
  cd $(BUILD_DIR) && \
49
49
  $(CC) $(CFLAGS) $(DEFINES) $(foreach i,$(SRC1), ../$i) $(COV_FLAGS) -o ../$(TARGET)
@@ -122,10 +122,17 @@ test: $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5) $(SRC6) $(SRC7) $(SRC8)
122
122
 
123
123
  # Compile only, for testing that preprocessor detection works
124
124
  UNITY_C_ONLY =-c ../src/unity.c -o $(BUILD_DIR)/unity.o
125
- intDetection:
125
+ intDetection: | $(BUILD_DIR)
126
126
  $(CC) $(CFLAGS) $(INC_DIR) $(UNITY_C_ONLY) -D UNITY_EXCLUDE_STDINT_H
127
127
  $(CC) $(CFLAGS) $(INC_DIR) $(UNITY_C_ONLY) -D UNITY_EXCLUDE_LIMITS_H
128
128
 
129
+ # UNITY_INCLUDE_EXEC_TIME is optional and was historically untested, so the
130
+ # default timer macros could rot. Compile them with Unity's own warning flags
131
+ # and with -Wsign-conversion (the failure reported in #838).
132
+ execTimeDetection: | $(BUILD_DIR)
133
+ $(CC) $(CFLAGS) $(INC_DIR) $(UNITY_C_ONLY) -D UNITY_INCLUDE_EXEC_TIME
134
+ $(CC) $(CFLAGS) -Wsign-conversion $(INC_DIR) $(UNITY_C_ONLY) -D UNITY_INCLUDE_EXEC_TIME
135
+
129
136
  $(BUILD_DIR)/test_unity_arraysRunner.c: tests/test_unity_arrays.c | $(BUILD_DIR)
130
137
  awk $(AWK_SCRIPT) tests/test_unity_arrays.c > $@
131
138
 
@@ -407,6 +407,7 @@ module RakefileHelpers
407
407
  combined_output = ''
408
408
  [ "make -s", # test with all defaults
409
409
  "make -s coverage", # test with coverage
410
+ "make -s execTimeDetection", # compile default UNITY_INCLUDE_EXEC_TIME macros
410
411
  "cd #{File.join("..","extras","fixture",'test')} && make -s default noStdlibMalloc",
411
412
  "cd #{File.join("..","extras","fixture",'test')} && make -s C89",
412
413
  "cd #{File.join("..","extras","memory",'test')} && make -s default noStdlibMalloc",
@@ -1334,6 +1334,55 @@ should 'GenerateSuiteTeardownWhenBeginAndEndAreOmitted' do
1334
1334
  $generate_test_runner_tests += 1
1335
1335
  end
1336
1336
 
1337
+ should 'FindTestsLineNumbersWhenNameStartsTheLine' do
1338
+ # The return type may sit on its own line, leaving the test name at column 0.
1339
+ # The line search must still find the definition (and must not scan to the end
1340
+ # of the file for every test, which is what made large files slow).
1341
+ source = "#include \"unity.h\"\n" \
1342
+ "\n" \
1343
+ "void\n" \
1344
+ "test_FirstAtColumnZero(void)\n" \
1345
+ "{\n" \
1346
+ "}\n" \
1347
+ "\n" \
1348
+ "void\n" \
1349
+ "test_SecondAtColumnZero(void)\n" \
1350
+ "{\n" \
1351
+ "}\n"
1352
+ found = UnityTestRunnerGenerator.new({}).find_tests(source).map { |t| [t[:test], t[:line_number]] }
1353
+ expected = [['test_FirstAtColumnZero', 4], ['test_SecondAtColumnZero', 9]]
1354
+ if found == expected
1355
+ report 'Runner_FindTestsLineNumbersWhenNameStartsTheLine:PASS'
1356
+ else
1357
+ report " FAIL: expected #{expected.inspect}, got #{found.inspect}"
1358
+ report 'Runner_FindTestsLineNumbersWhenNameStartsTheLine:FAIL'
1359
+ $generate_test_runner_failures += 1
1360
+ end
1361
+ $generate_test_runner_tests += 1
1362
+ end
1363
+
1364
+ should 'FindTestsLineNumbersWhenOneNameIsAPrefixOfAnother' do
1365
+ # Issue #288: test_my_function must not be located inside
1366
+ # test_my_function_invalid_behavior, which is defined first.
1367
+ source = "void test_my_function_invalid_behavior(void)\n" \
1368
+ "{\n" \
1369
+ "}\n" \
1370
+ "\n" \
1371
+ "void test_my_function(void)\n" \
1372
+ "{\n" \
1373
+ "}\n"
1374
+ found = UnityTestRunnerGenerator.new({}).find_tests(source).map { |t| [t[:test], t[:line_number]] }
1375
+ expected = [['test_my_function_invalid_behavior', 1], ['test_my_function', 5]]
1376
+ if found == expected
1377
+ report 'Runner_FindTestsLineNumbersWhenOneNameIsAPrefixOfAnother:PASS'
1378
+ else
1379
+ report " FAIL: expected #{expected.inspect}, got #{found.inspect}"
1380
+ report 'Runner_FindTestsLineNumbersWhenOneNameIsAPrefixOfAnother:FAIL'
1381
+ $generate_test_runner_failures += 1
1382
+ end
1383
+ $generate_test_runner_tests += 1
1384
+ end
1385
+
1337
1386
  RUNNER_TESTS.each do |testset|
1338
1387
  basename = File.basename(testset[:testfile], C_EXTENSION)
1339
1388
  testset_name = "Runner_#{basename}_#{testset[:name]}"
@@ -0,0 +1,58 @@
1
+ # =========================================================================
2
+ # Unity - A Test Framework for C
3
+ # ThrowTheSwitch.org
4
+ # Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
5
+ # SPDX-License-Identifier: MIT
6
+ # =========================================================================
7
+
8
+ require 'fileutils'
9
+ require_relative '../../auto/colour_reporter'
10
+
11
+ # the 'test:scripts' rake task tallies these, so only initialize them if we are loaded first
12
+ $generate_test_runner_tests ||= 0
13
+ $generate_test_runner_failures ||= 0
14
+ $unity_test_summary_failures = 0
15
+
16
+ SUMMARY_SCRIPT = File.expand_path('../../auto/unity_test_summary.rb', __dir__)
17
+ SUMMARY_SANDBOX = File.expand_path('../sandbox/test_summary', __dir__)
18
+ SUMMARY_RESULTS = <<~RESULTS
19
+ test/test_a.c:12:test_thing:PASS
20
+ test/test_b.c:34:test_broken:FAIL: Expected 1 Was 2
21
+ test/test_c.c:56:test_skipped:IGNORE: not ready
22
+
23
+ -----------------------
24
+ 3 Tests 1 Failures 1 Ignored
25
+ RESULTS
26
+
27
+ def summary_test(name, passed)
28
+ if passed
29
+ report "#{name}:PASS"
30
+ else
31
+ report "#{name}:FAIL"
32
+ $generate_test_runner_failures += 1
33
+ $unity_test_summary_failures += 1
34
+ end
35
+ $generate_test_runner_tests += 1
36
+ end
37
+
38
+ FileUtils.rm_rf(SUMMARY_SANDBOX)
39
+ FileUtils.mkdir_p(SUMMARY_SANDBOX)
40
+ File.write(File.join(SUMMARY_SANDBOX, 'test_sample.testfail'), SUMMARY_RESULTS)
41
+
42
+ begin
43
+ Dir.chdir(SUMMARY_SANDBOX) do
44
+ # with no arguments at all, the result files are looked for in the current directory
45
+ output = `ruby "#{SUMMARY_SCRIPT}" 2>&1`
46
+ summary_test('UnityTestSummary_DefaultsResultDirectoryToCurrentDirectory',
47
+ $?.success? && output.include?('3 TOTAL TESTS 1 TOTAL FAILURES 1 IGNORED'))
48
+
49
+ # with only a result directory given, the root path defaults to the current directory
50
+ expected = "#{Dir.pwd}/test/test_b.c:34".tr('/', '\\')
51
+ output = `ruby "#{SUMMARY_SCRIPT}" ./ 2>&1`
52
+ summary_test('UnityTestSummary_DefaultsRootPathToCurrentDirectory', output.include?(expected))
53
+ end
54
+ ensure
55
+ FileUtils.rm_rf(SUMMARY_SANDBOX)
56
+ end
57
+
58
+ raise "There were #{$unity_test_summary_failures} failures while testing unity_test_summary.rb" if $unity_test_summary_failures > 0
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.8
4
+ version: 1.1.10
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-09-10 00:00:00.000000000 Z
13
+ date: 2026-10-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -945,6 +945,7 @@ files:
945
945
  - spec/system/example_wondrous_forest_spec.rb
946
946
  - spec/system/gcov_deployment_spec.rb
947
947
  - spec/system/mixin_ordering_spec.rb
948
+ - spec/system/partials_types_header_spec.rb
948
949
  - spec/system/preprocessing_encoding_spec.rb
949
950
  - spec/system/preprocessing_fallback_conditionals_spec.rb
950
951
  - spec/system/preprocessing_locale_spec.rb
@@ -1739,6 +1740,7 @@ files:
1739
1740
  - vendor/unity/test/tests/test_unity_parameterized.c
1740
1741
  - vendor/unity/test/tests/test_unity_parameterizedDemo.c
1741
1742
  - vendor/unity/test/tests/test_unity_strings.c
1743
+ - vendor/unity/test/tests/test_unity_test_summary.rb
1742
1744
  - vendor/unity/test/tests/types_for_test.h
1743
1745
  - vendor/unity/unityConfig.cmake
1744
1746
  homepage: https://throwtheswitch.org/ceedling
@@ -1798,6 +1800,7 @@ test_files:
1798
1800
  - spec/system/example_wondrous_forest_spec.rb
1799
1801
  - spec/system/gcov_deployment_spec.rb
1800
1802
  - spec/system/mixin_ordering_spec.rb
1803
+ - spec/system/partials_types_header_spec.rb
1801
1804
  - spec/system/preprocessing_encoding_spec.rb
1802
1805
  - spec/system/preprocessing_fallback_conditionals_spec.rb
1803
1806
  - spec/system/preprocessing_locale_spec.rb