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
@@ -7,11 +7,20 @@
7
7
 
8
8
  require 'spec_helper'
9
9
  require 'ceedling/filesystem/file_path_utils'
10
+ require 'ceedling/filesystem/test_build_layout'
10
11
  require 'ceedling/filesystem/file_wrapper'
11
12
  require 'ceedling/filename_extension'
13
+ require 'ceedling/filesystem/build_roots'
14
+ require 'yaml'
12
15
 
13
16
  describe FilePathUtils do
14
17
 
18
+ # A FilePathUtils with a real TestBuildLayout of the same collaborators
19
+ def path_utils(configurator, file_wrapper)
20
+ layout = TestBuildLayout.new( { :configurator => configurator, :file_wrapper => file_wrapper } )
21
+ return described_class.new( { :configurator => configurator, :file_wrapper => file_wrapper, :test_build_layout => layout } )
22
+ end
23
+
15
24
  describe '.collapse_to_common_parents' do
16
25
 
17
26
  it 'returns nil unchanged' do
@@ -314,10 +323,7 @@ describe FilePathUtils do
314
323
  @configurator = double('configurator')
315
324
  @file_wrapper = double('file_wrapper')
316
325
  allow(@file_wrapper).to receive(:check_path_length)
317
- @fpu = described_class.new({
318
- :configurator => @configurator,
319
- :file_wrapper => @file_wrapper
320
- })
326
+ @fpu = path_utils( @configurator, @file_wrapper )
321
327
 
322
328
  # TEST_RUNNER_FILE_SUFFIX is a global constant created at runtime by
323
329
  # ConfiguratorBuilder from the project config. Set it for these tests.
@@ -362,10 +368,7 @@ describe FilePathUtils do
362
368
  @configurator = double('configurator')
363
369
  @file_wrapper = double('file_wrapper')
364
370
  allow(@file_wrapper).to receive(:check_path_length)
365
- @fpu = described_class.new({
366
- :configurator => @configurator,
367
- :file_wrapper => @file_wrapper
368
- })
371
+ @fpu = path_utils( @configurator, @file_wrapper )
369
372
 
370
373
  allow(@configurator).to receive(:project_test_runners_path).and_return('build/test/runners')
371
374
  allow(@configurator).to receive(:test_runner_file_suffix).and_return('_runner')
@@ -403,10 +406,7 @@ describe FilePathUtils do
403
406
  @configurator = double('configurator')
404
407
  @file_wrapper = double('file_wrapper')
405
408
  allow(@file_wrapper).to receive(:check_path_length)
406
- @fpu = described_class.new({
407
- :configurator => @configurator,
408
- :file_wrapper => @file_wrapper
409
- })
409
+ @fpu = path_utils( @configurator, @file_wrapper )
410
410
 
411
411
  allow(@configurator).to receive(:project_release_build_output_path).and_return('build/release/out')
412
412
  allow(@configurator).to receive(:project_release_dependencies_path).and_return('build/release/dependencies')
@@ -435,24 +435,22 @@ describe FilePathUtils do
435
435
  @configurator = double('configurator')
436
436
  @file_wrapper = double('file_wrapper')
437
437
  allow(@file_wrapper).to receive(:check_path_length)
438
- @fpu = described_class.new({
439
- :configurator => @configurator,
440
- :file_wrapper => @file_wrapper
441
- })
438
+ @fpu = path_utils( @configurator, @file_wrapper )
442
439
 
443
440
  allow(@configurator).to receive(:project_build_root).and_return('build')
441
+ allow(@configurator).to receive(:collection_build_roots).and_return( [] )
444
442
  allow(@configurator).to receive(:extension_dependencies).and_return( FilenameExtension.new('.d') )
445
443
  allow(@configurator).to receive(:extension_list).and_return( FilenameExtension.new('.lst') )
446
444
  end
447
445
 
448
446
  it 'mirrors a dependencies filepath the same way as the object it accompanies, distinguishing same-named modules under test' do
449
- expect( @fpu.form_test_dependencies_filepath('build/test/out/TestFoo/calculators/AdcCalc.o', name: 'TestFoo', context: :test) )
450
- .to eq('build/test/dependencies/TestFoo/calculators/AdcCalc.d')
447
+ expect( @fpu.form_test_dependencies_filepath('build/test/out/TestFoo/_t_/calculators/AdcCalc.o', name: 'TestFoo', context: :test) )
448
+ .to eq('build/test/dependencies/TestFoo/_t_/calculators/AdcCalc.d')
451
449
  end
452
450
 
453
451
  it 'forms a flat dependencies filepath for a flat object' do
454
- expect( @fpu.form_test_dependencies_filepath('build/test/out/TestFoo/AdcCalc.o', name: 'TestFoo', context: :test) )
455
- .to eq('build/test/dependencies/TestFoo/AdcCalc.d')
452
+ expect( @fpu.form_test_dependencies_filepath('build/test/out/TestFoo/_t_/AdcCalc.o', name: 'TestFoo', context: :test) )
453
+ .to eq('build/test/dependencies/TestFoo/_t_/AdcCalc.d')
456
454
  end
457
455
 
458
456
  it 'forms a flat dependencies filepath when no test identity is given' do
@@ -467,8 +465,8 @@ describe FilePathUtils do
467
465
  end
468
466
 
469
467
  it 'forms the list filepath directly alongside the object, wherever it was mirrored to' do
470
- expect( @fpu.form_test_build_list_filepath('build/test/out/TestFoo/calculators/AdcCalc.o') )
471
- .to eq('build/test/out/TestFoo/calculators/AdcCalc.lst')
468
+ expect( @fpu.form_test_build_list_filepath('build/test/out/TestFoo/_t_/calculators/AdcCalc.o') )
469
+ .to eq('build/test/out/TestFoo/_t_/calculators/AdcCalc.lst')
472
470
  end
473
471
  end
474
472
 
@@ -477,12 +475,10 @@ describe FilePathUtils do
477
475
  @configurator = double('configurator')
478
476
  @file_wrapper = double('file_wrapper')
479
477
  allow(@file_wrapper).to receive(:check_path_length)
480
- @fpu = described_class.new({
481
- :configurator => @configurator,
482
- :file_wrapper => @file_wrapper
483
- })
478
+ @fpu = path_utils( @configurator, @file_wrapper )
484
479
 
485
480
  allow(@configurator).to receive(:project_build_root).and_return('build')
481
+ allow(@configurator).to receive(:collection_build_roots).and_return( [] )
486
482
  allow(@configurator).to receive(:extension_object).and_return( FilenameExtension.new('.o') )
487
483
  allow(@configurator).to receive(:project_use_partials).and_return( true )
488
484
  allow(@configurator).to receive(:project_use_mocks).and_return( true )
@@ -492,7 +488,7 @@ describe FilePathUtils do
492
488
 
493
489
  it 'places a test\'s object where its build does, by the source\'s path from the project root' do
494
490
  expect( @fpu.form_test_object_filepath('src/a/util.c', name: 'test/test_util', context: :gcov) )
495
- .to eq('build/gcov/out/test/test_util/src/a/util.o')
491
+ .to eq('build/gcov/out/test/test_util/_t_/src/a/util.o')
496
492
  end
497
493
 
498
494
  # Untested sources compile outside any test, so same-named ones keep apart only by path
@@ -503,8 +499,15 @@ describe FilePathUtils do
503
499
 
504
500
  it 'places a test\'s generated Partial below its own subdirectory, as its build does' do
505
501
  expect(
506
- @fpu.form_test_object_filepath('build/test/partials/test/test_util/drv/ceedling_partial_util_impl.c', name: 'test/test_util', context: :gcov)
507
- ).to eq('build/gcov/out/test/test_util/drv/ceedling_partial_util_impl.o')
502
+ @fpu.form_test_object_filepath('build/test/partials/test/test_util/_t_/drv/ceedling_partial_util_impl.c', name: 'test/test_util', context: :gcov)
503
+ ).to eq('build/gcov/out/test/test_util/_t_/drv/ceedling_partial_util_impl.o')
504
+ end
505
+
506
+ # A test context's own objects sit below the base every test's root shares
507
+ it 'places a source in a directory named `_t_` apart from any test root, in or outside a test' do
508
+ expect( @fpu.form_test_object_filepath('src/_t_/foo.c', name: 'test/test_c', context: :test) )
509
+ .to eq('build/test/out/test/test_c/_t_/src/__t_/foo.o')
510
+ expect( @fpu.form_test_object_filepath('src/_t_/foo.c', context: :gcov) ).to eq('build/gcov/out/src/__t_/foo.o')
508
511
  end
509
512
  end
510
513
 
@@ -513,27 +516,24 @@ describe FilePathUtils do
513
516
  @configurator = double('configurator')
514
517
  @file_wrapper = double('file_wrapper')
515
518
  allow(@file_wrapper).to receive(:check_path_length)
516
- @fpu = described_class.new({
517
- :configurator => @configurator,
518
- :file_wrapper => @file_wrapper
519
- })
519
+ @fpu = path_utils( @configurator, @file_wrapper )
520
520
 
521
521
  allow(@configurator).to receive(:project_test_preprocess_build_directives_path).and_return('build/test/preprocess/build_directives')
522
522
  end
523
523
 
524
524
  it 'forms a per-test build directives cache directory path' do
525
525
  expect( @fpu.form_test_preprocess_build_directives_path('TestFoo') )
526
- .to eq('build/test/preprocess/build_directives/TestFoo')
526
+ .to eq('build/test/preprocess/build_directives/TestFoo/_t_')
527
527
  end
528
528
 
529
529
  it 'forms a build directives cache filepath using the fixed internal .yml extension' do
530
530
  expect( @fpu.form_test_build_directives_cache_filepath('test/TestFoo.c', 'TestFoo') )
531
- .to eq('build/test/preprocess/build_directives/TestFoo/TestFoo.c.yml')
531
+ .to eq('build/test/preprocess/build_directives/TestFoo/_t_/TestFoo.c.yml')
532
532
  end
533
533
 
534
534
  it 'forms a distinct source files cache filepath alongside the build directives cache' do
535
535
  expect( @fpu.form_preprocessed_source_files_cache_filepath('test/TestFoo.c', 'TestFoo') )
536
- .to eq('build/test/preprocess/build_directives/TestFoo/TestFoo.c_source_files.yml')
536
+ .to eq('build/test/preprocess/build_directives/TestFoo/_t_/TestFoo.c_source_files.yml')
537
537
  end
538
538
  end
539
539
 
@@ -544,13 +544,11 @@ describe FilePathUtils do
544
544
  :loginator => double('loginator').as_null_object,
545
545
  :verbosinator => double('verbosinator').as_null_object
546
546
  })
547
- @fpu = described_class.new({
548
- :configurator => @configurator,
549
- :file_wrapper => @file_wrapper
550
- })
547
+ @fpu = path_utils( @configurator, @file_wrapper )
551
548
 
552
549
  allow(@configurator).to receive(:project_release_build_output_path).and_return('build/release/out')
553
550
  allow(@configurator).to receive(:project_build_root).and_return('build')
551
+ allow(@configurator).to receive(:collection_build_roots).and_return( [] )
554
552
  allow(@configurator).to receive(:extension_object).and_return( FilenameExtension.new('.o') )
555
553
  end
556
554
 
@@ -573,6 +571,12 @@ describe FilePathUtils do
573
571
  expect { @fpu.form_release_build_objects_filelist( ['build/vendor/c_exception/lib/CException.c', 'CException.c'] ) }
574
572
  .to raise_error( CeedlingException, /`build\/vendor\/c_exception\/lib\/CException.c` and `CException.c`.*`build\/release\/out\/CException.o`/ )
575
573
  end
574
+
575
+ # A release build has no per-test directories, so nothing in its paths is reserved for them
576
+ it 'places a source in a directory named `_t_` at its own path' do
577
+ objects = @fpu.form_release_build_objects_filelist( ['src/_t_/foo.c', 'src/__t_/bar.c'] )
578
+ expect( objects ).to eq(['build/release/out/src/_t_/foo.o', 'build/release/out/src/__t_/bar.o'])
579
+ end
576
580
  end
577
581
 
578
582
  describe '#form_release_dependencies_filelist' do
@@ -582,13 +586,11 @@ describe FilePathUtils do
582
586
  :loginator => double('loginator').as_null_object,
583
587
  :verbosinator => double('verbosinator').as_null_object
584
588
  })
585
- @fpu = described_class.new({
586
- :configurator => @configurator,
587
- :file_wrapper => @file_wrapper
588
- })
589
+ @fpu = path_utils( @configurator, @file_wrapper )
589
590
 
590
591
  allow(@configurator).to receive(:project_release_dependencies_path).and_return('build/release/dependencies')
591
592
  allow(@configurator).to receive(:project_build_root).and_return('build')
593
+ allow(@configurator).to receive(:collection_build_roots).and_return( [] )
592
594
  allow(@configurator).to receive(:extension_dependencies).and_return( FilenameExtension.new('.d') )
593
595
  end
594
596
 
@@ -596,6 +598,10 @@ describe FilePathUtils do
596
598
  deps = @fpu.form_release_dependencies_filelist( ['drivers/foo/bar.c', 'drivers/baz/bar.c'] )
597
599
  expect( deps ).to eq(['build/release/dependencies/drivers/foo/bar.d', 'build/release/dependencies/drivers/baz/bar.d'])
598
600
  end
601
+
602
+ it 'places the dependency file of a source in a directory named `_t_` at its own path' do
603
+ expect( @fpu.form_release_dependencies_filelist( ['src/_t_/foo.c'] ) ).to eq(['build/release/dependencies/src/_t_/foo.d'])
604
+ end
599
605
  end
600
606
 
601
607
  # A mock's generated files sit below its test's mock root, in the subdirectory mirroring
@@ -604,10 +610,7 @@ describe FilePathUtils do
604
610
  # path nothing ever wrote.
605
611
  describe '#form_mock_output_path' do
606
612
  before(:each) do
607
- @fpu = described_class.new({
608
- :configurator => double('configurator'),
609
- :file_wrapper => double('file_wrapper')
610
- })
613
+ @fpu = path_utils( double('configurator'), double('file_wrapper') )
611
614
  end
612
615
 
613
616
  it 'joins a mock root and the subdirectory its content mirrors' do
@@ -630,14 +633,13 @@ describe FilePathUtils do
630
633
  before(:each) do
631
634
  @configurator = double('configurator')
632
635
  @file_wrapper = double('file_wrapper')
633
- @fpu = described_class.new({
634
- :configurator => @configurator,
635
- :file_wrapper => @file_wrapper
636
- })
636
+ @fpu = path_utils( @configurator, @file_wrapper )
637
637
 
638
638
  allow(@configurator).to receive(:project_test_preprocess_files_path).and_return('build/test/preprocess/files')
639
639
  allow(@configurator).to receive(:project_test_preprocess_includes_path).and_return('build/test/preprocess/includes')
640
+ allow(@file_wrapper).to receive(:check_path_length)
640
641
  allow(@configurator).to receive(:project_build_root).and_return('build')
642
+ allow(@configurator).to receive(:collection_build_roots).and_return( [] )
641
643
  allow(@configurator).to receive(:project_use_partials).and_return( true )
642
644
  allow(@configurator).to receive(:project_use_mocks).and_return( true )
643
645
  allow(@configurator).to receive(:project_test_partials_path).and_return('build/test/partials')
@@ -648,23 +650,25 @@ describe FilePathUtils do
648
650
  # from the project root, so two same-named files in one test never share one
649
651
  it 'places a file by its path from the project root below the test subdirectory' do
650
652
  expect( @fpu.form_preprocessed_file_filepath('src/drivers/uart/config.c', 'test_both') )
651
- .to eq('build/test/preprocess/files/test_both/src/drivers/uart/config.c')
653
+ .to eq('build/test/preprocess/files/test_both/_t_/src/drivers/uart/config.c')
652
654
  expect( @fpu.form_preprocessed_file_full_expansion_filepath('src/drivers/uart/config.c', 'test_both') )
653
- .to eq('build/test/preprocess/files/test_both/full_expansion/src/drivers/uart/config.c')
655
+ .to eq('build/test/preprocess/files/test_both/_t_/full_expansion/src/drivers/uart/config.c')
656
+ expect( @fpu.form_preprocessed_file_expanded_code_filepath('src/drivers/uart/config.c', 'test_both') )
657
+ .to eq('build/test/preprocess/files/test_both/_t_/expanded_code/src/drivers/uart/config.c')
654
658
  expect( @fpu.form_preprocessed_file_raw_directives_only_filepath('src/drivers/uart/config.c', 'test_both') )
655
- .to eq('build/test/preprocess/files/test_both/directives_only/raw/src/drivers/uart/config.c')
659
+ .to eq('build/test/preprocess/files/test_both/_t_/directives_only/raw/src/drivers/uart/config.c')
656
660
  expect( @fpu.form_preprocessed_file_compacted_directives_only_filepath('src/drivers/uart/config.c', 'test_both') )
657
- .to eq('build/test/preprocess/files/test_both/directives_only/src/drivers/uart/config.c')
661
+ .to eq('build/test/preprocess/files/test_both/_t_/directives_only/src/drivers/uart/config.c')
658
662
  expect( @fpu.form_preprocessed_file_fallback_expansion_filepath('src/drivers/uart/config.c', 'test_both') )
659
- .to eq('build/test/preprocess/files/test_both/fallback_expansion/src/drivers/uart/config.c')
663
+ .to eq('build/test/preprocess/files/test_both/_t_/fallback_expansion/src/drivers/uart/config.c')
660
664
  expect( @fpu.form_preprocessed_includes_list_filepath('src/drivers/uart/config.c', 'test_both') )
661
- .to eq('build/test/preprocess/includes/test_both/src/drivers/uart/config.c.yml')
665
+ .to eq('build/test/preprocess/includes/test_both/_t_/src/drivers/uart/config.c.yml')
662
666
  end
663
667
 
664
668
  it 'keeps a header far above the project below the test subdirectory' do
665
669
  far = File.expand_path( '../../far/inc/sdk.h' )
666
670
  expect( @fpu.form_preprocessed_file_filepath( far, 'test_both' ) )
667
- .to eq( File.join( 'build/test/preprocess/files/test_both', BuildSubpath.of_directory( File.dirname( far ) ), 'sdk.h' ) )
671
+ .to eq( File.join( 'build/test/preprocess/files/test_both/_t_', BuildSubpath.of_directory( File.dirname( far ) ), 'sdk.h' ) )
668
672
  expect( BuildSubpath.of_directory( File.dirname( far ) ) ).to_not include( '..' )
669
673
  end
670
674
 
@@ -684,12 +688,13 @@ describe FilePathUtils do
684
688
 
685
689
  @fpu.form_preprocessed_file_raw_directives_only_filepath('src/drivers/uart/config.c', 'test_both')
686
690
  @fpu.form_preprocessed_file_full_expansion_filepath('src/drivers/uart/config.c', 'test_both')
691
+ @fpu.form_preprocessed_file_expanded_code_filepath('src/drivers/uart/config.c', 'test_both')
687
692
  @fpu.form_preprocessed_includes_list_filepath('src/drivers/uart/config.c', 'test_both')
688
693
  end
689
694
 
690
695
  it 'places a header by its path from the project root' do
691
696
  expect( @fpu.form_preprocessed_file_filepath('include/drivers/uart/config.h', 'test_both') )
692
- .to eq('build/test/preprocess/files/test_both/include/drivers/uart/config.h')
697
+ .to eq('build/test/preprocess/files/test_both/_t_/include/drivers/uart/config.h')
693
698
  end
694
699
 
695
700
  # A generated Partial or mock sits below its own test's generated root rather than a
@@ -698,17 +703,17 @@ describe FilePathUtils do
698
703
  it 'mirrors a generated Partial header below its own test root' do
699
704
  expect(
700
705
  @fpu.form_preprocessed_file_raw_directives_only_filepath(
701
- 'build/test/partials/test_both/drivers/uart/ceedling_partial_config_interface.h', 'test_both'
706
+ 'build/test/partials/test_both/_t_/drivers/uart/ceedling_partial_config_interface.h', 'test_both'
702
707
  )
703
- ).to eq('build/test/preprocess/files/test_both/directives_only/raw/drivers/uart/ceedling_partial_config_interface.h')
708
+ ).to eq('build/test/preprocess/files/test_both/_t_/directives_only/raw/drivers/uart/ceedling_partial_config_interface.h')
704
709
  end
705
710
 
706
711
  it 'gives two same-named generated Partial headers distinct artifacts' do
707
712
  uart = @fpu.form_preprocessed_file_raw_directives_only_filepath(
708
- 'build/test/partials/test_both/drivers/uart/ceedling_partial_config_interface.h', 'test_both'
713
+ 'build/test/partials/test_both/_t_/drivers/uart/ceedling_partial_config_interface.h', 'test_both'
709
714
  )
710
715
  spi = @fpu.form_preprocessed_file_raw_directives_only_filepath(
711
- 'build/test/partials/test_both/drivers/spi/ceedling_partial_config_interface.h', 'test_both'
716
+ 'build/test/partials/test_both/_t_/drivers/spi/ceedling_partial_config_interface.h', 'test_both'
712
717
  )
713
718
 
714
719
  expect( uart ).to_not eq(spi)
@@ -717,31 +722,118 @@ describe FilePathUtils do
717
722
  it 'mirrors a generated mock below its own test root' do
718
723
  expect(
719
724
  @fpu.form_preprocessed_file_filepath(
720
- 'build/test/mocks/test_both/drivers/spi/mock_config.h', 'test_both'
725
+ 'build/test/mocks/test_both/_t_/drivers/spi/mock_config.h', 'test_both'
721
726
  )
722
- ).to eq('build/test/preprocess/files/test_both/drivers/spi/mock_config.h')
727
+ ).to eq('build/test/preprocess/files/test_both/_t_/drivers/spi/mock_config.h')
723
728
  end
724
729
 
725
730
  it 'keeps a generated file directly in its test root flat' do
726
- expect( @fpu.form_preprocessed_file_filepath('build/test/mocks/test_both/Mockconfig.h', 'test_both') )
727
- .to eq('build/test/preprocess/files/test_both/Mockconfig.h')
731
+ expect( @fpu.form_preprocessed_file_filepath('build/test/mocks/test_both/_t_/Mockconfig.h', 'test_both') )
732
+ .to eq('build/test/preprocess/files/test_both/_t_/Mockconfig.h')
733
+ end
734
+
735
+ # Without a test, a file still lies within the build directory
736
+ it 'places a file named for no test below the base every test shares' do
737
+ expect( @fpu.form_preprocessed_file_full_expansion_filepath('src/foo.h', nil) )
738
+ .to eq('build/test/preprocess/files/full_expansion/src/foo.h')
739
+ expect( @fpu.form_preprocessed_includes_list_filepath('src/foo.h', nil) )
740
+ .to eq('build/test/preprocess/includes/src/foo.h.yml')
728
741
  end
729
742
  end
730
743
 
731
- describe '#form_test_build_objects_filelist' do
744
+ # GH #1387: a long configured root's location gives way to its marker in build paths
745
+ describe 'shortened roots' do
746
+ let(:external_root) { '../vendor/acme/sdk/v3/include' }
747
+ let(:deep_root) { 'lib/vendor/acme/hal' }
748
+ let(:table) { BuildRoots.table( [external_root, deep_root, 'src'] ) }
749
+
732
750
  before(:each) do
733
751
  @configurator = double('configurator')
734
752
  @file_wrapper = FileWrapper.new({
735
753
  :loginator => double('loginator').as_null_object,
736
754
  :verbosinator => double('verbosinator').as_null_object
737
755
  })
738
- @fpu = described_class.new({
739
- :configurator => @configurator,
740
- :file_wrapper => @file_wrapper
756
+ @fpu = path_utils( @configurator, @file_wrapper )
757
+
758
+ allow(@configurator).to receive(:collection_build_roots).and_return( [external_root, deep_root, 'src'] )
759
+ allow(@configurator).to receive(:extension_object).and_return( FilenameExtension.new('.o') )
760
+ allow(@configurator).to receive(:project_build_root).and_return('build')
761
+ allow(@configurator).to receive(:project_test_preprocess_files_path).and_return('build/test/preprocess/files')
762
+ allow(@configurator).to receive(:project_use_partials).and_return( false )
763
+ allow(@configurator).to receive(:project_use_mocks).and_return( false )
764
+ end
765
+
766
+ it 'places objects below a shortened root at its marker, keeping their path below the root' do
767
+ objects = @fpu.form_test_build_objects_filelist(
768
+ 'build/test/out/TestFoo', ["#{external_root}/os/x.c", "#{deep_root}/y.c", 'src/drv/z.c']
769
+ )
770
+
771
+ expect( objects ).to eq([
772
+ "build/test/out/TestFoo/#{table.marker_for( external_root )}/os/x.o",
773
+ "build/test/out/TestFoo/#{table.marker_for( deep_root )}/y.o",
774
+ 'build/test/out/TestFoo/src/drv/z.o'
775
+ ])
776
+ end
777
+
778
+ it 'places preprocessed files below a shortened root the same way' do
779
+ expect( @fpu.form_preprocessed_file_raw_directives_only_filepath( "#{external_root}/cmsis_os2.h", 'test_os' ) )
780
+ .to eq( "build/test/preprocess/files/test_os/_t_/directives_only/raw/#{table.marker_for( external_root )}/cmsis_os2.h" )
781
+ end
782
+
783
+ it 'names a test below a shortened root by its whole path, as always' do
784
+ expect( @fpu.form_test_name( "#{deep_root}/test/test_hal.c" ) ).to eq( "#{deep_root}/test/test_hal" )
785
+ end
786
+
787
+ it 'holds one table for the configured roots' do
788
+ expected = table.entries
789
+ expect(BuildRoots).to receive(:table).once.and_call_original
790
+
791
+ 3.times { @fpu.build_roots }
792
+ expect( @fpu.build_roots.entries ).to eq( expected )
793
+ end
794
+
795
+ # gcov exclusions match the layout as it would be without shortened roots
796
+ it 'expands each marker in a build path back to its root\'s former spelling' do
797
+ marker = table.marker_for( external_root )
798
+
799
+ expect( @fpu.expanded_build_path( "build/gcov/out/test/test_os/#{marker}/os/x.gcno" ) )
800
+ .to eq( "build/gcov/out/test/test_os/#{BuildSubpath.encode( external_root )}/os/x.gcno" )
801
+ expect( @fpu.expanded_build_path( 'build/gcov/out/test/test_os/src/x.gcno' ) ).to eq( 'build/gcov/out/test/test_os/src/x.gcno' )
802
+ end
803
+
804
+ describe '#publish_build_roots' do
805
+ it 'writes each marker and its root to the build root, and returns them' do
806
+ expect(@file_wrapper).to receive(:mkdir).with( 'build' )
807
+ expect(@file_wrapper).to receive(:write) do |path, contents|
808
+ expect(path).to eq( 'build/build_roots.yml' )
809
+ expect(YAML.safe_load( contents )).to eq( table.entries.to_h { |root, marker| [marker, root] } )
810
+ end
811
+
812
+ expect( @fpu.publish_build_roots ).to eq( table.entries )
813
+ end
814
+
815
+ it 'removes the map when no root is shortened' do
816
+ allow(@configurator).to receive(:collection_build_roots).and_return( ['src'] )
817
+ expect(@file_wrapper).to receive(:rm_f).with( 'build/build_roots.yml' )
818
+ expect(@file_wrapper).not_to receive(:write)
819
+
820
+ expect( @fpu.publish_build_roots ).to be_empty
821
+ end
822
+ end
823
+ end
824
+
825
+ describe '#form_test_build_objects_filelist' do
826
+ before(:each) do
827
+ @configurator = double('configurator')
828
+ @file_wrapper = FileWrapper.new({
829
+ :loginator => double('loginator').as_null_object,
830
+ :verbosinator => double('verbosinator').as_null_object
741
831
  })
832
+ @fpu = path_utils( @configurator, @file_wrapper )
742
833
 
743
834
  allow(@configurator).to receive(:extension_object).and_return( FilenameExtension.new('.o') )
744
835
  allow(@configurator).to receive(:project_build_root).and_return('build')
836
+ allow(@configurator).to receive(:collection_build_roots).and_return( [] )
745
837
  end
746
838
 
747
839
  it 'places a test, module-under-test or support source by its path from the project root' do
@@ -766,8 +858,9 @@ describe FilePathUtils do
766
858
 
767
859
  # A source far from the project gains a directory for each level its path climbs, which
768
860
  # can reach Windows' path length limit
769
- it 'checks the length of each object\'s whole path, once' do
770
- expect(@file_wrapper).to receive(:check_path_length).with( 'build/test/out/TestFoo/_up_/_up_/far/src/x.o', origin: 'FilePathUtils#build_filepath' ).once
861
+ # FileWrapper reports each path once, however often it is checked
862
+ it 'checks the length of each object\'s whole path, each time it is formed' do
863
+ expect(@file_wrapper).to receive(:check_path_length).with( 'build/test/out/TestFoo/_up_/_up_/far/src/x.o', origin: 'FilePathUtils#build_filepath' ).twice
771
864
 
772
865
  2.times { @fpu.form_test_build_objects_filelist( 'build/test/out/TestFoo', ['../../far/src/x.c'] ) }
773
866
  end
@@ -815,10 +908,7 @@ describe FilePathUtils do
815
908
  :loginator => double('loginator').as_null_object,
816
909
  :verbosinator => double('verbosinator').as_null_object
817
910
  })
818
- @fpu = described_class.new({
819
- :configurator => @configurator,
820
- :file_wrapper => @file_wrapper
821
- })
911
+ @fpu = path_utils( @configurator, @file_wrapper )
822
912
 
823
913
  allow(@configurator).to receive(:extension_testpass).and_return( FilenameExtension.new('.pass') )
824
914
  allow(@configurator).to receive(:project_build_root).and_return( 'build' )
@@ -856,7 +946,7 @@ describe FilePathUtils do
856
946
 
857
947
  describe '#form_test_name' do
858
948
  before(:each) do
859
- @fpu = described_class.new({ :configurator => double('configurator'), :file_wrapper => double('file_wrapper') })
949
+ @fpu = path_utils( double('configurator'), double('file_wrapper') )
860
950
  end
861
951
 
862
952
  it 'names a test by its path from the project root, without its extension' do
@@ -905,13 +995,11 @@ describe FilePathUtils do
905
995
  @configurator = double('configurator')
906
996
  @file_wrapper = double('file_wrapper')
907
997
  allow(@file_wrapper).to receive(:check_path_length)
908
- @fpu = described_class.new({
909
- :configurator => @configurator,
910
- :file_wrapper => @file_wrapper
911
- })
998
+ @fpu = path_utils( @configurator, @file_wrapper )
912
999
 
913
1000
  allow(@configurator).to receive(:project_test_preprocess_includes_path).and_return('build/test/preprocess/includes')
914
1001
  allow(@configurator).to receive(:project_build_root).and_return('build')
1002
+ allow(@configurator).to receive(:collection_build_roots).and_return( [] )
915
1003
  allow(@configurator).to receive(:project_use_partials).and_return( false )
916
1004
  allow(@configurator).to receive(:project_use_mocks).and_return( false )
917
1005
  end
@@ -919,16 +1007,13 @@ describe FilePathUtils do
919
1007
  it 'uses the fixed internal .yml extension regardless of a project-configured :extension ↳ :yaml setting' do
920
1008
  expect(@configurator).to_not receive(:extension_yaml)
921
1009
  expect( @fpu.form_preprocessed_includes_list_filepath('test/TestFoo.c', 'TestFoo') )
922
- .to eq('build/test/preprocess/includes/TestFoo/test/TestFoo.c.yml')
1010
+ .to eq('build/test/preprocess/includes/TestFoo/_t_/test/TestFoo.c.yml')
923
1011
  end
924
1012
  end
925
1013
 
926
1014
  describe '#form_partial_types_header_filename' do
927
1015
  before(:each) do
928
- @fpu = described_class.new({
929
- :configurator => double('configurator'),
930
- :file_wrapper => double('file_wrapper')
931
- })
1016
+ @fpu = path_utils( double('configurator'), double('file_wrapper') )
932
1017
  end
933
1018
 
934
1019
  it 'forms a filename from the module name, the partial prefix, and a _types suffix' do
@@ -946,10 +1031,7 @@ describe FilePathUtils do
946
1031
  describe 'the remaining generated Partial filenames' do
947
1032
  before(:each) do
948
1033
  @configurator = double('configurator')
949
- @fpu = described_class.new({
950
- :configurator => @configurator,
951
- :file_wrapper => double('file_wrapper')
952
- })
1034
+ @fpu = path_utils( @configurator, double('file_wrapper') )
953
1035
  end
954
1036
 
955
1037
  it 'forms an interface header filename with the partial prefix and an _interface suffix' do
@@ -991,10 +1073,7 @@ describe FilePathUtils do
991
1073
  describe 'generated Partial filenames for a module named by directory' do
992
1074
  before(:each) do
993
1075
  @configurator = double('configurator')
994
- @fpu = described_class.new({
995
- :configurator => @configurator,
996
- :file_wrapper => double('file_wrapper')
997
- })
1076
+ @fpu = path_utils( @configurator, double('file_wrapper') )
998
1077
  end
999
1078
 
1000
1079
  it 'prefixes the basename and keeps the directory for an implementation header' do
@@ -1017,6 +1096,11 @@ describe FilePathUtils do
1017
1096
  .to eq('drivers/uart/ceedling_partial_config_types.h')
1018
1097
  end
1019
1098
 
1099
+ it 'prefixes the basename and keeps the directory for an extras header' do
1100
+ expect( @fpu.form_partial_extras_header_filename('drivers/uart/config') )
1101
+ .to eq('drivers/uart/ceedling_partial_config_extras.h')
1102
+ end
1103
+
1020
1104
  it 'stacks both prefixes on the basename for a mock interface header' do
1021
1105
  allow(@configurator).to receive(:cmock_mock_prefix).and_return('Mock')
1022
1106
 
@@ -1037,10 +1121,7 @@ describe FilePathUtils do
1037
1121
  before(:each) do
1038
1122
  @configurator = double('configurator')
1039
1123
  allow(@configurator).to receive(:cmock_mock_prefix).and_return('Mock')
1040
- @fpu = described_class.new({
1041
- :configurator => @configurator,
1042
- :file_wrapper => double('file_wrapper')
1043
- })
1124
+ @fpu = path_utils( @configurator, double('file_wrapper') )
1044
1125
  end
1045
1126
 
1046
1127
  it 'recovers a module named without a directory' do
@@ -1053,7 +1134,7 @@ describe FilePathUtils do
1053
1134
  .to eq('drivers/uart/config')
1054
1135
  end
1055
1136
 
1056
- # Three suffixes exist, one per generated file kind.
1137
+ # One suffix exists per generated file kind.
1057
1138
  it 'strips an implementation suffix' do
1058
1139
  expect( @fpu.module_from_partial_filename('ceedling_partial_config_impl.h') ).to eq('config')
1059
1140
  end
@@ -1062,6 +1143,10 @@ describe FilePathUtils do
1062
1143
  expect( @fpu.module_from_partial_filename('ceedling_partial_config_interface.h') ).to eq('config')
1063
1144
  end
1064
1145
 
1146
+ it 'strips an extras suffix' do
1147
+ expect( @fpu.module_from_partial_filename('ceedling_partial_config_extras.h') ).to eq('config')
1148
+ end
1149
+
1065
1150
  it 'strips a types suffix' do
1066
1151
  expect( @fpu.module_from_partial_filename('ceedling_partial_config_types.h') ).to eq('config')
1067
1152
  end
@@ -1097,27 +1182,77 @@ describe FilePathUtils do
1097
1182
  end
1098
1183
  end
1099
1184
 
1100
- describe '#form_named_path' do
1185
+ # Each of a test's own directories sits below its root of that kind (TestBuildLayout)
1186
+ describe "a test's own directories" do
1101
1187
  before(:each) do
1188
+ @configurator = double('configurator')
1102
1189
  @file_wrapper = double('file_wrapper')
1103
1190
  allow(@file_wrapper).to receive(:check_path_length)
1104
- @fpu = described_class.new({
1105
- :configurator => double('configurator'),
1106
- :file_wrapper => @file_wrapper
1107
- })
1191
+ allow(@configurator).to receive(:project_build_root).and_return('build')
1192
+ allow(@configurator).to receive(:project_use_mocks).and_return( true )
1193
+ allow(@configurator).to receive(:project_use_partials).and_return( true )
1194
+ allow(@configurator).to receive(:cmock_mock_path).and_return('build/test/mocks')
1195
+ allow(@configurator).to receive(:project_test_partials_path).and_return('build/test/partials')
1196
+ allow(@configurator).to receive(:project_test_preprocess_includes_path).and_return('build/test/preprocess/includes')
1197
+ allow(@configurator).to receive(:project_test_preprocess_files_path).and_return('build/test/preprocess/files')
1198
+ allow(@configurator).to receive(:project_test_preprocess_build_directives_path).and_return('build/test/preprocess/build_directives')
1199
+ @fpu = path_utils( @configurator, @file_wrapper )
1108
1200
  end
1109
1201
 
1110
- # form_named_path is private -- exercised via #send, same as its callers do internally.
1111
- it 'checks the constructed path length, identifying itself as the origin' do
1112
- @fpu.send(:form_named_path, 'build/test/preprocess/files', 'test_foo')
1113
- expect(@file_wrapper).to have_received(:check_path_length)
1114
- .with('build/test/preprocess/files/test_foo', origin: 'FilePathUtils#form_named_path')
1202
+ it "places each below the test's own root of its kind" do
1203
+ expect( @fpu.form_test_build_path( 'test/test_c', context: :test ) ).to eq('build/test/out/test/test_c/_t_')
1204
+ expect( @fpu.form_test_dependencies_path( 'test/test_c', context: :test ) ).to eq('build/test/dependencies/test/test_c/_t_')
1205
+ expect( @fpu.form_test_mocks_path( 'test/test_c' ) ).to eq('build/test/mocks/test/test_c/_t_')
1206
+ expect( @fpu.form_test_partials_path( 'test/test_c' ) ).to eq('build/test/partials/test/test_c/_t_')
1207
+ expect( @fpu.form_test_preprocess_includes_path( 'test/test_c' ) ).to eq('build/test/preprocess/includes/test/test_c/_t_')
1208
+ expect( @fpu.form_test_preprocess_files_path( 'test/test_c' ) ).to eq('build/test/preprocess/files/test/test_c/_t_')
1209
+ expect( @fpu.form_test_preprocess_build_directives_path( 'test/test_c' ) ).to eq('build/test/preprocess/build_directives/test/test_c/_t_')
1210
+ end
1211
+
1212
+ it "places each preprocessing directory below the test's own root" do
1213
+ expect( @fpu.form_test_preprocess_files_full_expansion_path( 'test/test_c' ) )
1214
+ .to eq('build/test/preprocess/files/test/test_c/_t_/full_expansion')
1215
+ expect( @fpu.form_test_preprocess_files_directives_only_path( 'test/test_c' ) )
1216
+ .to eq('build/test/preprocess/files/test/test_c/_t_/directives_only')
1217
+ expect( @fpu.form_test_preprocess_files_raw_directives_only_path( 'test/test_c' ) )
1218
+ .to eq('build/test/preprocess/files/test/test_c/_t_/directives_only/raw')
1115
1219
  end
1116
1220
 
1117
- it 'checks the constructed path length including an optional subdir' do
1118
- @fpu.send(:form_named_path, 'build/test/preprocess/files', 'test_foo', subdir: 'full_expansion')
1221
+ it "places a test's executable and linker map below its own root" do
1222
+ allow(@configurator).to receive(:extension_executable).and_return( FilenameExtension.new('.out') )
1223
+ allow(@configurator).to receive(:extension_map).and_return( FilenameExtension.new('.map') )
1224
+ build = @fpu.form_test_build_path( 'test/test_c', context: :test )
1225
+
1226
+ expect( @fpu.form_test_executable_filepath( build, 'test/test_c.c' ) ).to eq('build/test/out/test/test_c/_t_/test_c.out')
1227
+ expect( @fpu.form_test_build_map_filepath( build, 'build/test/out/test/test_c/_t_/test_c.out' ) ).to eq('build/test/out/test/test_c/_t_/test_c.map')
1228
+ end
1229
+
1230
+ # A test's name continues another's, and that test's mock lies in a folder of the same name
1231
+ it "keeps a nested test's directories apart from another test's subdirectory of its name" do
1232
+ expect( @fpu.form_test_mocks_path( 'test/test_c/test_x' ) ).to eq('build/test/mocks/test/test_c/test_x/_t_')
1233
+ expect( @fpu.form_mock_header_filepath( 'test/test_c', 'test_x/mock_qux.h' ) ).to eq('build/test/mocks/test/test_c/_t_/test_x/mock_qux.h')
1234
+
1235
+ expect( @fpu.form_test_partials_path( 'test/test_c/test_x' ) ).to eq('build/test/partials/test/test_c/test_x/_t_')
1236
+ expect( @fpu.form_partial_header_filepath( 'test/test_c', 'test_x/ceedling_partial_qux_impl.h' ) )
1237
+ .to eq('build/test/partials/test/test_c/_t_/test_x/ceedling_partial_qux_impl.h')
1238
+ end
1239
+
1240
+ it "keeps a context's own output root for no test" do
1241
+ expect( @fpu.form_test_build_path( nil, context: :gcov ) ).to eq('build/gcov/out')
1242
+ expect( @fpu.form_test_dependencies_path( nil, context: :gcov ) ).to eq('build/gcov/dependencies')
1243
+ end
1244
+
1245
+ it "gives a test's generated roots, Partials first" do
1246
+ expect( @fpu.generated_roots( 'test/test_c' ) ).to eq(['build/test/partials/test/test_c/_t_', 'build/test/mocks/test/test_c/_t_'])
1247
+ expect( @fpu.generated_roots( nil ) ).to eq([])
1248
+ end
1249
+
1250
+ it "checks a root's length once, naming the layout as the origin" do
1251
+ @fpu.form_test_preprocess_files_full_expansion_path( 'test/test_c' )
1252
+
1253
+ expect(@file_wrapper).to have_received(:check_path_length).once
1119
1254
  expect(@file_wrapper).to have_received(:check_path_length)
1120
- .with('build/test/preprocess/files/test_foo/full_expansion', origin: 'FilePathUtils#form_named_path')
1255
+ .with('build/test/preprocess/files/test/test_c/_t_', origin: 'TestBuildLayout#root', directory: true)
1121
1256
  end
1122
1257
  end
1123
1258
 
@@ -1127,10 +1262,8 @@ describe FilePathUtils do
1127
1262
  @file_wrapper = double('file_wrapper')
1128
1263
  allow(@file_wrapper).to receive(:check_path_length)
1129
1264
  allow(@configurator).to receive(:project_build_root).and_return('build')
1130
- @fpu = described_class.new({
1131
- :configurator => @configurator,
1132
- :file_wrapper => @file_wrapper
1133
- })
1265
+ allow(@configurator).to receive(:collection_build_roots).and_return( [] )
1266
+ @fpu = path_utils( @configurator, @file_wrapper )
1134
1267
  end
1135
1268
 
1136
1269
  # form_build_context_path is private -- exercised via #send, same as its callers do internally.