ceedling 1.2.1 → 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 (276) hide show
  1. checksums.yaml +4 -4
  2. data/GIT_COMMIT_SHA +1 -1
  3. data/README.md +11 -9
  4. data/Rakefile +2 -1
  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 +14 -1
  10. data/bin/ceedling +13 -3
  11. data/bin/cli.rb +25 -6
  12. data/bin/cli_handler.rb +113 -73
  13. data/bin/cli_helper.rb +51 -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 +74 -3
  23. data/docs/KnownIssues.md +90 -4
  24. data/docs/ReleaseNotes.md +13 -0
  25. data/lib/ceedling/build_log_writer.rb +33 -0
  26. data/lib/ceedling/config/build_root_policy.rb +70 -0
  27. data/lib/ceedling/config/configurator.rb +14 -16
  28. data/lib/ceedling/config/configurator_builder.rb +58 -28
  29. data/lib/ceedling/config/configurator_paths_validator.rb +179 -0
  30. data/lib/ceedling/config/configurator_plugins.rb +1 -1
  31. data/lib/ceedling/config/configurator_setup.rb +15 -28
  32. data/lib/ceedling/config/configurator_validator.rb +1 -110
  33. data/lib/ceedling/defaults.rb +4 -4
  34. data/lib/ceedling/dependencies/README.md +18 -16
  35. data/lib/ceedling/dependencies/dependency_cache_store.rb +20 -3
  36. data/lib/ceedling/dependencies/dependency_hasher.rb +35 -1
  37. data/lib/ceedling/filename_extension.rb +7 -1
  38. data/lib/ceedling/filesystem/FILE_TREE.md +253 -0
  39. data/lib/ceedling/filesystem/PATH_HANDLING.md +304 -0
  40. data/lib/ceedling/filesystem/README.md +41 -0
  41. data/lib/ceedling/filesystem/build_subpath.rb +102 -0
  42. data/lib/ceedling/filesystem/destination_collision.rb +25 -0
  43. data/lib/ceedling/{file_finder.rb → filesystem/file_finder.rb} +159 -104
  44. data/lib/ceedling/{file_finder_helper.rb → filesystem/file_finder_helper.rb} +36 -31
  45. data/lib/ceedling/filesystem/file_path_collection_utils.rb +183 -0
  46. data/lib/ceedling/{file_path_utils.rb → filesystem/file_path_utils.rb} +108 -97
  47. data/lib/ceedling/{file_system_wrapper.rb → filesystem/file_system_wrapper.rb} +6 -5
  48. data/lib/ceedling/filesystem/file_tree.rb +241 -0
  49. data/lib/ceedling/{file_wrapper.rb → filesystem/file_wrapper.rb} +45 -38
  50. data/lib/ceedling/filesystem/path_exclusions.rb +30 -0
  51. data/lib/ceedling/{path_matcher.rb → filesystem/path_matcher.rb} +27 -23
  52. data/lib/ceedling/{path_mirror.rb → filesystem/path_mirror.rb} +19 -18
  53. data/lib/ceedling/filesystem/path_spellings.rb +55 -0
  54. data/lib/ceedling/filesystem/project_paths.rb +184 -0
  55. data/lib/ceedling/filesystem/working_dir.rb +40 -0
  56. data/lib/ceedling/generators/generator.rb +5 -6
  57. data/lib/ceedling/generators/generator_partials.rb +1 -1
  58. data/lib/ceedling/generators/generator_test_results_backtrace.rb +7 -7
  59. data/lib/ceedling/handoff.rb +121 -0
  60. data/lib/ceedling/includes/include_factory.rb +3 -3
  61. data/lib/ceedling/includes/include_pathinator.rb +67 -10
  62. data/lib/ceedling/includes/includes.rb +1 -1
  63. data/lib/ceedling/installation.rb +92 -0
  64. data/lib/ceedling/library_resolver.rb +99 -0
  65. data/lib/ceedling/objects.yml +23 -2
  66. data/lib/ceedling/partials/partializer.rb +4 -4
  67. data/lib/ceedling/partials/partializer_config.rb +3 -1
  68. data/lib/ceedling/plugins/report_log_writer_plugin.rb +3 -5
  69. data/lib/ceedling/preprocess/preprocessinator_file_assembler.rb +1 -1
  70. data/lib/ceedling/preprocess/preprocessinator_includes_handler.rb +1 -1
  71. data/lib/ceedling/preprocess/preprocessinator_line_marker_includes_extractor.rb +1 -1
  72. data/lib/ceedling/rake_app/rakefile_component_resolver.rb +10 -17
  73. data/lib/ceedling/rakefile.rb +15 -1
  74. data/lib/ceedling/rakefiles/base/tasks_base.rake +1 -1
  75. data/lib/ceedling/rakefiles/release/rules_release.rake +4 -7
  76. data/lib/ceedling/release_invoker/release_build_executor.rb +33 -44
  77. data/lib/ceedling/release_invoker/release_build_planner.rb +14 -6
  78. data/lib/ceedling/reportinator.rb +3 -4
  79. data/lib/ceedling/setupinator.rb +94 -90
  80. data/lib/ceedling/test_context_extractor.rb +5 -1
  81. data/lib/ceedling/test_invoker/PIPELINE.md +9 -7
  82. data/lib/ceedling/test_invoker/mock_locator.rb +60 -2
  83. data/lib/ceedling/test_invoker/partials_manager.rb +12 -0
  84. data/lib/ceedling/test_invoker/standin_headerinator.rb +22 -13
  85. data/lib/ceedling/test_invoker/test_build_executor.rb +24 -40
  86. data/lib/ceedling/test_invoker/test_build_planner.rb +37 -18
  87. data/lib/ceedling/test_invoker/test_build_setup.rb +17 -12
  88. data/lib/ceedling/test_invoker/test_build_validations.rb +16 -31
  89. data/lib/ceedling/test_invoker/test_file_preprocessinator.rb +1 -1
  90. data/lib/ceedling/test_invoker/test_invoker.rb +6 -1
  91. data/lib/ceedling/test_invoker/test_pipeline_helpers.rb +1 -1
  92. data/lib/ceedling/test_invoker/test_source_file_directive_resolver.rb +40 -20
  93. data/lib/ceedling/tool_executor.rb +9 -3
  94. data/lib/ceedling/yaml_wrapper.rb +3 -2
  95. data/lib/version.rb +1 -1
  96. data/plugins/bullseye/config/defaults_bullseye.rb +1 -1
  97. data/plugins/bullseye/lib/bullseye.rb +9 -7
  98. data/plugins/cppcheck/config/defaults_cppcheck.rb +1 -1
  99. data/plugins/dependencies/config/defaults.yml +6 -6
  100. data/plugins/dependencies/dependencies.rake +4 -1
  101. data/plugins/dependencies/lib/dependencies.rb +18 -8
  102. data/plugins/dependencies/lib/dependency_spec.rb +17 -5
  103. data/plugins/fff/lib/fff.rb +45 -39
  104. data/plugins/fff/spec/fff_cmock_wrapper_spec.rb +128 -0
  105. data/plugins/gcov/config/defaults_gcov.rb +1 -1
  106. data/plugins/gcov/lib/console_reportinator.rb +4 -18
  107. data/plugins/gcov/lib/gcov.rb +9 -2
  108. data/plugins/gcov/lib/gcovr_reportinator.rb +8 -40
  109. data/plugins/gcov/lib/gcovr_thresholds.rb +74 -0
  110. data/plugins/gcov/lib/reportgenerator_reportinator.rb +1 -1
  111. data/plugins/module_generator/lib/module_generator.rb +3 -3
  112. data/plugins/report_tests_teamcity_stdout/lib/report_tests_teamcity_stdout.rb +53 -80
  113. data/plugins/sanitize/lib/sanitize_records.rb +3 -6
  114. data/plugins/valgrind/lib/valgrind.rb +14 -7
  115. data/site-local/configuration/reference/cmock.html +2 -1
  116. data/site-local/configuration/reference/files.html +9 -3
  117. data/site-local/configuration/reference/libraries.html +21 -3
  118. data/site-local/configuration/reference/paths.html +29 -6
  119. data/site-local/configuration/reference/project.html +17 -7
  120. data/site-local/configuration/reference/release-build.html +2 -0
  121. data/site-local/configuration/reference/tools.html +9 -0
  122. data/site-local/configuration/which-ceedling.html +377 -17
  123. data/site-local/development/releases.html +5 -1
  124. data/site-local/development/workflow.html +48 -43
  125. data/site-local/getting-started/builds.html +2 -0
  126. data/site-local/getting-started/command-line.html +56 -4
  127. data/site-local/plugins/dependencies.html +6 -3
  128. data/site-local/plugins/fff.html +42 -11
  129. data/site-local/plugins/gcov/gcovr.html +15 -12
  130. data/site-local/plugins/gcov/setup.html +2 -1
  131. data/site-local/plugins/report-tests-raw-output-log.html +3 -1
  132. data/site-local/plugins/report-tests-teamcity-stdout.html +6 -3
  133. data/site-local/plugins/sanitize.html +7 -6
  134. data/site-local/plugins/valgrind.html +8 -7
  135. data/site-local/project/upgrade.html +3 -0
  136. data/site-local/reference/command-line.html +9 -2
  137. data/site-local/sitemap.xml.gz +0 -0
  138. data/site-local/snapshot/plugins/bullseye/config/defaults_bullseye.rb +1 -1
  139. data/site-local/snapshot/plugins/gcov/config/defaults_gcov.rb +1 -1
  140. data/site-local/testing-guide/conventions.html +53 -0
  141. data/spec/integration/actionator_file_operations_spec.rb +91 -1
  142. data/spec/integration/compile_commands_json_db_spec.rb +1 -1
  143. data/spec/integration/configurator_validation_spec.rb +1 -1
  144. data/spec/integration/dependencies/dependency_tracker_cache_hardening_spec.rb +26 -0
  145. data/spec/integration/dependencies/dependency_tracker_core_spec.rb +22 -0
  146. data/spec/integration/launcher_handoff_spec.rb +297 -0
  147. data/spec/integration/mixin_loading_spec.rb +1 -1
  148. data/spec/integration/module_generator_spec.rb +3 -3
  149. data/spec/integration/nested_test_artifacts_spec.rb +99 -0
  150. data/spec/integration/partials_module_resolution_spec.rb +7 -4
  151. data/spec/integration/path_intake_scenarios_spec.rb +101 -0
  152. data/spec/integration/path_scenarios_spec.rb +322 -0
  153. data/spec/integration/quote_include_isolator_spec.rb +1 -1
  154. data/spec/integration/report_build_warnings_log_spec.rb +1 -1
  155. data/spec/integration/report_tests_log_factory_spec.rb +1 -1
  156. data/spec/integration/test_executable_manifest_spec.rb +1 -1
  157. data/spec/integration/test_includes_extractinator_spec.rb +2 -1
  158. data/spec/integration/test_naming_spec.rb +198 -0
  159. data/spec/integration/test_source_file_checks_spec.rb +166 -0
  160. data/spec/integration/tool_validator_spec.rb +1 -1
  161. data/spec/integration/upgrade_docs_spec.rb +84 -0
  162. data/spec/integration/vendor_copy_transient_io_retry_spec.rb +74 -5
  163. data/spec/support/file_tree_helper.rb +88 -0
  164. data/spec/support/integration/configurator_integration_helper.rb +6 -6
  165. data/spec/support/integration/dependency_tracker_integration_helper.rb +1 -1
  166. data/spec/support/integration/partials_generation_integration_helper.rb +2 -2
  167. data/spec/support/integration/path_scenario_harness.rb +173 -0
  168. data/spec/support/integration/spec_integration_helper.rb +1 -1
  169. data/spec/support/integration/test_includes_harness.rb +13 -2
  170. data/spec/support/spec_helper.rb +2 -0
  171. data/spec/support/system/spec_system_helper.rb +7 -6
  172. data/spec/support/system/system_context.rb +21 -3
  173. data/spec/support/working_dir_tracking.rb +49 -0
  174. data/spec/system/build_output_mirroring_spec.rb +2 -2
  175. data/spec/system/conditional_mock_includes_spec.rb +1 -1
  176. data/spec/system/delta_builds_spec.rb +137 -11
  177. data/spec/system/gcov_deployment_spec.rb +1 -0
  178. data/spec/system/header_include_path_validation_spec.rb +4 -4
  179. data/spec/system/launcher_handoff_spec.rb +82 -0
  180. data/spec/system/mock_include_folders_spec.rb +91 -0
  181. data/spec/system/parent_directory_reference_spec.rb +5 -3
  182. data/spec/system/path_handling_probes_spec.rb +192 -0
  183. data/spec/system/preprocessing_parameterized_tests_spec.rb +1 -1
  184. data/spec/system/rake_release_task_path_disambiguation_spec.rb +6 -6
  185. data/spec/system/rake_test_task_path_disambiguation_spec.rb +85 -0
  186. data/spec/system/special_path_characters_spec.rb +86 -0
  187. data/spec/system/support/common_test_cases.rb +23 -21
  188. data/spec/system/support/gcov_common_test_cases.rb +37 -9
  189. data/spec/system/support/sanitize_common_test_cases.rb +2 -2
  190. data/spec/system/support/valgrind_common_test_cases.rb +12 -12
  191. data/spec/system/test_pipeline_stop_points_spec.rb +4 -4
  192. data/spec/system/test_runner_system_include_spec.rb +1 -1
  193. data/spec/system/test_source_file_directive_spec.rb +34 -5
  194. data/spec/units/bin/actionator_spec.rb +14 -17
  195. data/spec/units/bin/app_cfg_spec.rb +37 -0
  196. data/spec/units/bin/cli_handler_spec.rb +282 -6
  197. data/spec/units/bin/cli_helper_spec.rb +116 -45
  198. data/spec/units/bin/installation_selector_spec.rb +114 -0
  199. data/spec/units/bin/launchinator_spec.rb +171 -0
  200. data/spec/units/bin/path_validator_spec.rb +10 -0
  201. data/spec/units/bin/versionator_spec.rb +38 -6
  202. data/spec/units/build_log_writer_spec.rb +57 -0
  203. data/spec/units/config/build_root_policy_spec.rb +61 -0
  204. data/spec/units/config/configurator_builder_spec.rb +37 -6
  205. data/spec/units/config/configurator_paths_validator_spec.rb +292 -0
  206. data/spec/units/config/configurator_setup_spec.rb +9 -65
  207. data/spec/units/config/configurator_spec.rb +27 -5
  208. data/spec/units/config/configurator_validator_spec.rb +1 -172
  209. data/spec/units/default_tools_quoting_spec.rb +83 -0
  210. data/spec/units/dependencies/dependency_cache_store_spec.rb +33 -2
  211. data/spec/units/dependencies/dependency_debug_tree_spec.rb +1 -1
  212. data/spec/units/dependencies/dependency_hasher_spec.rb +42 -1
  213. data/spec/units/dependencies/dependency_path_normalizer_spec.rb +1 -1
  214. data/spec/units/dependencies/dependency_tracker_spec.rb +3 -1
  215. data/spec/units/filename_extension_spec.rb +11 -0
  216. data/spec/units/filesystem/build_subpath_spec.rb +122 -0
  217. data/spec/units/filesystem/destination_collision_spec.rb +30 -0
  218. data/spec/units/{file_finder_helper_spec.rb → filesystem/file_finder_helper_spec.rb} +46 -1
  219. data/spec/units/{file_finder_spec.rb → filesystem/file_finder_spec.rb} +188 -22
  220. data/spec/units/{file_path_collection_utils_spec.rb → filesystem/file_path_collection_utils_spec.rb} +181 -1
  221. data/spec/units/{file_path_utils_spec.rb → filesystem/file_path_utils_spec.rb} +204 -87
  222. data/spec/units/filesystem/file_system_wrapper_spec.rb +33 -0
  223. data/spec/units/filesystem/file_tree_spec.rb +511 -0
  224. data/spec/units/filesystem/file_tree_windows_spec.rb +78 -0
  225. data/spec/units/{file_wrapper_spec.rb → filesystem/file_wrapper_spec.rb} +95 -12
  226. data/spec/units/{path_matcher_spec.rb → filesystem/path_matcher_spec.rb} +12 -1
  227. data/spec/units/{path_mirror_spec.rb → filesystem/path_mirror_spec.rb} +32 -4
  228. data/spec/units/filesystem/project_paths_spec.rb +147 -0
  229. data/spec/units/filesystem/working_dir_spec.rb +71 -0
  230. data/spec/units/generators/generator_spec.rb +12 -6
  231. data/spec/units/generators/generator_test_results_backtrace_spec.rb +50 -46
  232. data/spec/units/generators/generator_test_results_spec.rb +1 -1
  233. data/spec/units/handoff_spec.rb +205 -0
  234. data/spec/units/includes/include_factory_spec.rb +3 -3
  235. data/spec/units/includes/include_pathinator_spec.rb +46 -0
  236. data/spec/units/installation_spec.rb +228 -0
  237. data/spec/units/library_resolver_spec.rb +157 -0
  238. data/spec/units/mock_locator_spec.rb +76 -1
  239. data/spec/units/partials/partializer_config_spec.rb +7 -0
  240. data/spec/units/partials/partializer_spec.rb +1 -0
  241. data/spec/units/partials_manager_spec.rb +17 -0
  242. data/spec/units/plugins/bullseye_spec.rb +15 -2
  243. data/spec/units/plugins/console_reportinator_spec.rb +18 -20
  244. data/spec/units/plugins/dependencies_spec.rb +33 -7
  245. data/spec/units/plugins/dependency_spec_spec.rb +17 -0
  246. data/spec/units/plugins/gcov_spec.rb +28 -3
  247. data/spec/units/plugins/gcovr_reportinator_spec.rb +19 -47
  248. data/spec/units/plugins/gcovr_thresholds_spec.rb +95 -0
  249. data/spec/units/plugins/module_generator_spec.rb +5 -5
  250. data/spec/units/plugins/report_build_warnings_log_spec.rb +3 -3
  251. data/spec/units/plugins/report_log_writer_plugin_spec.rb +10 -1
  252. data/spec/units/plugins/report_tests_raw_output_log_spec.rb +13 -2
  253. data/spec/units/plugins/report_tests_teamcity_stdout_spec.rb +77 -3
  254. data/spec/units/plugins/reportgenerator_reportinator_spec.rb +1 -1
  255. data/spec/units/plugins/sanitize_records_spec.rb +3 -1
  256. data/spec/units/plugins/sanitize_spec.rb +1 -1
  257. data/spec/units/plugins/valgrind_spec.rb +23 -8
  258. data/spec/units/preprocess/preprocessinator_comment_stripper_spec.rb +1 -1
  259. data/spec/units/rake_app/rakefile_component_resolver_spec.rb +21 -0
  260. data/spec/units/release_build_executor_spec.rb +53 -14
  261. data/spec/units/release_build_planner_spec.rb +15 -3
  262. data/spec/units/reportinator_spec.rb +5 -5
  263. data/spec/units/standin_headerinator_spec.rb +31 -1
  264. data/spec/units/test_build_executor_spec.rb +65 -3
  265. data/spec/units/test_build_planner_spec.rb +104 -2
  266. data/spec/units/test_build_setup_spec.rb +96 -12
  267. data/spec/units/test_context_extractor_spec.rb +25 -0
  268. data/spec/units/test_file_preprocessinator_spec.rb +17 -1
  269. data/spec/units/test_includes_extractinator_spec.rb +5 -1
  270. data/spec/units/test_invoker/objects_wiring_spec.rb +6 -3
  271. data/spec/units/test_invoker_spec.rb +14 -1
  272. data/spec/units/test_source_file_directive_resolver_spec.rb +38 -7
  273. data/spec/units/tool_executor_spec.rb +26 -0
  274. data/spec/units/yaml_wrapper_spec.rb +11 -0
  275. metadata +109 -25
  276. data/lib/ceedling/file_path_collection_utils.rb +0 -164
@@ -6,7 +6,7 @@
6
6
  # =========================================================================
7
7
 
8
8
  require 'rbconfig'
9
- require 'ceedling/file_wrapper'
9
+ require 'ceedling/filesystem/file_wrapper'
10
10
  require 'ceedling/yaml_wrapper'
11
11
 
12
12
  module CommonSystemTestCases
@@ -188,8 +188,8 @@ module CommonSystemTestCases
188
188
 
189
189
  # Windows' Installer Detection reads a manifest beside each test executable
190
190
  if windows
191
- manifests = Dir.glob('build/test/out/test_example_file_success/*.manifest')
192
- expect(manifests).to eq(['build/test/out/test_example_file_success/test_example_file_success.exe.manifest'])
191
+ manifests = Dir.glob('build/test/out/test/test_example_file_success/*.manifest')
192
+ expect(manifests).to eq(['build/test/out/test/test_example_file_success/test_example_file_success.exe.manifest'])
193
193
  end
194
194
  end
195
195
  end
@@ -727,7 +727,7 @@ module CommonSystemTestCases
727
727
  expect(output).to match(/PASSED:\s+\d/)
728
728
  expect(output).to match(/FAILED:\s+\d/)
729
729
  expect(output).to match(/IGNORED:\s+\d/)
730
- expect(File.exist?("build/artifacts/test/test_example_file_verbose.raw.log")).to eq true
730
+ expect(File.exist?("build/artifacts/test/test/test_example_file_verbose.raw.log")).to eq true
731
731
  end
732
732
  end
733
733
  end
@@ -880,7 +880,6 @@ module CommonSystemTestCases
880
880
  expect(@c.last_exit_status).to eq(1) # Test should fail because of crash
881
881
  expect(output).to match(/Test Executable Crashed/i)
882
882
  expect(output).to match(/Unit test failures/)
883
- expect(!File.exist?('./build/test/results/test_add.fail'))
884
883
  end
885
884
  end
886
885
  end
@@ -901,9 +900,12 @@ module CommonSystemTestCases
901
900
  expect(@c.last_exit_status).to eq(1) # Test should fail because of crash
902
901
  expect(output).to match(/Test Executable Crashed/i)
903
902
  expect(output).to match(/Unit test failures/)
904
- expect(File.exist?('./build/test/results/test_nosanitize_crash_sigsegv.fail')).to be(true)
905
- output_rd = read_spec_file('./build/test/results/test_nosanitize_crash_sigsegv.fail')
906
- expect(output_rd =~ /test_add_numbers_will_fail \(\) at test\/test_nosanitize_crash_sigsegv.c\:\d+/ )
903
+ expect(File.exist?('./build/test/results/test/test_nosanitize_crash_sigsegv.fail')).to be(true)
904
+ # Without backtraces the whole executable crashed, so every case fails as a crash at its own line
905
+ results = yaml_wrapper_for_test.load('./build/test/results/test/test_nosanitize_crash_sigsegv.fail')
906
+ crashed = results[:failures].find { |failure| failure[:test] == 'test_add_numbers_will_fail' }
907
+ expect(crashed).to include(message: 'Test executable crashed')
908
+ expect(crashed[:line]).to be > 0
907
909
  end
908
910
  end
909
911
  end
@@ -924,15 +926,15 @@ module CommonSystemTestCases
924
926
  expect(@c.last_exit_status).to eq(1) # Test should fail because of crash
925
927
  expect(output).to match(/Test Case Crashed/i)
926
928
  expect(output).to match(/Unit test failures/)
927
- expect(File.exist?('./build/test/results/test_nosanitize_crash_sigsegv.fail')).to be(true)
928
- output_rd = read_spec_file('./build/test/results/test_nosanitize_crash_sigsegv.fail')
929
+ expect(File.exist?('./build/test/results/test/test_nosanitize_crash_sigsegv.fail')).to be(true)
930
+ output_rd = read_spec_file('./build/test/results/test/test_nosanitize_crash_sigsegv.fail')
929
931
  expect(output_rd).to match(/Test case crashed/)
930
932
  expect(output_rd).to match(/SIGSEGV/i)
931
933
  expect(output).to match(/TESTED:\s+2/)
932
934
  expect(output).to match(/PASSED:\s+(?:0|1)/)
933
935
  expect(output).to match(/FAILED:\s+(?:1|2)/)
934
936
  expect(output).to match(/IGNORED:\s+0/)
935
- log_path = './build/logs/test/test_nosanitize_crash_sigsegv/test_add_numbers_will_fail.gdb.log'
937
+ log_path = './build/logs/test/test/test_nosanitize_crash_sigsegv/test_add_numbers_will_fail.gdb.log'
936
938
  expect(File.exist?(log_path)).to be(true)
937
939
  expect(read_spec_file(log_path)).to match(/SIGSEGV|Segmentation fault/i)
938
940
  expect(output).to match(/test_add_numbers_will_fail\.gdb\.log/)
@@ -955,15 +957,15 @@ module CommonSystemTestCases
955
957
  expect(@c.last_exit_status).to eq(1) # Test should fail because of crash
956
958
  expect(output).to match(/Test Case Crashed/i)
957
959
  expect(output).to match(/Unit test failures/)
958
- expect(File.exist?('./build/test/results/test_nosanitize_crash_sigsegv.fail')).to be(true)
959
- output_rd = read_spec_file('./build/test/results/test_nosanitize_crash_sigsegv.fail')
960
+ expect(File.exist?('./build/test/results/test/test_nosanitize_crash_sigsegv.fail')).to be(true)
961
+ output_rd = read_spec_file('./build/test/results/test/test_nosanitize_crash_sigsegv.fail')
960
962
  expect(output_rd).to match(/Test case crashed/)
961
963
  expect(output_rd).to match(/SIGSEGV/i)
962
964
  expect(output).to match(/TESTED:\s+1/)
963
965
  expect(output).to match(/PASSED:\s+(?:0|1)/)
964
966
  expect(output).to match(/FAILED:\s+(?:1|2)/)
965
967
  expect(output).to match(/IGNORED:\s+0/)
966
- log_path = './build/logs/test/test_nosanitize_crash_sigsegv/test_add_numbers_will_fail.gdb.log'
968
+ log_path = './build/logs/test/test/test_nosanitize_crash_sigsegv/test_add_numbers_will_fail.gdb.log'
967
969
  expect(File.exist?(log_path)).to be(true)
968
970
  expect(read_spec_file(log_path)).to match(/SIGSEGV|Segmentation fault/i)
969
971
  expect(output).to match(/test_add_numbers_will_fail\.gdb\.log/)
@@ -986,15 +988,15 @@ module CommonSystemTestCases
986
988
  expect(@c.last_exit_status).to eq(1) # Test should fail because of crash
987
989
  expect(output).to match(/Test Case Crashed/i)
988
990
  expect(output).to match(/Unit test failures/)
989
- expect(File.exist?('./build/test/results/test_nosanitize_crash_sigsegv.fail')).to be(true)
990
- output_rd = read_spec_file('./build/test/results/test_nosanitize_crash_sigsegv.fail')
991
+ expect(File.exist?('./build/test/results/test/test_nosanitize_crash_sigsegv.fail')).to be(true)
992
+ output_rd = read_spec_file('./build/test/results/test/test_nosanitize_crash_sigsegv.fail')
991
993
  expect(output_rd).to match(/Test case crashed/)
992
994
  expect(output_rd).to match(/SIGSEGV/i)
993
995
  expect(output).to match(/TESTED:\s+1/)
994
996
  expect(output).to match(/PASSED:\s+(?:0|1)/)
995
997
  expect(output).to match(/FAILED:\s+(?:1|2)/)
996
998
  expect(output).to match(/IGNORED:\s+0/)
997
- log_path = './build/logs/test/test_nosanitize_crash_sigsegv/test_add_numbers_will_fail.gdb.log'
999
+ log_path = './build/logs/test/test/test_nosanitize_crash_sigsegv/test_add_numbers_will_fail.gdb.log'
998
1000
  expect(File.exist?(log_path)).to be(true)
999
1001
  expect(read_spec_file(log_path)).to match(/SIGSEGV|Segmentation fault/i)
1000
1002
  expect(output).to match(/test_add_numbers_will_fail\.gdb\.log/)
@@ -1021,7 +1023,7 @@ module CommonSystemTestCases
1021
1023
  expect(output).to match(/Unit test failures/)
1022
1024
  expect(output).to match(/SIGABRT/i)
1023
1025
  expect(output).to match(/Assertion/i)
1024
- log_path = './build/logs/test/test_nosanitize_crash_assert/test_add_numbers_triggers_assert.gdb.log'
1026
+ log_path = './build/logs/test/test/test_nosanitize_crash_assert/test_add_numbers_triggers_assert.gdb.log'
1025
1027
  expect(File.exist?(log_path)).to be(true)
1026
1028
  # Windwos gdb output for an assertion failure can be quite different from Linux.
1027
1029
  # Windows gdb reports do not seem to cite the signal "SIGABRT" and may be quite brief,
@@ -1116,7 +1118,7 @@ module CommonSystemTestCases
1116
1118
  expect(output).to match(/FAILED:\s+1/)
1117
1119
  expect(output).to match(/IGNORED:\s+0/)
1118
1120
 
1119
- result_file = './build/test/results/test_nosanitize_crash_sigsegv_with_param.fail'
1121
+ result_file = './build/test/results/test/test_nosanitize_crash_sigsegv_with_param.fail'
1120
1122
  expect(File.exist?(result_file)).to be(true)
1121
1123
  results = yaml_wrapper_for_test.load(result_file)
1122
1124
 
@@ -1158,7 +1160,7 @@ module CommonSystemTestCases
1158
1160
  expect(output).to match(/FAILED:\s+1/)
1159
1161
  expect(output).to match(/IGNORED:\s+0/)
1160
1162
 
1161
- result_file = './build/test/results/test_nosanitize_crash_sigsegv_with_param.fail'
1163
+ result_file = './build/test/results/test/test_nosanitize_crash_sigsegv_with_param.fail'
1162
1164
  expect(File.exist?(result_file)).to be(true)
1163
1165
  results = yaml_wrapper_for_test.load(result_file)
1164
1166
 
@@ -1174,7 +1176,7 @@ module CommonSystemTestCases
1174
1176
  'test_difference_between_numbers_is_correct(0, 0, 0)'
1175
1177
  )
1176
1178
 
1177
- log_path = './build/logs/test/test_nosanitize_crash_sigsegv_with_param/test_add_numbers_will_fail.gdb.log'
1179
+ log_path = './build/logs/test/test/test_nosanitize_crash_sigsegv_with_param/test_add_numbers_will_fail.gdb.log'
1178
1180
  expect(File.exist?(log_path)).to be(true)
1179
1181
  expect(read_spec_file(log_path)).to match(/SIGSEGV|Segmentation fault/i)
1180
1182
  end
@@ -448,9 +448,12 @@ module GcovCommonTestCases
448
448
  expect(@c.last_exit_status).to eq(1) # Ceedling should exit with error because of failed test due to crash
449
449
  expect(output).to match(/crashed/i)
450
450
  expect(output).to match(/Unit test failures/)
451
- expect(File.exist?('./build/gcov/results/test_nosanitize_crash_sigsegv.fail'))
452
- output_rd = read_spec_file('./build/gcov/results/test_nosanitize_crash_sigsegv.fail')
453
- expect(output_rd =~ /test_add_numbers_will_fail \(\) at test\/test_nosanitize_crash_sigsegv.c\:\d+/ )
451
+ expect(File.exist?('./build/gcov/results/test/test_nosanitize_crash_sigsegv.fail')).to be(true)
452
+ # gdb names the crashing case, its signal, and the log of its backtrace
453
+ results = yaml_wrapper_for_test.load('./build/gcov/results/test/test_nosanitize_crash_sigsegv.fail')
454
+ expect(results[:failures].map { |failure| failure[:test] }).to eq(['test_add_numbers_will_fail'])
455
+ expect(results[:failures].first[:message]).to match(/Test case crashed >> \[SIGSEGV\] Segmentation fault/)
456
+ expect(results[:failures].first[:message]).to include('build/logs/gcov/test/test_nosanitize_crash_sigsegv/test_add_numbers_will_fail.gdb.log')
454
457
  expect(output).to match(/TESTED:\s+2/)
455
458
  expect(output).to match(/PASSED:\s+(?:0|1)/)
456
459
  expect(output).to match(/FAILED:\s+(?:1|2)/)
@@ -482,9 +485,12 @@ module GcovCommonTestCases
482
485
  expect(@c.last_exit_status).to eq(1) # Ceedling should exit with error because of failed test due to crash
483
486
  expect(output).to match(/Test Case Crashed/i)
484
487
  expect(output).to match(/Unit test failures/)
485
- expect(File.exist?('./build/gcov/results/test_nosanitize_crash_sigsegv.fail'))
486
- output_rd = read_spec_file('./build/gcov/results/test_nosanitize_crash_sigsegv.fail')
487
- expect(output_rd =~ /test_add_numbers_will_fail \(\) at test\/test_nosanitize_crash_sigsegv.c\:\d+/ )
488
+ expect(File.exist?('./build/gcov/results/test/test_nosanitize_crash_sigsegv.fail')).to be(true)
489
+ # gdb names the crashing case, its signal, and the log of its backtrace
490
+ results = yaml_wrapper_for_test.load('./build/gcov/results/test/test_nosanitize_crash_sigsegv.fail')
491
+ expect(results[:failures].map { |failure| failure[:test] }).to eq(['test_add_numbers_will_fail'])
492
+ expect(results[:failures].first[:message]).to match(/Test case crashed >> \[SIGSEGV\] Segmentation fault/)
493
+ expect(results[:failures].first[:message]).to include('build/logs/gcov/test/test_nosanitize_crash_sigsegv/test_add_numbers_will_fail.gdb.log')
488
494
  expect(output).to match(/TESTED:\s+1/)
489
495
  expect(output).to match(/PASSED:\s+0/)
490
496
  expect(output).to match(/FAILED:\s+1/)
@@ -522,7 +528,7 @@ module GcovCommonTestCases
522
528
 
523
529
  output = @c.ceedling_build_exec("gcov:all --exclude_test_case=test_add_numbers_will_fail")
524
530
  expect(@c.last_exit_status).to eq(0)
525
- expect(File.exist?('./build/gcov/results/test_nosanitize_crash_sigsegv.pass'))
531
+ expect(File.exist?('./build/gcov/results/test/test_nosanitize_crash_sigsegv.pass')).to be(true)
526
532
  expect(output).to match(/TESTED:\s+2/)
527
533
  expect(output).to match(/PASSED:\s+2/)
528
534
  expect(output).to match(/FAILED:\s+0/)
@@ -624,7 +630,7 @@ module GcovCommonTestCases
624
630
 
625
631
  output = @c.ceedling_build_exec("gcov:untested_sources")
626
632
  expect(@c.last_exit_status).to eq(0), output
627
- expect(File.exist?('build/gcov/out/needs_define.o')).to eq true
633
+ expect(File.exist?('build/gcov/out/src/needs_define.o')).to eq true
628
634
  end
629
635
  end
630
636
  end
@@ -645,7 +651,29 @@ module GcovCommonTestCases
645
651
  output = @c.ceedling_build_exec("gcov:untested_sources")
646
652
  expect(@c.last_exit_status).to eq(0)
647
653
  expect(output).not_to match(/TESTED:\s+\d/) # No test build/run occurred
648
- expect(File.exist?('build/gcov/out/uncovered_example_file.o')).to eq true
654
+ expect(File.exist?('build/gcov/out/src/uncovered_example_file.o')).to eq true
655
+ end
656
+ end
657
+ end
658
+
659
+ # Untested sources compile outside any test, so only their paths keep same-named ones apart
660
+ def project_with_gcov_untested_sources_sharing_a_name
661
+ @c.with_context do
662
+ Dir.chdir @proj_name do
663
+ prep_project_yml_for_coverage
664
+ add_gcov_option("untested_sources", ":compile")
665
+ FileUtils.cp test_asset_path("example_file.h"), 'src/'
666
+ FileUtils.cp test_asset_path("example_file.c"), 'src/'
667
+ FileUtils.cp test_asset_path("test_example_file_success.c"), 'test/'
668
+ FileUtils.mkdir_p( ['src/a', 'src/b'] )
669
+ File.write( 'src/a/util.c', "int util_a(void) { return 1; }\n" )
670
+ File.write( 'src/b/util.c', "int util_b(void) { return 2; }\n" )
671
+
672
+ output = @c.ceedling_build_exec("gcov:untested_sources")
673
+ expect(@c.last_exit_status).to eq(0), output
674
+ expect(File.exist?('build/gcov/out/src/a/util.o')).to eq true
675
+ expect(File.exist?('build/gcov/out/src/b/util.o')).to eq true
676
+ expect(Dir.glob('build/gcov/dependencies/**/util.d').sort).to eq(['build/gcov/dependencies/src/a/util.d', 'build/gcov/dependencies/src/b/util.d'])
649
677
  end
650
678
  end
651
679
  end
@@ -33,7 +33,7 @@ module SanitizeCommonTestCases
33
33
  expect(@c.last_exit_status).to eq(0)
34
34
  expect(output).to match(/SANITIZE: .*OVERALL TEST SUMMARY/)
35
35
  expect(output).not_to match(/Sanitizers found/)
36
- expect(Dir.glob('build/artifacts/sanitize/sanitize/*.log')).to be_empty
36
+ expect(Dir.glob('build/artifacts/sanitize/sanitize/**/*.log')).to be_empty
37
37
  end
38
38
  end
39
39
  end
@@ -68,7 +68,7 @@ module SanitizeCommonTestCases
68
68
  expect(@c.last_exit_status).to eq(1)
69
69
  expect(output).to match(/test_writes_past_its_buffer.*\n.*AddressSanitizer heap-buffer-overflow at \S*test_nosanitize_heap_buffer_overflow\.c:\d+/)
70
70
  expect(output).to match(/Sanitizers found 1 problem in 1 test/)
71
- expect(read_spec_file('build/artifacts/sanitize/sanitize/test_nosanitize_heap_buffer_overflow.log')).to match(/ERROR: AddressSanitizer: heap-buffer-overflow/)
71
+ expect(read_spec_file('build/artifacts/sanitize/sanitize/test/test_nosanitize_heap_buffer_overflow.log')).to match(/ERROR: AddressSanitizer: heap-buffer-overflow/)
72
72
  end
73
73
  end
74
74
  end
@@ -33,8 +33,8 @@ module ValgrindCommonTestCases
33
33
  output = @c.ceedling_build_exec("valgrind:all")
34
34
  expect(@c.last_exit_status).to eq(0)
35
35
  expect(output).to match(/Wrote 1 Valgrind report/i)
36
- expect(File.exist?('build/artifacts/valgrind/test_example_file_success.log')).to eq(true)
37
- expect(File.size('build/artifacts/valgrind/test_example_file_success.log')).to be > 0
36
+ expect(File.exist?('build/artifacts/valgrind/test/test_example_file_success.log')).to eq(true)
37
+ expect(File.size('build/artifacts/valgrind/test/test_example_file_success.log')).to be > 0
38
38
  end
39
39
  end
40
40
  end
@@ -70,8 +70,8 @@ module ValgrindCommonTestCases
70
70
  output = @c.ceedling_build_exec("valgrind:test_example_file_success.c")
71
71
  expect(@c.last_exit_status).to eq(0)
72
72
  expect(output).to match(/Wrote 1 Valgrind report/i)
73
- expect(File.exist?('build/artifacts/valgrind/test_example_file_success.log')).to eq(true)
74
- expect(File.size('build/artifacts/valgrind/test_example_file_success.log')).to be > 0
73
+ expect(File.exist?('build/artifacts/valgrind/test/test_example_file_success.log')).to eq(true)
74
+ expect(File.size('build/artifacts/valgrind/test/test_example_file_success.log')).to be > 0
75
75
  end
76
76
  end
77
77
  end
@@ -97,10 +97,10 @@ module ValgrindCommonTestCases
97
97
  # Aggregate build failure registered by Valgrind plugin
98
98
  expect(output).to match(/Valgrind detected.*memory error.*across/i)
99
99
  expect(output).to match(/Wrote 1 Valgrind report/i)
100
- expect(File.exist?('build/artifacts/valgrind/test_nosanitize_crash_sigsegv.log')).to eq(true)
101
- expect(File.size('build/artifacts/valgrind/test_nosanitize_crash_sigsegv.log')).to be > 0
100
+ expect(File.exist?('build/artifacts/valgrind/test/test_nosanitize_crash_sigsegv.log')).to eq(true)
101
+ expect(File.size('build/artifacts/valgrind/test/test_nosanitize_crash_sigsegv.log')).to be > 0
102
102
  # Expected memory error(s) detected by Valgrind
103
- expect(read_spec_file('build/artifacts/valgrind/test_nosanitize_crash_sigsegv.log')).to match(/ERROR SUMMARY:\s+[1-9]/)
103
+ expect(read_spec_file('build/artifacts/valgrind/test/test_nosanitize_crash_sigsegv.log')).to match(/ERROR SUMMARY:\s+[1-9]/)
104
104
  end
105
105
  end
106
106
  end
@@ -127,10 +127,10 @@ module ValgrindCommonTestCases
127
127
  # No aggregate Valgrind build failure registered
128
128
  expect(output).not_to match(/Valgrind detected.*memory error.*across/i)
129
129
  expect(output).to match(/Wrote 1 Valgrind report/i)
130
- expect(File.exist?('build/artifacts/valgrind/test_nosanitize_crash_sigsegv.log')).to eq(true)
131
- expect(File.size('build/artifacts/valgrind/test_nosanitize_crash_sigsegv.log')).to be > 0
130
+ expect(File.exist?('build/artifacts/valgrind/test/test_nosanitize_crash_sigsegv.log')).to eq(true)
131
+ expect(File.size('build/artifacts/valgrind/test/test_nosanitize_crash_sigsegv.log')).to be > 0
132
132
  # Expected memory error(s) detected by Valgrind
133
- expect(read_spec_file('build/artifacts/valgrind/test_nosanitize_crash_sigsegv.log')).to match(/ERROR SUMMARY:\s+[1-9]/)
133
+ expect(read_spec_file('build/artifacts/valgrind/test/test_nosanitize_crash_sigsegv.log')).to match(/ERROR SUMMARY:\s+[1-9]/)
134
134
  end
135
135
  end
136
136
  end
@@ -149,7 +149,7 @@ module ValgrindCommonTestCases
149
149
 
150
150
  expect(@c.last_exit_status).to eq(0)
151
151
 
152
- xml_path = 'build/artifacts/valgrind/test_example_file_success.xml'
152
+ xml_path = 'build/artifacts/valgrind/test/test_example_file_success.xml'
153
153
  expect(File.exist?(xml_path)).to eq(true)
154
154
  expect(read_spec_file(xml_path)).to match(/<valgrindoutput>/)
155
155
  end
@@ -175,7 +175,7 @@ module ValgrindCommonTestCases
175
175
  @c.ceedling_build_exec("valgrind:all")
176
176
 
177
177
  expect(@c.last_exit_status).to eq(0)
178
- expect(File.exist?('build/artifacts/valgrind/test_example_file_success.log')).to eq(true)
178
+ expect(File.exist?('build/artifacts/valgrind/test/test_example_file_success.log')).to eq(true)
179
179
  end
180
180
  end
181
181
  end
@@ -41,7 +41,7 @@ ceedling_system_tests do
41
41
  Dir.chdir "temp_sensor" do
42
42
  output = @c.ceedling_build_exec("gen:mocks")
43
43
 
44
- expect(output).to match(/Generating mock for adc\/TestAdcModel::TaskScheduler\.h/)
44
+ expect(output).to match(/Generating mock for test\/adc\/TestAdcModel::TaskScheduler\.h/)
45
45
  expect(output).to_not match(/Generating runner for/)
46
46
  expect(output).to_not match(/^Compiling /)
47
47
  expect(output).to_not match(/^Linking /)
@@ -62,7 +62,7 @@ ceedling_system_tests do
62
62
  Dir.chdir "temp_sensor" do
63
63
  output = @c.ceedling_build_exec("gen:test_runner")
64
64
 
65
- expect(output).to match(/Generating mock for adc\/TestAdcModel::TaskScheduler\.h/)
65
+ expect(output).to match(/Generating mock for test\/adc\/TestAdcModel::TaskScheduler\.h/)
66
66
  expect(output).to match(/Generating runner for TestAdcModel\.c/)
67
67
  expect(output).to_not match(/^Compiling /)
68
68
  expect(output).to_not match(/^Linking /)
@@ -80,7 +80,7 @@ ceedling_system_tests do
80
80
  Dir.chdir "temp_sensor" do
81
81
  output = @c.ceedling_build_exec("gen:mocks:TestAdcModel.c")
82
82
 
83
- expect(output).to match(/Generating mock for adc\/TestAdcModel::TaskScheduler\.h/)
83
+ expect(output).to match(/Generating mock for test\/adc\/TestAdcModel::TaskScheduler\.h/)
84
84
  # TestAdcModel.c mocks TaskScheduler, TemperatureCalculator, and TemperatureFilter --
85
85
  # exactly its own 3 mocks, none belonging to any other test.
86
86
  expect(output.to_s.scan(/Generating mock for /).length).to eq(3)
@@ -101,7 +101,7 @@ ceedling_system_tests do
101
101
  Dir.chdir "temp_sensor" do
102
102
  output = @c.ceedling_build_exec("gen:test_runner:TestAdcModel.c")
103
103
 
104
- expect(output).to match(/Generating mock for adc\/TestAdcModel::TaskScheduler\.h/)
104
+ expect(output).to match(/Generating mock for test\/adc\/TestAdcModel::TaskScheduler\.h/)
105
105
  # TestAdcModel.c mocks TaskScheduler, TemperatureCalculator, and TemperatureFilter --
106
106
  # exactly its own 3 mocks, none belonging to any other test.
107
107
  expect(output.to_s.scan(/Generating mock for /).length).to eq(3)
@@ -55,7 +55,7 @@ ceedling_system_tests do
55
55
  # The generated runner is what actually failed to compile in the reported
56
56
  # issue -- assert on its content directly rather than just overall build
57
57
  # success, since only the runner (not the test file itself) was affected.
58
- runner_path = Dir.glob('build/test/runners/*_runner.c').first
58
+ runner_path = Dir.glob('build/test/runners/**/*_runner.c').first
59
59
  expect(runner_path).not_to be_nil
60
60
 
61
61
  runner_contents = read_spec_file(runner_path)
@@ -121,6 +121,35 @@ ceedling_system_tests do
121
121
 
122
122
  end
123
123
 
124
+ # =========================================================================
125
+ describe "A project where one of several tests misspells a TEST_SOURCE_FILE() entry" do
126
+ # =========================================================================
127
+
128
+ # A misspelled entry stops the build naming its own test, with test preprocessing on or off
129
+ before do
130
+ copy_duplicate_calc_sources
131
+ in_project do
132
+ copy_fixture("test_source_file_duplicate_basenames/test_calc_alpha.c", 'test')
133
+ copy_fixture("test_source_file_duplicate_basenames/test_calc_beta.c", 'test')
134
+ copy_fixture("test_source_file_duplicate_basenames/test_calc_typo.c", 'test')
135
+ end
136
+ end
137
+
138
+ [:none, :tests].each do |preprocessing|
139
+ it "names the test with the misspelled entry, with test preprocessing #{preprocessing}" do
140
+ in_project do
141
+ @c.merge_project_yml_for_test({ :project => { :use_test_preprocessor => preprocessing } })
142
+
143
+ output = @c.ceedling_build_exec("test:all")
144
+ expect(@c.last_exit_status).not_to eq(0)
145
+ expect(output).to match(%r{'alpha/clac\.c' specified with TEST_SOURCE_FILE\(\) in test/test_calc_typo cannot be found})
146
+ expect(output).not_to match(/Undefined symbols|undefined reference/)
147
+ end
148
+ end
149
+ end
150
+
151
+ end
152
+
124
153
  # =========================================================================
125
154
  describe "A project with two same-named, header-less sources, each identified by a disambiguating TEST_SOURCE_FILE() path" do
126
155
  # =========================================================================
@@ -165,8 +194,8 @@ ceedling_system_tests do
165
194
  # is untouched by the override), so its own NOTICE still fires -- but the
166
195
  # correctly-linked pass above already proves only beta/dup.c was ever compiled,
167
196
  # not both. A duplicate-symbol link error would have failed the build otherwise.
168
- expect(File.exist?('build/test/out/test_dup_override/beta/dup.o')).to be true
169
- expect(File.exist?('build/test/out/test_dup_override/alpha/dup.o')).to be false
197
+ expect(File.exist?('build/test/out/test/test_dup_override/src/beta/dup.o')).to be true
198
+ expect(File.exist?('build/test/out/test/test_dup_override/src/alpha/dup.o')).to be false
170
199
 
171
200
  # A second, distinct NOTICE -- from extract_sources's own override, not the
172
201
  # header-ambiguity NOTICE above -- names the winning TEST_SOURCE_FILE() entry
@@ -195,8 +224,8 @@ ceedling_system_tests do
195
224
  expect(output).to match(/TESTED:\s+1/)
196
225
  expect(output).to match(/PASSED:\s+1/)
197
226
 
198
- expect(File.exist?('build/test/out/test_dup_subtractive/alpha/dup.o')).to be false
199
- expect(File.exist?('build/test/out/test_dup_subtractive/gamma/dup_gamma.o')).to be true
227
+ expect(File.exist?('build/test/out/test/test_dup_subtractive/src/alpha/dup.o')).to be false
228
+ expect(File.exist?('build/test/out/test/test_dup_subtractive/src/gamma/dup_gamma.o')).to be true
200
229
 
201
230
  expect(output).to match(/TEST_SOURCE_FILE\(.*-:alpha[\/\\]dup\.c.*\)/)
202
231
  expect(output).to match(/removed/)
@@ -222,7 +251,7 @@ ceedling_system_tests do
222
251
  expect(output).to match(/TESTED:\s+1/)
223
252
  expect(output).to match(/PASSED:\s+1/)
224
253
 
225
- expect(File.exist?('build/test/out/test_dup_subtractive_noop/alpha/dup.o')).to be true
254
+ expect(File.exist?('build/test/out/test/test_dup_subtractive_noop/src/alpha/dup.o')).to be true
226
255
 
227
256
  expect(output).to_not match(/TEST_SOURCE_FILE\(.*removed/)
228
257
  end
@@ -213,11 +213,10 @@ describe Actionator do
213
213
  allow(@file_wrapper).to receive(:dirname) { |path| File.dirname( path ) }
214
214
  allow(@file_wrapper).to receive(:mkdir)
215
215
  allow(@file_wrapper).to receive(:write)
216
- allow(@file_wrapper).to receive(:directory?).and_return( false )
217
216
  end
218
217
 
219
218
  it 'copies files and omits junk files' do
220
- allow(@file_wrapper).to receive(:directory_listing).and_return([
219
+ allow(@file_wrapper).to receive(:tree_files).and_return([
221
220
  src_path('tree', 'keep.txt'),
222
221
  src_path('tree', 'thumbs.db'),
223
222
  src_path('tree', '.DS_Store'),
@@ -231,25 +230,25 @@ describe Actionator do
231
230
  end
232
231
 
233
232
  it 'rebases nested sources onto the destination' do
234
- allow(@file_wrapper).to receive(:directory_listing).and_return([ src_path('tree', 'a', 'b', 'c.txt') ])
233
+ allow(@file_wrapper).to receive(:tree_files).and_return([ src_path('tree', 'a', 'b', 'c.txt') ])
235
234
 
236
235
  expect(@file_wrapper).to receive(:write).with( dest_path('out', 'a', 'b', 'c.txt'), 'contents', 'wb' )
237
236
 
238
237
  @actionator.copy_directory( 'tree', 'out', force: true )
239
238
  end
240
239
 
241
- it 'skips directory entries in the listing' do
242
- allow(@file_wrapper).to receive(:directory_listing).and_return([ src_path('tree', 'sub') ])
243
- allow(@file_wrapper).to receive(:directory?).with( src_path('tree', 'sub') ).and_return( true )
244
-
245
- expect(@file_wrapper).to_not receive(:write).with( /sub/, anything, anything )
240
+ it 'lists the source without entries named with a leading dot' do
241
+ skip_rule = nil
242
+ allow(@file_wrapper).to receive(:tree_files) { |_dir, skip:| skip_rule = skip; [] }
246
243
 
247
244
  @actionator.copy_directory( 'tree', 'out', force: true )
245
+
246
+ expect( ['.rspec', '.hidden', 'keep.c'].reject { |name| skip_rule.call( name ) } ).to eq( ['keep.c'] )
248
247
  end
249
248
 
250
249
  # Thor reported the destination directory itself before any of its contents.
251
250
  it 'reports the destination directory before its files' do
252
- allow(@file_wrapper).to receive(:directory_listing).and_return([ src_path('tree', 'keep.txt') ])
251
+ allow(@file_wrapper).to receive(:tree_files).and_return([ src_path('tree', 'keep.txt') ])
253
252
 
254
253
  reported = []
255
254
  allow(@loginator).to receive(:console) { |message, _label| reported << message }
@@ -262,24 +261,22 @@ describe Actionator do
262
261
  ])
263
262
  end
264
263
 
265
- # Issue #104: a Ceedling install path can contain literal glob metacharacters.
266
- # FileWrapper#directory_listing does not escape, so Actionator has to.
267
- it 'escapes glob metacharacters in the source path' do
264
+ # Issue #104: a Ceedling install path can contain literal glob metacharacters. The
265
+ # tree is listed by walking it, so the path passes through as written.
266
+ it 'lists a source path holding glob metacharacters as written' do
268
267
  bracketed_root = File.expand_path( '/src/[legacy]' )
269
268
  @actionator.source_root = bracketed_root
270
- allow(@file_wrapper).to receive(:directory_listing).and_return([])
271
269
 
272
- escaped = bracketed_root.gsub( /[*?{}\[\]]/ ) { |char| '\\' + char }
273
- expect(@file_wrapper).to receive(:directory_listing).with( File.join( escaped, 'tree', '**', '*' ) )
270
+ expect(@file_wrapper).to receive(:tree_files).with( File.join( bracketed_root, 'tree' ), skip: Actionator::HIDDEN ).and_return([])
274
271
 
275
272
  @actionator.copy_directory( 'tree', 'out', force: true )
276
273
  end
277
274
 
278
275
  # cli_helper.rb passes component paths with a trailing separator.
279
276
  it 'tolerates a trailing separator on the source' do
280
- allow(@file_wrapper).to receive(:directory_listing).and_return([ src_path('tree', 'keep.txt') ])
277
+ allow(@file_wrapper).to receive(:tree_files).and_return([ src_path('tree', 'keep.txt') ])
281
278
 
282
- expect(@file_wrapper).to receive(:directory_listing).with( File.join( src_path('tree'), '**', '*' ) )
279
+ expect(@file_wrapper).to receive(:tree_files).with( src_path('tree'), skip: Actionator::HIDDEN )
283
280
  expect(@file_wrapper).to receive(:write).with( dest_path('out', 'keep.txt'), 'contents', 'wb' )
284
281
 
285
282
  @actionator.copy_directory( 'tree/', 'out', force: true )
@@ -44,6 +44,43 @@ describe CeedlingAppConfig do
44
44
  end
45
45
  end
46
46
 
47
+ describe ':launcher_root_path' do
48
+ it 'starts as the root of the installation this code runs from' do
49
+ expect(@app_cfg[:launcher_root_path]).to eq( @app_cfg[:ceedling_root_path] )
50
+ end
51
+
52
+ # GH #1365: `version` needs the launcher after which-Ceedling resolution moves the paths
53
+ it 'keeps the launcher root when #set_paths moves the application paths' do
54
+ launcher = @app_cfg[:ceedling_root_path]
55
+
56
+ @app_cfg.set_paths( '/tmp/some/root' )
57
+
58
+ expect(@app_cfg[:launcher_root_path]).to eq( launcher )
59
+ end
60
+ end
61
+
62
+ describe 'launch context' do
63
+ it 'keeps a frozen copy of the command line it was given' do
64
+ argv = ['test:all', '--verbosity=obnoxious']
65
+ app_cfg = described_class.new( argv: argv )
66
+ argv << 'mutated'
67
+
68
+ expect(app_cfg[:argv]).to eq( ['test:all', '--verbosity=obnoxious'] )
69
+ expect(app_cfg[:argv]).to be_frozen
70
+ end
71
+
72
+ it 'defaults to an empty command line and no hand-off' do
73
+ expect(@app_cfg[:argv]).to eq( [] )
74
+ expect(@app_cfg[:handoff]).to be_nil
75
+ end
76
+
77
+ it '#set_handoff keeps the markers a launcher handed this process' do
78
+ @app_cfg.set_handoff( {launcher: '/gem', target: '/app'} )
79
+
80
+ expect(@app_cfg[:handoff]).to eq( {launcher: '/gem', target: '/app'} )
81
+ end
82
+ end
83
+
47
84
  describe 'simple setters' do
48
85
  it '#set_project_config updates :project_config' do
49
86
  @app_cfg.set_project_config( {:project => {}} )