ceedling 1.2.2 → 1.2.3

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 (390) hide show
  1. checksums.yaml +4 -4
  2. data/GIT_COMMIT_SHA +1 -1
  3. data/README.md +1 -1
  4. data/assets/fixtures/tests_with_partials_coverage/src/private_macro.c +7 -0
  5. data/assets/fixtures/tests_with_partials_coverage/src/private_macro.h +5 -0
  6. data/assets/fixtures/tests_with_partials_coverage/src/tally.c +13 -0
  7. data/assets/fixtures/tests_with_partials_coverage/src/tally.h +4 -0
  8. data/assets/fixtures/tests_with_partials_coverage/test/test_private_macro.c +10 -0
  9. data/assets/fixtures/tests_with_partials_coverage/test/test_tally.c +9 -0
  10. data/docs/BreakingChanges.md +16 -0
  11. data/docs/Changelog.md +71 -0
  12. data/docs/KnownIssues.md +91 -4
  13. data/examples/wondrous_forest/README.md +29 -1
  14. data/examples/wondrous_forest/src/ForestUnits.h +23 -0
  15. data/examples/wondrous_forest/src/RainGauge.c +59 -0
  16. data/examples/wondrous_forest/src/RainGauge.h +39 -0
  17. data/examples/wondrous_forest/src/RainTipIsr.c +17 -0
  18. data/examples/wondrous_forest/src/RainTipIsr.h +14 -0
  19. data/examples/wondrous_forest/test/TestRainGauge.c +126 -0
  20. data/lib/ceedling/c_extractor/README.md +15 -7
  21. data/lib/ceedling/c_extractor/c_extractor.rb +25 -14
  22. data/lib/ceedling/c_extractor/c_extractor_code_text.rb +84 -54
  23. data/lib/ceedling/c_extractor/c_extractor_constants.rb +18 -7
  24. data/lib/ceedling/c_extractor/c_extractor_declarations.rb +319 -283
  25. data/lib/ceedling/c_extractor/c_extractor_declarator.rb +285 -0
  26. data/lib/ceedling/c_extractor/c_extractor_defined_type.rb +111 -0
  27. data/lib/ceedling/c_extractor/c_extractor_definitions.rb +174 -121
  28. data/lib/ceedling/c_extractor/c_extractor_functions.rb +191 -162
  29. data/lib/ceedling/c_extractor/c_extractor_preprocessing.rb +46 -55
  30. data/lib/ceedling/c_extractor/c_extractor_statement.rb +30 -0
  31. data/lib/ceedling/c_extractor/c_extractor_types.rb +63 -41
  32. data/lib/ceedling/c_extractor/c_module_edits.rb +48 -0
  33. data/lib/ceedling/c_identifier.rb +21 -0
  34. data/lib/ceedling/ceedling.h +8 -0
  35. data/lib/ceedling/config/configurator.rb +4 -3
  36. data/lib/ceedling/config/configurator_builder.rb +17 -0
  37. data/lib/ceedling/config/configurator_setup.rb +29 -5
  38. data/lib/ceedling/constants.rb +5 -1
  39. data/lib/ceedling/defaults.rb +31 -1
  40. data/lib/ceedling/dependencies/CACHE_SCHEMA.md +118 -0
  41. data/lib/ceedling/dependencies/README.md +1 -1
  42. data/lib/ceedling/dependencies/dependency_cache_store.rb +30 -25
  43. data/lib/ceedling/dependencies/dependency_tracker.rb +9 -3
  44. data/lib/ceedling/dependencies/dependinator.rb +13 -1
  45. data/lib/ceedling/diagnostics/DOCTOR.md +142 -0
  46. data/lib/ceedling/diagnostics/README.md +5 -0
  47. data/lib/ceedling/diagnostics/build_step_doctor.rb +110 -0
  48. data/lib/ceedling/diagnostics/duplicate_symbol_specialist.rb +108 -0
  49. data/lib/ceedling/diagnostics/guidance_phrases.rb +30 -0
  50. data/lib/ceedling/diagnostics/header_collision_guidance.rb +56 -0
  51. data/lib/ceedling/diagnostics/header_collision_specialist.rb +152 -0
  52. data/lib/ceedling/diagnostics/include_depth_specialist.rb +132 -0
  53. data/lib/ceedling/diagnostics/missing_symbol_specialist.rb +111 -0
  54. data/lib/ceedling/diagnostics/partial_name_specialist.rb +134 -0
  55. data/lib/ceedling/diagnostics/toolchain_output.rb +44 -0
  56. data/lib/ceedling/filesystem/PATH_HANDLING.md +83 -27
  57. data/lib/ceedling/filesystem/README.md +6 -1
  58. data/lib/ceedling/filesystem/build_roots.rb +105 -0
  59. data/lib/ceedling/filesystem/build_subpath.rb +110 -25
  60. data/lib/ceedling/filesystem/file_finder.rb +76 -110
  61. data/lib/ceedling/filesystem/file_finder_helper.rb +33 -11
  62. data/lib/ceedling/filesystem/file_path_utils.rb +113 -91
  63. data/lib/ceedling/filesystem/file_wrapper.rb +105 -28
  64. data/lib/ceedling/filesystem/path_matcher.rb +21 -0
  65. data/lib/ceedling/filesystem/test_build_layout.rb +114 -0
  66. data/lib/ceedling/filesystem/win_long_paths.rb +153 -0
  67. data/lib/ceedling/filesystem/win_path_limit.rb +83 -0
  68. data/lib/ceedling/filesystem/win_path_prober.rb +52 -0
  69. data/lib/ceedling/generators/generator.rb +27 -64
  70. data/lib/ceedling/generators/generator_helper.rb +0 -44
  71. data/lib/ceedling/generators/generator_mocks.rb +5 -0
  72. data/lib/ceedling/generators/generator_partials.rb +305 -243
  73. data/lib/ceedling/generators/generator_test_runner.rb +5 -8
  74. data/lib/ceedling/generators/partial_header_writer.rb +95 -0
  75. data/lib/ceedling/generators/partial_source_writer.rb +137 -0
  76. data/lib/ceedling/includes/header_search.rb +225 -0
  77. data/lib/ceedling/includes/include_factory.rb +9 -12
  78. data/lib/ceedling/includes/include_pathinator.rb +53 -31
  79. data/lib/ceedling/includes/includes.rb +149 -37
  80. data/lib/ceedling/objects.yml +89 -4
  81. data/lib/ceedling/partials/README.md +110 -16
  82. data/lib/ceedling/partials/carry_plan.rb +71 -0
  83. data/lib/ceedling/partials/definition_head.rb +74 -0
  84. data/lib/ceedling/partials/include_groups.rb +37 -0
  85. data/lib/ceedling/partials/interface_extras.rb +25 -0
  86. data/lib/ceedling/partials/partializer.rb +599 -120
  87. data/lib/ceedling/partials/partializer_config.rb +5 -0
  88. data/lib/ceedling/partials/partializer_helper.rb +851 -145
  89. data/lib/ceedling/partials/partializer_reconciler.rb +174 -0
  90. data/lib/ceedling/partials/partializer_utils.rb +89 -109
  91. data/lib/ceedling/partials/partials.rb +153 -10
  92. data/lib/ceedling/partials/type_macros.rb +126 -0
  93. data/lib/ceedling/preprocess/README.md +43 -33
  94. data/lib/ceedling/preprocess/preprocessinator.rb +100 -186
  95. data/lib/ceedling/preprocess/preprocessinator_code_finder.rb +65 -72
  96. data/lib/ceedling/preprocess/preprocessinator_file_assembler.rb +31 -75
  97. data/lib/ceedling/preprocess/preprocessinator_reconstructor.rb +51 -14
  98. data/lib/ceedling/setupinator.rb +16 -3
  99. data/lib/ceedling/test_invoker/HEADER_COLLISIONS.md +21 -7
  100. data/lib/ceedling/test_invoker/PIPELINE.md +57 -16
  101. data/lib/ceedling/test_invoker/README.md +1 -1
  102. data/lib/ceedling/test_invoker/derived_search_path_notices.rb +45 -0
  103. data/lib/ceedling/test_invoker/mock_locator.rb +116 -9
  104. data/lib/ceedling/test_invoker/partial_files_preprocessinator.rb +181 -0
  105. data/lib/ceedling/test_invoker/partials_manager.rb +265 -308
  106. data/lib/ceedling/test_invoker/standin_headerinator.rb +8 -15
  107. data/lib/ceedling/test_invoker/test_bare_includes_extractinator.rb +26 -3
  108. data/lib/ceedling/test_invoker/test_build_executor.rb +338 -198
  109. data/lib/ceedling/test_invoker/test_build_planner.rb +13 -19
  110. data/lib/ceedling/test_invoker/test_build_setup.rb +26 -6
  111. data/lib/ceedling/test_invoker/test_build_validations.rb +23 -20
  112. data/lib/ceedling/test_invoker/test_derived_search_paths.rb +189 -0
  113. data/lib/ceedling/test_invoker/test_file_preprocessinator.rb +1 -2
  114. data/lib/ceedling/test_invoker/test_includes_reconcilinator.rb +1 -1
  115. data/lib/ceedling/test_invoker/test_invoker_types.rb +28 -20
  116. data/lib/ceedling/test_invoker/test_pipeline_helpers.rb +5 -3
  117. data/lib/ceedling/test_invoker/test_pipeline_manager.rb +25 -8
  118. data/lib/ceedling/test_invoker/test_runner_generatinator.rb +31 -3
  119. data/lib/ceedling/test_invoker/test_search_paths.rb +30 -8
  120. data/lib/ceedling/test_invoker/test_substitutions.rb +72 -0
  121. data/lib/ceedling/tools/shell_quoting.rb +45 -0
  122. data/lib/ceedling/tools/tool_quoting.rb +79 -0
  123. data/lib/ceedling/{tool_validator.rb → tools/tool_validator.rb} +18 -7
  124. data/lib/version.rb +1 -1
  125. data/plugins/bullseye/bullseye.rake +1 -3
  126. data/plugins/bullseye/lib/bullseye.rb +15 -2
  127. data/plugins/command_hooks/lib/command_hooks.rb +1 -1
  128. data/plugins/fff/lib/fff.rb +42 -15
  129. data/plugins/fff/lib/fff_mock_generator.rb +12 -9
  130. data/plugins/fff/spec/fff_cmock_wrapper_spec.rb +134 -0
  131. data/plugins/fff/spec/fff_mock_header_generator_spec.rb +9 -0
  132. data/plugins/fff/spec/fff_mock_source_generator_spec.rb +20 -0
  133. data/plugins/gcov/lib/console_reportinator.rb +25 -19
  134. data/plugins/gcov/lib/reportgenerator_reportinator.rb +2 -1
  135. data/site-local/404.html +2 -2
  136. data/site-local/assets/javascripts/{bundle.c21346df.min.js → bundle.a5f9d56c.min.js} +1 -1
  137. data/site-local/assets/javascripts/{bundle.c21346df.min.js.map → bundle.a5f9d56c.min.js.map} +2 -2
  138. data/site-local/configuration/environment-vars.html +2 -2
  139. data/site-local/configuration/global-collections.html +3 -3
  140. data/site-local/configuration/index.html +2 -2
  141. data/site-local/configuration/loading.html +2 -2
  142. data/site-local/configuration/mixins.html +2 -2
  143. data/site-local/configuration/parallel-builds.html +2 -2
  144. data/site-local/configuration/project-file.html +2 -2
  145. data/site-local/configuration/reference/cexception.html +2 -2
  146. data/site-local/configuration/reference/cmock.html +5 -2
  147. data/site-local/configuration/reference/defines.html +2 -2
  148. data/site-local/configuration/reference/environment.html +2 -2
  149. data/site-local/configuration/reference/extension.html +2 -2
  150. data/site-local/configuration/reference/files.html +56 -9
  151. data/site-local/configuration/reference/flags.html +2 -2
  152. data/site-local/configuration/reference/index.html +2 -2
  153. data/site-local/configuration/reference/libraries.html +2 -2
  154. data/site-local/configuration/reference/mixins.html +2 -2
  155. data/site-local/configuration/reference/partials.html +84 -2
  156. data/site-local/configuration/reference/paths.html +7 -2
  157. data/site-local/configuration/reference/plugins.html +2 -2
  158. data/site-local/configuration/reference/project.html +247 -5
  159. data/site-local/configuration/reference/release-build.html +2 -2
  160. data/site-local/configuration/reference/test-build.html +2 -2
  161. data/site-local/configuration/reference/test-runner.html +2 -2
  162. data/site-local/configuration/reference/tools.html +49 -4
  163. data/site-local/configuration/reference/unity.html +2 -2
  164. data/site-local/configuration/which-ceedling.html +2 -2
  165. data/site-local/development/index.html +2 -2
  166. data/site-local/development/plugins/configuration.html +2 -2
  167. data/site-local/development/plugins/index.html +2 -2
  168. data/site-local/development/plugins/plugin-subclass.html +5 -4
  169. data/site-local/development/plugins/rake-tasks.html +2 -2
  170. data/site-local/development/releases.html +2 -2
  171. data/site-local/development/workflow.html +2 -2
  172. data/site-local/getting-started/builds.html +2 -2
  173. data/site-local/getting-started/command-line.html +2 -2
  174. data/site-local/getting-started/example-projects/cipher-quest.html +2 -2
  175. data/site-local/getting-started/example-projects/index.html +2 -2
  176. data/site-local/getting-started/example-projects/temp-sensor.html +2 -2
  177. data/site-local/getting-started/example-projects/wondrous-forest.html +10 -2
  178. data/site-local/getting-started/index.html +2 -2
  179. data/site-local/getting-started/installation.html +2 -2
  180. data/site-local/getting-started/quick-start.html +2 -2
  181. data/site-local/help.html +2 -2
  182. data/site-local/index.html +2 -2
  183. data/site-local/overview/build-system.html +2 -2
  184. data/site-local/overview/index.html +2 -2
  185. data/site-local/overview/test-environments.html +2 -2
  186. data/site-local/overview/tools-and-frameworks.html +2 -2
  187. data/site-local/plugins/beep.html +2 -2
  188. data/site-local/plugins/bullseye/index.html +45 -38
  189. data/site-local/plugins/bullseye/licensing.html +2 -2
  190. data/site-local/plugins/command-hooks.html +4 -4
  191. data/site-local/plugins/compile-commands-json-db.html +2 -2
  192. data/site-local/plugins/cppcheck.html +2 -2
  193. data/site-local/plugins/dependencies.html +2 -2
  194. data/site-local/plugins/fff.html +16 -2
  195. data/site-local/plugins/gcov/examples.html +2 -2
  196. data/site-local/plugins/gcov/gcovr.html +8 -2
  197. data/site-local/plugins/gcov/index.html +2 -2
  198. data/site-local/plugins/gcov/overview.html +2 -2
  199. data/site-local/plugins/gcov/reportgenerator.html +18 -14
  200. data/site-local/plugins/gcov/reporting.html +2 -2
  201. data/site-local/plugins/gcov/setup.html +2 -2
  202. data/site-local/plugins/gcov/tool-versions.html +2 -2
  203. data/site-local/plugins/gcov/troubleshooting.html +2 -2
  204. data/site-local/plugins/index.html +2 -2
  205. data/site-local/plugins/module-generator.html +2 -2
  206. data/site-local/plugins/report-build-warnings-log.html +2 -2
  207. data/site-local/plugins/report-tests-gtestlike-stdout.html +2 -2
  208. data/site-local/plugins/report-tests-ide-stdout.html +2 -2
  209. data/site-local/plugins/report-tests-log-factory.html +2 -2
  210. data/site-local/plugins/report-tests-pretty-stdout.html +2 -2
  211. data/site-local/plugins/report-tests-raw-output-log.html +2 -2
  212. data/site-local/plugins/report-tests-teamcity-stdout.html +2 -2
  213. data/site-local/plugins/sanitize.html +2 -2
  214. data/site-local/plugins/valgrind.html +2 -2
  215. data/site-local/project/index.html +2 -2
  216. data/site-local/project/release-history.html +2 -2
  217. data/site-local/project/sbom.html +2 -2
  218. data/site-local/project/upgrade.html +2 -2
  219. data/site-local/reference/build-directives.html +2 -2
  220. data/site-local/reference/command-line.html +2 -2
  221. data/site-local/reference/environment-vars.html +2 -2
  222. data/site-local/reference/gcov-plugin.html +2 -2
  223. data/site-local/reference/global-collections.html +12 -12
  224. data/site-local/reference/index.html +2 -2
  225. data/site-local/reference/partials-macros.html +47 -2
  226. data/site-local/reference/project-configuration.html +2 -2
  227. data/site-local/sitemap.xml.gz +0 -0
  228. data/site-local/snapshot/examples/cipher_quest/index.html +2 -2
  229. data/site-local/snapshot/examples/temp_sensor/index.html +2 -2
  230. data/site-local/snapshot/examples/wondrous_forest/index.html +72 -15
  231. data/site-local/testing-guide/build-directives.html +2 -2
  232. data/site-local/testing-guide/conventions.html +67 -22
  233. data/site-local/testing-guide/frameworks.html +2 -2
  234. data/site-local/testing-guide/index.html +2 -2
  235. data/site-local/testing-guide/partials/configuration.html +31 -4
  236. data/site-local/testing-guide/partials/conventions.html +509 -8
  237. data/site-local/testing-guide/partials/directives.html +4 -3
  238. data/site-local/testing-guide/partials/example.html +2 -2
  239. data/site-local/testing-guide/partials/index.html +2 -2
  240. data/site-local/testing-guide/partials/overview.html +30 -12
  241. data/site-local/testing-guide/partials/variables.html +169 -4
  242. data/site-local/testing-guide/test-cases.html +2 -2
  243. data/site-local/testing-guide/test-sample.html +2 -2
  244. data/site-local/testing-guide/test-suite-anatomy.html +2 -2
  245. data/spec/integration/build_step_doctor_spec.rb +270 -0
  246. data/spec/integration/c_extractor_composition_spec.rb +254 -4
  247. data/spec/integration/includes_extraction_spec.rb +27 -14
  248. data/spec/integration/nested_test_artifacts_spec.rb +1 -1
  249. data/spec/integration/partial_files_preprocessing_spec.rb +128 -0
  250. data/spec/integration/partials_carry_spec.rb +520 -0
  251. data/spec/integration/partials_declarations_spec.rb +655 -0
  252. data/spec/integration/partials_fallback_preprocessing_spec.rb +65 -0
  253. data/spec/integration/partials_function_pointers_spec.rb +277 -0
  254. data/spec/integration/partials_header_composition_spec.rb +268 -35
  255. data/spec/integration/partials_macro_decorators_spec.rb +267 -0
  256. data/spec/integration/partials_module_resolution_spec.rb +26 -19
  257. data/spec/integration/partials_symbol_linkage_spec.rb +13 -0
  258. data/spec/integration/path_length_reporting_spec.rb +64 -0
  259. data/spec/integration/path_scenarios_spec.rb +80 -3
  260. data/spec/integration/quote_include_isolator_spec.rb +56 -0
  261. data/spec/integration/test_build_parallel_barrier_spec.rb +1 -1
  262. data/spec/integration/test_includes_extractinator_spec.rb +70 -5
  263. data/spec/integration/test_naming_spec.rb +6 -3
  264. data/spec/integration/test_source_file_checks_spec.rb +5 -3
  265. data/spec/integration/tool_executor_spec.rb +1 -1
  266. data/spec/integration/tool_validator_spec.rb +2 -2
  267. data/spec/integration/win_long_paths_probe_spec.rb +46 -0
  268. data/spec/integration/win_path_limit_spec.rb +53 -0
  269. data/spec/integration/windows_registry_query_tool_spec.rb +41 -0
  270. data/spec/support/integration/configurator_integration_helper.rb +8 -3
  271. data/spec/support/integration/partial_files_harness.rb +181 -0
  272. data/spec/support/integration/partials_generation_integration_helper.rb +237 -141
  273. data/spec/support/integration/path_scenario_harness.rb +4 -2
  274. data/spec/support/integration/spec_integration_helper.rb +8 -3
  275. data/spec/support/integration/test_includes_harness.rb +56 -35
  276. data/spec/support/integration/tool_executor_integration_helper.rb +14 -2
  277. data/spec/system/bullseye_deployment_spec.rb +2 -0
  278. data/spec/system/delta_builds_spec.rb +26 -12
  279. data/spec/system/encoding_stress_spec.rb +4 -4
  280. data/spec/system/example_wondrous_forest_spec.rb +2 -2
  281. data/spec/system/gcov_deployment_spec.rb +2 -0
  282. data/spec/system/header_include_path_validation_spec.rb +4 -4
  283. data/spec/system/header_search_paths_spec.rb +1083 -0
  284. data/spec/system/mock_include_folders_spec.rb +121 -0
  285. data/spec/system/mockable_header_reassembly_spec.rb +184 -0
  286. data/spec/system/partials_carry_spec.rb +581 -0
  287. data/spec/system/partials_delta_builds_spec.rb +280 -0
  288. data/spec/system/partials_function_pointers_spec.rb +106 -0
  289. data/spec/system/partials_macro_decorators_spec.rb +127 -0
  290. data/spec/system/partials_module_disambiguation_spec.rb +125 -0
  291. data/spec/system/path_handling_probes_spec.rb +16 -12
  292. data/spec/system/pinned_thread_count_spec.rb +4 -4
  293. data/spec/system/preprocessing_fallback_conditionals_spec.rb +1 -1
  294. data/spec/system/short_build_paths_spec.rb +87 -0
  295. data/spec/system/sibling_header_collision_spec.rb +30 -6
  296. data/spec/system/support/bullseye_common_test_cases.rb +42 -0
  297. data/spec/system/support/common_test_cases.rb +2 -2
  298. data/spec/system/support/gcov_partials_test_cases.rb +48 -0
  299. data/spec/system/test_build_layout_spec.rb +209 -0
  300. data/spec/system/test_source_file_directive_spec.rb +35 -5
  301. data/spec/units/c_extractor/c_extractor_code_text_spec.rb +67 -10
  302. data/spec/units/c_extractor/c_extractor_declarations_spec.rb +501 -4
  303. data/spec/units/c_extractor/c_extractor_declarator_spec.rb +245 -0
  304. data/spec/units/c_extractor/c_extractor_defined_type_spec.rb +45 -0
  305. data/spec/units/c_extractor/c_extractor_definitions_spec.rb +163 -3
  306. data/spec/units/c_extractor/c_extractor_functions_spec.rb +462 -21
  307. data/spec/units/c_extractor/c_extractor_preprocessing_spec.rb +39 -0
  308. data/spec/units/c_extractor/c_extractor_spec.rb +4 -4
  309. data/spec/units/c_extractor/c_extractor_types_spec.rb +163 -0
  310. data/spec/units/c_identifier_spec.rb +35 -0
  311. data/spec/units/config/configurator_builder_spec.rb +24 -0
  312. data/spec/units/config/configurator_setup_spec.rb +72 -4
  313. data/spec/units/config/configurator_spec.rb +27 -1
  314. data/spec/units/dependencies/dependency_cache_store_spec.rb +68 -3
  315. data/spec/units/dependencies/dependency_tracker_spec.rb +25 -0
  316. data/spec/units/dependencies/dependinator_spec.rb +17 -2
  317. data/spec/units/diagnostics/build_step_doctor_spec.rb +170 -0
  318. data/spec/units/diagnostics/duplicate_symbol_specialist_spec.rb +117 -0
  319. data/spec/units/diagnostics/header_collision_specialist_spec.rb +267 -0
  320. data/spec/units/diagnostics/include_depth_specialist_spec.rb +137 -0
  321. data/spec/units/diagnostics/missing_symbol_specialist_spec.rb +154 -0
  322. data/spec/units/diagnostics/partial_name_specialist_spec.rb +129 -0
  323. data/spec/units/diagnostics/toolchain_output_spec.rb +86 -0
  324. data/spec/units/encodinator_spec.rb +3 -4
  325. data/spec/units/filesystem/build_roots_spec.rb +131 -0
  326. data/spec/units/filesystem/build_subpath_spec.rb +113 -0
  327. data/spec/units/filesystem/file_finder_helper_spec.rb +80 -0
  328. data/spec/units/filesystem/file_finder_spec.rb +242 -58
  329. data/spec/units/filesystem/file_path_utils_spec.rb +251 -118
  330. data/spec/units/filesystem/file_wrapper_spec.rb +191 -6
  331. data/spec/units/filesystem/path_matcher_spec.rb +36 -0
  332. data/spec/units/filesystem/test_build_layout_spec.rb +216 -0
  333. data/spec/units/filesystem/win_long_paths_spec.rb +204 -0
  334. data/spec/units/filesystem/win_path_prober_spec.rb +158 -0
  335. data/spec/units/generators/generator_helper_spec.rb +0 -60
  336. data/spec/units/generators/generator_mocks_spec.rb +13 -0
  337. data/spec/units/generators/generator_partials_spec.rb +656 -55
  338. data/spec/units/generators/generator_spec.rb +26 -0
  339. data/spec/units/generators/generator_test_runner_spec.rb +9 -5
  340. data/spec/units/generators/partial_source_writer_spec.rb +129 -0
  341. data/spec/units/includes/header_search_spec.rb +406 -0
  342. data/spec/units/includes/include_factory_spec.rb +22 -5
  343. data/spec/units/includes/include_pathinator_spec.rb +77 -13
  344. data/spec/units/includes/include_spec.rb +14 -0
  345. data/spec/units/includes/includes_spec.rb +176 -19
  346. data/spec/units/loginator_spec.rb +31 -0
  347. data/spec/units/mock_locator_spec.rb +199 -5
  348. data/spec/units/partials/include_groups_spec.rb +42 -0
  349. data/spec/units/partials/partializer_config_spec.rb +25 -0
  350. data/spec/units/partials/partializer_helper_carry_spec.rb +661 -0
  351. data/spec/units/partials/partializer_helper_interface_extras_spec.rb +396 -0
  352. data/spec/units/partials/partializer_helper_spec.rb +529 -277
  353. data/spec/units/partials/partializer_reconciler_spec.rb +661 -0
  354. data/spec/units/partials/partializer_spec.rb +1578 -270
  355. data/spec/units/partials/partializer_utils_spec.rb +269 -232
  356. data/spec/units/partials/partials_rename_spec.rb +160 -0
  357. data/spec/units/partials_manager_spec.rb +554 -261
  358. data/spec/units/plugins/bullseye_spec.rb +34 -0
  359. data/spec/units/plugins/console_reportinator_spec.rb +58 -9
  360. data/spec/units/plugins/report_tests_teamcity_stdout_spec.rb +1 -1
  361. data/spec/units/plugins/reportgenerator_reportinator_spec.rb +51 -3
  362. data/spec/units/preprocess/preprocessinator_code_finder_spec.rb +73 -10
  363. data/spec/units/preprocess/preprocessinator_file_assembler_spec.rb +125 -37
  364. data/spec/units/preprocess/preprocessinator_includes_handler_spec.rb +15 -0
  365. data/spec/units/preprocess/preprocessinator_reconstructor_spec.rb +197 -0
  366. data/spec/units/preprocess/preprocessinator_spec.rb +153 -95
  367. data/spec/units/setupinator_spec.rb +51 -0
  368. data/spec/units/standin_headerinator_spec.rb +27 -11
  369. data/spec/units/test_build_executor_spec.rb +780 -166
  370. data/spec/units/test_build_planner_spec.rb +116 -28
  371. data/spec/units/test_build_setup_spec.rb +83 -18
  372. data/spec/units/test_context_extractor_spec.rb +11 -2
  373. data/spec/units/test_derived_search_paths_spec.rb +259 -0
  374. data/spec/units/test_includes_extractinator_spec.rb +56 -8
  375. data/spec/units/test_invoker/objects_wiring_spec.rb +20 -3
  376. data/spec/units/test_invoker/partial_files_preprocessinator_spec.rb +264 -0
  377. data/spec/units/test_invoker/test_substitutions_spec.rb +122 -0
  378. data/spec/units/test_invoker_types_spec.rb +8 -7
  379. data/spec/units/test_pipeline_manager_spec.rb +54 -13
  380. data/spec/units/test_runner_generatinator_spec.rb +93 -1
  381. data/spec/units/test_search_paths_spec.rb +73 -5
  382. data/spec/units/{default_tools_quoting_spec.rb → tools/default_tools_quoting_spec.rb} +39 -5
  383. data/spec/units/tools/shell_quoting_spec.rb +76 -0
  384. data/spec/units/{tool_executor_helper_spec.rb → tools/tool_executor_helper_spec.rb} +1 -1
  385. data/spec/units/{tool_executor_spec.rb → tools/tool_executor_spec.rb} +1 -1
  386. data/spec/units/{tool_validator_spec.rb → tools/tool_validator_spec.rb} +110 -1
  387. data/spec/units/windows_registry_query_tool_spec.rb +53 -0
  388. metadata +161 -16
  389. /data/lib/ceedling/{tool_executor.rb → tools/tool_executor.rb} +0 -0
  390. /data/lib/ceedling/{tool_executor_helper.rb → tools/tool_executor_helper.rb} +0 -0
@@ -5,19 +5,13 @@
5
5
  # SPDX-License-Identifier: MIT
6
6
  # =========================================================================
7
7
 
8
+ require 'ceedling/c_extractor/c_extractor_statement'
9
+
8
10
  module CExtractorTypes
9
11
 
10
- # Pairs a raw C statement string with its 1-based source line number.
11
- # Used for macro_definitions, type_definitions, and aggregate_definitions in CModule.
12
- CStatement = Struct.new(
13
- :text, # String — raw extracted statement text (comments replaced with spaces)
14
- :line_num, # Integer — 1-based line number where the statement begins in the source file
15
- keyword_init: true
16
- ) do
17
- def initialize(text: nil, line_num: nil)
18
- super
19
- end
20
- end unless const_defined?(:CStatement, false)
12
+ # Each CModule statement list's kind, which a statement in it takes (see CStatement#kind)
13
+ STATEMENT_KINDS = { macro_definitions: :macro, type_definitions: :typedef, aggregate_definitions: :aggregate,
14
+ macro_invocations: :invocation }.freeze unless const_defined?(:STATEMENT_KINDS, false)
21
15
 
22
16
  # Data class representing all extracted content of C module
23
17
  CModule = Struct.new(
@@ -26,28 +20,28 @@ module CExtractorTypes
26
20
  :function_declarations, # Array of CFunctionDeclaration structs (each with :line_num)
27
21
  :macro_definitions, # Array of CStatement — raw #define text with source line number
28
22
  :type_definitions, # Array of CStatement — raw typedef text with source line number
29
- :aggregate_definitions, # Array of CStatement — raw non-typedef struct/enum/union text with source line number
23
+ :aggregate_definitions, # Array of CStatement — raw non-typedef struct/enum/union text with source line number, a struct or
24
+ # union forward declaration, or a type a variable declaration defines (see CVariableDeclaration#defined_type)
30
25
  :macro_invocations, # Array of CStatement — raw bare, top-level, semicolon-less macro-invocation text (e.g. an x-macro call) with source line number
31
26
  :element_sequence, # Array of references to all items above in extraction order (cross-type ordering index)
32
27
  keyword_init: true
33
28
  ) do
34
- # Constructor to set unassigned fields to empty arrays for convenience
35
- def initialize(
36
- variable_declarations: [],
37
- function_definitions: [],
38
- function_declarations: [],
39
- macro_definitions: [],
40
- type_definitions: [],
41
- aggregate_definitions: [],
42
- macro_invocations: [],
43
- element_sequence: []
44
- )
29
+ # Constructor to set unassigned fields to empty arrays for convenience. A statement without a
30
+ # kind takes its list's, so a statement's kind always says which list holds it.
31
+ def initialize(variable_declarations: [], function_definitions: [], function_declarations: [], macro_definitions: [],
32
+ type_definitions: [], aggregate_definitions: [], macro_invocations: [], element_sequence: [])
45
33
  super
34
+ STATEMENT_KINDS.each { |list, kind| self[list].each { |statement| statement.kind ||= kind } }
35
+ end
36
+
37
+ # Whether the module defines or names any type, which a Partial's types header then holds
38
+ def types?
39
+ return !(type_definitions.empty? and aggregate_definitions.empty?)
46
40
  end
47
41
 
48
42
  # Concatenate two CModule instances.
49
- # element_sequence preserves first operand's items before second operand's items,
50
- # maintaining source-before-header ordering regardless of line numbers.
43
+ # element_sequence keeps the first operand's items ahead of the second operand's items.
44
+ # Partials merges a header and then its source, so header items come first.
51
45
  def +(other)
52
46
  CModule.new(
53
47
  variable_declarations: (self.variable_declarations + other.variable_declarations),
@@ -60,6 +54,14 @@ module CExtractorTypes
60
54
  element_sequence: (self.element_sequence + other.element_sequence)
61
55
  )
62
56
  end
57
+
58
+ # Records which file of a module each item came from.
59
+ # CExtractor reads text alone and cannot know a file's role, so the caller stamps it.
60
+ # element_sequence references these same objects and so reflects the stamp too.
61
+ def stamp_origin!(origin)
62
+ (function_definitions + function_declarations + element_sequence).each { |item| item.origin = origin }
63
+ return self
64
+ end
63
65
  end unless const_defined?(:CModule, false)
64
66
 
65
67
  # Data class representing an extracted C function declaration
@@ -69,9 +71,12 @@ module CExtractorTypes
69
71
  :decorators, # Array of decorator strings (e.g., ["static"])
70
72
  :signature_stripped, # Signature without decorators (e.g., "int foo(void);")
71
73
  :line_num, # Integer — 1-based line number in source file where declaration begins
74
+ :source_filepath, # Original file the declaration was located in, when a caller locates it
75
+ :origin, # :header or :source when the caller knows the file's role, otherwise nil
76
+ :inline_elsewhere, # True when the module never defines the function and a header the declaring file includes defines it inline
72
77
  keyword_init: true
73
78
  ) do
74
- def initialize(name: nil, signature: nil, decorators: [], signature_stripped: nil, line_num: nil)
79
+ def initialize(name: nil, signature: nil, decorators: [], signature_stripped: nil, line_num: nil, source_filepath: nil, origin: nil, inline_elsewhere: false)
75
80
  super
76
81
  end
77
82
  end unless const_defined?(:CFunctionDeclaration, false)
@@ -87,20 +92,15 @@ module CExtractorTypes
87
92
  :line_num, # Line number in source C file
88
93
  :decorators, # Array of decorator strings (e.g., ["static"])
89
94
  :signature_stripped, # Signature without decorators (e.g., "int foo(void)")
95
+ :origin, # :header or :source when the caller knows the file's role, otherwise nil
96
+ :expanded_body, # Body with every macro expanded, taken from the full expansion copy when one exists
97
+ :hidden_decorators, # Decorators only the full expansion shows, since a macro spells them
90
98
  keyword_init: true
91
99
  ) do
92
100
  # Constructor to set unassigned fields to nil for convenience
93
- def initialize(
94
- name: nil,
95
- signature: nil,
96
- body: nil,
97
- code_block: nil,
98
- line_count: 0,
99
- source_filepath: nil,
100
- line_num: nil,
101
- decorators: [],
102
- signature_stripped: nil
103
- )
101
+ def initialize(name: nil, signature: nil, body: nil, code_block: nil, line_count: 0, source_filepath: nil,
102
+ line_num: nil, decorators: [], signature_stripped: nil, origin: nil, expanded_body: nil,
103
+ hidden_decorators: [])
104
104
  super
105
105
  end
106
106
  end unless const_defined?(:CFunctionDefinition, false)
@@ -110,16 +110,38 @@ module CExtractorTypes
110
110
  :original, # Full original C text (e.g., "static int x, y;") -- shared by all Structs
111
111
  # created from a single compound declaration.
112
112
  :name, # Variable name (e.g., "x") -- array subscripts stripped
113
- :type, # Type without decorator keywords (e.g., "int", "char*") -- array subscripts stripped
114
- :array_suffix, # Array subscript string (e.g., "[8]", "[M][N]", "" for scalars)
113
+ :type, # Type without decorator keywords (e.g., "int", "char*") -- array subscripts stripped.
114
+ # With a declarator, only the text ahead of it (e.g., "int" for "int (*hook)(int)").
115
+ # Only what follows the type when the declaration defines it (see :defined_type), as "*" or "".
116
+ :array_suffix, # Array subscript string (e.g., "[8]", "[M][N]", "" for scalars). "" with a
117
+ # declarator, which keeps any subscripts itself.
115
118
  :decorators, # Array of decorator keyword strings (e.g., ["static", "const"])
116
- :text, # Cleaned declaration without decorators, whitespace normalized (e.g., "int x;")
119
+ :text, # Cleaned declaration without decorators, whitespace normalized (e.g., "int x;"). Without
120
+ # its type when the declaration defines one (e.g., "s_ctx = { 1 };").
117
121
  :line_num, # Integer — 1-based line number in source file where declaration begins
122
+ :declarator, # A parenthesized declarator from its '(' onward (e.g., "(*hook)(int)" after type "int"), or nil
123
+ :asm_label, # An asm label naming the symbol (e.g., '__asm__("g_symbol")'), or nil. :text and :original hold it too.
124
+ # A file-scope basic asm statement, such as `asm(".globl x");`, has no name and holds itself here.
125
+ :origin, # :header or :source when the caller knows the file's role, otherwise nil
126
+ :defined_type, # The CStatement for a type the declaration defines, as `struct { int count; }` in
127
+ # `static struct { int count; } s_ctx;`, shared by every variable it declares. Otherwise nil.
128
+ :promoted_from, # The name of the function a promoted function-scope static came from, otherwise nil
129
+ :expanded_text, # :text as the full expansion spells it, every macro expanded, or nil before reconciliation.
130
+ # Every twin's text, joined, when fallback left the name written more often than expanded.
118
131
  keyword_init: true
119
132
  ) do
120
- def initialize(original: nil, name: nil, type: nil, array_suffix: '', decorators: [], text: nil, line_num: nil)
133
+ def initialize(original: nil, name: nil, type: nil, array_suffix: '', decorators: [], text: nil, line_num: nil, declarator: nil,
134
+ asm_label: nil, origin: nil, defined_type: nil, promoted_from: nil, expanded_text: nil)
121
135
  super
122
136
  end
137
+
138
+ # A variable declared `extern` lives in another file, which holds its definition
139
+ def extern?
140
+ return decorators.include?( 'extern' )
141
+ end
123
142
  end unless const_defined?(:CVariableDeclaration, false)
124
143
 
125
144
  end
145
+
146
+ # Loaded last, since it reopens CModule above
147
+ require 'ceedling/c_extractor/c_module_edits'
@@ -0,0 +1,48 @@
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 'set'
9
+
10
+ module CExtractorTypes
11
+
12
+ # The list of a CModule that holds each kind of item. A statement's list follows its kind.
13
+ ITEM_LISTS = {
14
+ CVariableDeclaration => :variable_declarations,
15
+ CFunctionDefinition => :function_definitions,
16
+ CFunctionDeclaration => :function_declarations
17
+ }.freeze unless const_defined?(:ITEM_LISTS, false)
18
+
19
+ # Edits that keep a CModule's lists and its element_sequence in step. Each item sits in one
20
+ # list and in element_sequence, so an edit to one must reach the other.
21
+ class CModule
22
+ # Removes `items` from their lists and from element_sequence. Items are matched by identity,
23
+ # since two equal statements can sit in different places.
24
+ def remove!(items)
25
+ gone = Set.new.compare_by_identity.merge( items )
26
+ members.each { |list| self[list].reject! { |item| gone.include?( item ) } }
27
+ return self
28
+ end
29
+
30
+ # Adds `items` to their lists and places them in element_sequence just ahead of `anchor`, or
31
+ # at the end when `anchor` isn't there
32
+ def insert_before!(anchor, items)
33
+ items.each { |item| self[_list_for( item )] << item }
34
+
35
+ at = element_sequence.index { |item| item.equal?( anchor ) } || element_sequence.size
36
+ element_sequence.insert( at, *items )
37
+ return self
38
+ end
39
+
40
+ private
41
+
42
+ def _list_for(item)
43
+ list = item.is_a?( CStatement ) ? STATEMENT_KINDS.key( item.kind ) : ITEM_LISTS[item.class]
44
+ return list || raise( ArgumentError, "No CModule list holds a #{item.class} of kind #{item.respond_to?( :kind ) ? item.kind.inspect : 'none'}" )
45
+ end
46
+ end
47
+
48
+ end
@@ -0,0 +1,21 @@
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
+ # Builds C identifiers from names that may hold characters C does not allow, such as a
9
+ # filename or a module name. Generated include guards and the type names Partials invent
10
+ # share this rule, so one name folds the same way everywhere.
11
+ module CIdentifier
12
+
13
+ # Each character a C identifier cannot hold becomes an underscore, one for one:
14
+ # my-sensor.v2 --> my_sensor_v2. A test author can predict the result from the name
15
+ # alone, which a macro naming a generated identifier relies on. Callers needing more,
16
+ # such as an include guard's squeezed underscores, build on this.
17
+ def self.fold(text)
18
+ return text.gsub( /\W/, '_' )
19
+ end
20
+
21
+ end
@@ -24,6 +24,14 @@
24
24
  // Create a unique namespaced variable name
25
25
  #define PARTIAL_LOCAL_VAR(namespace, var) partial_##namespace##_##var
26
26
 
27
+ // Name the type a Partial gives a variable declared together with its type, as in
28
+ // `static struct { int count; } s_ctx;`. PARTIAL_LOCAL_TYPE names a promoted function-scope
29
+ // static's. The module is its name alone, without any directory, each character a C identifier
30
+ // cannot hold written as `_`. The module and variable paste before anything expands, so neither
31
+ // is taken for a macro, and the outer join expands the prefix.
32
+ #define PARTIAL_TYPE(module, var) __PARTIALS_JOIN(CEEDLING_PARTIALS_PREFIX, module##_##var##_t)
33
+ #define PARTIAL_LOCAL_TYPE(module, function, var) __PARTIALS_JOIN(CEEDLING_PARTIALS_PREFIX, module##_##function##_##var##_t)
34
+
27
35
  //
28
36
  // NOTE: These macros expect symbols CMOCK_MOCK_PREFIX and CEEDLING_PARTIALS_PREFIX to be defined at compilation
29
37
  //
@@ -10,7 +10,7 @@ require 'ceedling/constants'
10
10
  require 'ceedling/filesystem/file_path_utils'
11
11
  require 'ceedling/exceptions'
12
12
  require 'ceedling/rake_app/rakefile_component_resolver'
13
- require 'ceedling/tool_executor'
13
+ require 'ceedling/tools/tool_executor'
14
14
  require 'deep_merge'
15
15
 
16
16
  class Configurator
@@ -28,7 +28,7 @@ class Configurator
28
28
  # Validations of the completed configuration
29
29
  FINAL_VALIDATIONS = [
30
30
  :validate_build_root, :validate_paths, :validate_tools, :validate_defines, :validate_flags, :validate_line_markers,
31
- :validate_test_preprocessor, :validate_backtrace, :validate_threads, :validate_partials, :validate_plugins
31
+ :validate_test_preprocessor, :validate_backtrace, :validate_win_path_limit, :validate_threads, :validate_partials, :validate_plugins
32
32
  ].freeze
33
33
 
34
34
  # CMock and Unity options that test runner generation also reads
@@ -538,7 +538,8 @@ class Configurator
538
538
  [DEFAULT_TOOLS_TEST_ASSEMBLER, setting( config, :test_build, :use_assembly )],
539
539
  [DEFAULT_TOOLS_TEST_GDB_BACKTRACE, setting( config, :project, :use_backtrace ) == :gdb],
540
540
  [DEFAULT_TOOLS_RELEASE, release],
541
- [DEFAULT_TOOLS_RELEASE_ASSEMBLER, release && setting( config, :release_build, :use_assembly )]
541
+ [DEFAULT_TOOLS_RELEASE_ASSEMBLER, release && setting( config, :release_build, :use_assembly )],
542
+ [DEFAULT_TOOLS_WINDOWS_REGISTRY_QUERY, @system_wrapper.windows? && setting( config, :project, :win_path_limit ) != :classic]
542
543
  ].select { |_, needed| needed }.map( &:first )
543
544
  end
544
545
 
@@ -14,6 +14,8 @@ require 'ceedling/constants' # for Verbosity constants class & base file p
14
14
  require 'ceedling/filename_extension'
15
15
  require 'ceedling/rake_app/rakefile_component_resolver'
16
16
  require 'ceedling/config/build_root_policy'
17
+ require 'ceedling/filesystem/build_roots'
18
+ require 'ceedling/exceptions'
17
19
 
18
20
  class ConfiguratorBuilder
19
21
 
@@ -188,6 +190,21 @@ class ConfiguratorBuilder
188
190
  }
189
191
  end
190
192
 
193
+ # The roots whose long locations build paths may spell by a short marker (see
194
+ # BuildRoots), taken from every :paths section a build's inputs come from
195
+ def collect_build_roots(in_hash)
196
+ entries = [:paths_source, :paths_include, :paths_test, :paths_support].flat_map { |key| Array( in_hash[key] ) }
197
+ roots = @file_path_collection_utils.collect_mirror_roots( entries )
198
+
199
+ collisions = BuildRoots.collisions( roots )
200
+ unless collisions.empty?
201
+ pairs = collisions.map { |a, b| "'#{a}' and '#{b}'" }.join( '; ' )
202
+ raise CeedlingException.new( "Configured paths #{pairs} would share one short name in build paths. Rename or move one of them." )
203
+ end
204
+
205
+ return { :collection_build_roots => roots }
206
+ end
207
+
191
208
  def collect_source_and_include_paths(in_hash)
192
209
  return {
193
210
  :collection_paths_source_and_include =>
@@ -19,6 +19,7 @@ class ConfiguratorSetup
19
19
  PATH_COLLECTIONS = [
20
20
  :expand_all_path_globs,
21
21
  :collect_mirror_roots,
22
+ :collect_build_roots,
22
23
  :collect_vendor_paths,
23
24
  :collect_source_and_include_paths,
24
25
  :collect_source_include_vendor_paths,
@@ -269,6 +270,12 @@ class ConfiguratorSetup
269
270
  return validate_option( config, :use_backtrace, [:none, :simple, :gdb] )
270
271
  end
271
272
 
273
+ # Windows has two path limits, so the setting names one or asks for a probe. Validated on
274
+ # every OS, so a project file shared across hosts is checked everywhere.
275
+ def validate_win_path_limit(config)
276
+ return validate_option( config, :win_path_limit, [:classic, :long_paths, :auto] )
277
+ end
278
+
272
279
  def validate_threads(config)
273
280
  return [:compile_threads, :test_threads].map { |key| validate_thread_count( config, key ) }.all?
274
281
  end
@@ -276,13 +283,24 @@ class ConfiguratorSetup
276
283
  # `:max_extraction_length` multiplies 1000 characters, so `5000` reads more clearly than
277
284
  # `5000000`. The minimum keeps that ceiling well above any ordinary C declaration or
278
285
  # signature, and catches `1000` written to mean 1000 characters.
286
+ #
287
+ # `:suppress_redundant_decls` decides whether generated code carries GCC pragmas, so a
288
+ # misspelled value is caught here rather than read as truthy. `:extern_variables` must name
289
+ # one of its two behaviors.
279
290
  def validate_partials(config)
280
291
  max_extraction_length = config[:partials][:max_extraction_length]
281
292
  walk = @reportinator.generate_config_walk( [:partials, :max_extraction_length] )
282
293
 
283
294
  return log_invalid( "#{walk} is not an integer" ) unless max_extraction_length.is_a?( Integer )
284
295
  return log_invalid( "#{walk} must be at least 10 (10,000 characters)" ) if max_extraction_length < 10
285
- return true
296
+
297
+ suppress = config[:partials][:suppress_redundant_decls]
298
+ unless [true, false].include?( suppress )
299
+ walk = @reportinator.generate_config_walk( [:partials, :suppress_redundant_decls] )
300
+ return log_invalid( "#{walk} is '#{suppress}' but must be TRUE or FALSE" )
301
+ end
302
+
303
+ return validate_option( config, :extern_variables, [:weak, :test], section: :partials )
286
304
  end
287
305
 
288
306
  # Discovery records a path beneath :plugins for each enabled plugin it found, whatever
@@ -457,12 +475,18 @@ class ConfiguratorSetup
457
475
  @loginator.log( "Preprocessing configured at #{walk} is only supported in the :test context", Verbosity::ERRORS, LogLabels::WARNING )
458
476
  end
459
477
 
460
- def validate_option(config, key, options)
461
- value = config[:project][key]
478
+ def validate_option(config, key, options, section: :project)
479
+ value = config[section][key]
462
480
  return true if options.include?( value )
463
481
 
464
- walk = @reportinator.generate_config_walk( [:project, key] )
465
- return log_invalid( "#{walk} is ':#{value}' but must be one of {#{options.map { |option| ":#{option}" }.join( ', ' )}}" )
482
+ walk = @reportinator.generate_config_walk( [section, key] )
483
+ return log_invalid( "#{walk} is #{option_value( value )} but must be one of {#{options.map { |option| ":#{option}" }.join( ', ' )}}" )
484
+ end
485
+
486
+ # A Symbol reads as YAML writes it. Anything else reads as itself, so a string missing its
487
+ # leading colon can't pass for the symbol it resembles.
488
+ def option_value(value)
489
+ return value.is_a?( Symbol ) ? "':#{value}'" : value.inspect
466
490
  end
467
491
 
468
492
  def validate_thread_count(config, key)
@@ -90,10 +90,12 @@ PARTIAL_FILENAME_PREFIX = 'ceedling_partial_'
90
90
  PARTIAL_SUFFIX_INTERFACE = '_interface'
91
91
  PARTIAL_SUFFIX_TYPES = '_types'
92
92
  PARTIAL_SUFFIX_IMPL = '_impl'
93
+ PARTIAL_SUFFIX_EXTRAS = '_extras'
93
94
  PARTIAL_FILENAME_SUFFIXES = [
94
95
  PARTIAL_SUFFIX_INTERFACE,
95
96
  PARTIAL_SUFFIX_TYPES,
96
- PARTIAL_SUFFIX_IMPL
97
+ PARTIAL_SUFFIX_IMPL,
98
+ PARTIAL_SUFFIX_EXTRAS
97
99
  ].freeze
98
100
 
99
101
  class PATTERNS
@@ -186,6 +188,7 @@ BACKTRACE_GDB_SCRIPT_FILE = 'backtrace.gdb'
186
188
 
187
189
  INPUT_CONFIGURATION_CACHE_FILE = 'input.yml' unless defined?(INPUT_CONFIGURATION_CACHE_FILE) # input configuration file dump
188
190
  DEFINES_DEPENDENCY_CACHE_FILE = 'defines_dependency.yml' unless defined?(DEFINES_DEPENDENCY_CACHE_FILE) # preprocessor definitions for files
191
+ BUILD_ROOTS_MAP_FILE = "build_roots#{EXTENSION_CORE_YAML}" unless defined?(BUILD_ROOTS_MAP_FILE) # shortened build roots and their markers
189
192
 
190
193
  TEST_ROOT_NAME = 'test' unless defined?(TEST_ROOT_NAME)
191
194
  TEST_TASK_ROOT = TEST_ROOT_NAME + ':' unless defined?(TEST_TASK_ROOT)
@@ -213,6 +216,7 @@ OPERATION_LINK_SYM = :link unless defined?(OPERATION_LINK_SYM)
213
216
 
214
217
  PREPROCESS_STANDINS_DIR = 'standins'
215
218
  PREPROCESS_FULL_EXPANSION_DIR = 'full_expansion'
219
+ PREPROCESS_EXPANDED_CODE_DIR = 'expanded_code'
216
220
  PREPROCESS_DIRECTIVES_ONLY_DIR = 'directives_only'
217
221
  PREPROCESS_RAW_DIRECTIVES_ONLY_DIR = 'directives_only/raw'
218
222
  PREPROCESS_FALLBACK_EXPANSION_DIR = 'fallback_expansion'
@@ -212,6 +212,20 @@ DEFAULT_TEST_BACKTRACE_GDB_TOOL = {
212
212
  ].freeze
213
213
  }
214
214
 
215
+ # Reads one registry value, for the Windows long path probe (see WinPathProber). Optional:
216
+ # the probe reads the registry only to explain a failure, so a missing reg.exe must not
217
+ # stop a build.
218
+ DEFAULT_WINDOWS_REGISTRY_QUERY_TOOL = {
219
+ :executable => FilePathUtils.os_executable_ext('reg').freeze,
220
+ :name => 'default_windows_registry_query'.freeze,
221
+ :optional => true.freeze,
222
+ :arguments => [
223
+ 'query'.freeze,
224
+ '"${1}"'.freeze, # Registry key, quoted
225
+ '/v ${2}'.freeze # Value name
226
+ ].freeze
227
+ }
228
+
215
229
  DEFAULT_TOOLS_TEST = {
216
230
  :tools => {
217
231
  :test_compiler => DEFAULT_TEST_COMPILER_TOOL,
@@ -263,6 +277,12 @@ DEFAULT_TOOLS_RELEASE_DEPENDENCIES = {
263
277
  }
264
278
  }
265
279
 
280
+ DEFAULT_TOOLS_WINDOWS_REGISTRY_QUERY = {
281
+ :tools => {
282
+ :windows_registry_query => DEFAULT_WINDOWS_REGISTRY_QUERY_TOOL,
283
+ }
284
+ }
285
+
266
286
 
267
287
  DEFAULT_RELEASE_TARGET_NAME = 'project'
268
288
 
@@ -278,7 +298,9 @@ DEFAULT_CEEDLING_PROJECT_CONFIG = {
278
298
  :test_threads => 1,
279
299
  :test_file_prefix => 'test_',
280
300
  :release_build => false,
281
- :use_backtrace => :simple
301
+ :use_backtrace => :simple,
302
+ # Windows' classic 260-character limit, the long path limit, or a probe for which applies
303
+ :win_path_limit => :classic
282
304
  },
283
305
 
284
306
  :release_build => {
@@ -301,6 +323,14 @@ DEFAULT_CEEDLING_PROJECT_CONFIG = {
301
323
  # outright rather than silently dropping an oversized construct and everything after
302
324
  # it in the file. Value is a multiplier of 1000 characters -- 5000 means 5,000,000.
303
325
  :max_extraction_length => 5000,
326
+ # A Partial's implementation source carries prototypes the module's code relies on, and some
327
+ # repeat a declaration a header already made. GCC diagnostic pragmas around them keep
328
+ # -Wredundant-decls quiet for those lines, so a build treating warnings as errors still passes.
329
+ :suppress_redundant_decls => true,
330
+ # A variable a module declares `extern` but never defines. `:weak` writes a weak definition
331
+ # that a real one overrides, so the link works whether or not the defining module is linked.
332
+ # `:test` writes none, leaving the definition to the test or a linked module.
333
+ :extern_variables => :weak,
304
334
  },
305
335
 
306
336
  # Unlike other top-level entries, :environment is an array (of hashes) to preserve order
@@ -0,0 +1,118 @@
1
+ # Dependency Cache Schema Versions
2
+
3
+ This file records each version of the delta build dependency cache's schema: what a
4
+ cache of that version holds, and why the version was raised. Add a section here whenever
5
+ a version changes.
6
+
7
+ ## Each pipeline's version
8
+
9
+ Test and release builds each have a version of their own, since a change to one build's
10
+ layout leaves the other's cache valid. Both are in `dependency_cache_store.rb`:
11
+
12
+ - **`CACHE_SCHEMA_VERSION`** is every test pipeline's: `test` and each plugin's own
13
+ context, such as `gcov`.
14
+ - **`RELEASE_CACHE_SCHEMA_VERSION`** is the release build's.
15
+
16
+ `Dependinator.cache_schema_version` chooses one by the pipeline's identifier. A change
17
+ to the file's shape raises both versions. A change to one build's layout raises only that
18
+ build's version. Up to version 3 the two were one, and a section below names its
19
+ pipelines when its version is only one build's.
20
+
21
+ ## When the version changes
22
+
23
+ The version changes in either of two cases:
24
+
25
+ - **The file's shape changes.** A field is added, removed, renamed, or reinterpreted in a
26
+ way an older Ceedling would misread.
27
+ - **The build layout changes.** Cache keys are build paths, so a release that moves where
28
+ a build puts its output changes that build's version even when the file's shape is
29
+ unchanged. Otherwise an old entry could vouch for a path that now holds a different
30
+ target's output.
31
+
32
+ An optional field an older reader safely ignores needs no new version.
33
+
34
+ ## How a version is read
35
+
36
+ `DependencyCacheStore#load` compares a cache's `schema_version` with its pipeline's
37
+ current one:
38
+
39
+ - **Equal.** The cache is used. Malformed entries and entries whose target is gone are
40
+ dropped one at a time.
41
+ - **Earlier**, from 1 up to the current version minus 1. The cache comes from an earlier
42
+ build layout. It is set aside, and the first build rebuilds everything once. A notice
43
+ advises `ceedling clobber` to remove output the old layout left on disk, which gcov
44
+ reports would otherwise still read.
45
+ - **Anything else**, missing or newer. The cache is treated as absent, with a warning,
46
+ and the build rebuilds everything.
47
+
48
+ ## The cache file
49
+
50
+ Each pipeline, such as test or release, has its own cache file,
51
+ `<build_root>/cache/.<identifier>.dep_cache.json`. It is one JSON object:
52
+
53
+ ```json
54
+ {
55
+ "schema_version": 4,
56
+ "hash_algorithm": "sha256",
57
+ "entries": {
58
+ "<target path>": {
59
+ "self_hash": "<hex digest>",
60
+ "meta_hash": "<hex digest> or null",
61
+ "deps": { "<dependency path>": "<hex digest>" },
62
+ "outputs": { "<output path>": "<hex digest>" }
63
+ }
64
+ }
65
+ }
66
+ ```
67
+
68
+ - **`hash_algorithm`** names the digest every hash uses. A cache with another algorithm
69
+ is treated as absent.
70
+ - **`entries`** maps each tracked target's absolute, real-cased path to what its last
71
+ fresh build saw:
72
+ - `self_hash`, the target's own content;
73
+ - `meta_hash`, the hash of the target's build inputs that aren't files, such as a tool's
74
+ command line, or null;
75
+ - `deps`, each dependency file's content hash;
76
+ - `outputs`, present only for a step that produces files a later run trusts, each
77
+ output's content hash.
78
+
79
+ ## Versions
80
+
81
+ ### 4: each test's own root (1.2.3, test pipelines only)
82
+
83
+ **Contents:** unchanged from version 3.
84
+
85
+ **Why:** the test build layout changed. A test's name is its path, so one test's
86
+ directory below a shared base could also be a subdirectory of another test's, and the two
87
+ tests' files mixed (#1439). Each test's own directory below the mocks, Partials,
88
+ preprocessing, output, and dependencies directories gained a closing `_t_` segment after
89
+ the test's name, and its executable and linker map moved with its objects. Keys naming
90
+ the old paths name places no build reads any more. A release build's paths didn't move,
91
+ so its caches stay at version 3.
92
+
93
+ ### 3: shortened build roots (1.2.3)
94
+
95
+ **Contents:** unchanged from version 2.
96
+
97
+ **Why:** the build layout changed. A build file below a long configured `:paths` root
98
+ moved below the root's short `_<name>_<hash>` marker, in place of the root's whole
99
+ location and any `_up_` climb to it (#1387). Keys naming the old paths name places no
100
+ build reads any more.
101
+
102
+ ### 2: placement by project path (1.2.2)
103
+
104
+ **Contents:** unchanged from version 1.
105
+
106
+ **Why:** the build layout changed. Each test's output moved below the test's path from the
107
+ project root. Each object, preprocessed file, and dependencies file moved below its
108
+ source's path from the project root, with `_up_`, `_abs_`, `_unc_`, and `_ceedling_` for
109
+ paths outside it. A different test's new name could reuse an old directory, so no old
110
+ entry could be trusted.
111
+
112
+ ### 1: the first cache (1.2.0)
113
+
114
+ **Contents:** `schema_version`, `hash_algorithm`, and `entries` with `self_hash`,
115
+ `meta_hash`, and `deps`. `outputs` was added during the 1.2.0 prereleases, before 1.2.0
116
+ shipped, as an optional field older readers ignore, so it needed no new version.
117
+
118
+ **Why:** content-hash tracking replaced timestamp-based rebuild decisions.
@@ -55,7 +55,7 @@ Each pipeline identifier gets exactly one JSON cache file of its own, never shar
55
55
 
56
56
  Loading that cache is deliberately forgiving in one direction and strict in another. Any structural surprise in the file as a whole degrades the entire store to empty rather than raising. A missing cache, malformed cache, or incompatible version simply triggers a full rebuild instead of a hard failure. A single malformed *entry* within an otherwise-good file, similarly, only drops that one entry (i.e. requires a rebuild step). On every load, entries whose target has since been deleted from disk are pruned, automatically and unconditionally. This pruning is always safe, even during a partial run that only touches a handful of targets, because it only ever removes an entry once its target is confirmed gone from disk -- never merely unregistered this run. That’s exactly what distinguishes it from the opt-in pruning described next. Persisting the cache back out is done via a write-to-temp-file-then-rename, so a reader can never observe a half-written cache.
57
57
 
58
- The cache’s schema version also marks the build layout. Its keys are build paths, so a release that moves where a build puts its output bumps the version even when the file’s shape is unchanged. Version 2 marks 1.2.2’s layout, which places each test’s output by the test’s path from the project root, and each object, preprocessed file, and dependencies file by its source’s path from the project root. A cache from an earlier version is set aside like any other incompatible one, so the first build after upgrading rebuilds everything once, and no target can trust an old directory that a different test’s new name happens to reuse. Its warning says so and advises `ceedling clobber`. The old store’s entries go with it, so nothing in the cache refers to the old layout. Only the old files stay on disk, where gcov’s coverage reports would still read them until `clobber` removes them.
58
+ The cache’s schema version also marks the build layout. Its keys are build paths, so a release that moves where a build puts its output bumps the version even when the file’s shape is unchanged. [CACHE_SCHEMA.md](CACHE_SCHEMA.md) records each version, what it holds, and why it was raised. A cache from an earlier version is set aside like any other incompatible one, so the first build after upgrading rebuilds everything once, and no target can trust an old directory that a different test’s new name happens to reuse. Its warning says so and advises `ceedling clobber`. The old store’s entries go with it, so nothing in the cache refers to the old layout. Only the old files stay on disk, where gcov’s coverage reports would still read them until `clobber` removes them.
59
59
 
60
60
  ## `refresh_dependencies`: the special feature
61
61