ceedling 1.2.0 → 1.2.2

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 (383) hide show
  1. checksums.yaml +4 -4
  2. data/GIT_COMMIT_SHA +1 -1
  3. data/README.md +57 -58
  4. data/Rakefile +5 -3
  5. data/assets/features/ceedling +1 -1
  6. data/assets/fixtures/test_source_file_duplicate_basenames/test_calc_typo.c +14 -0
  7. data/assets/fixtures/tests_with_duplicate_test_names/test_foo.c +21 -0
  8. data/bin/actionator.rb +6 -12
  9. data/bin/app_cfg.rb +35 -1
  10. data/bin/ceedling +13 -3
  11. data/bin/cli.rb +25 -6
  12. data/bin/cli_handler.rb +119 -73
  13. data/bin/cli_helper.rb +56 -78
  14. data/bin/installation_selector.rb +81 -0
  15. data/bin/launchinator.rb +69 -0
  16. data/bin/mixin_resolvinator.rb +26 -36
  17. data/bin/objects.yml +13 -0
  18. data/bin/path_validator.rb +25 -29
  19. data/bin/versionator.rb +47 -48
  20. data/ceedling.gemspec +19 -15
  21. data/docs/BreakingChanges.md +70 -1
  22. data/docs/Changelog.md +84 -3
  23. data/docs/KnownIssues.md +90 -4
  24. data/docs/ReleaseNotes.md +13 -0
  25. data/docs/overrides/main.html +11 -8
  26. data/lib/ceedling/build_log_writer.rb +33 -0
  27. data/lib/ceedling/config/build_root_policy.rb +70 -0
  28. data/lib/ceedling/config/configurator.rb +19 -18
  29. data/lib/ceedling/config/configurator_builder.rb +58 -28
  30. data/lib/ceedling/config/configurator_paths_validator.rb +179 -0
  31. data/lib/ceedling/config/configurator_plugins.rb +1 -1
  32. data/lib/ceedling/config/configurator_setup.rb +39 -41
  33. data/lib/ceedling/config/configurator_validator.rb +1 -110
  34. data/lib/ceedling/defaults.rb +4 -4
  35. data/lib/ceedling/dependencies/README.md +18 -16
  36. data/lib/ceedling/dependencies/dependency_cache_store.rb +20 -3
  37. data/lib/ceedling/dependencies/dependency_hasher.rb +35 -1
  38. data/lib/ceedling/filename_extension.rb +7 -1
  39. data/lib/ceedling/filesystem/FILE_TREE.md +253 -0
  40. data/lib/ceedling/filesystem/PATH_HANDLING.md +304 -0
  41. data/lib/ceedling/filesystem/README.md +41 -0
  42. data/lib/ceedling/filesystem/build_subpath.rb +102 -0
  43. data/lib/ceedling/filesystem/destination_collision.rb +25 -0
  44. data/lib/ceedling/{file_finder.rb → filesystem/file_finder.rb} +159 -104
  45. data/lib/ceedling/{file_finder_helper.rb → filesystem/file_finder_helper.rb} +36 -31
  46. data/lib/ceedling/filesystem/file_path_collection_utils.rb +183 -0
  47. data/lib/ceedling/{file_path_utils.rb → filesystem/file_path_utils.rb} +108 -97
  48. data/lib/ceedling/{file_system_wrapper.rb → filesystem/file_system_wrapper.rb} +6 -5
  49. data/lib/ceedling/filesystem/file_tree.rb +241 -0
  50. data/lib/ceedling/{file_wrapper.rb → filesystem/file_wrapper.rb} +65 -28
  51. data/lib/ceedling/filesystem/path_exclusions.rb +30 -0
  52. data/lib/ceedling/{path_matcher.rb → filesystem/path_matcher.rb} +27 -23
  53. data/lib/ceedling/{path_mirror.rb → filesystem/path_mirror.rb} +19 -18
  54. data/lib/ceedling/filesystem/path_spellings.rb +55 -0
  55. data/lib/ceedling/filesystem/project_paths.rb +184 -0
  56. data/lib/ceedling/filesystem/working_dir.rb +40 -0
  57. data/lib/ceedling/generators/generator.rb +5 -6
  58. data/lib/ceedling/generators/generator_partials.rb +1 -1
  59. data/lib/ceedling/generators/generator_test_results_backtrace.rb +7 -7
  60. data/lib/ceedling/handoff.rb +121 -0
  61. data/lib/ceedling/includes/include_factory.rb +3 -3
  62. data/lib/ceedling/includes/include_pathinator.rb +67 -10
  63. data/lib/ceedling/includes/includes.rb +1 -1
  64. data/lib/ceedling/installation.rb +92 -0
  65. data/lib/ceedling/library_resolver.rb +99 -0
  66. data/lib/ceedling/objects.yml +23 -2
  67. data/lib/ceedling/partials/partializer.rb +4 -4
  68. data/lib/ceedling/partials/partializer_config.rb +3 -1
  69. data/lib/ceedling/plugins/report_log_writer_plugin.rb +3 -5
  70. data/lib/ceedling/preprocess/preprocessinator_file_assembler.rb +1 -1
  71. data/lib/ceedling/preprocess/preprocessinator_includes_handler.rb +1 -1
  72. data/lib/ceedling/preprocess/preprocessinator_line_marker_includes_extractor.rb +1 -1
  73. data/lib/ceedling/rake_app/rakefile_component_resolver.rb +10 -17
  74. data/lib/ceedling/rake_app/test_task_name.rb +29 -0
  75. data/lib/ceedling/rakefile.rb +16 -1
  76. data/lib/ceedling/rakefiles/base/tasks_base.rake +1 -1
  77. data/lib/ceedling/rakefiles/release/rules_release.rake +4 -7
  78. data/lib/ceedling/rakefiles/tests/rules_tests.rake +3 -20
  79. data/lib/ceedling/rakefiles/tests/rules_tests_generate.rake +4 -30
  80. data/lib/ceedling/release_invoker/release_build_executor.rb +33 -44
  81. data/lib/ceedling/release_invoker/release_build_planner.rb +14 -6
  82. data/lib/ceedling/reportinator.rb +3 -4
  83. data/lib/ceedling/setupinator.rb +95 -87
  84. data/lib/ceedling/test_context_extractor.rb +5 -1
  85. data/lib/ceedling/test_invoker/PIPELINE.md +9 -7
  86. data/lib/ceedling/test_invoker/mock_locator.rb +60 -2
  87. data/lib/ceedling/test_invoker/partials_manager.rb +12 -0
  88. data/lib/ceedling/test_invoker/standin_headerinator.rb +22 -13
  89. data/lib/ceedling/test_invoker/test_build_executor.rb +42 -41
  90. data/lib/ceedling/test_invoker/test_build_planner.rb +37 -18
  91. data/lib/ceedling/test_invoker/test_build_setup.rb +17 -12
  92. data/lib/ceedling/test_invoker/test_build_validations.rb +16 -31
  93. data/lib/ceedling/test_invoker/test_file_preprocessinator.rb +1 -1
  94. data/lib/ceedling/test_invoker/test_invoker.rb +6 -1
  95. data/lib/ceedling/test_invoker/test_pipeline_helpers.rb +1 -1
  96. data/lib/ceedling/test_invoker/test_source_file_directive_resolver.rb +40 -20
  97. data/lib/ceedling/tool_executor.rb +9 -3
  98. data/lib/ceedling/yaml_wrapper.rb +3 -2
  99. data/lib/version.rb +1 -1
  100. data/plugins/bullseye/bullseye.rake +6 -9
  101. data/plugins/bullseye/config/defaults_bullseye.rb +1 -1
  102. data/plugins/bullseye/lib/bullseye.rb +9 -7
  103. data/plugins/cppcheck/config/defaults_cppcheck.rb +1 -1
  104. data/plugins/dependencies/config/defaults.yml +6 -6
  105. data/plugins/dependencies/dependencies.rake +4 -1
  106. data/plugins/dependencies/lib/dependencies.rb +18 -8
  107. data/plugins/dependencies/lib/dependency_spec.rb +17 -5
  108. data/plugins/fff/lib/fff.rb +45 -39
  109. data/plugins/fff/spec/fff_cmock_wrapper_spec.rb +128 -0
  110. data/plugins/gcov/config/defaults_gcov.rb +1 -1
  111. data/plugins/gcov/gcov.rake +6 -9
  112. data/plugins/gcov/lib/console_reportinator.rb +4 -18
  113. data/plugins/gcov/lib/gcov.rb +9 -2
  114. data/plugins/gcov/lib/gcovr_reportinator.rb +8 -40
  115. data/plugins/gcov/lib/gcovr_thresholds.rb +74 -0
  116. data/plugins/gcov/lib/reportgenerator_reportinator.rb +1 -1
  117. data/plugins/module_generator/lib/module_generator.rb +3 -3
  118. data/plugins/report_tests_teamcity_stdout/lib/report_tests_teamcity_stdout.rb +53 -80
  119. data/plugins/sanitize/lib/sanitize_records.rb +3 -6
  120. data/plugins/sanitize/sanitize.rake +6 -6
  121. data/plugins/valgrind/lib/valgrind.rb +14 -7
  122. data/plugins/valgrind/valgrind.rake +6 -6
  123. data/site-local/404.html +6 -20
  124. data/site-local/assets/javascripts/{bundle.d7400e89.min.js → bundle.c21346df.min.js} +3 -3
  125. data/site-local/assets/javascripts/{bundle.d7400e89.min.js.map → bundle.c21346df.min.js.map} +2 -2
  126. data/site-local/assets/javascripts/workers/{search.2c215733.min.js → search.a7633da7.min.js} +2 -2
  127. data/site-local/assets/javascripts/workers/{search.2c215733.min.js.map → search.a7633da7.min.js.map} +1 -1
  128. data/site-local/assets/stylesheets/main.57a0d79d.min.css +6 -0
  129. data/site-local/assets/stylesheets/main.57a0d79d.min.css.map +1 -0
  130. data/site-local/assets/stylesheets/palette.fb2fffe2.min.css +4 -0
  131. data/site-local/assets/stylesheets/palette.fb2fffe2.min.css.map +1 -0
  132. data/site-local/configuration/environment-vars.html +6 -20
  133. data/site-local/configuration/global-collections.html +6 -20
  134. data/site-local/configuration/index.html +6 -20
  135. data/site-local/configuration/loading.html +6 -20
  136. data/site-local/configuration/mixins.html +10 -24
  137. data/site-local/configuration/parallel-builds.html +6 -20
  138. data/site-local/configuration/project-file.html +8 -22
  139. data/site-local/configuration/reference/cexception.html +6 -20
  140. data/site-local/configuration/reference/cmock.html +8 -21
  141. data/site-local/configuration/reference/defines.html +16 -30
  142. data/site-local/configuration/reference/environment.html +10 -24
  143. data/site-local/configuration/reference/extension.html +6 -20
  144. data/site-local/configuration/reference/files.html +22 -30
  145. data/site-local/configuration/reference/flags.html +13 -27
  146. data/site-local/configuration/reference/index.html +6 -20
  147. data/site-local/configuration/reference/libraries.html +27 -23
  148. data/site-local/configuration/reference/mixins.html +6 -20
  149. data/site-local/configuration/reference/partials.html +6 -20
  150. data/site-local/configuration/reference/paths.html +38 -29
  151. data/site-local/configuration/reference/plugins.html +6 -20
  152. data/site-local/configuration/reference/project.html +32 -36
  153. data/site-local/configuration/reference/release-build.html +8 -20
  154. data/site-local/configuration/reference/test-build.html +6 -20
  155. data/site-local/configuration/reference/test-runner.html +6 -20
  156. data/site-local/configuration/reference/tools.html +27 -32
  157. data/site-local/configuration/reference/unity.html +6 -20
  158. data/site-local/configuration/which-ceedling.html +383 -37
  159. data/site-local/development/index.html +6 -20
  160. data/site-local/development/plugins/configuration.html +6 -20
  161. data/site-local/development/plugins/index.html +6 -20
  162. data/site-local/development/plugins/plugin-subclass.html +54 -68
  163. data/site-local/development/plugins/rake-tasks.html +8 -22
  164. data/site-local/development/releases.html +84 -29
  165. data/site-local/development/workflow.html +62 -71
  166. data/site-local/getting-started/builds.html +8 -20
  167. data/site-local/getting-started/command-line.html +62 -24
  168. data/site-local/getting-started/example-projects/cipher-quest.html +6 -20
  169. data/site-local/getting-started/example-projects/index.html +6 -20
  170. data/site-local/getting-started/example-projects/temp-sensor.html +6 -20
  171. data/site-local/getting-started/example-projects/wondrous-forest.html +6 -20
  172. data/site-local/getting-started/index.html +6 -20
  173. data/site-local/getting-started/installation.html +6 -20
  174. data/site-local/getting-started/quick-start.html +6 -20
  175. data/site-local/help.html +6 -20
  176. data/site-local/index.html +11 -24
  177. data/site-local/overview/build-system.html +6 -20
  178. data/site-local/overview/index.html +6 -20
  179. data/site-local/overview/test-environments.html +6 -20
  180. data/site-local/overview/tools-and-frameworks.html +6 -20
  181. data/site-local/plugins/beep.html +6 -20
  182. data/site-local/plugins/bullseye/index.html +13 -24
  183. data/site-local/plugins/bullseye/licensing.html +14 -28
  184. data/site-local/plugins/command-hooks.html +8 -22
  185. data/site-local/plugins/compile-commands-json-db.html +6 -20
  186. data/site-local/plugins/cppcheck.html +8 -22
  187. data/site-local/plugins/dependencies.html +16 -27
  188. data/site-local/plugins/fff.html +49 -32
  189. data/site-local/plugins/gcov/examples.html +7 -21
  190. data/site-local/plugins/gcov/gcovr.html +22 -33
  191. data/site-local/plugins/gcov/index.html +6 -20
  192. data/site-local/plugins/gcov/overview.html +9 -20
  193. data/site-local/plugins/gcov/reportgenerator.html +9 -23
  194. data/site-local/plugins/gcov/reporting.html +6 -20
  195. data/site-local/plugins/gcov/setup.html +8 -21
  196. data/site-local/plugins/gcov/tool-versions.html +6 -20
  197. data/site-local/plugins/gcov/troubleshooting.html +10 -24
  198. data/site-local/plugins/index.html +6 -20
  199. data/site-local/plugins/module-generator.html +21 -35
  200. data/site-local/plugins/report-build-warnings-log.html +53 -67
  201. data/site-local/plugins/report-tests-gtestlike-stdout.html +6 -20
  202. data/site-local/plugins/report-tests-ide-stdout.html +43 -57
  203. data/site-local/plugins/report-tests-log-factory.html +50 -64
  204. data/site-local/plugins/report-tests-pretty-stdout.html +7 -21
  205. data/site-local/plugins/report-tests-raw-output-log.html +9 -21
  206. data/site-local/plugins/report-tests-teamcity-stdout.html +20 -31
  207. data/site-local/plugins/sanitize.html +56 -65
  208. data/site-local/plugins/valgrind.html +49 -58
  209. data/site-local/project/index.html +6 -20
  210. data/site-local/project/release-history.html +6 -20
  211. data/site-local/project/sbom.html +6 -20
  212. data/site-local/project/upgrade.html +9 -20
  213. data/site-local/reference/build-directives.html +6 -20
  214. data/site-local/reference/command-line.html +15 -22
  215. data/site-local/reference/environment-vars.html +6 -20
  216. data/site-local/reference/gcov-plugin.html +6 -20
  217. data/site-local/reference/global-collections.html +6 -20
  218. data/site-local/reference/index.html +6 -20
  219. data/site-local/reference/partials-macros.html +6 -20
  220. data/site-local/reference/project-configuration.html +6 -20
  221. data/site-local/sitemap.xml.gz +0 -0
  222. data/site-local/snapshot/examples/cipher_quest/index.html +16 -30
  223. data/site-local/snapshot/examples/temp_sensor/index.html +8 -22
  224. data/site-local/snapshot/examples/wondrous_forest/index.html +6 -20
  225. data/site-local/snapshot/plugins/bullseye/config/defaults_bullseye.rb +1 -1
  226. data/site-local/snapshot/plugins/gcov/config/defaults_gcov.rb +1 -1
  227. data/site-local/testing-guide/build-directives.html +14 -28
  228. data/site-local/testing-guide/conventions.html +66 -27
  229. data/site-local/testing-guide/frameworks.html +11 -25
  230. data/site-local/testing-guide/index.html +6 -20
  231. data/site-local/testing-guide/partials/configuration.html +8 -22
  232. data/site-local/testing-guide/partials/conventions.html +8 -22
  233. data/site-local/testing-guide/partials/directives.html +16 -30
  234. data/site-local/testing-guide/partials/example.html +14 -28
  235. data/site-local/testing-guide/partials/index.html +6 -20
  236. data/site-local/testing-guide/partials/overview.html +6 -20
  237. data/site-local/testing-guide/partials/variables.html +11 -25
  238. data/site-local/testing-guide/test-cases.html +13 -27
  239. data/site-local/testing-guide/test-sample.html +12 -26
  240. data/site-local/testing-guide/test-suite-anatomy.html +6 -20
  241. data/spec/integration/actionator_file_operations_spec.rb +91 -1
  242. data/spec/integration/compile_commands_json_db_spec.rb +1 -1
  243. data/spec/integration/configurator_pipeline_spec.rb +10 -0
  244. data/spec/integration/configurator_validation_spec.rb +1 -1
  245. data/spec/integration/dependencies/dependency_tracker_cache_hardening_spec.rb +26 -0
  246. data/spec/integration/dependencies/dependency_tracker_core_spec.rb +62 -0
  247. data/spec/integration/launcher_handoff_spec.rb +297 -0
  248. data/spec/integration/mixin_loading_spec.rb +1 -1
  249. data/spec/integration/module_generator_spec.rb +3 -3
  250. data/spec/integration/nested_test_artifacts_spec.rb +99 -0
  251. data/spec/integration/partials_module_resolution_spec.rb +7 -4
  252. data/spec/integration/path_intake_scenarios_spec.rb +101 -0
  253. data/spec/integration/path_scenarios_spec.rb +322 -0
  254. data/spec/integration/quote_include_isolator_spec.rb +1 -1
  255. data/spec/integration/rake_task_registry_plugins_spec.rb +95 -0
  256. data/spec/integration/report_build_warnings_log_spec.rb +1 -1
  257. data/spec/integration/report_tests_log_factory_spec.rb +1 -1
  258. data/spec/integration/test_executable_manifest_spec.rb +1 -1
  259. data/spec/integration/test_includes_extractinator_spec.rb +2 -1
  260. data/spec/integration/test_naming_spec.rb +198 -0
  261. data/spec/integration/test_source_file_checks_spec.rb +166 -0
  262. data/spec/integration/tool_validator_spec.rb +1 -1
  263. data/spec/integration/upgrade_docs_spec.rb +84 -0
  264. data/spec/integration/vendor_copy_transient_io_retry_spec.rb +192 -75
  265. data/spec/support/file_tree_helper.rb +88 -0
  266. data/spec/support/integration/configurator_integration_helper.rb +10 -7
  267. data/spec/support/integration/dependency_tracker_integration_helper.rb +1 -1
  268. data/spec/support/integration/partials_generation_integration_helper.rb +2 -2
  269. data/spec/support/integration/path_scenario_harness.rb +173 -0
  270. data/spec/support/integration/spec_integration_helper.rb +1 -1
  271. data/spec/support/integration/test_includes_harness.rb +13 -2
  272. data/spec/support/spec_helper.rb +2 -0
  273. data/spec/support/system/spec_system_helper.rb +7 -6
  274. data/spec/support/system/system_context.rb +21 -3
  275. data/spec/support/working_dir_tracking.rb +49 -0
  276. data/spec/system/build_output_mirroring_spec.rb +2 -2
  277. data/spec/system/conditional_mock_includes_spec.rb +1 -1
  278. data/spec/system/delta_builds_spec.rb +137 -11
  279. data/spec/system/gcov_deployment_spec.rb +1 -0
  280. data/spec/system/header_include_path_validation_spec.rb +4 -4
  281. data/spec/system/launcher_handoff_spec.rb +82 -0
  282. data/spec/system/mock_include_folders_spec.rb +91 -0
  283. data/spec/system/parent_directory_reference_spec.rb +5 -3
  284. data/spec/system/path_handling_probes_spec.rb +192 -0
  285. data/spec/system/preprocessing_parameterized_tests_spec.rb +1 -1
  286. data/spec/system/rake_release_task_path_disambiguation_spec.rb +6 -6
  287. data/spec/system/rake_test_task_path_disambiguation_spec.rb +85 -0
  288. data/spec/system/special_path_characters_spec.rb +86 -0
  289. data/spec/system/support/common_test_cases.rb +23 -21
  290. data/spec/system/support/gcov_common_test_cases.rb +37 -9
  291. data/spec/system/support/sanitize_common_test_cases.rb +2 -2
  292. data/spec/system/support/valgrind_common_test_cases.rb +12 -12
  293. data/spec/system/test_pipeline_stop_points_spec.rb +4 -4
  294. data/spec/system/test_runner_system_include_spec.rb +1 -1
  295. data/spec/system/test_source_file_directive_spec.rb +34 -5
  296. data/spec/units/bin/actionator_spec.rb +14 -17
  297. data/spec/units/bin/app_cfg_spec.rb +47 -0
  298. data/spec/units/bin/cli_handler_spec.rb +284 -7
  299. data/spec/units/bin/cli_helper_spec.rb +126 -45
  300. data/spec/units/bin/installation_selector_spec.rb +114 -0
  301. data/spec/units/bin/launchinator_spec.rb +171 -0
  302. data/spec/units/bin/path_validator_spec.rb +10 -0
  303. data/spec/units/bin/versionator_spec.rb +38 -6
  304. data/spec/units/build_log_writer_spec.rb +57 -0
  305. data/spec/units/config/build_root_policy_spec.rb +61 -0
  306. data/spec/units/config/configurator_builder_spec.rb +37 -6
  307. data/spec/units/config/configurator_paths_validator_spec.rb +292 -0
  308. data/spec/units/config/configurator_setup_spec.rb +65 -103
  309. data/spec/units/config/configurator_spec.rb +37 -6
  310. data/spec/units/config/configurator_validator_spec.rb +1 -172
  311. data/spec/units/default_tools_quoting_spec.rb +83 -0
  312. data/spec/units/dependencies/dependency_cache_store_spec.rb +33 -2
  313. data/spec/units/dependencies/dependency_debug_tree_spec.rb +1 -1
  314. data/spec/units/dependencies/dependency_hasher_spec.rb +42 -1
  315. data/spec/units/dependencies/dependency_path_normalizer_spec.rb +1 -1
  316. data/spec/units/dependencies/dependency_tracker_spec.rb +3 -1
  317. data/spec/units/filename_extension_spec.rb +11 -0
  318. data/spec/units/filesystem/build_subpath_spec.rb +122 -0
  319. data/spec/units/filesystem/destination_collision_spec.rb +30 -0
  320. data/spec/units/{file_finder_helper_spec.rb → filesystem/file_finder_helper_spec.rb} +46 -1
  321. data/spec/units/{file_finder_spec.rb → filesystem/file_finder_spec.rb} +188 -22
  322. data/spec/units/{file_path_collection_utils_spec.rb → filesystem/file_path_collection_utils_spec.rb} +181 -1
  323. data/spec/units/{file_path_utils_spec.rb → filesystem/file_path_utils_spec.rb} +204 -87
  324. data/spec/units/filesystem/file_system_wrapper_spec.rb +33 -0
  325. data/spec/units/filesystem/file_tree_spec.rb +511 -0
  326. data/spec/units/filesystem/file_tree_windows_spec.rb +78 -0
  327. data/spec/units/{file_wrapper_spec.rb → filesystem/file_wrapper_spec.rb} +154 -32
  328. data/spec/units/{path_matcher_spec.rb → filesystem/path_matcher_spec.rb} +12 -1
  329. data/spec/units/{path_mirror_spec.rb → filesystem/path_mirror_spec.rb} +32 -4
  330. data/spec/units/filesystem/project_paths_spec.rb +147 -0
  331. data/spec/units/filesystem/working_dir_spec.rb +71 -0
  332. data/spec/units/generators/generator_spec.rb +12 -6
  333. data/spec/units/generators/generator_test_results_backtrace_spec.rb +50 -46
  334. data/spec/units/generators/generator_test_results_spec.rb +1 -1
  335. data/spec/units/handoff_spec.rb +205 -0
  336. data/spec/units/includes/include_factory_spec.rb +3 -3
  337. data/spec/units/includes/include_pathinator_spec.rb +46 -0
  338. data/spec/units/installation_spec.rb +228 -0
  339. data/spec/units/library_resolver_spec.rb +157 -0
  340. data/spec/units/mock_locator_spec.rb +76 -1
  341. data/spec/units/partials/partializer_config_spec.rb +7 -0
  342. data/spec/units/partials/partializer_spec.rb +1 -0
  343. data/spec/units/partials_manager_spec.rb +17 -0
  344. data/spec/units/plugins/bullseye_spec.rb +15 -2
  345. data/spec/units/plugins/console_reportinator_spec.rb +18 -20
  346. data/spec/units/plugins/dependencies_spec.rb +33 -7
  347. data/spec/units/plugins/dependency_spec_spec.rb +17 -0
  348. data/spec/units/plugins/gcov_spec.rb +28 -3
  349. data/spec/units/plugins/gcovr_reportinator_spec.rb +19 -47
  350. data/spec/units/plugins/gcovr_thresholds_spec.rb +95 -0
  351. data/spec/units/plugins/module_generator_spec.rb +5 -5
  352. data/spec/units/plugins/report_build_warnings_log_spec.rb +3 -3
  353. data/spec/units/plugins/report_log_writer_plugin_spec.rb +10 -1
  354. data/spec/units/plugins/report_tests_raw_output_log_spec.rb +13 -2
  355. data/spec/units/plugins/report_tests_teamcity_stdout_spec.rb +77 -3
  356. data/spec/units/plugins/reportgenerator_reportinator_spec.rb +1 -1
  357. data/spec/units/plugins/sanitize_records_spec.rb +3 -1
  358. data/spec/units/plugins/sanitize_spec.rb +1 -1
  359. data/spec/units/plugins/valgrind_spec.rb +23 -8
  360. data/spec/units/preprocess/preprocessinator_comment_stripper_spec.rb +1 -1
  361. data/spec/units/rake_app/rakefile_component_resolver_spec.rb +21 -0
  362. data/spec/units/rake_app/test_task_name_spec.rb +47 -0
  363. data/spec/units/release_build_executor_spec.rb +53 -14
  364. data/spec/units/release_build_planner_spec.rb +15 -3
  365. data/spec/units/reportinator_spec.rb +5 -5
  366. data/spec/units/standin_headerinator_spec.rb +31 -1
  367. data/spec/units/test_build_executor_spec.rb +107 -5
  368. data/spec/units/test_build_planner_spec.rb +104 -2
  369. data/spec/units/test_build_setup_spec.rb +96 -12
  370. data/spec/units/test_context_extractor_spec.rb +25 -0
  371. data/spec/units/test_file_preprocessinator_spec.rb +17 -1
  372. data/spec/units/test_includes_extractinator_spec.rb +5 -1
  373. data/spec/units/test_invoker/objects_wiring_spec.rb +6 -3
  374. data/spec/units/test_invoker_spec.rb +14 -1
  375. data/spec/units/test_source_file_directive_resolver_spec.rb +38 -7
  376. data/spec/units/tool_executor_spec.rb +26 -0
  377. data/spec/units/yaml_wrapper_spec.rb +11 -0
  378. metadata +122 -33
  379. data/lib/ceedling/file_path_collection_utils.rb +0 -164
  380. data/site-local/assets/stylesheets/main.ec1eaa64.min.css +0 -1
  381. data/site-local/assets/stylesheets/main.ec1eaa64.min.css.map +0 -1
  382. data/site-local/assets/stylesheets/palette.ab4e12ef.min.css +0 -1
  383. data/site-local/assets/stylesheets/palette.ab4e12ef.min.css.map +0 -1
@@ -0,0 +1,297 @@
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
+ # GH #1365: a launcher ran another installation's application inside its own process,
9
+ # so the application ran on a mix of both installations' code. Each command must now
10
+ # run whole in the installation it selects.
11
+ #
12
+ # The second installation is real: `new --local` vendors this repository into a
13
+ # project, and the copy gains the assets and examples a vendored copy leaves out, so
14
+ # it can also run `new` and `examples`. Two markers make it distinguishable from the
15
+ # launcher:
16
+ # - Its lib/version.rb reports 9.9.9.
17
+ # - Its bin/ceedling reports, on exit, how many of the launcher's own files its
18
+ # process loaded. A whole hand-off loads none.
19
+ #
20
+ # Every command here stops short of compiling, so no toolchain is needed.
21
+
22
+ require 'spec_helper'
23
+ require 'tmpdir'
24
+ require 'fileutils'
25
+ require 'open3'
26
+ require 'rbconfig'
27
+ require 'yaml'
28
+ require 'ceedling/installation'
29
+
30
+ describe 'Launcher hand-off' do
31
+ REPO_ROOT = File.expand_path( '../..', __dir__ )
32
+ LAUNCHER_VERSION = Installation.new( REPO_ROOT ).version
33
+
34
+ # Registered as the copy's launcher starts, so it reports on every exit, failures
35
+ # included. It prints to stderr, so `dumpconfig --stdout` output stays pure YAML.
36
+ MARKER = <<~RUBY
37
+ at_exit {
38
+ launcher_files = $LOADED_FEATURES.count { |f| f.start_with?( '%<lib>s' ) or f.start_with?( '%<bin>s' ) }
39
+ $stderr.puts( "LAUNCHER FILES LOADED: \#{launcher_files}" )
40
+ }
41
+ RUBY
42
+
43
+ def ceedling(*args, env: {}, dir: @project)
44
+ stdout, stderr, status = Open3.capture3(
45
+ {'CEEDLING_DECORATORS' => 'false'}.merge( env ),
46
+ RbConfig.ruby, File.join( REPO_ROOT, 'bin', 'ceedling' ), *args,
47
+ chdir: dir
48
+ )
49
+ return stdout, stderr, status
50
+ end
51
+
52
+ # The copy ran its own command, loading none of the launcher's files
53
+ def expect_copy_ran(stderr)
54
+ expect(stderr).to include( 'LAUNCHER FILES LOADED: 0' )
55
+ end
56
+
57
+ before(:all) do
58
+ @tmp = Dir.mktmpdir( 'handoff' )
59
+ _, stderr, status = ceedling( 'new', '--local', 'proj', dir: @tmp )
60
+ raise "Could not create a vendored project:\n#{stderr}" unless status.success?
61
+
62
+ @project = File.join( @tmp, 'proj' )
63
+ @copy = File.join( @project, 'vendor', 'ceedling' )
64
+
65
+ version_rb = File.join( @copy, 'lib', 'version.rb' )
66
+ File.write( version_rb, File.read( version_rb ).sub( /BASE = '[^']+'/, "BASE = '9.9.9'" ) )
67
+ marker = format( MARKER, lib: File.join( REPO_ROOT, 'lib', 'ceedling' ), bin: File.join( REPO_ROOT, 'bin' ) )
68
+ launcher = File.join( @copy, 'bin', 'ceedling' )
69
+ shebang, rest = File.read( launcher ).split( "\n", 2 )
70
+ File.write( launcher, [shebang, marker, rest].join( "\n" ) )
71
+
72
+ ['assets', 'examples'].each { |dir| FileUtils.cp_r( File.join( REPO_ROOT, dir ), @copy ) }
73
+
74
+ @copy_version = Installation.new( @copy ).version
75
+ end
76
+
77
+ after(:all) do
78
+ FileUtils.rm_rf( @tmp )
79
+ end
80
+
81
+ it 'gives the copy a distinct version' do
82
+ expect(@copy_version).to eq( '9.9.9.dev' )
83
+ expect(@copy_version).to_not eq( LAUNCHER_VERSION )
84
+ end
85
+
86
+ describe '`version`' do
87
+ it 'reports both installations for a project whose :which_ceedling selects the copy' do
88
+ stdout, _, status = ceedling( 'version' )
89
+
90
+ expect(status.exitstatus).to eq( 0 )
91
+ expect(stdout).to include( "Ceedling Launcher => #{LAUNCHER_VERSION}" )
92
+ expect(stdout).to include( "Ceedling App => #{@copy_version}" )
93
+ end
94
+
95
+ it 'reports the copy that WHICH_CEEDLING selects, with no project' do
96
+ stdout, _, _ = ceedling( 'version', env: {'WHICH_CEEDLING' => @copy}, dir: @tmp )
97
+
98
+ expect(stdout).to include( "Ceedling App => #{@copy_version}" )
99
+ end
100
+
101
+ it 'reports the copy that a project named with --project selects, from elsewhere' do
102
+ Dir.mktmpdir do |elsewhere|
103
+ # :which_ceedling resolves against the working directory, so name the copy absolutely
104
+ mixin = File.join( elsewhere, 'which.yml' )
105
+ File.write( mixin, {:project => {:which_ceedling => @copy}}.to_yaml )
106
+
107
+ stdout, _, _ = ceedling( 'version', '--project', File.join( @project, 'project.yml' ), '--mixin', mixin, dir: elsewhere )
108
+
109
+ expect(stdout).to include( "Ceedling App => #{@copy_version}" )
110
+ end
111
+ end
112
+
113
+ it 'never hands off' do
114
+ _, stderr, _ = ceedling( 'version' )
115
+
116
+ expect(stderr).to_not include( 'LAUNCHER FILES LOADED' )
117
+ end
118
+ end
119
+
120
+ describe 'project commands' do
121
+ it '`check` runs in the copy, with notices from both sides naming both versions' do
122
+ stdout, stderr, status = ceedling( 'check' )
123
+
124
+ expect(status.exitstatus).to eq( 0 ), stdout + stderr
125
+ expect_copy_ran( stderr )
126
+ expect(stdout).to include( "Ceedling launcher #{LAUNCHER_VERSION} at #{REPO_ROOT}/ is handing off to Ceedling #{@copy_version} at #{File.realpath( @copy )}/" ).or(
127
+ include( "Ceedling launcher #{LAUNCHER_VERSION} at #{REPO_ROOT}/ is handing off to Ceedling #{@copy_version} at #{@copy}/" )
128
+ )
129
+ expect(stdout).to match( /Ceedling #{Regexp.escape( @copy_version )} at .+ is now running, launched from Ceedling #{Regexp.escape( LAUNCHER_VERSION )} at #{Regexp.escape( REPO_ROOT )}\// )
130
+ end
131
+
132
+ ['environment', 'help', '-T'].each do |command|
133
+ it "`#{command}` runs in the copy" do
134
+ stdout, stderr, status = ceedling( command )
135
+
136
+ expect(status.exitstatus).to eq( 0 ), stdout + stderr
137
+ expect_copy_ran( stderr )
138
+ end
139
+ end
140
+
141
+ it '`help` shows the copy\'s version in its footer' do
142
+ stdout, _, _ = ceedling( 'help' )
143
+
144
+ expect(stdout).to include( "Ceedling Packet User Manual (v#{@copy_version})" )
145
+ end
146
+
147
+ it '`dumpconfig --stdout` runs in the copy and writes nothing but YAML to stdout' do
148
+ stdout, stderr, status = ceedling( 'dumpconfig', '--stdout' )
149
+
150
+ expect(status.exitstatus).to eq( 0 ), stdout + stderr
151
+ expect_copy_ran( stderr )
152
+ expect(YAML.safe_load( stdout, permitted_classes: [Symbol] )).to include( :project )
153
+ end
154
+
155
+ it '`dumpconfig --no-app` runs in the copy' do
156
+ _, stderr, status = ceedling( 'dumpconfig', '--no-app', File.join( @tmp, 'dump.yml' ) )
157
+
158
+ expect(status.exitstatus).to eq( 0 ), stderr
159
+ expect_copy_ran( stderr )
160
+ end
161
+
162
+ it 'exits with the copy\'s failing status' do
163
+ Dir.mktmpdir do |mixins|
164
+ bad = File.join( mixins, 'bad.yml' )
165
+ File.write( bad, {:plugins => {:enabled => ['no_such_plugin']}}.to_yaml )
166
+
167
+ _, stderr, status = ceedling( 'check', '--mixin', bad )
168
+
169
+ expect(status.exitstatus).to eq( 1 )
170
+ expect_copy_ran( stderr )
171
+ end
172
+ end
173
+ end
174
+
175
+ describe 'commands without a project' do
176
+ it '`new` runs in the copy WHICH_CEEDLING selects, which vendors itself' do
177
+ Dir.mktmpdir do |dir|
178
+ _, stderr, status = ceedling( 'new', '--local', 'other', env: {'WHICH_CEEDLING' => @copy}, dir: dir )
179
+
180
+ expect(status.exitstatus).to eq( 0 ), stderr
181
+ expect_copy_ran( stderr )
182
+ expect(Installation.new( File.join( dir, 'other', 'vendor', 'ceedling' ) ).version).to eq( @copy_version )
183
+ expect(File.read( File.join( dir, 'other', 'project.yml' ) )).to include( ":ceedling_version: #{@copy_version}" )
184
+ end
185
+ end
186
+
187
+ it '`examples` runs in the copy WHICH_CEEDLING selects' do
188
+ Dir.mktmpdir do |dir|
189
+ _, stderr, _ = ceedling( 'examples', env: {'WHICH_CEEDLING' => @copy}, dir: dir )
190
+
191
+ expect_copy_ran( stderr )
192
+ end
193
+ end
194
+
195
+ it '`docs` exports the launcher\'s documentation, saying so, since the copy holds none' do
196
+ Dir.mktmpdir do |dir|
197
+ stdout, stderr, status = ceedling( 'docs', 'out', env: {'WHICH_CEEDLING' => @copy}, dir: dir )
198
+
199
+ expect(status.exitstatus).to eq( 0 ), stdout + stderr
200
+ expect(stderr).to_not include( 'LAUNCHER FILES LOADED' )
201
+ expect(stdout).to include( "Ceedling #{@copy_version} at" )
202
+ expect(stdout).to include( "Exporting the documentation of Ceedling launcher #{LAUNCHER_VERSION} at #{REPO_ROOT}/ instead." )
203
+ end
204
+ end
205
+ end
206
+
207
+ describe '`upgrade`' do
208
+ it 'refuses to re-vendor a project from its own vendored copy' do
209
+ stdout, stderr, status = ceedling( 'upgrade', '.', env: {'WHICH_CEEDLING' => 'vendor/ceedling'} )
210
+
211
+ expect(status.exitstatus).to eq( 1 )
212
+ expect(stdout + stderr).to include( 'from itself' )
213
+ expect(File.directory?( @copy )).to be( true )
214
+ end
215
+ end
216
+
217
+ # A launcher before 1.2.2 loads the application into its own process. The application
218
+ # finishes the hand-off itself.
219
+ describe 'an application loaded into an older launcher\'s process' do
220
+ # Stands in for every 1.x launcher before 1.2.2: it builds its bin/ objects before
221
+ # Thor consumes ARGV, hands them over in CEEDLING_HANDOFF_OBJECTS, and requires the
222
+ # application's rakefile. Docker runs the real 1.0.0 through 1.2.1 launchers.
223
+ OLD_LAUNCHER = <<~RUBY
224
+ repo, app = ARGV.shift( 2 )
225
+ $LOAD_PATH.unshift( File.join( repo, 'bin' ) )
226
+ require 'app_cfg'
227
+ CEEDLING_APPCFG = CeedlingAppConfig.new
228
+ lib = CEEDLING_APPCFG[:ceedling_lib_path]
229
+ $LOAD_PATH.unshift( CEEDLING_APPCFG[:ceedling_lib_base_path], lib, File.join( lib, 'config' ), File.join( lib, 'filesystem' ),
230
+ File.join( lib, 'rake_app' ), File.join( CEEDLING_APPCFG[:ceedling_vendor_path], 'diy', 'lib' ) )
231
+ require 'constructor'
232
+ require 'ceedling/constants'
233
+ require 'diy'
234
+ objects = DIY::Context.from_yaml( File.read( File.join( repo, 'bin', 'objects.yml' ) ) )
235
+ objects.build_everything
236
+ CEEDLING_HANDOFF_OBJECTS = [:rake_task_registry, :reportinator, :loginator, :file_wrapper, :yaml_wrapper,
237
+ :ruby_expandinator, :config_walkinator, :system_wrapper, :verbosinator].to_h { |n| [n, objects[n]] }
238
+ def boom_handler(_loginator, exception) = $stderr.puts( exception.message )
239
+ objects[:cli_helper].set_verbosity( Verbosity::NORMAL )
240
+ CEEDLING_APPCFG.set_paths( app )
241
+ require CEEDLING_APPCFG[:ceedling_rakefile_filepath]
242
+ RUBY
243
+
244
+ it 'restarts in its own process, with the original command line, saying so on both sides' do
245
+ script = File.join( @tmp, 'old_launcher.rb' )
246
+ File.write( script, OLD_LAUNCHER )
247
+
248
+ stdout, stderr, status = Open3.capture3(
249
+ {'CEEDLING_DECORATORS' => 'false'}, RbConfig.ruby, script, REPO_ROOT, @copy, 'check', chdir: @project
250
+ )
251
+
252
+ expect(status.exitstatus).to eq( 0 ), stdout + stderr
253
+ expect_copy_ran( stderr )
254
+ expect(stdout).to include( "Ceedling launcher #{LAUNCHER_VERSION} at #{REPO_ROOT}/ loaded Ceedling #{@copy_version}" )
255
+ expect(stdout).to include( "Restarting in Ceedling #{@copy_version}'s own process." )
256
+ expect(stdout).to include( 'Project configuration processed.' )
257
+ end
258
+
259
+ it 'warns and continues in that process when a hand-off already brought it there' do
260
+ stdout, stderr, status = ceedling(
261
+ 'check', env: {'CEEDLING_HANDOFF_LAUNCHER' => '/elsewhere', 'CEEDLING_HANDOFF_TARGET' => REPO_ROOT}
262
+ )
263
+
264
+ expect(status.exitstatus).to eq( 0 ), stdout + stderr
265
+ expect(stderr).to_not include( 'LAUNCHER FILES LOADED' )
266
+ expect(stdout).to include( "Ceedling #{LAUNCHER_VERSION} at #{REPO_ROOT}/ is now running, launched from Ceedling at #{File.expand_path( '/elsewhere' )}/." )
267
+ expect(stdout).to include( "loaded Ceedling #{@copy_version}" )
268
+ expect(stdout).to include( "Continuing in the launcher's process" )
269
+ end
270
+ end
271
+
272
+ describe 'the vendored copy' do
273
+ it 'runs on its own, holding the built-in mixins its launcher validates' do
274
+ stdout, stderr, status = Open3.capture3(
275
+ {'CEEDLING_DECORATORS' => 'false'}, RbConfig.ruby, File.join( @copy, 'bin', 'ceedling' ), 'check', chdir: @project
276
+ )
277
+
278
+ expect(status.exitstatus).to eq( 0 ), stdout + stderr
279
+ expect(File.directory?( File.join( @copy, Installation::BUILTIN_MIXINS_DIR ) )).to be( true )
280
+ end
281
+
282
+ # Windows has ceedling.cmd, whose %* passes the command tail intact
283
+ it 'takes arguments through its ./ceedling launch script exactly as typed', unless: Installation.windows? do
284
+ Dir.mktmpdir do |dir|
285
+ dump = File.join( dir, 'dump with spaces.yml' )
286
+
287
+ stdout, stderr, status = Open3.capture3(
288
+ {'CEEDLING_DECORATORS' => 'false'}, './ceedling', 'dumpconfig', '--no-app', '--mixin', "=:project:\n :name: Two Words", dump,
289
+ chdir: @project
290
+ )
291
+
292
+ expect(status.exitstatus).to eq( 0 ), stdout + stderr
293
+ expect(YAML.safe_load_file( dump, permitted_classes: [Symbol] )[:project][:name]).to eq( 'Two Words' )
294
+ end
295
+ end
296
+ end
297
+ end
@@ -50,7 +50,7 @@ require 'spec_helper'
50
50
  require 'tmpdir'
51
51
  require 'fileutils'
52
52
  require 'ceedling/constants'
53
- require 'ceedling/file_wrapper'
53
+ require 'ceedling/filesystem/file_wrapper'
54
54
  require 'ceedling/yaml_wrapper'
55
55
  require 'ceedling/ruby_expandinator'
56
56
  require 'ceedling/reportinator'
@@ -21,8 +21,8 @@ require 'yaml' # a Ceedling build always has YAML loaded
21
21
  require 'ceedling/constants'
22
22
  require 'ceedling/exceptions'
23
23
  require 'ceedling/plugins/plugin'
24
- require 'ceedling/file_finder_helper'
25
- require 'ceedling/file_wrapper'
24
+ require 'ceedling/filesystem/file_finder_helper'
25
+ require 'ceedling/filesystem/file_wrapper'
26
26
  require 'ceedling/config/config_matchinator'
27
27
  require 'ceedling/defineinator'
28
28
 
@@ -249,7 +249,7 @@ describe 'Module Generator plugin (integration)' do
249
249
  File.write( 'src/old/a_file.c', '' )
250
250
  plugin = plugin_for( config )
251
251
  loginator = plugin.instance_variable_get( :@ceedling )[:loginator]
252
- expect(loginator).to receive(:log).with( /`src\/a_file.c`.*`src\/old\/a_file.c`/, anything, anything )
252
+ expect(loginator).to receive(:log).with( /`src\/a_file.c`.*`src\/old\/a_file.c`/, Verbosity::COMPLAIN )
253
253
 
254
254
  capture_stdout { plugin.create( ModuleGeneratorRequest.new( name: 'a_file' ) ) }
255
255
 
@@ -0,0 +1,99 @@
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
+ # Per-test logs placed by a test's name, written with real file I/O in a temporary project.
9
+ # A test's name is its path from the project root, so its logs sit in subdirectories that
10
+ # must exist before anything writes there (GH #1364). Same-named tests keep separate gdb
11
+ # logs, each holding only its latest build's crash.
12
+
13
+ require 'spec_helper'
14
+ require 'tmpdir'
15
+ require 'ceedling/constants'
16
+ require 'ceedling/plugins/plugin'
17
+ require 'ceedling/filesystem/file_wrapper'
18
+ require 'ceedling/filesystem/file_path_utils'
19
+ require 'ceedling/build_log_writer'
20
+
21
+ $LOAD_PATH.unshift( File.expand_path( '../../plugins/report_tests_raw_output_log/lib', __dir__ ) )
22
+ $LOAD_PATH.unshift( File.expand_path( '../../plugins/valgrind/lib', __dir__ ) )
23
+
24
+ # Ceedling runtime path constants the plugins need at require time
25
+ PROJECT_BUILD_ROOT = 'build' unless defined?(PROJECT_BUILD_ROOT)
26
+ PROJECT_BUILD_ARTIFACTS_ROOT = 'artifacts' unless defined?(PROJECT_BUILD_ARTIFACTS_ROOT)
27
+ PROJECT_TEST_RESULTS_PATH = 'build/test/results' unless defined?(PROJECT_TEST_RESULTS_PATH)
28
+
29
+ require 'report_tests_raw_output_log'
30
+ require 'valgrind'
31
+
32
+ describe 'Per-test logs of nested tests (integration)' do
33
+ let(:loginator) { double( 'loginator', log: nil ) }
34
+ let(:file_wrapper) { FileWrapper.new( { loginator: loginator, verbosinator: double( 'verbosinator', should_output?: false ) } ) }
35
+
36
+ def in_project
37
+ Dir.mktmpdir( 'nested' ) do |root|
38
+ Dir.chdir( root ) do
39
+ stub_const( 'PROJECT_BUILD_ARTIFACTS_ROOT', 'build/artifacts' )
40
+ stub_const( 'VALGRIND_ARTIFACTS_PATH', 'build/artifacts/valgrind' )
41
+ yield
42
+ end
43
+ end
44
+ end
45
+
46
+ it 'writes the raw-output log of a test below its root' do
47
+ in_project do
48
+ objects = { file_wrapper: file_wrapper, loginator: loginator, reportinator: double( 'reportinator', generate_heading: '', generate_progress: '' ) }
49
+ plugin = ReportTestsRawOutputLog.new( objects, 'report_tests_raw_output_log', '/plugins/report_tests_raw_output_log' )
50
+
51
+ plugin.post_test_fixture_execute( context: :test, test_name: 'test/unit/test_calc', shell_result: { output: "hello\n" } )
52
+ plugin.post_build( 0 )
53
+
54
+ expect( File.read( 'build/artifacts/test/test/unit/test_calc.raw.log' ) ).to include( 'hello' )
55
+ end
56
+ end
57
+
58
+ # Valgrind writes its own report at the --log-file path a build hands it
59
+ it "reads the Valgrind report of a test below its root" do
60
+ in_project do
61
+ stub_const( 'TOOLS_VALGRIND', { name: 'valgrind', executable: 'valgrind', arguments: [] } )
62
+ valgrind = Valgrind.allocate
63
+ {
64
+ configurator: double( 'configurator', project_config_hash: {} ), loginator: loginator, file_wrapper: file_wrapper,
65
+ dependinator: double( 'dependinator', register: nil ), mutex: Mutex.new, result_list: [], memory_errors: 0,
66
+ tests_processed: 0, reports_read: 0, explained: []
67
+ }.each { |name, value| valgrind.instance_variable_set( "@#{name}", value ) }
68
+
69
+ arg_hash = { context: VALGRIND_SYM, test_name: 'test/unit/test_calc', target: 'build/valgrind/out/test/unit/test_calc/test_calc.out', tool: {} }
70
+ valgrind.pre_test_fixture_register( arg_hash )
71
+
72
+ report = arg_hash[:tool][:arguments].find { |argument| argument.start_with?( '--log-file=' ) }[/"(.+)"/, 1]
73
+ File.write( report, "==1== ERROR SUMMARY: 2 errors from 2 contexts\n" )
74
+
75
+ valgrind.post_test_fixture_execute( context: VALGRIND_SYM, test_name: 'test/unit/test_calc', result_file: 'test_calc.pass' )
76
+
77
+ expect( report ).to eq( 'build/artifacts/valgrind/test/unit/test_calc.log' )
78
+ expect( valgrind.instance_variable_get( :@reports_read ) ).to eq( 1 )
79
+ expect( valgrind.instance_variable_get( :@memory_errors ) ).to eq( 2 )
80
+ end
81
+ end
82
+
83
+ it 'keeps the gdb logs of same-named tests apart, each holding only the latest build' do
84
+ in_project do
85
+ paths = FilePathUtils.new( configurator: double( 'configurator', project_log_path: 'build/logs' ), file_wrapper: file_wrapper )
86
+ logs = ['test/a/test_crash', 'test/b/test_crash'].map { |name| paths.form_test_gdb_log( name, context: :test, name: 'test_boom' ) }
87
+
88
+ 2.times do |build|
89
+ writer = BuildLogWriter.new( file_wrapper: file_wrapper )
90
+ logs.each { |log| writer.write( log, "=== test_boom ===\nbuild #{build} #{log}\n" ) }
91
+ end
92
+
93
+ expect( logs.uniq.size ).to eq( 2 )
94
+ logs.each do |log|
95
+ expect( File.read( log ) ).to eq( "=== test_boom ===\nbuild 1 #{log}\n" )
96
+ end
97
+ end
98
+ end
99
+ end
@@ -20,11 +20,11 @@
20
20
  # sharing a basename in different directories.
21
21
 
22
22
  require 'spec_helper'
23
- require 'ceedling/file_finder'
24
- require 'ceedling/file_finder_helper'
23
+ require 'ceedling/filesystem/file_finder'
24
+ require 'ceedling/filesystem/file_finder_helper'
25
25
  require 'ceedling/filename_extension'
26
- require 'ceedling/path_matcher'
27
- require 'ceedling/file_path_utils'
26
+ require 'ceedling/filesystem/path_matcher'
27
+ require 'ceedling/filesystem/file_path_utils'
28
28
  require 'ceedling/constants'
29
29
 
30
30
  describe 'Partial module resolution (integration)' do
@@ -50,6 +50,7 @@ describe 'Partial module resolution (integration)' do
50
50
  allow(@configurator).to receive(:extension_source).and_return( FilenameExtension.new('.c') )
51
51
  allow(@configurator).to receive(:collection_all_headers).and_return( RESOLUTION_HEADERS )
52
52
  allow(@configurator).to receive(:collection_all_source).and_return( RESOLUTION_SOURCES )
53
+ allow(@configurator).to receive(:collection_all_tests).and_return( [] )
53
54
 
54
55
  @finder = FileFinder.new({
55
56
  :configurator => @configurator,
@@ -134,6 +135,8 @@ describe 'Partial module resolution (integration)' do
134
135
  before(:each) do
135
136
  allow(@configurator).to receive(:project_build_root).and_return('build')
136
137
  allow(@configurator).to receive(:paths_include).and_return( ['include/**'] )
138
+ allow(@configurator).to receive(:collection_mirror_roots_include).and_return( ['include'] )
139
+ allow(@configurator).to receive(:collection_mirror_roots_headers).and_return( ['include'] )
137
140
  allow(@configurator).to receive(:paths_source).and_return( ['src/**'] )
138
141
  allow(@configurator).to receive(:paths_support).and_return( [] )
139
142
  allow(@configurator).to receive(:release_build_use_assembly).and_return( false )
@@ -0,0 +1,101 @@
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
+ # How configuration takes in the paths a project file names, before any build: where each
9
+ # lands, and which a build can't use safely. Each example names the gap it probes (the path
10
+ # handling audit around GH #1370). Where the right behavior is a policy still to be chosen,
11
+ # the example states the one it assumes.
12
+
13
+ require 'spec_helper'
14
+ require 'configurator_integration_helper'
15
+
16
+ describe 'Path intake (integration)' do
17
+ include ConfiguratorIntegrationHelpers
18
+
19
+ def yaml(project: {}, paths: {}, extra: '')
20
+ project_lines = { build_root: 'build' }.merge( project ).map { |key, value| " :#{key}: #{value.inspect}" }.join( "\n" )
21
+ path_lines = { test: ['test/**'], source: ['src/**'], include: ['src/**'] }.merge( paths ).map { |key, value| " :#{key}: #{value.inspect}" }.join( "\n" )
22
+ return ":project:\n#{project_lines}\n :use_test_preprocessor: :none\n:paths:\n#{path_lines}\n#{extra}"
23
+ end
24
+
25
+ # Clobber empties the build root's test and release trees, so a build root holding the
26
+ # whole project is refused. An empty build root is left to the unit specs: it names the
27
+ # filesystem root, where a configuration that got past it would create directories.
28
+ { '.' => 'the project directory', '..' => 'a directory above the project' }.each do |root, what|
29
+ it "G16: refuses a build root that is #{what}" do
30
+ in_temp_project( minimal_project_files ) do
31
+ expect { configure( yaml( project: { build_root: root } ) ) }.to raise_error( CeedlingException )
32
+ expect(logged.join( "\n" )).to match( /build_root.*'#{Regexp.escape( root )}'/ )
33
+ end
34
+ end
35
+ end
36
+
37
+ it 'G16: accepts a build root beside the project\'s own directories' do
38
+ in_temp_project( minimal_project_files ) do
39
+ expect { configure( yaml( project: { build_root: 'out/build' } ) ) }.to_not raise_error
40
+ end
41
+ end
42
+
43
+ it 'G16: accepts a build root holding sources, warning of the entry' do
44
+ in_temp_project( minimal_project_files ) do
45
+ expect { configure( yaml( project: { build_root: 'src' } ) ) }.to_not raise_error
46
+ expect(logged.join( "\n" )).to match( %r{:paths ↳ :source => 'src/\*\*' lies in the build root 'src'} )
47
+ end
48
+ end
49
+
50
+ # A `-:` entry names what a build leaves out, and nothing there to leave out is no error.
51
+ # Below the build root, where nothing exists before a first build, it is not worth a word.
52
+ it 'G24: accepts a `-:` path below the build root that names nothing, silently' do
53
+ in_temp_project( minimal_project_files ) do
54
+ configure( yaml( paths: { include: ['src/**', '-:build/gen'] } ) )
55
+
56
+ expect(logged.join( "\n" )).to_not match( %r{build/gen} )
57
+ end
58
+ end
59
+
60
+ it 'G24: accepts a `-:` path elsewhere that names nothing, warning of it' do
61
+ in_temp_project( minimal_project_files ) do
62
+ configure( yaml( paths: { include: ['src/**', '-:src/gone'] } ) )
63
+
64
+ expect(logged.join( "\n" )).to match( %r{'-:src/gone' leaves out nothing} )
65
+ end
66
+ end
67
+
68
+ it "G18: includes a Unity helper written with backslashes in every mock by its own filename" do
69
+ files = minimal_project_files.merge( 'test/support/helper.h' => "\n" )
70
+ in_temp_project( files ) do
71
+ config = configure( yaml( extra: ":cmock:\n :unity_helper_path: 'test\\support\\helper.h'\n" ) )[:configurator]
72
+
73
+ expect(config.cmock_includes).to include( 'helper.h' )
74
+ end
75
+ end
76
+
77
+ # Assumes an absolute release output names the release itself
78
+ it 'G19: places a release named by an absolute :output where it names' do
79
+ in_temp_project( minimal_project_files ) do |dir|
80
+ output = File.join( File.realpath( dir ), 'out', 'app.elf' )
81
+ config = configure( yaml( project: { release_build: true }, extra: ":release_build:\n :output: #{output}\n" ) )[:configurator]
82
+
83
+ expect(config.project_release_build_target).to eq( output )
84
+ end
85
+ end
86
+
87
+ # Assumes `~` means the home directory, as it does in a shell
88
+ it 'G21: reads a `~` path as below the home directory' do
89
+ in_temp_project( minimal_project_files.merge( 'home/inc/extra.h' => "\n" ) ) do |dir|
90
+ home = ENV['HOME']
91
+ begin
92
+ ENV['HOME'] = File.join( File.realpath( dir ), 'home' )
93
+ config = configure( yaml( paths: { include: ['src/**', '~/inc'] } ) )[:configurator]
94
+
95
+ expect(config.collection_all_headers.map { |header| File.basename( header ) }).to include( 'extra.h' )
96
+ ensure
97
+ ENV['HOME'] = home
98
+ end
99
+ end
100
+ end
101
+ end