ceedling 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/GIT_COMMIT_SHA +1 -1
- data/README.md +11 -9
- data/Rakefile +2 -1
- data/assets/features/ceedling +1 -1
- data/assets/fixtures/test_source_file_duplicate_basenames/test_calc_typo.c +14 -0
- data/assets/fixtures/tests_with_duplicate_test_names/test_foo.c +21 -0
- data/assets/fixtures/tests_with_partials_coverage/src/private_macro.c +7 -0
- data/assets/fixtures/tests_with_partials_coverage/src/private_macro.h +5 -0
- data/assets/fixtures/tests_with_partials_coverage/src/tally.c +13 -0
- data/assets/fixtures/tests_with_partials_coverage/src/tally.h +4 -0
- data/assets/fixtures/tests_with_partials_coverage/test/test_private_macro.c +10 -0
- data/assets/fixtures/tests_with_partials_coverage/test/test_tally.c +9 -0
- data/bin/actionator.rb +6 -12
- data/bin/app_cfg.rb +14 -1
- data/bin/ceedling +13 -3
- data/bin/cli.rb +25 -6
- data/bin/cli_handler.rb +113 -73
- data/bin/cli_helper.rb +51 -78
- data/bin/installation_selector.rb +81 -0
- data/bin/launchinator.rb +69 -0
- data/bin/mixin_resolvinator.rb +26 -36
- data/bin/objects.yml +13 -0
- data/bin/path_validator.rb +25 -29
- data/bin/versionator.rb +47 -48
- data/ceedling.gemspec +19 -15
- data/docs/BreakingChanges.md +86 -1
- data/docs/Changelog.md +145 -3
- data/docs/KnownIssues.md +179 -6
- data/docs/ReleaseNotes.md +13 -0
- data/examples/wondrous_forest/README.md +29 -1
- data/examples/wondrous_forest/src/ForestUnits.h +23 -0
- data/examples/wondrous_forest/src/RainGauge.c +59 -0
- data/examples/wondrous_forest/src/RainGauge.h +39 -0
- data/examples/wondrous_forest/src/RainTipIsr.c +17 -0
- data/examples/wondrous_forest/src/RainTipIsr.h +14 -0
- data/examples/wondrous_forest/test/TestRainGauge.c +126 -0
- data/lib/ceedling/build_log_writer.rb +33 -0
- data/lib/ceedling/c_extractor/README.md +15 -7
- data/lib/ceedling/c_extractor/c_extractor.rb +25 -14
- data/lib/ceedling/c_extractor/c_extractor_code_text.rb +84 -54
- data/lib/ceedling/c_extractor/c_extractor_constants.rb +18 -7
- data/lib/ceedling/c_extractor/c_extractor_declarations.rb +319 -283
- data/lib/ceedling/c_extractor/c_extractor_declarator.rb +285 -0
- data/lib/ceedling/c_extractor/c_extractor_defined_type.rb +111 -0
- data/lib/ceedling/c_extractor/c_extractor_definitions.rb +174 -121
- data/lib/ceedling/c_extractor/c_extractor_functions.rb +191 -162
- data/lib/ceedling/c_extractor/c_extractor_preprocessing.rb +46 -55
- data/lib/ceedling/c_extractor/c_extractor_statement.rb +30 -0
- data/lib/ceedling/c_extractor/c_extractor_types.rb +63 -41
- data/lib/ceedling/c_extractor/c_module_edits.rb +48 -0
- data/lib/ceedling/c_identifier.rb +21 -0
- data/lib/ceedling/ceedling.h +8 -0
- data/lib/ceedling/config/build_root_policy.rb +70 -0
- data/lib/ceedling/config/configurator.rb +18 -19
- data/lib/ceedling/config/configurator_builder.rb +75 -28
- data/lib/ceedling/config/configurator_paths_validator.rb +179 -0
- data/lib/ceedling/config/configurator_plugins.rb +1 -1
- data/lib/ceedling/config/configurator_setup.rb +44 -33
- data/lib/ceedling/config/configurator_validator.rb +1 -110
- data/lib/ceedling/constants.rb +5 -1
- data/lib/ceedling/defaults.rb +35 -5
- data/lib/ceedling/dependencies/CACHE_SCHEMA.md +118 -0
- data/lib/ceedling/dependencies/README.md +18 -16
- data/lib/ceedling/dependencies/dependency_cache_store.rb +43 -21
- data/lib/ceedling/dependencies/dependency_hasher.rb +35 -1
- data/lib/ceedling/dependencies/dependency_tracker.rb +9 -3
- data/lib/ceedling/dependencies/dependinator.rb +13 -1
- data/lib/ceedling/diagnostics/DOCTOR.md +142 -0
- data/lib/ceedling/diagnostics/README.md +5 -0
- data/lib/ceedling/diagnostics/build_step_doctor.rb +110 -0
- data/lib/ceedling/diagnostics/duplicate_symbol_specialist.rb +108 -0
- data/lib/ceedling/diagnostics/guidance_phrases.rb +30 -0
- data/lib/ceedling/diagnostics/header_collision_guidance.rb +56 -0
- data/lib/ceedling/diagnostics/header_collision_specialist.rb +152 -0
- data/lib/ceedling/diagnostics/include_depth_specialist.rb +132 -0
- data/lib/ceedling/diagnostics/missing_symbol_specialist.rb +111 -0
- data/lib/ceedling/diagnostics/partial_name_specialist.rb +134 -0
- data/lib/ceedling/diagnostics/toolchain_output.rb +44 -0
- data/lib/ceedling/filename_extension.rb +7 -1
- data/lib/ceedling/filesystem/FILE_TREE.md +253 -0
- data/lib/ceedling/filesystem/PATH_HANDLING.md +360 -0
- data/lib/ceedling/filesystem/README.md +46 -0
- data/lib/ceedling/filesystem/build_roots.rb +105 -0
- data/lib/ceedling/filesystem/build_subpath.rb +187 -0
- data/lib/ceedling/filesystem/destination_collision.rb +25 -0
- data/lib/ceedling/{file_finder.rb → filesystem/file_finder.rb} +177 -156
- data/lib/ceedling/filesystem/file_finder_helper.rb +154 -0
- data/lib/ceedling/filesystem/file_path_collection_utils.rb +183 -0
- data/lib/ceedling/{file_path_utils.rb → filesystem/file_path_utils.rb} +200 -167
- data/lib/ceedling/{file_system_wrapper.rb → filesystem/file_system_wrapper.rb} +6 -5
- data/lib/ceedling/filesystem/file_tree.rb +241 -0
- data/lib/ceedling/{file_wrapper.rb → filesystem/file_wrapper.rb} +149 -65
- data/lib/ceedling/filesystem/path_exclusions.rb +30 -0
- data/lib/ceedling/{path_matcher.rb → filesystem/path_matcher.rb} +48 -23
- data/lib/ceedling/{path_mirror.rb → filesystem/path_mirror.rb} +19 -18
- data/lib/ceedling/filesystem/path_spellings.rb +55 -0
- data/lib/ceedling/filesystem/project_paths.rb +184 -0
- data/lib/ceedling/filesystem/test_build_layout.rb +114 -0
- data/lib/ceedling/filesystem/win_long_paths.rb +153 -0
- data/lib/ceedling/filesystem/win_path_limit.rb +83 -0
- data/lib/ceedling/filesystem/win_path_prober.rb +52 -0
- data/lib/ceedling/filesystem/working_dir.rb +40 -0
- data/lib/ceedling/generators/generator.rb +32 -70
- data/lib/ceedling/generators/generator_helper.rb +0 -44
- data/lib/ceedling/generators/generator_mocks.rb +5 -0
- data/lib/ceedling/generators/generator_partials.rb +306 -244
- data/lib/ceedling/generators/generator_test_results_backtrace.rb +7 -7
- data/lib/ceedling/generators/generator_test_runner.rb +5 -8
- data/lib/ceedling/generators/partial_header_writer.rb +95 -0
- data/lib/ceedling/generators/partial_source_writer.rb +137 -0
- data/lib/ceedling/handoff.rb +121 -0
- data/lib/ceedling/includes/header_search.rb +225 -0
- data/lib/ceedling/includes/include_factory.rb +9 -12
- data/lib/ceedling/includes/include_pathinator.rb +112 -33
- data/lib/ceedling/includes/includes.rb +150 -38
- data/lib/ceedling/installation.rb +92 -0
- data/lib/ceedling/library_resolver.rb +99 -0
- data/lib/ceedling/objects.yml +112 -6
- data/lib/ceedling/partials/README.md +110 -16
- data/lib/ceedling/partials/carry_plan.rb +71 -0
- data/lib/ceedling/partials/definition_head.rb +74 -0
- data/lib/ceedling/partials/include_groups.rb +37 -0
- data/lib/ceedling/partials/interface_extras.rb +25 -0
- data/lib/ceedling/partials/partializer.rb +603 -124
- data/lib/ceedling/partials/partializer_config.rb +8 -1
- data/lib/ceedling/partials/partializer_helper.rb +851 -145
- data/lib/ceedling/partials/partializer_reconciler.rb +174 -0
- data/lib/ceedling/partials/partializer_utils.rb +89 -109
- data/lib/ceedling/partials/partials.rb +153 -10
- data/lib/ceedling/partials/type_macros.rb +126 -0
- data/lib/ceedling/plugins/report_log_writer_plugin.rb +3 -5
- data/lib/ceedling/preprocess/README.md +43 -33
- data/lib/ceedling/preprocess/preprocessinator.rb +100 -186
- data/lib/ceedling/preprocess/preprocessinator_code_finder.rb +65 -72
- data/lib/ceedling/preprocess/preprocessinator_file_assembler.rb +32 -76
- data/lib/ceedling/preprocess/preprocessinator_includes_handler.rb +1 -1
- data/lib/ceedling/preprocess/preprocessinator_line_marker_includes_extractor.rb +1 -1
- data/lib/ceedling/preprocess/preprocessinator_reconstructor.rb +51 -14
- data/lib/ceedling/rake_app/rakefile_component_resolver.rb +10 -17
- data/lib/ceedling/rakefile.rb +15 -1
- data/lib/ceedling/rakefiles/base/tasks_base.rake +1 -1
- data/lib/ceedling/rakefiles/release/rules_release.rake +4 -7
- data/lib/ceedling/release_invoker/release_build_executor.rb +33 -44
- data/lib/ceedling/release_invoker/release_build_planner.rb +14 -6
- data/lib/ceedling/reportinator.rb +3 -4
- data/lib/ceedling/setupinator.rb +104 -87
- data/lib/ceedling/test_context_extractor.rb +5 -1
- data/lib/ceedling/test_invoker/HEADER_COLLISIONS.md +21 -7
- data/lib/ceedling/test_invoker/PIPELINE.md +62 -19
- data/lib/ceedling/test_invoker/README.md +1 -1
- data/lib/ceedling/test_invoker/derived_search_path_notices.rb +45 -0
- data/lib/ceedling/test_invoker/mock_locator.rb +175 -10
- data/lib/ceedling/test_invoker/partial_files_preprocessinator.rb +181 -0
- data/lib/ceedling/test_invoker/partials_manager.rb +271 -302
- data/lib/ceedling/test_invoker/standin_headerinator.rb +19 -17
- data/lib/ceedling/test_invoker/test_bare_includes_extractinator.rb +26 -3
- data/lib/ceedling/test_invoker/test_build_executor.rb +358 -234
- data/lib/ceedling/test_invoker/test_build_planner.rb +46 -33
- data/lib/ceedling/test_invoker/test_build_setup.rb +43 -18
- data/lib/ceedling/test_invoker/test_build_validations.rb +35 -47
- data/lib/ceedling/test_invoker/test_derived_search_paths.rb +189 -0
- data/lib/ceedling/test_invoker/test_file_preprocessinator.rb +2 -3
- data/lib/ceedling/test_invoker/test_includes_reconcilinator.rb +1 -1
- data/lib/ceedling/test_invoker/test_invoker.rb +6 -1
- data/lib/ceedling/test_invoker/test_invoker_types.rb +28 -20
- data/lib/ceedling/test_invoker/test_pipeline_helpers.rb +6 -4
- data/lib/ceedling/test_invoker/test_pipeline_manager.rb +25 -8
- data/lib/ceedling/test_invoker/test_runner_generatinator.rb +31 -3
- data/lib/ceedling/test_invoker/test_search_paths.rb +30 -8
- data/lib/ceedling/test_invoker/test_source_file_directive_resolver.rb +40 -20
- data/lib/ceedling/test_invoker/test_substitutions.rb +72 -0
- data/lib/ceedling/tools/shell_quoting.rb +45 -0
- data/lib/ceedling/{tool_executor.rb → tools/tool_executor.rb} +9 -3
- data/lib/ceedling/tools/tool_quoting.rb +79 -0
- data/lib/ceedling/{tool_validator.rb → tools/tool_validator.rb} +18 -7
- data/lib/ceedling/yaml_wrapper.rb +3 -2
- data/lib/version.rb +1 -1
- data/plugins/bullseye/bullseye.rake +1 -3
- data/plugins/bullseye/config/defaults_bullseye.rb +1 -1
- data/plugins/bullseye/lib/bullseye.rb +24 -9
- data/plugins/command_hooks/lib/command_hooks.rb +1 -1
- data/plugins/cppcheck/config/defaults_cppcheck.rb +1 -1
- data/plugins/dependencies/config/defaults.yml +6 -6
- data/plugins/dependencies/dependencies.rake +4 -1
- data/plugins/dependencies/lib/dependencies.rb +18 -8
- data/plugins/dependencies/lib/dependency_spec.rb +17 -5
- data/plugins/fff/lib/fff.rb +79 -46
- data/plugins/fff/lib/fff_mock_generator.rb +12 -9
- data/plugins/fff/spec/fff_cmock_wrapper_spec.rb +262 -0
- data/plugins/fff/spec/fff_mock_header_generator_spec.rb +9 -0
- data/plugins/fff/spec/fff_mock_source_generator_spec.rb +20 -0
- data/plugins/gcov/config/defaults_gcov.rb +1 -1
- data/plugins/gcov/lib/console_reportinator.rb +28 -36
- data/plugins/gcov/lib/gcov.rb +9 -2
- data/plugins/gcov/lib/gcovr_reportinator.rb +8 -40
- data/plugins/gcov/lib/gcovr_thresholds.rb +74 -0
- data/plugins/gcov/lib/reportgenerator_reportinator.rb +3 -2
- data/plugins/module_generator/lib/module_generator.rb +3 -3
- data/plugins/report_tests_teamcity_stdout/lib/report_tests_teamcity_stdout.rb +53 -80
- data/plugins/sanitize/lib/sanitize_records.rb +3 -6
- data/plugins/valgrind/lib/valgrind.rb +14 -7
- data/site-local/404.html +2 -2
- data/site-local/assets/javascripts/{bundle.c21346df.min.js → bundle.a5f9d56c.min.js} +1 -1
- data/site-local/assets/javascripts/{bundle.c21346df.min.js.map → bundle.a5f9d56c.min.js.map} +2 -2
- data/site-local/configuration/environment-vars.html +2 -2
- data/site-local/configuration/global-collections.html +3 -3
- data/site-local/configuration/index.html +2 -2
- data/site-local/configuration/loading.html +2 -2
- data/site-local/configuration/mixins.html +2 -2
- data/site-local/configuration/parallel-builds.html +2 -2
- data/site-local/configuration/project-file.html +2 -2
- data/site-local/configuration/reference/cexception.html +2 -2
- data/site-local/configuration/reference/cmock.html +7 -3
- data/site-local/configuration/reference/defines.html +2 -2
- data/site-local/configuration/reference/environment.html +2 -2
- data/site-local/configuration/reference/extension.html +2 -2
- data/site-local/configuration/reference/files.html +65 -12
- data/site-local/configuration/reference/flags.html +2 -2
- data/site-local/configuration/reference/index.html +2 -2
- data/site-local/configuration/reference/libraries.html +23 -5
- data/site-local/configuration/reference/mixins.html +2 -2
- data/site-local/configuration/reference/partials.html +84 -2
- data/site-local/configuration/reference/paths.html +36 -8
- data/site-local/configuration/reference/plugins.html +2 -2
- data/site-local/configuration/reference/project.html +264 -12
- data/site-local/configuration/reference/release-build.html +4 -2
- data/site-local/configuration/reference/test-build.html +2 -2
- data/site-local/configuration/reference/test-runner.html +2 -2
- data/site-local/configuration/reference/tools.html +58 -4
- data/site-local/configuration/reference/unity.html +2 -2
- data/site-local/configuration/which-ceedling.html +379 -19
- data/site-local/development/index.html +2 -2
- data/site-local/development/plugins/configuration.html +2 -2
- data/site-local/development/plugins/index.html +2 -2
- data/site-local/development/plugins/plugin-subclass.html +5 -4
- data/site-local/development/plugins/rake-tasks.html +2 -2
- data/site-local/development/releases.html +7 -3
- data/site-local/development/workflow.html +50 -45
- data/site-local/getting-started/builds.html +4 -2
- data/site-local/getting-started/command-line.html +58 -6
- data/site-local/getting-started/example-projects/cipher-quest.html +2 -2
- data/site-local/getting-started/example-projects/index.html +2 -2
- data/site-local/getting-started/example-projects/temp-sensor.html +2 -2
- data/site-local/getting-started/example-projects/wondrous-forest.html +10 -2
- data/site-local/getting-started/index.html +2 -2
- data/site-local/getting-started/installation.html +2 -2
- data/site-local/getting-started/quick-start.html +2 -2
- data/site-local/help.html +2 -2
- data/site-local/index.html +2 -2
- data/site-local/overview/build-system.html +2 -2
- data/site-local/overview/index.html +2 -2
- data/site-local/overview/test-environments.html +2 -2
- data/site-local/overview/tools-and-frameworks.html +2 -2
- data/site-local/plugins/beep.html +2 -2
- data/site-local/plugins/bullseye/index.html +45 -38
- data/site-local/plugins/bullseye/licensing.html +2 -2
- data/site-local/plugins/command-hooks.html +4 -4
- data/site-local/plugins/compile-commands-json-db.html +2 -2
- data/site-local/plugins/cppcheck.html +2 -2
- data/site-local/plugins/dependencies.html +8 -5
- data/site-local/plugins/fff.html +58 -13
- data/site-local/plugins/gcov/examples.html +2 -2
- data/site-local/plugins/gcov/gcovr.html +23 -14
- data/site-local/plugins/gcov/index.html +2 -2
- data/site-local/plugins/gcov/overview.html +2 -2
- data/site-local/plugins/gcov/reportgenerator.html +18 -14
- data/site-local/plugins/gcov/reporting.html +2 -2
- data/site-local/plugins/gcov/setup.html +4 -3
- data/site-local/plugins/gcov/tool-versions.html +2 -2
- data/site-local/plugins/gcov/troubleshooting.html +2 -2
- data/site-local/plugins/index.html +2 -2
- data/site-local/plugins/module-generator.html +2 -2
- data/site-local/plugins/report-build-warnings-log.html +2 -2
- data/site-local/plugins/report-tests-gtestlike-stdout.html +2 -2
- data/site-local/plugins/report-tests-ide-stdout.html +2 -2
- data/site-local/plugins/report-tests-log-factory.html +2 -2
- data/site-local/plugins/report-tests-pretty-stdout.html +2 -2
- data/site-local/plugins/report-tests-raw-output-log.html +5 -3
- data/site-local/plugins/report-tests-teamcity-stdout.html +8 -5
- data/site-local/plugins/sanitize.html +9 -8
- data/site-local/plugins/valgrind.html +10 -9
- data/site-local/project/index.html +2 -2
- data/site-local/project/release-history.html +2 -2
- data/site-local/project/sbom.html +2 -2
- data/site-local/project/upgrade.html +5 -2
- data/site-local/reference/build-directives.html +2 -2
- data/site-local/reference/command-line.html +11 -4
- data/site-local/reference/environment-vars.html +2 -2
- data/site-local/reference/gcov-plugin.html +2 -2
- data/site-local/reference/global-collections.html +12 -12
- data/site-local/reference/index.html +2 -2
- data/site-local/reference/partials-macros.html +47 -2
- data/site-local/reference/project-configuration.html +2 -2
- data/site-local/sitemap.xml.gz +0 -0
- data/site-local/snapshot/examples/cipher_quest/index.html +2 -2
- data/site-local/snapshot/examples/temp_sensor/index.html +2 -2
- data/site-local/snapshot/examples/wondrous_forest/index.html +72 -15
- data/site-local/snapshot/plugins/bullseye/config/defaults_bullseye.rb +1 -1
- data/site-local/snapshot/plugins/gcov/config/defaults_gcov.rb +1 -1
- data/site-local/testing-guide/build-directives.html +2 -2
- data/site-local/testing-guide/conventions.html +113 -15
- data/site-local/testing-guide/frameworks.html +2 -2
- data/site-local/testing-guide/index.html +2 -2
- data/site-local/testing-guide/partials/configuration.html +31 -4
- data/site-local/testing-guide/partials/conventions.html +509 -8
- data/site-local/testing-guide/partials/directives.html +4 -3
- data/site-local/testing-guide/partials/example.html +2 -2
- data/site-local/testing-guide/partials/index.html +2 -2
- data/site-local/testing-guide/partials/overview.html +30 -12
- data/site-local/testing-guide/partials/variables.html +169 -4
- data/site-local/testing-guide/test-cases.html +2 -2
- data/site-local/testing-guide/test-sample.html +2 -2
- data/site-local/testing-guide/test-suite-anatomy.html +2 -2
- data/spec/integration/actionator_file_operations_spec.rb +91 -1
- data/spec/integration/build_step_doctor_spec.rb +270 -0
- data/spec/integration/c_extractor_composition_spec.rb +254 -4
- data/spec/integration/compile_commands_json_db_spec.rb +1 -1
- data/spec/integration/configurator_validation_spec.rb +1 -1
- data/spec/integration/dependencies/dependency_tracker_cache_hardening_spec.rb +26 -0
- data/spec/integration/dependencies/dependency_tracker_core_spec.rb +22 -0
- data/spec/integration/includes_extraction_spec.rb +27 -14
- data/spec/integration/launcher_handoff_spec.rb +297 -0
- data/spec/integration/mixin_loading_spec.rb +1 -1
- data/spec/integration/module_generator_spec.rb +3 -3
- data/spec/integration/nested_test_artifacts_spec.rb +99 -0
- data/spec/integration/partial_files_preprocessing_spec.rb +128 -0
- data/spec/integration/partials_carry_spec.rb +520 -0
- data/spec/integration/partials_declarations_spec.rb +655 -0
- data/spec/integration/partials_fallback_preprocessing_spec.rb +65 -0
- data/spec/integration/partials_function_pointers_spec.rb +277 -0
- data/spec/integration/partials_header_composition_spec.rb +268 -35
- data/spec/integration/partials_macro_decorators_spec.rb +267 -0
- data/spec/integration/partials_module_resolution_spec.rb +33 -23
- data/spec/integration/partials_symbol_linkage_spec.rb +13 -0
- data/spec/integration/path_intake_scenarios_spec.rb +101 -0
- data/spec/integration/path_length_reporting_spec.rb +64 -0
- data/spec/integration/path_scenarios_spec.rb +399 -0
- data/spec/integration/quote_include_isolator_spec.rb +57 -1
- data/spec/integration/report_build_warnings_log_spec.rb +1 -1
- data/spec/integration/report_tests_log_factory_spec.rb +1 -1
- data/spec/integration/test_build_parallel_barrier_spec.rb +1 -1
- data/spec/integration/test_executable_manifest_spec.rb +1 -1
- data/spec/integration/test_includes_extractinator_spec.rb +69 -3
- data/spec/integration/test_naming_spec.rb +201 -0
- data/spec/integration/test_source_file_checks_spec.rb +168 -0
- data/spec/integration/tool_executor_spec.rb +1 -1
- data/spec/integration/tool_validator_spec.rb +3 -3
- data/spec/integration/upgrade_docs_spec.rb +84 -0
- data/spec/integration/vendor_copy_transient_io_retry_spec.rb +74 -5
- data/spec/integration/win_long_paths_probe_spec.rb +46 -0
- data/spec/integration/win_path_limit_spec.rb +53 -0
- data/spec/integration/windows_registry_query_tool_spec.rb +41 -0
- data/spec/support/file_tree_helper.rb +88 -0
- data/spec/support/integration/configurator_integration_helper.rb +14 -9
- data/spec/support/integration/dependency_tracker_integration_helper.rb +1 -1
- data/spec/support/integration/partial_files_harness.rb +181 -0
- data/spec/support/integration/partials_generation_integration_helper.rb +239 -143
- data/spec/support/integration/path_scenario_harness.rb +175 -0
- data/spec/support/integration/spec_integration_helper.rb +9 -4
- data/spec/support/integration/test_includes_harness.rb +69 -37
- data/spec/support/integration/tool_executor_integration_helper.rb +14 -2
- data/spec/support/spec_helper.rb +2 -0
- data/spec/support/system/spec_system_helper.rb +7 -6
- data/spec/support/system/system_context.rb +21 -3
- data/spec/support/working_dir_tracking.rb +49 -0
- data/spec/system/build_output_mirroring_spec.rb +2 -2
- data/spec/system/bullseye_deployment_spec.rb +2 -0
- data/spec/system/conditional_mock_includes_spec.rb +1 -1
- data/spec/system/delta_builds_spec.rb +163 -23
- data/spec/system/encoding_stress_spec.rb +4 -4
- data/spec/system/example_wondrous_forest_spec.rb +2 -2
- data/spec/system/gcov_deployment_spec.rb +3 -0
- data/spec/system/header_include_path_validation_spec.rb +4 -4
- data/spec/system/header_search_paths_spec.rb +1083 -0
- data/spec/system/launcher_handoff_spec.rb +82 -0
- data/spec/system/mock_include_folders_spec.rb +212 -0
- data/spec/system/mockable_header_reassembly_spec.rb +184 -0
- data/spec/system/parent_directory_reference_spec.rb +5 -3
- data/spec/system/partials_carry_spec.rb +581 -0
- data/spec/system/partials_delta_builds_spec.rb +280 -0
- data/spec/system/partials_function_pointers_spec.rb +106 -0
- data/spec/system/partials_macro_decorators_spec.rb +127 -0
- data/spec/system/partials_module_disambiguation_spec.rb +125 -0
- data/spec/system/path_handling_probes_spec.rb +196 -0
- data/spec/system/pinned_thread_count_spec.rb +4 -4
- data/spec/system/preprocessing_fallback_conditionals_spec.rb +1 -1
- data/spec/system/preprocessing_parameterized_tests_spec.rb +1 -1
- data/spec/system/rake_release_task_path_disambiguation_spec.rb +6 -6
- data/spec/system/rake_test_task_path_disambiguation_spec.rb +85 -0
- data/spec/system/short_build_paths_spec.rb +87 -0
- data/spec/system/sibling_header_collision_spec.rb +30 -6
- data/spec/system/special_path_characters_spec.rb +86 -0
- data/spec/system/support/bullseye_common_test_cases.rb +42 -0
- data/spec/system/support/common_test_cases.rb +23 -21
- data/spec/system/support/gcov_common_test_cases.rb +37 -9
- data/spec/system/support/gcov_partials_test_cases.rb +48 -0
- data/spec/system/support/sanitize_common_test_cases.rb +2 -2
- data/spec/system/support/valgrind_common_test_cases.rb +12 -12
- data/spec/system/test_build_layout_spec.rb +209 -0
- data/spec/system/test_pipeline_stop_points_spec.rb +4 -4
- data/spec/system/test_runner_system_include_spec.rb +1 -1
- data/spec/system/test_source_file_directive_spec.rb +64 -5
- data/spec/units/bin/actionator_spec.rb +14 -17
- data/spec/units/bin/app_cfg_spec.rb +37 -0
- data/spec/units/bin/cli_handler_spec.rb +282 -6
- data/spec/units/bin/cli_helper_spec.rb +116 -45
- data/spec/units/bin/installation_selector_spec.rb +114 -0
- data/spec/units/bin/launchinator_spec.rb +171 -0
- data/spec/units/bin/path_validator_spec.rb +10 -0
- data/spec/units/bin/versionator_spec.rb +38 -6
- data/spec/units/build_log_writer_spec.rb +57 -0
- data/spec/units/c_extractor/c_extractor_code_text_spec.rb +67 -10
- data/spec/units/c_extractor/c_extractor_declarations_spec.rb +501 -4
- data/spec/units/c_extractor/c_extractor_declarator_spec.rb +245 -0
- data/spec/units/c_extractor/c_extractor_defined_type_spec.rb +45 -0
- data/spec/units/c_extractor/c_extractor_definitions_spec.rb +163 -3
- data/spec/units/c_extractor/c_extractor_functions_spec.rb +462 -21
- data/spec/units/c_extractor/c_extractor_preprocessing_spec.rb +39 -0
- data/spec/units/c_extractor/c_extractor_spec.rb +4 -4
- data/spec/units/c_extractor/c_extractor_types_spec.rb +163 -0
- data/spec/units/c_identifier_spec.rb +35 -0
- data/spec/units/config/build_root_policy_spec.rb +61 -0
- data/spec/units/config/configurator_builder_spec.rb +61 -6
- data/spec/units/config/configurator_paths_validator_spec.rb +292 -0
- data/spec/units/config/configurator_setup_spec.rb +80 -68
- data/spec/units/config/configurator_spec.rb +54 -6
- data/spec/units/config/configurator_validator_spec.rb +1 -172
- data/spec/units/dependencies/dependency_cache_store_spec.rb +98 -2
- data/spec/units/dependencies/dependency_debug_tree_spec.rb +1 -1
- data/spec/units/dependencies/dependency_hasher_spec.rb +42 -1
- data/spec/units/dependencies/dependency_path_normalizer_spec.rb +1 -1
- data/spec/units/dependencies/dependency_tracker_spec.rb +28 -1
- data/spec/units/dependencies/dependinator_spec.rb +17 -2
- data/spec/units/diagnostics/build_step_doctor_spec.rb +170 -0
- data/spec/units/diagnostics/duplicate_symbol_specialist_spec.rb +117 -0
- data/spec/units/diagnostics/header_collision_specialist_spec.rb +267 -0
- data/spec/units/diagnostics/include_depth_specialist_spec.rb +137 -0
- data/spec/units/diagnostics/missing_symbol_specialist_spec.rb +154 -0
- data/spec/units/diagnostics/partial_name_specialist_spec.rb +129 -0
- data/spec/units/diagnostics/toolchain_output_spec.rb +86 -0
- data/spec/units/encodinator_spec.rb +3 -4
- data/spec/units/filename_extension_spec.rb +11 -0
- data/spec/units/filesystem/build_roots_spec.rb +131 -0
- data/spec/units/filesystem/build_subpath_spec.rb +235 -0
- data/spec/units/filesystem/destination_collision_spec.rb +30 -0
- data/spec/units/{file_finder_helper_spec.rb → filesystem/file_finder_helper_spec.rb} +126 -1
- data/spec/units/filesystem/file_finder_spec.rb +845 -0
- data/spec/units/{file_path_collection_utils_spec.rb → filesystem/file_path_collection_utils_spec.rb} +181 -1
- data/spec/units/{file_path_utils_spec.rb → filesystem/file_path_utils_spec.rb} +435 -185
- data/spec/units/filesystem/file_system_wrapper_spec.rb +33 -0
- data/spec/units/filesystem/file_tree_spec.rb +511 -0
- data/spec/units/filesystem/file_tree_windows_spec.rb +78 -0
- data/spec/units/{file_wrapper_spec.rb → filesystem/file_wrapper_spec.rb} +286 -18
- data/spec/units/{path_matcher_spec.rb → filesystem/path_matcher_spec.rb} +48 -1
- data/spec/units/{path_mirror_spec.rb → filesystem/path_mirror_spec.rb} +32 -4
- data/spec/units/filesystem/project_paths_spec.rb +147 -0
- data/spec/units/filesystem/test_build_layout_spec.rb +216 -0
- data/spec/units/filesystem/win_long_paths_spec.rb +204 -0
- data/spec/units/filesystem/win_path_prober_spec.rb +158 -0
- data/spec/units/filesystem/working_dir_spec.rb +71 -0
- data/spec/units/generators/generator_helper_spec.rb +0 -60
- data/spec/units/generators/generator_mocks_spec.rb +13 -0
- data/spec/units/generators/generator_partials_spec.rb +656 -55
- data/spec/units/generators/generator_spec.rb +38 -6
- data/spec/units/generators/generator_test_results_backtrace_spec.rb +50 -46
- data/spec/units/generators/generator_test_results_spec.rb +1 -1
- data/spec/units/generators/generator_test_runner_spec.rb +9 -5
- data/spec/units/generators/partial_source_writer_spec.rb +129 -0
- data/spec/units/handoff_spec.rb +205 -0
- data/spec/units/includes/header_search_spec.rb +406 -0
- data/spec/units/includes/include_factory_spec.rb +23 -6
- data/spec/units/includes/include_pathinator_spec.rb +118 -8
- data/spec/units/includes/include_spec.rb +14 -0
- data/spec/units/includes/includes_spec.rb +176 -19
- data/spec/units/installation_spec.rb +228 -0
- data/spec/units/library_resolver_spec.rb +157 -0
- data/spec/units/loginator_spec.rb +31 -0
- data/spec/units/mock_locator_spec.rb +275 -6
- data/spec/units/partials/include_groups_spec.rb +42 -0
- data/spec/units/partials/partializer_config_spec.rb +32 -0
- data/spec/units/partials/partializer_helper_carry_spec.rb +661 -0
- data/spec/units/partials/partializer_helper_interface_extras_spec.rb +396 -0
- data/spec/units/partials/partializer_helper_spec.rb +529 -277
- data/spec/units/partials/partializer_reconciler_spec.rb +661 -0
- data/spec/units/partials/partializer_spec.rb +1579 -270
- data/spec/units/partials/partializer_utils_spec.rb +269 -232
- data/spec/units/partials/partials_rename_spec.rb +160 -0
- data/spec/units/partials_manager_spec.rb +561 -251
- data/spec/units/plugins/bullseye_spec.rb +49 -2
- data/spec/units/plugins/console_reportinator_spec.rb +73 -26
- data/spec/units/plugins/dependencies_spec.rb +33 -7
- data/spec/units/plugins/dependency_spec_spec.rb +17 -0
- data/spec/units/plugins/gcov_spec.rb +28 -3
- data/spec/units/plugins/gcovr_reportinator_spec.rb +19 -47
- data/spec/units/plugins/gcovr_thresholds_spec.rb +95 -0
- data/spec/units/plugins/module_generator_spec.rb +5 -5
- data/spec/units/plugins/report_build_warnings_log_spec.rb +3 -3
- data/spec/units/plugins/report_log_writer_plugin_spec.rb +10 -1
- data/spec/units/plugins/report_tests_raw_output_log_spec.rb +13 -2
- data/spec/units/plugins/report_tests_teamcity_stdout_spec.rb +77 -3
- data/spec/units/plugins/reportgenerator_reportinator_spec.rb +52 -4
- data/spec/units/plugins/sanitize_records_spec.rb +3 -1
- data/spec/units/plugins/sanitize_spec.rb +1 -1
- data/spec/units/plugins/valgrind_spec.rb +23 -8
- data/spec/units/preprocess/preprocessinator_code_finder_spec.rb +73 -10
- data/spec/units/preprocess/preprocessinator_comment_stripper_spec.rb +1 -1
- data/spec/units/preprocess/preprocessinator_file_assembler_spec.rb +125 -37
- data/spec/units/preprocess/preprocessinator_includes_handler_spec.rb +15 -0
- data/spec/units/preprocess/preprocessinator_reconstructor_spec.rb +197 -0
- data/spec/units/preprocess/preprocessinator_spec.rb +153 -95
- data/spec/units/rake_app/rakefile_component_resolver_spec.rb +21 -0
- data/spec/units/release_build_executor_spec.rb +53 -14
- data/spec/units/release_build_planner_spec.rb +15 -3
- data/spec/units/reportinator_spec.rb +5 -5
- data/spec/units/setupinator_spec.rb +51 -0
- data/spec/units/standin_headerinator_spec.rb +55 -9
- data/spec/units/test_build_executor_spec.rb +842 -166
- data/spec/units/test_build_planner_spec.rb +205 -15
- data/spec/units/test_build_setup_spec.rb +179 -30
- data/spec/units/test_context_extractor_spec.rb +36 -2
- data/spec/units/test_derived_search_paths_spec.rb +259 -0
- data/spec/units/test_file_preprocessinator_spec.rb +17 -1
- data/spec/units/test_includes_extractinator_spec.rb +61 -9
- data/spec/units/test_invoker/objects_wiring_spec.rb +24 -4
- data/spec/units/test_invoker/partial_files_preprocessinator_spec.rb +264 -0
- data/spec/units/test_invoker/test_substitutions_spec.rb +122 -0
- data/spec/units/test_invoker_spec.rb +14 -1
- data/spec/units/test_invoker_types_spec.rb +8 -7
- data/spec/units/test_pipeline_manager_spec.rb +54 -13
- data/spec/units/test_runner_generatinator_spec.rb +93 -1
- data/spec/units/test_search_paths_spec.rb +73 -5
- data/spec/units/test_source_file_directive_resolver_spec.rb +38 -7
- data/spec/units/tools/default_tools_quoting_spec.rb +117 -0
- data/spec/units/tools/shell_quoting_spec.rb +76 -0
- data/spec/units/{tool_executor_helper_spec.rb → tools/tool_executor_helper_spec.rb} +1 -1
- data/spec/units/{tool_executor_spec.rb → tools/tool_executor_spec.rb} +27 -1
- data/spec/units/{tool_validator_spec.rb → tools/tool_validator_spec.rb} +110 -1
- data/spec/units/windows_registry_query_tool_spec.rb +53 -0
- data/spec/units/yaml_wrapper_spec.rb +11 -0
- metadata +265 -36
- data/lib/ceedling/file_finder_helper.rb +0 -127
- data/lib/ceedling/file_path_collection_utils.rb +0 -164
- data/spec/units/file_finder_spec.rb +0 -495
- /data/lib/ceedling/{tool_executor_helper.rb → tools/tool_executor_helper.rb} +0 -0
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
#
|
|
15
15
|
# Preprocessing is part of what it runs, and that matters more than it looks. Partials never
|
|
16
16
|
# sees a module's original text. `Partializer#extract_module_contents` calls
|
|
17
|
-
# `CExtractor#from_file` against what `Preprocessinator#
|
|
17
|
+
# `CExtractor#from_file` against what `Preprocessinator#preprocess_partial_file`
|
|
18
18
|
# reconstituted, so conditionals are already resolved, comments are gone, every line
|
|
19
19
|
# belonging to an included header has been discarded, and the file has been rebuilt from the
|
|
20
20
|
# survivors plus a reconciled include list. A harness fed original source would report
|
|
@@ -48,6 +48,7 @@ require 'ceedling/c_extractor/c_extractor_definitions'
|
|
|
48
48
|
require 'ceedling/generators/generator_partials'
|
|
49
49
|
require 'ceedling/partials/partializer'
|
|
50
50
|
require 'ceedling/partials/partializer_helper'
|
|
51
|
+
require 'ceedling/partials/partializer_reconciler'
|
|
51
52
|
require 'ceedling/partials/partializer_utils'
|
|
52
53
|
require 'ceedling/partials/partializer_config'
|
|
53
54
|
require 'ceedling/partials/partials'
|
|
@@ -55,9 +56,11 @@ require 'ceedling/preprocess/preprocessinator_reconstructor'
|
|
|
55
56
|
require 'ceedling/preprocess/preprocessinator_comment_stripper'
|
|
56
57
|
require 'ceedling/preprocess/c_comment_scanner'
|
|
57
58
|
require 'ceedling/preprocess/preprocessinator_file_assembler'
|
|
59
|
+
require 'ceedling/preprocess/preprocessinator_code_finder'
|
|
58
60
|
require 'ceedling/parsing_parcels'
|
|
59
|
-
require 'ceedling/file_path_utils'
|
|
60
|
-
require 'ceedling/
|
|
61
|
+
require 'ceedling/filesystem/file_path_utils'
|
|
62
|
+
require 'ceedling/filesystem/test_build_layout'
|
|
63
|
+
require 'ceedling/filesystem/file_wrapper'
|
|
61
64
|
require 'ceedling/includes/includes'
|
|
62
65
|
|
|
63
66
|
|
|
@@ -69,10 +72,12 @@ module PartialsGeneration
|
|
|
69
72
|
# GeneratorPartials#generate_types returning nil for that case. `pp_header` and `pp_source`
|
|
70
73
|
# are the reconstituted files the extractor actually parsed, which is where to look when a
|
|
71
74
|
# generated file is missing something the original module had.
|
|
75
|
+
# `carry` is the plan the implementation source was written from, or nil when nothing
|
|
76
|
+
# was selected to test.
|
|
72
77
|
Result = Struct.new(
|
|
73
78
|
:dir, :module_name, :mode,
|
|
74
|
-
:types_h, :impl_h, :impl_c, :interface_h,
|
|
75
|
-
:pp_header, :pp_source,
|
|
79
|
+
:types_h, :impl_h, :impl_c, :interface_h, :extras_h,
|
|
80
|
+
:pp_header, :pp_source, :carry,
|
|
76
81
|
keyword_init: true
|
|
77
82
|
) do
|
|
78
83
|
# Generated file contents by role, so the accessors below read one way for any of them.
|
|
@@ -84,6 +89,7 @@ module PartialsGeneration
|
|
|
84
89
|
when :impl_h then impl_h
|
|
85
90
|
when :impl_c then impl_c
|
|
86
91
|
when :interface_h then interface_h
|
|
92
|
+
when :extras_h then extras_h
|
|
87
93
|
else raise ArgumentError, "unknown generated file '#{file}'"
|
|
88
94
|
end
|
|
89
95
|
end
|
|
@@ -192,9 +198,9 @@ module PartialsGeneration
|
|
|
192
198
|
end
|
|
193
199
|
end
|
|
194
200
|
|
|
195
|
-
# Raised when
|
|
196
|
-
#
|
|
197
|
-
#
|
|
201
|
+
# Raised when a preprocessor run fails outright. Production falls back for that file. A
|
|
202
|
+
# case that cannot preprocess is a broken case, so the harness refuses rather than silently
|
|
203
|
+
# measuring a different path than the one asked for.
|
|
198
204
|
class PreprocessFailure < StandardError; end
|
|
199
205
|
|
|
200
206
|
end
|
|
@@ -206,6 +212,7 @@ module PartialsGenerationHelpers
|
|
|
206
212
|
#
|
|
207
213
|
# `header_includes` and `source_includes` are include spellings; `<name>` marks a system
|
|
208
214
|
# header and anything else a user header, matching what reconciliation hands the assembler.
|
|
215
|
+
# `source: nil` makes a header-only module, which has no source to write or preprocess.
|
|
209
216
|
# `extra` writes additional headers into the working directory, where the preprocessor and
|
|
210
217
|
# the later compile resolve them. `partials` defaults to empty: this module is partialized,
|
|
211
218
|
# which the remap methods handle from `name:` alone. The hash names *other* partialized
|
|
@@ -222,79 +229,81 @@ module PartialsGenerationHelpers
|
|
|
222
229
|
mode: :accurate,
|
|
223
230
|
tests_expose: PartializerConfig::DEDUCT,
|
|
224
231
|
mocks_expose: PartializerConfig::DEDUCT,
|
|
232
|
+
tests_subtract: [],
|
|
233
|
+
mocks_add: [],
|
|
234
|
+
mocks_subtract: [],
|
|
235
|
+
suppress_redundant_decls: true,
|
|
236
|
+
extern_variables: :weak,
|
|
225
237
|
dir: nil
|
|
226
238
|
)
|
|
227
239
|
# A caller supplies `dir` to generate two modules into one working directory, which is
|
|
228
240
|
# what a link across two partialized modules needs.
|
|
229
241
|
dir ||= Dir.mktmpdir( 'partials-generation-' )
|
|
230
242
|
|
|
231
|
-
|
|
232
|
-
File.
|
|
233
|
-
|
|
243
|
+
# Byte for byte, so a module's line endings are the same on every platform
|
|
244
|
+
File.binwrite( File.join( dir, "#{module_name}.h" ), header )
|
|
245
|
+
File.binwrite( File.join( dir, "#{module_name}.c" ), source ) unless source.nil?
|
|
246
|
+
extra.each { |name, text| File.binwrite( File.join( dir, name ), text ) }
|
|
234
247
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
includes: header_includes, defines: defines, mode: mode
|
|
238
|
-
)
|
|
239
|
-
pp_source = reconstitute_partial_file(
|
|
240
|
-
dir: dir, filename: "#{module_name}.c", kind: :source,
|
|
241
|
-
includes: source_includes, defines: defines, mode: mode
|
|
248
|
+
# Each file is preprocessed as stages 6 and 7 preprocess it, into the record they fill in
|
|
249
|
+
header_file = preprocess_partial_file(
|
|
250
|
+
dir: dir, filename: "#{module_name}.h", kind: :header, includes: header_includes, defines: defines, mode: mode
|
|
242
251
|
)
|
|
252
|
+
# A header-only module's source keeps the empty record PartialsManager leaves it
|
|
253
|
+
source_file =
|
|
254
|
+
if source.nil?
|
|
255
|
+
Partials::ConfigFileInfo.new
|
|
256
|
+
else
|
|
257
|
+
preprocess_partial_file(
|
|
258
|
+
dir: dir, filename: "#{module_name}.c", kind: :source, includes: source_includes, defines: defines, mode: mode
|
|
259
|
+
)
|
|
260
|
+
end
|
|
243
261
|
|
|
244
|
-
|
|
262
|
+
# DEDUCT with no subtractions is what TEST_PARTIAL_ALL_MODULE resolves to -- every function
|
|
263
|
+
# exposed. The two sides are separate because a module is routinely tested at one visibility
|
|
264
|
+
# and mocked at another, which splits its own content across two generated files. Visibility
|
|
265
|
+
# filtering has its own thorough unit coverage, so a case states the exposure it wants rather
|
|
266
|
+
# than re-proving the filter.
|
|
267
|
+
config = PartializerConfig::Config.new(
|
|
268
|
+
module: module_name,
|
|
269
|
+
tests: PartializerConfig::PartialFunctions.new( type: tests_expose, subtractions: tests_subtract ),
|
|
270
|
+
mocks: PartializerConfig::PartialFunctions.new( type: mocks_expose, additions: mocks_add, subtractions: mocks_subtract ),
|
|
271
|
+
header: header_file,
|
|
272
|
+
source: source_file
|
|
273
|
+
)
|
|
245
274
|
|
|
246
275
|
generator = build_partials_generator
|
|
247
276
|
partializer = build_partializer
|
|
248
277
|
|
|
249
|
-
#
|
|
250
|
-
#
|
|
251
|
-
#
|
|
252
|
-
#
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
c_module.element_sequence.concat( promoted ) unless promoted.empty?
|
|
278
|
+
# Extraction runs as PartialsManager runs it. Each file is extracted, reconciled with its
|
|
279
|
+
# expansion, located in its raw copy or in fallback its source, and has its function-scope
|
|
280
|
+
# statics promoted. The two merge, and declarations an included header defines inline are
|
|
281
|
+
# marked.
|
|
282
|
+
c_module = partializer.extract_module_contents( 'PartialsGenerationTest', config )
|
|
283
|
+
|
|
284
|
+
# Partials refuses a module whose shape fallback preprocessing cannot resolve, rather than
|
|
285
|
+
# generating from a guess and leaving a compiler to report something arcane later. The
|
|
286
|
+
# refusal comes right after extraction, before generation, as in PartialsManager.
|
|
287
|
+
partializer.validate_config( c_module: c_module, config: config, name: 'PartialsGenerationTest' )
|
|
260
288
|
|
|
261
289
|
# Generated-file boilerplate carried in from the reconstituted files is stripped before
|
|
262
290
|
# generation, exactly as PartialsManager#stage_generate_partials does. Skipping this
|
|
263
291
|
# leaves synthetic include guards in the extracted macros and misreports what a real
|
|
264
|
-
# build would emit.
|
|
265
|
-
partializer.sanitize( c_module )
|
|
292
|
+
# build would emit. The real header's own guard goes too, since every generated file states it.
|
|
293
|
+
partializer.sanitize( c_module, include_guard: partializer.extract_module_include_guard( config.header.filepath ) )
|
|
266
294
|
|
|
267
|
-
#
|
|
268
|
-
#
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
# and mocked at another, which splits its own content across two generated files. Visibility
|
|
274
|
-
# filtering has its own thorough unit coverage, so a case states the exposure it wants rather
|
|
275
|
-
# than re-proving the filter.
|
|
276
|
-
config = PartializerConfig::Config.new(
|
|
277
|
-
module: module_name,
|
|
278
|
-
tests: PartializerConfig::PartialFunctions.new( type: tests_expose ),
|
|
279
|
-
mocks: PartializerConfig::PartialFunctions.new( type: mocks_expose ),
|
|
280
|
-
header: Partials::ConfigFileInfo.new( filepath: File.join( dir, "#{module_name}.h" ) ),
|
|
281
|
-
source: Partials::ConfigFileInfo.new( filepath: File.join( dir, "#{module_name}.c" ) )
|
|
282
|
-
)
|
|
295
|
+
# The header remaps take the source's and the header's lists apart, as partials_manager
|
|
296
|
+
# hands them. The implementation source's remap takes them joined, source first.
|
|
297
|
+
source_objects = source_file.includes
|
|
298
|
+
header_objects = header_file.includes
|
|
299
|
+
raw_includes = source_objects + header_objects
|
|
300
|
+
apart = { source_includes: source_objects, header_includes: header_objects }
|
|
283
301
|
|
|
284
302
|
# Production hands the remaps the whole test file's partials hash, which includes the module
|
|
285
303
|
# being generated. That entry is what tells the source remap to carry this module's own
|
|
286
304
|
# interface header, so omitting it hides a real behavior.
|
|
287
305
|
all_partials = partials.merge( module_name => config )
|
|
288
306
|
|
|
289
|
-
# Partials refuses a module whose shape fallback preprocessing cannot resolve, rather than
|
|
290
|
-
# generating from a guess and leaving a compiler to report something arcane later. Routed
|
|
291
|
-
# through validate_config so the refusal happens exactly where production puts it: before
|
|
292
|
-
# generation, not after.
|
|
293
|
-
partializer.validate_config(
|
|
294
|
-
c_module: c_module, config: config, name: 'PartialsGenerationTest',
|
|
295
|
-
fallback: mode == :fallback
|
|
296
|
-
)
|
|
297
|
-
|
|
298
307
|
implementation = partializer.extract_implementation_functions(
|
|
299
308
|
test: 'PartialsGenerationTest', partial: module_name,
|
|
300
309
|
definitions: c_module.function_definitions, config: config
|
|
@@ -309,17 +318,18 @@ module PartialsGenerationHelpers
|
|
|
309
318
|
# The types header carries its own dependencies and its own guard-spoof, so both are
|
|
310
319
|
# computed here the way partials_manager does and handed to the generator.
|
|
311
320
|
types_includes = partializer.remap_types_header_includes(
|
|
312
|
-
name: module_name,
|
|
321
|
+
name: module_name, **apart, partials: all_partials
|
|
313
322
|
)
|
|
314
323
|
include_guard = partializer.extract_module_include_guard( config.header.filepath )
|
|
315
324
|
|
|
316
325
|
types_h_name = generator.generate_types(
|
|
317
326
|
name: module_name, c_module: c_module, output_path: dir,
|
|
318
|
-
includes: types_includes,
|
|
327
|
+
includes: types_includes.leading, following_includes: types_includes.following,
|
|
328
|
+
include_guard: include_guard
|
|
319
329
|
)
|
|
320
330
|
|
|
321
331
|
header_list = partializer.remap_implementation_header_includes(
|
|
322
|
-
name: module_name,
|
|
332
|
+
name: module_name, **apart, partials: all_partials,
|
|
323
333
|
types_header: types_h_name
|
|
324
334
|
)
|
|
325
335
|
|
|
@@ -328,32 +338,54 @@ module PartialsGenerationHelpers
|
|
|
328
338
|
)
|
|
329
339
|
|
|
330
340
|
interface_list = partializer.remap_interface_header_includes(
|
|
331
|
-
name: module_name,
|
|
341
|
+
name: module_name, **apart, partials: all_partials,
|
|
332
342
|
types_header: types_h_name
|
|
333
343
|
)
|
|
334
344
|
|
|
345
|
+
# What the implementation carries beyond the selection, planned as PartialsManager plans it
|
|
346
|
+
carry = nil
|
|
347
|
+
unless implementation.nil?
|
|
348
|
+
carry = partializer.plan_carry(
|
|
349
|
+
test: 'PartialsGenerationTest', c_module: c_module, impl: implementation, interface: interface,
|
|
350
|
+
header_guarded: !include_guard.nil?, config: config
|
|
351
|
+
)
|
|
352
|
+
end
|
|
353
|
+
|
|
335
354
|
generator.generate_implementation(
|
|
336
|
-
test: 'PartialsGenerationTest',
|
|
337
355
|
name: module_name,
|
|
338
356
|
function_definitions: implementation || [],
|
|
339
357
|
source_includes: source_list,
|
|
340
|
-
header_includes: header_list,
|
|
358
|
+
header_includes: header_list.leading,
|
|
359
|
+
header_following_includes: header_list.following,
|
|
341
360
|
c_module: c_module,
|
|
342
361
|
output_path: dir,
|
|
343
|
-
include_guard: include_guard
|
|
362
|
+
include_guard: include_guard,
|
|
363
|
+
carry: carry || Partials::CarryPlan.new,
|
|
364
|
+
suppress_redundant_decls: suppress_redundant_decls,
|
|
365
|
+
extern_variables: extern_variables
|
|
344
366
|
)
|
|
345
367
|
|
|
368
|
+
# A mock-only Partial's interface keeps the rest of its real header in an extras header,
|
|
369
|
+
# planned as PartialsManager plans it
|
|
370
|
+
extras = nil
|
|
371
|
+
if implementation.nil? and !interface.nil?
|
|
372
|
+
extras = partializer.plan_interface_extras(
|
|
373
|
+
test: 'PartialsGenerationTest', c_module: c_module, interface: interface, header_guarded: !include_guard.nil?, config: config
|
|
374
|
+
)
|
|
375
|
+
end
|
|
376
|
+
|
|
346
377
|
# The mockable interface header is what CMock mocks in place of the real module header,
|
|
347
378
|
# and it carries the same types header the implementation header does. Both land in one
|
|
348
379
|
# translation unit when a module is tested and mocked in the same test file.
|
|
349
380
|
generator.generate_interface(
|
|
350
|
-
test: 'PartialsGenerationTest',
|
|
351
381
|
name: module_name,
|
|
352
382
|
function_declarations: interface || [],
|
|
353
|
-
includes: interface_list,
|
|
383
|
+
includes: interface_list.leading,
|
|
384
|
+
following_includes: interface_list.following,
|
|
354
385
|
c_module: c_module,
|
|
355
386
|
output_path: dir,
|
|
356
|
-
include_guard: include_guard
|
|
387
|
+
include_guard: include_guard,
|
|
388
|
+
extras: extras
|
|
357
389
|
)
|
|
358
390
|
|
|
359
391
|
PartialsGeneration::Result.new(
|
|
@@ -364,30 +396,79 @@ module PartialsGenerationHelpers
|
|
|
364
396
|
impl_h: read_generated( dir, "ceedling_partial_#{module_name}_impl.h" ),
|
|
365
397
|
impl_c: read_generated( dir, "ceedling_partial_#{module_name}_impl.c" ),
|
|
366
398
|
interface_h: read_generated( dir, "ceedling_partial_#{module_name}_interface.h" ),
|
|
367
|
-
|
|
368
|
-
|
|
399
|
+
extras_h: read_generated( dir, "ceedling_partial_#{module_name}_extras.h" ),
|
|
400
|
+
pp_header: File.read( header_file.assembled_filepath, encoding: 'UTF-8' ),
|
|
401
|
+
pp_source: source_file.assembled_filepath && File.read( source_file.assembled_filepath, encoding: 'UTF-8' ),
|
|
402
|
+
carry: carry
|
|
369
403
|
)
|
|
370
404
|
end
|
|
371
405
|
|
|
372
|
-
#
|
|
373
|
-
#
|
|
374
|
-
#
|
|
375
|
-
#
|
|
376
|
-
|
|
377
|
-
# include while leaving macro directives as written. The fallback path never runs a
|
|
378
|
-
# compiler: it scans the file's own text, tracking conditionals approximately, which is
|
|
379
|
-
# why it resolves less and why Partials needs to refuse some shapes outright under it.
|
|
380
|
-
def reconstitute_partial_file(dir:, filename:, kind:, includes:, defines: [], mode: :accurate)
|
|
406
|
+
# Preprocesses one module file as stages 6 and 7 do, and gives the record they fill in. The
|
|
407
|
+
# accurate path keeps a raw directives-only copy, which locates functions and marks inline
|
|
408
|
+
# bodies. Both paths keep a full expansion and its own lines as plain code, which
|
|
409
|
+
# reconciliation parses.
|
|
410
|
+
def preprocess_partial_file(dir:, filename:, kind:, includes:, defines:, mode:)
|
|
381
411
|
path = File.join( dir, filename )
|
|
382
412
|
|
|
383
|
-
|
|
413
|
+
raw =
|
|
384
414
|
case mode
|
|
385
|
-
when :accurate then
|
|
386
|
-
when :fallback then
|
|
415
|
+
when :accurate then directives_only( dir: dir, path: path, defines: defines )
|
|
416
|
+
when :fallback then nil
|
|
387
417
|
else raise ArgumentError, "unknown preprocessing mode '#{mode}'"
|
|
388
418
|
end
|
|
389
419
|
|
|
390
|
-
|
|
420
|
+
raw_expansion, expansion = expand( dir: dir, path: path, defines: defines )
|
|
421
|
+
|
|
422
|
+
return Partials::ConfigFileInfo.new(
|
|
423
|
+
filepath: path, raw_directives_only_filepath: raw, raw_expansion_filepath: raw_expansion, expansion_filepath: expansion,
|
|
424
|
+
assembled_filepath: reconstitute_partial_file( dir: dir, filename: filename, kind: kind, includes: includes, raw: raw, defines: defines ),
|
|
425
|
+
fallback: raw.nil?, includes: partial_include_objects( includes )
|
|
426
|
+
)
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
# GCC's -fdirectives-only output with its comments stripped, as Preprocessinator#generate_directives_only_output
|
|
430
|
+
# leaves it. Defines reach every pass, as they do in production. Without them a case pairing
|
|
431
|
+
# `defines:` with accurate mode would silently measure the undefined configuration instead.
|
|
432
|
+
def directives_only(dir:, path:, defines:)
|
|
433
|
+
raw = "#{path}.directives_only"
|
|
434
|
+
run_partials_preprocessor( dir: dir, path: path, output: raw, defines: defines, flags: '-fdirectives-only' )
|
|
435
|
+
partials_comment_stripper.strip_file( raw )
|
|
436
|
+
|
|
437
|
+
return raw
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
# The full expansion and its own lines, as Preprocessinator#generate_partial_expansion writes them
|
|
441
|
+
def expand(dir:, path:, defines:)
|
|
442
|
+
raw = "#{path}.full_expansion"
|
|
443
|
+
code = "#{path}.expanded_code"
|
|
444
|
+
run_partials_preprocessor( dir: dir, path: path, output: raw, defines: defines )
|
|
445
|
+
|
|
446
|
+
contents = partials_file_assembler.collect_own_lines( source_filepath: path, preprocessed_filepath: raw )
|
|
447
|
+
partials_file_assembler.assemble_preprocessed_code_file( preprocessed_filepath: code, contents: contents, extras: [], includes: [] )
|
|
448
|
+
|
|
449
|
+
return raw, code
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
def run_partials_preprocessor(dir:, path:, output:, defines:, flags: '')
|
|
453
|
+
defines = defines.map { |name| "-D#{name}" }.join( ' ' )
|
|
454
|
+
command = "#{partials_compiler} -E #{flags} #{defines} -I#{dir} -x c #{path} -o #{output}".squeeze( ' ' )
|
|
455
|
+
|
|
456
|
+
_out, stderr, status = Open3.capture3( command )
|
|
457
|
+
raise PartialsGeneration::PreprocessFailure, "#{command}\n#{stderr}" unless status.success?
|
|
458
|
+
end
|
|
459
|
+
|
|
460
|
+
# Reproduces the assembled copy Preprocessinator#preprocess_partial_file leaves for the
|
|
461
|
+
# extractor, in the same steps and with the same collaborators, and gives its path.
|
|
462
|
+
#
|
|
463
|
+
# The accurate path reads GCC's directives-only output, which resolves every conditional and
|
|
464
|
+
# follows every include while leaving macro directives as written. The fallback path never
|
|
465
|
+
# runs a compiler: it scans the file's own text, tracking conditionals approximately, which
|
|
466
|
+
# is why it resolves less and why Partials needs to refuse some shapes outright under it.
|
|
467
|
+
def reconstitute_partial_file(dir:, filename:, kind:, includes:, raw:, defines:)
|
|
468
|
+
path = File.join( dir, filename )
|
|
469
|
+
contents, extras = raw ? reconstitute_accurate( path: path, raw: raw ) : reconstitute_fallback( path: path, defines: defines )
|
|
470
|
+
|
|
471
|
+
assembled = File.join( dir, "preprocessed_#{filename}" )
|
|
391
472
|
include_list = partial_include_objects( includes )
|
|
392
473
|
|
|
393
474
|
if kind == :header
|
|
@@ -397,53 +478,37 @@ module PartialsGenerationHelpers
|
|
|
397
478
|
)
|
|
398
479
|
else
|
|
399
480
|
partials_file_assembler.assemble_preprocessed_code_file(
|
|
400
|
-
|
|
401
|
-
contents: contents, extras: extras, includes: include_list
|
|
481
|
+
preprocessed_filepath: assembled, contents: contents, extras: extras, includes: include_list
|
|
402
482
|
)
|
|
403
483
|
end
|
|
404
484
|
|
|
405
|
-
|
|
485
|
+
return assembled
|
|
406
486
|
end
|
|
407
487
|
|
|
408
|
-
# Only lines belonging to this file survive
|
|
409
|
-
#
|
|
410
|
-
#
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
# Defines reach both passes, as they do in production. Without this a case pairing
|
|
415
|
-
# `defines:` with accurate mode would silently measure the undefined configuration instead.
|
|
416
|
-
flags = defines.map { |name| "-D#{name}" }.join( ' ' )
|
|
417
|
-
|
|
418
|
-
command = "#{partials_compiler} -E -fdirectives-only #{flags} -I#{dir} -x c #{path} -o #{raw}".squeeze( ' ' )
|
|
419
|
-
_out, stderr, status = Open3.capture3( command )
|
|
420
|
-
raise PartialsGeneration::PreprocessFailure, "#{command}\n#{stderr}" unless status.success?
|
|
421
|
-
|
|
422
|
-
partials_comment_stripper.strip_file( raw )
|
|
423
|
-
|
|
424
|
-
contents = File.open( raw, 'rb' ) do |file|
|
|
425
|
-
partials_reconstructor.extract_file_as_array_from_expansion( file, path )
|
|
426
|
-
end
|
|
427
|
-
|
|
428
|
-
[contents, []]
|
|
488
|
+
# Only lines belonging to this file survive. A type arriving from an included header is
|
|
489
|
+
# discarded here, which is why an extracted type can reference something no generated file
|
|
490
|
+
# declares. On Windows, GCC's directives-only output of a CRLF source ends each line in
|
|
491
|
+
# "\r\r\n", and the production reader's text mode keeps one line break, not two.
|
|
492
|
+
def reconstitute_accurate(path:, raw:)
|
|
493
|
+
return partials_file_assembler.collect_own_lines( source_filepath: path, preprocessed_filepath: raw, rejoin: false ), []
|
|
429
494
|
end
|
|
430
495
|
|
|
431
496
|
# Fallback strips every directive line out of the content, so the macros and pragmas the
|
|
432
497
|
# extractor still needs are recovered separately and reinserted as assembler extras. That
|
|
433
498
|
# second pass is what keeps a type's array-size macro visible when no compiler ran.
|
|
434
|
-
def reconstitute_fallback(path:, defines:
|
|
435
|
-
contents = partials_file_assembler.collect_file_contents_fallback(
|
|
436
|
-
|
|
437
|
-
)
|
|
438
|
-
extras = partials_file_assembler.collect_macros_and_pragmas_fallback(
|
|
439
|
-
source_filepath: path, defines: defines
|
|
440
|
-
)
|
|
499
|
+
def reconstitute_fallback(path:, defines:)
|
|
500
|
+
contents = partials_file_assembler.collect_file_contents_fallback( source_filepath: path, defines: defines )
|
|
501
|
+
extras = partials_file_assembler.collect_macros_and_pragmas_fallback( source_filepath: path, defines: defines )
|
|
441
502
|
|
|
442
|
-
|
|
503
|
+
return contents, extras
|
|
443
504
|
end
|
|
444
505
|
|
|
445
506
|
# ---- compilation -------------------------------------------------------------
|
|
446
507
|
|
|
508
|
+
# GCC before 14 only warns about a call to an undeclared function, as Clang does not. A
|
|
509
|
+
# missing prototype has to fail on every compiler for a case about carrying one to mean anything.
|
|
510
|
+
STRICT_DECLARATIONS = '-Werror=implicit-function-declaration' unless const_defined?( :STRICT_DECLARATIONS )
|
|
511
|
+
|
|
447
512
|
# Compiles a translation unit that includes the generated implementation header, the way a
|
|
448
513
|
# generated test runner would. Syntax-only: this probes declarations and ordering, not code
|
|
449
514
|
# generation.
|
|
@@ -468,6 +533,15 @@ module PartialsGenerationHelpers
|
|
|
468
533
|
syntax_only( result, probe )
|
|
469
534
|
end
|
|
470
535
|
|
|
536
|
+
# Compiles a translation unit that includes the generated interface header, the way the mock
|
|
537
|
+
# CMock generates from it includes it
|
|
538
|
+
def compile_interface(result)
|
|
539
|
+
probe = File.join( result.dir, "probe_#{result.module_name}_interface.c" )
|
|
540
|
+
File.write( probe, "#include \"ceedling_partial_#{result.module_name}_interface.h\"\nint main(void) { return 0; }\n" )
|
|
541
|
+
|
|
542
|
+
syntax_only( result, probe )
|
|
543
|
+
end
|
|
544
|
+
|
|
471
545
|
# Compiles the types header entirely on its own, which is the question of whether that
|
|
472
546
|
# header is self-contained. Nothing else is included first.
|
|
473
547
|
def compile_types_header_alone(result)
|
|
@@ -478,7 +552,7 @@ module PartialsGenerationHelpers
|
|
|
478
552
|
end
|
|
479
553
|
|
|
480
554
|
def syntax_only(result, probe)
|
|
481
|
-
command = "#{partials_compiler} -fsyntax-only -I#{result.dir} #{probe}"
|
|
555
|
+
command = "#{partials_compiler} #{STRICT_DECLARATIONS} -fsyntax-only -I#{result.dir} #{probe}"
|
|
482
556
|
_out, stderr, status = Open3.capture3( command )
|
|
483
557
|
|
|
484
558
|
PartialsGeneration::Compilation.new( ok: status.success?, stderr: stderr, command: command )
|
|
@@ -493,12 +567,13 @@ module PartialsGenerationHelpers
|
|
|
493
567
|
# of`, so stripping `static` from a file-scope variable -- which turns a module-private
|
|
494
568
|
# name into one that participates in link-time resolution -- is testable only here.
|
|
495
569
|
|
|
496
|
-
# Compiles one result's generated implementation source to a real object file.
|
|
497
|
-
|
|
570
|
+
# Compiles one result's generated implementation source to a real object file. `flags`
|
|
571
|
+
# reach the compiler as given, so a case can hold the source to a warning set.
|
|
572
|
+
def compile_objects(result, flags: '')
|
|
498
573
|
object = File.join( result.dir, "ceedling_partial_#{result.module_name}_impl.o" )
|
|
499
574
|
source = File.join( result.dir, "ceedling_partial_#{result.module_name}_impl.c" )
|
|
500
575
|
|
|
501
|
-
command = "#{partials_compiler} -c -I#{result.dir} #{source} -o #{object}"
|
|
576
|
+
command = "#{partials_compiler} #{STRICT_DECLARATIONS} #{flags} -c -I#{result.dir} #{source} -o #{object}".squeeze( ' ' )
|
|
502
577
|
_out, stderr, status = Open3.capture3( command )
|
|
503
578
|
|
|
504
579
|
PartialsGeneration::Compilation.new( ok: status.success?, stderr: stderr, command: command )
|
|
@@ -507,7 +582,10 @@ module PartialsGenerationHelpers
|
|
|
507
582
|
# Links one or more results' generated implementations against a stand-in test translation
|
|
508
583
|
# unit. The stand-in takes the address of each named symbol so the linker has to resolve
|
|
509
584
|
# it; a symbol that merely compiles is not proof the definition survived.
|
|
510
|
-
|
|
585
|
+
#
|
|
586
|
+
# `stubs` is C the stand-in test file defines, the way a real test defines a stub for a
|
|
587
|
+
# function it subtracted. `flags` reach the compiler as given.
|
|
588
|
+
def link_partials(results, references: [], stubs: '', flags: '')
|
|
511
589
|
results = Array( results )
|
|
512
590
|
dir = results.first.dir
|
|
513
591
|
|
|
@@ -521,20 +599,20 @@ module PartialsGenerationHelpers
|
|
|
521
599
|
end
|
|
522
600
|
|
|
523
601
|
probe = File.join( dir, "probe_link_#{results.map( &:module_name ).join( '_' )}.c" )
|
|
524
|
-
File.write( probe, "#{headers.join( "\n" )}\nint main(void) {\n#{body}\n}\n" )
|
|
602
|
+
File.write( probe, "#{headers.join( "\n" )}\n#{stubs}\nint main(void) {\n#{body}\n}\n" )
|
|
525
603
|
|
|
526
604
|
sources = results.map { |r| File.join( r.dir, "ceedling_partial_#{r.module_name}_impl.c" ) }
|
|
527
605
|
includes = results.map( &:dir ).uniq.map { |d| "-I#{d}" }.join( ' ' )
|
|
528
606
|
output = File.join( dir, "probe_link_#{results.map( &:module_name ).join( '_' )}" )
|
|
529
607
|
|
|
530
|
-
command = "#{partials_compiler} #{includes} #{probe} #{sources.join( ' ' )} -o #{output}"
|
|
608
|
+
command = "#{partials_compiler} #{STRICT_DECLARATIONS} #{flags} #{includes} #{probe} #{sources.join( ' ' )} -o #{output}".squeeze( ' ' )
|
|
531
609
|
_out, stderr, status = Open3.capture3( command )
|
|
532
610
|
|
|
533
611
|
PartialsGeneration::Compilation.new( ok: status.success?, stderr: stderr, command: command )
|
|
534
612
|
end
|
|
535
613
|
|
|
536
|
-
def link_partial(result, references: [])
|
|
537
|
-
link_partials( [result], references: references )
|
|
614
|
+
def link_partial(result, references: [], stubs: '', flags: '')
|
|
615
|
+
link_partials( [result], references: references, stubs: stubs, flags: flags )
|
|
538
616
|
end
|
|
539
617
|
|
|
540
618
|
# A `partials:` entry for some *other* partialized module in the same test file. The remap
|
|
@@ -570,6 +648,12 @@ module PartialsGenerationHelpers
|
|
|
570
648
|
ENV.fetch( 'PARTIALS_GENERATION_CC', 'gcc' )
|
|
571
649
|
end
|
|
572
650
|
|
|
651
|
+
# Clang answers to `gcc` on macOS, and some warnings only GCC reports
|
|
652
|
+
def partials_compiler_gcc?
|
|
653
|
+
@partials_compiler_gcc = !`#{partials_compiler} --version 2>&1`.match?( /clang/i ) if @partials_compiler_gcc.nil?
|
|
654
|
+
return @partials_compiler_gcc
|
|
655
|
+
end
|
|
656
|
+
|
|
573
657
|
# ---- construction -------------------------------------------------------------
|
|
574
658
|
|
|
575
659
|
# `<name>` is a system header, everything else a user header -- the distinction
|
|
@@ -585,6 +669,12 @@ module PartialsGenerationHelpers
|
|
|
585
669
|
end
|
|
586
670
|
|
|
587
671
|
def extract_c(content)
|
|
672
|
+
partials_c_extractor.from_string( content: content )
|
|
673
|
+
end
|
|
674
|
+
|
|
675
|
+
# A real extractor that reads files with a real file wrapper, as Partializer reads the
|
|
676
|
+
# assembled copies and reconciliation reads the expanded code
|
|
677
|
+
def partials_c_extractor
|
|
588
678
|
code_text = CExtractorCodeText.new
|
|
589
679
|
declarations = CExtractorDeclarations.new({ c_extractor_code_text: code_text })
|
|
590
680
|
functions = CExtractorFunctions.new({ c_extractor_code_text: code_text })
|
|
@@ -604,11 +694,11 @@ module PartialsGenerationHelpers
|
|
|
604
694
|
# length, as c_extractor_composition_spec.rb does.
|
|
605
695
|
configurator: RSpec::Mocks::Double.new( 'Configurator' ),
|
|
606
696
|
loginator: RSpec::Mocks::Double.new( 'Loginator' ).as_null_object,
|
|
607
|
-
file_wrapper:
|
|
697
|
+
file_wrapper: partials_file_wrapper
|
|
608
698
|
}
|
|
609
699
|
)
|
|
610
700
|
extractor.setup()
|
|
611
|
-
extractor
|
|
701
|
+
extractor
|
|
612
702
|
end
|
|
613
703
|
|
|
614
704
|
def build_partials_generator
|
|
@@ -626,36 +716,36 @@ module PartialsGenerationHelpers
|
|
|
626
716
|
def build_partializer
|
|
627
717
|
Partializer.new(
|
|
628
718
|
{
|
|
629
|
-
configurator:
|
|
630
|
-
partializer_helper:
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
719
|
+
configurator: RSpec::Mocks::Double.new( 'Configurator' ).as_null_object,
|
|
720
|
+
partializer_helper: partials_helper,
|
|
721
|
+
partializer_reconciler: PartializerReconciler.new( c_extractor: partials_c_extractor, loginator: partials_null_loginator ),
|
|
722
|
+
file_finder: RSpec::Mocks::Double.new( 'FileFinder' ).as_null_object,
|
|
723
|
+
c_extractor: partials_c_extractor,
|
|
724
|
+
file_path_utils: partials_file_path_utils,
|
|
634
725
|
preprocessinator_reconstructor: partials_reconstructor,
|
|
635
|
-
file_wrapper:
|
|
636
|
-
reportinator:
|
|
637
|
-
loginator:
|
|
726
|
+
file_wrapper: partials_file_wrapper,
|
|
727
|
+
reportinator: RSpec::Mocks::Double.new( 'Reportinator' ).as_null_object,
|
|
728
|
+
loginator: partials_null_loginator
|
|
638
729
|
}
|
|
639
730
|
)
|
|
640
731
|
end
|
|
641
732
|
|
|
642
|
-
# One instance per case, memoized so
|
|
643
|
-
#
|
|
644
|
-
#
|
|
733
|
+
# One instance per case, memoized so extraction and the later passes share state. Every
|
|
734
|
+
# collaborator is real, so selected bodies and carried items alike carry the #line a build
|
|
735
|
+
# gives them.
|
|
645
736
|
def partials_helper
|
|
646
737
|
@partials_helper ||= PartializerHelper.new(
|
|
647
738
|
{
|
|
739
|
+
# A real finder, so a carried prototype's #line names its true line and reaches the compiler
|
|
648
740
|
partializer_utils: PartializerUtils.new(
|
|
649
741
|
{
|
|
650
|
-
preprocessinator_code_finder:
|
|
742
|
+
preprocessinator_code_finder: PreprocessinatorCodeFinder.new( { file_wrapper: partials_file_wrapper } ),
|
|
651
743
|
loginator: partials_null_loginator
|
|
652
744
|
}
|
|
653
745
|
),
|
|
654
|
-
c_extractor: RSpec::Mocks::Double.new( 'CExtractor' ).as_null_object,
|
|
655
746
|
c_extractor_declarations: CExtractorDeclarations.new(
|
|
656
747
|
{ c_extractor_code_text: CExtractorCodeText.new }
|
|
657
748
|
).tap( &:setup ),
|
|
658
|
-
file_path_utils: partials_file_path_utils,
|
|
659
749
|
parsing_parcels: ParsingParcels.new,
|
|
660
750
|
loginator: partials_null_loginator
|
|
661
751
|
}
|
|
@@ -674,7 +764,7 @@ module PartialsGenerationHelpers
|
|
|
674
764
|
)
|
|
675
765
|
end
|
|
676
766
|
|
|
677
|
-
# Of the
|
|
767
|
+
# Of the nine collaborators, the assemble and fallback-collect methods used here consult
|
|
678
768
|
# only the reconstructor, the file wrapper, and parsing parcels; the rest serve collection
|
|
679
769
|
# methods the harness drives itself.
|
|
680
770
|
def partials_file_assembler
|
|
@@ -687,7 +777,8 @@ module PartialsGenerationHelpers
|
|
|
687
777
|
file_wrapper: partials_file_wrapper,
|
|
688
778
|
parsing_parcels: ParsingParcels.new,
|
|
689
779
|
loginator: partials_null_loginator,
|
|
690
|
-
reportinator: RSpec::Mocks::Double.new( 'Reportinator' ).as_null_object
|
|
780
|
+
reportinator: RSpec::Mocks::Double.new( 'Reportinator' ).as_null_object,
|
|
781
|
+
build_step_doctor: RSpec::Mocks::Double.new( 'BuildStepDoctor' ).as_null_object
|
|
691
782
|
}
|
|
692
783
|
)
|
|
693
784
|
end
|
|
@@ -696,10 +787,15 @@ module PartialsGenerationHelpers
|
|
|
696
787
|
FileWrapper.new( loginator: partials_null_loginator, verbosinator: partials_null_verbosinator )
|
|
697
788
|
end
|
|
698
789
|
|
|
790
|
+
# Partializer names generated files with it. Each record carries its preprocessed paths, so
|
|
791
|
+
# no build tree is needed.
|
|
699
792
|
def partials_file_path_utils
|
|
793
|
+
configurator = RSpec::Mocks::Double.new( 'Configurator', project_test_preprocess_files_path: '/no/preprocessed/files' ).as_null_object
|
|
794
|
+
|
|
700
795
|
FilePathUtils.new(
|
|
701
|
-
configurator:
|
|
702
|
-
file_wrapper:
|
|
796
|
+
configurator: configurator,
|
|
797
|
+
file_wrapper: partials_file_wrapper,
|
|
798
|
+
test_build_layout: TestBuildLayout.new( configurator: configurator, file_wrapper: partials_file_wrapper )
|
|
703
799
|
)
|
|
704
800
|
end
|
|
705
801
|
|