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
|
@@ -9,7 +9,9 @@ require 'spec_helper'
|
|
|
9
9
|
require 'ceedling/test_invoker/partials_manager'
|
|
10
10
|
require 'ceedling/test_invoker/test_invoker_types'
|
|
11
11
|
require 'ceedling/partials/partials'
|
|
12
|
+
require 'ceedling/partials/partializer_config'
|
|
12
13
|
require 'ceedling/includes/includes'
|
|
14
|
+
require 'ceedling/includes/header_search'
|
|
13
15
|
|
|
14
16
|
describe PartialsManager do
|
|
15
17
|
before(:each) do
|
|
@@ -17,30 +19,31 @@ describe PartialsManager do
|
|
|
17
19
|
@loginator = double( "Loginator" )
|
|
18
20
|
@reportinator = double( "Reportinator" )
|
|
19
21
|
@batchinator = double( "Batchinator" )
|
|
20
|
-
@preprocessinator = double( "Preprocessinator" )
|
|
21
22
|
@partializer = double( "Partializer" )
|
|
22
23
|
@generator = double( "Generator" )
|
|
23
24
|
@dependinator = double( "Dependinator" )
|
|
24
25
|
@file_path_utils = double( "FilePathUtils" )
|
|
26
|
+
@file_wrapper = double( "FileWrapper" )
|
|
27
|
+
@mock_locator = double( "MockLocator" )
|
|
28
|
+
@header_search = double( "HeaderSearch" )
|
|
29
|
+
|
|
30
|
+
allow(@mock_locator).to receive(:header_search).and_return( @header_search )
|
|
31
|
+
allow(@header_search).to receive(:header_candidates).and_return( [] )
|
|
32
|
+
allow(@header_search).to receive(:at).and_return( nil )
|
|
25
33
|
|
|
26
34
|
allow(@reportinator).to receive(:generate_module_progress).and_return( '' )
|
|
27
35
|
allow(@reportinator).to receive(:generate_skip_summary).and_return( nil )
|
|
28
36
|
allow(@loginator).to receive(:log)
|
|
29
37
|
|
|
30
|
-
@
|
|
31
|
-
@tools_test_file_directives_only_preprocessor = { name: 'fake directives-only preprocessor' }
|
|
32
|
-
@tools_test_file_full_preprocessor = { name: 'fake full preprocessor' }
|
|
33
|
-
@partials_config = { max_extraction_length: 5000 }
|
|
38
|
+
@partials_config = { max_extraction_length: 5000 }
|
|
34
39
|
|
|
35
|
-
allow(@configurator).to receive(:tools_test_bare_includes_preprocessor).and_return( @tools_test_bare_includes_preprocessor )
|
|
36
|
-
allow(@configurator).to receive(:tools_test_file_directives_only_preprocessor).and_return( @tools_test_file_directives_only_preprocessor )
|
|
37
|
-
allow(@configurator).to receive(:tools_test_file_full_preprocessor).and_return( @tools_test_file_full_preprocessor )
|
|
38
40
|
allow(@configurator).to receive(:test_build_preprocess_force_fallback).and_return( false )
|
|
39
41
|
allow(@configurator).to receive(:get_partials_config).and_return( @partials_config )
|
|
40
42
|
|
|
41
43
|
allow(@dependinator).to receive(:register)
|
|
42
44
|
allow(@dependinator).to receive(:stale?).and_return( true )
|
|
43
45
|
allow(@dependinator).to receive(:mark_fresh)
|
|
46
|
+
allow(@file_wrapper).to receive(:exist?).and_return( false )
|
|
44
47
|
|
|
45
48
|
@manager = described_class.new(
|
|
46
49
|
{
|
|
@@ -48,11 +51,12 @@ describe PartialsManager do
|
|
|
48
51
|
:loginator => @loginator,
|
|
49
52
|
:reportinator => @reportinator,
|
|
50
53
|
:batchinator => @batchinator,
|
|
51
|
-
:preprocessinator => @preprocessinator,
|
|
52
54
|
:partializer => @partializer,
|
|
53
55
|
:generator => @generator,
|
|
54
56
|
:dependinator => @dependinator,
|
|
55
|
-
:file_path_utils => @file_path_utils
|
|
57
|
+
:file_path_utils => @file_path_utils,
|
|
58
|
+
:file_wrapper => @file_wrapper,
|
|
59
|
+
:mock_locator => @mock_locator
|
|
56
60
|
}
|
|
57
61
|
)
|
|
58
62
|
end
|
|
@@ -61,307 +65,229 @@ describe PartialsManager do
|
|
|
61
65
|
# stubbed to synchronously yield every `things` entry to the given block,
|
|
62
66
|
# matching its real per-item iteration contract without pulling in Parallel.
|
|
63
67
|
def stub_batchinator_exec
|
|
64
|
-
allow(@batchinator).to receive(:exec) do |
|
|
68
|
+
allow(@batchinator).to receive(:exec) do |things:, **, &block|
|
|
65
69
|
things.each { |k, v| block.call(k, v) }
|
|
66
70
|
end
|
|
67
71
|
end
|
|
68
72
|
|
|
69
|
-
context "#
|
|
73
|
+
context "#stage_generate_partials" do
|
|
70
74
|
before(:each) do
|
|
71
75
|
stub_batchinator_exec()
|
|
72
76
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
allow(@preprocessinator).to receive(:preprocess_partial_header_file_preserve_macros).and_return( ['build/preprocess/raw/Foo.h', []] )
|
|
79
|
-
allow(@preprocessinator).to receive(:preprocess_partial_header_expand_macros).and_return( 'build/preprocess/full_expansion/Foo.h' )
|
|
80
|
-
allow(@preprocessinator).to receive(:load_includes_list).and_return( [] )
|
|
81
|
-
|
|
82
|
-
@testable = TestInvokerTypes::Testable.new(
|
|
83
|
-
:name => 'a_test',
|
|
84
|
-
:preprocess_flags => ['-Wall'], :preprocess_defines => ['TEST'], :search_paths => ['src']
|
|
85
|
-
)
|
|
86
|
-
@config = Partials::ConfigFileInfo.new( filepath: 'src/Foo.h' )
|
|
87
|
-
@details = TestInvokerTypes::PartialWork.new( :config => @config, :testable => @testable, :directives_only_filepath => nil )
|
|
88
|
-
@state = TestInvokerTypes::PipelineState.new(
|
|
89
|
-
:testables => { :a_test => @testable }, :partials_headers => [@details], :context => :test, :options => []
|
|
90
|
-
)
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
it "registers the header's deterministic target with the header file as sole antecedent and preprocess flags/defines/search paths, preprocessing tools, and :partials config as meta" do
|
|
94
|
-
allow(@configurator).to receive(:test_build_preprocess_directives_only_available).and_return( false )
|
|
95
|
-
|
|
96
|
-
expect(@dependinator).to receive(:register).with(
|
|
97
|
-
'build/preprocess/Foo.h',
|
|
98
|
-
files: ['src/Foo.h'],
|
|
99
|
-
meta: {
|
|
100
|
-
flags: ['-Wall'], defines: ['TEST'], search_paths: ['src'],
|
|
101
|
-
tools: [@tools_test_file_directives_only_preprocessor, @tools_test_bare_includes_preprocessor, @tools_test_file_full_preprocessor],
|
|
102
|
-
preprocess_force_fallback: false,
|
|
103
|
-
partials: @partials_config
|
|
104
|
-
}
|
|
77
|
+
@module_contents = double( "CModule",
|
|
78
|
+
function_definitions: [],
|
|
79
|
+
function_declarations: [],
|
|
80
|
+
type_definitions: [],
|
|
81
|
+
aggregate_definitions: []
|
|
105
82
|
)
|
|
83
|
+
# Whether the module has types follows from its lists, which an example may stub
|
|
84
|
+
allow(@module_contents).to receive(:types?) { !(@module_contents.type_definitions.empty? and @module_contents.aggregate_definitions.empty?) }
|
|
85
|
+
allow(@partializer).to receive(:extract_module_contents).and_return( @module_contents )
|
|
86
|
+
allow(@partializer).to receive(:validate_config)
|
|
87
|
+
allow(@partializer).to receive(:sanitize)
|
|
88
|
+
allow(@partializer).to receive(:validate_extracted_functions)
|
|
89
|
+
allow(@partializer).to receive(:remap_implementation_header_includes).and_return( Partials::IncludeGroups.new )
|
|
90
|
+
allow(@partializer).to receive(:remap_implementation_source_includes).and_return( [] )
|
|
91
|
+
allow(@partializer).to receive(:remap_interface_header_includes).and_return( Partials::IncludeGroups.new )
|
|
92
|
+
allow(@partializer).to receive(:remap_types_header_includes).and_return( Partials::IncludeGroups.new )
|
|
93
|
+
allow(@partializer).to receive(:extract_module_include_guard).and_return( 'FOO_H' )
|
|
94
|
+
allow(@partializer).to receive(:plan_carry).and_return( Partials::CarryPlan.new )
|
|
95
|
+
allow(@partializer).to receive(:plan_interface_extras).and_return( Partials::InterfaceExtras.new )
|
|
96
|
+
allow(@partializer).to receive(:explain_tested_mock)
|
|
97
|
+
allow(@configurator).to receive(:partials_suppress_redundant_decls).and_return( true )
|
|
98
|
+
allow(@configurator).to receive(:partials_extern_variables).and_return( :weak )
|
|
99
|
+
allow(@generator).to receive(:generate_partial_types)
|
|
100
|
+
allow(@generator).to receive(:generate_partial_implementation)
|
|
101
|
+
allow(@generator).to receive(:generate_partial_interface)
|
|
106
102
|
|
|
107
|
-
@
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
allow(@
|
|
112
|
-
allow(@dependinator).to receive(:stale?).and_return( true )
|
|
113
|
-
|
|
114
|
-
expect(@preprocessinator).to receive(:generate_directives_only_output).ordered
|
|
115
|
-
expect(@preprocessinator).to receive(:preprocess_partial_header_file_preserve_macros).ordered
|
|
116
|
-
expect(@preprocessinator).to receive(:preprocess_partial_header_expand_macros).ordered
|
|
117
|
-
expect(@dependinator).to receive(:mark_fresh).with('build/preprocess/Foo.h').ordered
|
|
118
|
-
|
|
119
|
-
@manager.stage_preprocess_partial_headers( @state )
|
|
120
|
-
end
|
|
103
|
+
allow(@file_path_utils).to receive(:form_partial_types_header_filename).and_return( 'ceedling_partial_Foo_types.h' )
|
|
104
|
+
allow(@file_path_utils).to receive(:form_partial_implementation_source_filename).and_return( 'ceedling_partial_Foo_impl.c' )
|
|
105
|
+
allow(@file_path_utils).to receive(:form_partial_implementation_header_filename).and_return( 'ceedling_partial_Foo_impl.h' )
|
|
106
|
+
allow(@file_path_utils).to receive(:form_partial_interface_header_filename).and_return( 'ceedling_partial_Foo_interface.h' )
|
|
107
|
+
allow(@file_path_utils).to receive(:form_partial_extras_header_filename).and_return( 'ceedling_partial_Foo_extras.h' )
|
|
121
108
|
|
|
122
|
-
|
|
123
|
-
it "registers the includes list and full expansion as outputs before marking the target fresh" do
|
|
124
|
-
allow(@configurator).to receive(:test_build_preprocess_directives_only_available).and_return( false )
|
|
109
|
+
allow(@dependinator).to receive(:register)
|
|
125
110
|
allow(@dependinator).to receive(:stale?).and_return( true )
|
|
126
|
-
allow(@
|
|
127
|
-
allow(@preprocessinator).to receive(:preprocess_partial_header_expand_macros)
|
|
128
|
-
|
|
129
|
-
expect(@dependinator).to receive(:register).with(
|
|
130
|
-
'build/preprocess/Foo.h', outputs: ['build/preprocess/includes/Foo.h.yml', 'build/preprocess/full_expansion/Foo.h']
|
|
131
|
-
).ordered
|
|
132
|
-
expect(@dependinator).to receive(:mark_fresh).with('build/preprocess/Foo.h').ordered
|
|
111
|
+
allow(@dependinator).to receive(:mark_fresh)
|
|
133
112
|
|
|
134
|
-
@
|
|
113
|
+
@config = PartializerConfig::Config.new(
|
|
114
|
+
module: 'Foo',
|
|
115
|
+
header: Partials::ConfigFileInfo.new( filepath: 'src/Foo.h', includes: [] ),
|
|
116
|
+
source: Partials::ConfigFileInfo.new( filepath: 'src/Foo.c', includes: [] )
|
|
117
|
+
)
|
|
118
|
+
@testable = TestInvokerTypes::Testable.new(
|
|
119
|
+
:name => 'a_test',
|
|
120
|
+
:paths => { :partials => 'build/test/partials/a_test' }
|
|
121
|
+
)
|
|
122
|
+
@testable.partials.configs = { 'Foo' => @config }
|
|
123
|
+
@state = TestInvokerTypes::PipelineState.new(
|
|
124
|
+
:testables => { :a_test => @testable }, :context => :test, :options => [], :lock => Mutex.new
|
|
125
|
+
)
|
|
135
126
|
end
|
|
136
127
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
expect(@preprocessinator).to_not receive(:preprocess_partial_header_file_preserve_macros)
|
|
145
|
-
expect(@preprocessinator).to_not receive(:preprocess_partial_header_expand_macros)
|
|
146
|
-
expect(@dependinator).to_not receive(:mark_fresh)
|
|
128
|
+
# `config` here looks exactly as it would whether stage 6/7 just freshly
|
|
129
|
+
# preprocessed it or recalled it whole from a dependency-tracker cache
|
|
130
|
+
# hit -- this stage reads only `config` and has no way to tell the
|
|
131
|
+
# difference, so a single fixture covers both cases.
|
|
132
|
+
it "adds the module to tests and mocks when both implementation and interface are extracted" do
|
|
133
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
134
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
147
135
|
|
|
148
|
-
@manager.
|
|
136
|
+
@manager.stage_generate_partials( @state )
|
|
149
137
|
|
|
150
|
-
expect( @
|
|
151
|
-
expect( @
|
|
152
|
-
expect( @config.full_expansion_filepath ).to eq( 'build/preprocess/full_expansion/Foo.h' )
|
|
138
|
+
expect( @testable.partials.tests ).to eq( ['Foo'] )
|
|
139
|
+
expect( @testable.partials.mocks ).to eq( ['Foo'] )
|
|
153
140
|
end
|
|
154
141
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
allow(@
|
|
142
|
+
# Build threads finish in any order, and a test's link records its objects in order
|
|
143
|
+
it "keeps a test's Partial modules in configuration order, however the batch finishes" do
|
|
144
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
145
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
146
|
+
allow(@batchinator).to receive(:exec) do |things:, **, &block|
|
|
147
|
+
things.reverse_each { |thing| block.call( thing ) }
|
|
148
|
+
end
|
|
149
|
+
@testable.partials.configs = %w[Alpha Beta Gamma].to_h do |name|
|
|
150
|
+
[name, PartializerConfig::Config.new( module: name, header: @config.header, source: @config.source )]
|
|
151
|
+
end
|
|
158
152
|
|
|
159
|
-
|
|
160
|
-
expect(@preprocessinator).to receive(:preprocess_partial_header_file_preserve_macros)
|
|
161
|
-
expect(@preprocessinator).to receive(:preprocess_partial_header_expand_macros)
|
|
153
|
+
@manager.stage_generate_partials( @state )
|
|
162
154
|
|
|
163
|
-
@
|
|
155
|
+
expect( @testable.partials.tests ).to eq( %w[Alpha Beta Gamma] )
|
|
156
|
+
expect( @testable.partials.mocks ).to eq( %w[Alpha Beta Gamma] )
|
|
164
157
|
end
|
|
165
158
|
|
|
166
|
-
it "
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
allow(@
|
|
170
|
-
|
|
171
|
-
.and_return( 'Preprocessing partial header for a_test::Foo.h...' )
|
|
159
|
+
it "plans what the implementation carries from both selections, the Partial and the guard" do
|
|
160
|
+
impl = [double("FunctionDefinition")]
|
|
161
|
+
iface = [double("FunctionDeclaration")]
|
|
162
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( impl )
|
|
163
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( iface )
|
|
172
164
|
|
|
173
|
-
expect(@
|
|
174
|
-
|
|
165
|
+
expect(@partializer).to receive(:plan_carry).with(
|
|
166
|
+
test: 'a_test', c_module: @module_contents, impl: impl, interface: iface, header_guarded: true, config: @config
|
|
167
|
+
).and_return( Partials::CarryPlan.new )
|
|
175
168
|
|
|
176
|
-
@manager.
|
|
169
|
+
@manager.stage_generate_partials( @state )
|
|
177
170
|
end
|
|
178
171
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
allow(@
|
|
182
|
-
allow(@
|
|
183
|
-
|
|
184
|
-
.and_return( 'Skipping partial header preprocessing for a_test::Foo.h...' )
|
|
172
|
+
# Without a guard to stand in for, the real header may arrive through another include
|
|
173
|
+
it "plans for an unguarded module header when the header has no guard" do
|
|
174
|
+
allow(@partializer).to receive(:extract_module_include_guard).and_return( nil )
|
|
175
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
176
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( nil )
|
|
185
177
|
|
|
186
|
-
expect(@
|
|
187
|
-
expect(@reportinator).to_not receive(:generate_module_progress)
|
|
188
|
-
.with( operation: 'Preprocessing partial header for', module_name: anything, filename: anything )
|
|
178
|
+
expect(@partializer).to receive(:plan_carry).with( hash_including( header_guarded: false ) ).and_return( Partials::CarryPlan.new )
|
|
189
179
|
|
|
190
|
-
@manager.
|
|
180
|
+
@manager.stage_generate_partials( @state )
|
|
191
181
|
end
|
|
192
|
-
end
|
|
193
182
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
allow(@
|
|
199
|
-
allow(@
|
|
200
|
-
allow(@
|
|
201
|
-
allow(@file_path_utils).to receive(:form_preprocessed_includes_list_filepath).and_return( 'build/preprocess/includes/Foo.c.yml' )
|
|
202
|
-
allow(@preprocessinator).to receive(:generate_directives_only_output).and_return( 'build/preprocess/raw/Foo.c' )
|
|
203
|
-
allow(@preprocessinator).to receive(:preprocess_partial_source_file_preserve_macros).and_return( ['build/preprocess/raw/Foo.c', []] )
|
|
204
|
-
allow(@preprocessinator).to receive(:preprocess_partial_source_expand_macros).and_return( 'build/preprocess/full_expansion/Foo.c' )
|
|
205
|
-
allow(@preprocessinator).to receive(:load_includes_list).and_return( [] )
|
|
183
|
+
it "hands the plan and both Partials settings to implementation generation" do
|
|
184
|
+
plan = Partials::CarryPlan.new
|
|
185
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
186
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( nil )
|
|
187
|
+
allow(@partializer).to receive(:plan_carry).and_return( plan )
|
|
188
|
+
allow(@configurator).to receive(:partials_suppress_redundant_decls).and_return( false )
|
|
189
|
+
allow(@configurator).to receive(:partials_extern_variables).and_return( :test )
|
|
206
190
|
|
|
207
|
-
@
|
|
208
|
-
:
|
|
209
|
-
:preprocess_flags => ['-Wall'], :preprocess_defines => ['TEST'], :search_paths => ['src']
|
|
210
|
-
)
|
|
211
|
-
@config = Partials::ConfigFileInfo.new( filepath: 'src/Foo.c' )
|
|
212
|
-
@details = TestInvokerTypes::PartialWork.new( :config => @config, :testable => @testable, :directives_only_filepath => nil )
|
|
213
|
-
@state = TestInvokerTypes::PipelineState.new(
|
|
214
|
-
:testables => { :a_test => @testable }, :partials_sources => [@details], :context => :test, :options => []
|
|
191
|
+
expect(@generator).to receive(:generate_partial_implementation).with(
|
|
192
|
+
hash_including( carry: plan, suppress_redundant_decls: false, extern_variables: :test )
|
|
215
193
|
)
|
|
194
|
+
|
|
195
|
+
@manager.stage_generate_partials( @state )
|
|
216
196
|
end
|
|
217
197
|
|
|
218
|
-
|
|
219
|
-
|
|
198
|
+
# Only a regenerating implementation reads the plan, so its notices appear with that build
|
|
199
|
+
it "plans nothing when only the interface regenerates" do
|
|
200
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
201
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
202
|
+
allow(@dependinator).to receive(:stale?) { |target| target.end_with?( 'ceedling_partial_Foo_interface.h' ) }
|
|
220
203
|
|
|
221
|
-
expect(@
|
|
222
|
-
|
|
223
|
-
files: ['src/Foo.c'],
|
|
224
|
-
meta: {
|
|
225
|
-
flags: ['-Wall'], defines: ['TEST'], search_paths: ['src'],
|
|
226
|
-
tools: [@tools_test_file_directives_only_preprocessor, @tools_test_bare_includes_preprocessor, @tools_test_file_full_preprocessor],
|
|
227
|
-
preprocess_force_fallback: false,
|
|
228
|
-
partials: @partials_config
|
|
229
|
-
}
|
|
230
|
-
)
|
|
204
|
+
expect(@partializer).not_to receive(:plan_carry)
|
|
205
|
+
expect(@generator).to receive(:generate_partial_interface)
|
|
231
206
|
|
|
232
|
-
@manager.
|
|
207
|
+
@manager.stage_generate_partials( @state )
|
|
233
208
|
end
|
|
234
209
|
|
|
235
|
-
it "
|
|
236
|
-
allow(@
|
|
237
|
-
allow(@
|
|
210
|
+
it "plans nothing when no implementation is extracted" do
|
|
211
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( nil )
|
|
212
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
238
213
|
|
|
239
|
-
expect(@
|
|
240
|
-
expect(@preprocessinator).to receive(:preprocess_partial_source_file_preserve_macros).ordered
|
|
241
|
-
expect(@preprocessinator).to receive(:preprocess_partial_source_expand_macros).ordered
|
|
242
|
-
expect(@dependinator).to receive(:mark_fresh).with('build/preprocess/Foo.c').ordered
|
|
214
|
+
expect(@partializer).not_to receive(:plan_carry)
|
|
243
215
|
|
|
244
|
-
@manager.
|
|
216
|
+
@manager.stage_generate_partials( @state )
|
|
245
217
|
end
|
|
246
218
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
allow(@
|
|
252
|
-
|
|
253
|
-
expect(@preprocessinator).to_not receive(:generate_directives_only_output)
|
|
254
|
-
expect(@preprocessinator).to_not receive(:preprocess_partial_source_file_preserve_macros)
|
|
255
|
-
expect(@preprocessinator).to_not receive(:preprocess_partial_source_expand_macros)
|
|
256
|
-
expect(@dependinator).to_not receive(:mark_fresh)
|
|
219
|
+
# A mock-only Partial's interface stands in for the real header, so it keeps the rest of it
|
|
220
|
+
it "plans what a mock-only Partial's interface keeps from the module, its selection and the guard" do
|
|
221
|
+
interface = [double("FunctionDeclaration")]
|
|
222
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( nil )
|
|
223
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( interface )
|
|
257
224
|
|
|
258
|
-
@
|
|
225
|
+
expect(@partializer).to receive(:plan_interface_extras).with(
|
|
226
|
+
test: 'a_test', c_module: @module_contents, interface: interface, header_guarded: true, config: @config
|
|
227
|
+
).and_return( Partials::InterfaceExtras.new )
|
|
259
228
|
|
|
260
|
-
|
|
261
|
-
expect( @config.includes ).to eq( cached_includes )
|
|
262
|
-
expect( @config.full_expansion_filepath ).to eq( 'build/preprocess/full_expansion/Foo.c' )
|
|
229
|
+
@manager.stage_generate_partials( @state )
|
|
263
230
|
end
|
|
264
231
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
allow(@
|
|
232
|
+
# The module's implementation carries what its own code uses
|
|
233
|
+
it "plans no extras for a module the test also tests" do
|
|
234
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
235
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
268
236
|
|
|
269
|
-
expect(@
|
|
270
|
-
expect(@
|
|
271
|
-
expect(@preprocessinator).to receive(:preprocess_partial_source_expand_macros)
|
|
237
|
+
expect(@partializer).not_to receive(:plan_interface_extras)
|
|
238
|
+
expect(@generator).to receive(:generate_partial_interface).with( hash_including( extras: nil ) )
|
|
272
239
|
|
|
273
|
-
@manager.
|
|
240
|
+
@manager.stage_generate_partials( @state )
|
|
274
241
|
end
|
|
275
242
|
|
|
276
|
-
it "
|
|
277
|
-
|
|
278
|
-
allow(@
|
|
279
|
-
allow(@
|
|
280
|
-
.with( operation: 'Preprocessing partial source for', module_name: 'a_test', filename: 'Foo.c' )
|
|
281
|
-
.and_return( 'Preprocessing partial source for a_test::Foo.c...' )
|
|
243
|
+
it "explains what other Partials go without when the test both tests and mocks a module" do
|
|
244
|
+
interface = [double("FunctionDeclaration")]
|
|
245
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
246
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( interface )
|
|
282
247
|
|
|
283
|
-
expect(@
|
|
284
|
-
|
|
248
|
+
expect(@partializer).to receive(:explain_tested_mock).with(
|
|
249
|
+
test: 'a_test', c_module: @module_contents, interface: interface, header_guarded: true, config: @config,
|
|
250
|
+
partials: @testable.partials.configs
|
|
251
|
+
)
|
|
285
252
|
|
|
286
|
-
@manager.
|
|
253
|
+
@manager.stage_generate_partials( @state )
|
|
287
254
|
end
|
|
288
255
|
|
|
289
|
-
it "
|
|
290
|
-
allow(@
|
|
291
|
-
allow(@
|
|
292
|
-
allow(@reportinator).to receive(:generate_module_progress)
|
|
293
|
-
.with( operation: 'Skipping partial source preprocessing for', module_name: 'a_test', filename: 'Foo.c' )
|
|
294
|
-
.and_return( 'Skipping partial source preprocessing for a_test::Foo.c...' )
|
|
256
|
+
it "explains nothing for a mock-only Partial" do
|
|
257
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( nil )
|
|
258
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
295
259
|
|
|
296
|
-
expect(@
|
|
297
|
-
expect(@reportinator).to_not receive(:generate_module_progress)
|
|
298
|
-
.with( operation: 'Preprocessing partial source for', module_name: anything, filename: anything )
|
|
260
|
+
expect(@partializer).not_to receive(:explain_tested_mock)
|
|
299
261
|
|
|
300
|
-
@manager.
|
|
262
|
+
@manager.stage_generate_partials( @state )
|
|
301
263
|
end
|
|
302
|
-
end
|
|
303
264
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
allow(@
|
|
309
|
-
|
|
310
|
-
@module_contents = double( "CModule",
|
|
311
|
-
function_definitions: [],
|
|
312
|
-
function_declarations: [],
|
|
313
|
-
type_definitions: [],
|
|
314
|
-
aggregate_definitions: []
|
|
315
|
-
)
|
|
316
|
-
allow(@partializer).to receive(:extract_module_contents).and_return( @module_contents )
|
|
317
|
-
allow(@partializer).to receive(:validate_config)
|
|
318
|
-
allow(@partializer).to receive(:sanitize)
|
|
319
|
-
allow(@partializer).to receive(:validate_extracted_functions)
|
|
320
|
-
allow(@partializer).to receive(:remap_implementation_header_includes).and_return( [] )
|
|
321
|
-
allow(@partializer).to receive(:remap_implementation_source_includes).and_return( [] )
|
|
322
|
-
allow(@partializer).to receive(:remap_interface_header_includes).and_return( [] )
|
|
323
|
-
allow(@partializer).to receive(:remap_types_header_includes).and_return( [] )
|
|
324
|
-
allow(@partializer).to receive(:extract_module_include_guard).and_return( 'FOO_H' )
|
|
325
|
-
allow(@generator).to receive(:generate_partial_types)
|
|
326
|
-
allow(@generator).to receive(:generate_partial_implementation)
|
|
327
|
-
allow(@generator).to receive(:generate_partial_interface)
|
|
265
|
+
it "hands the extras to interface generation, which vouches for the extras header" do
|
|
266
|
+
extras = Partials::InterfaceExtras.new( items: [double("CFunctionDefinition")] )
|
|
267
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( nil )
|
|
268
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
269
|
+
allow(@partializer).to receive(:plan_interface_extras).and_return( extras )
|
|
328
270
|
|
|
329
|
-
|
|
330
|
-
allow(@file_path_utils).to receive(:form_partial_implementation_source_filename).and_return( 'ceedling_partial_Foo_impl.c' )
|
|
331
|
-
allow(@file_path_utils).to receive(:form_partial_implementation_header_filename).and_return( 'ceedling_partial_Foo_impl.h' )
|
|
332
|
-
allow(@file_path_utils).to receive(:form_partial_interface_header_filename).and_return( 'ceedling_partial_Foo_interface.h' )
|
|
271
|
+
expect(@generator).to receive(:generate_partial_interface).with( hash_including( extras: extras ) )
|
|
333
272
|
|
|
334
|
-
|
|
335
|
-
allow(@dependinator).to receive(:stale?).and_return( true )
|
|
336
|
-
allow(@dependinator).to receive(:mark_fresh)
|
|
273
|
+
@manager.stage_generate_partials( @state )
|
|
337
274
|
|
|
338
|
-
@
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
source: Partials::ConfigFileInfo.new( filepath: 'src/Foo.c', includes: [] )
|
|
342
|
-
)
|
|
343
|
-
@testable = TestInvokerTypes::Testable.new(
|
|
344
|
-
:name => 'a_test',
|
|
345
|
-
:paths => { :partials => 'build/test/partials/a_test' }
|
|
346
|
-
)
|
|
347
|
-
@testable.partials.configs = { 'Foo' => @config }
|
|
348
|
-
@state = TestInvokerTypes::PipelineState.new(
|
|
349
|
-
:testables => { :a_test => @testable }, :context => :test, :options => [], :lock => Mutex.new
|
|
275
|
+
expect(@dependinator).to have_received(:register).with(
|
|
276
|
+
'build/test/partials/a_test/ceedling_partial_Foo_interface.h',
|
|
277
|
+
hash_including( outputs: ['build/test/partials/a_test/ceedling_partial_Foo_extras.h'] )
|
|
350
278
|
)
|
|
351
279
|
end
|
|
352
280
|
|
|
353
|
-
#
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
it "adds the module to tests and mocks when both implementation and interface are extracted" do
|
|
358
|
-
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
281
|
+
# An extras header an earlier build left would sit beside an interface that no longer includes it
|
|
282
|
+
it "removes an extras header an earlier build left once the interface keeps nothing" do
|
|
283
|
+
extras = 'build/test/partials/a_test/ceedling_partial_Foo_extras.h'
|
|
284
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( nil )
|
|
359
285
|
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
286
|
+
allow(@file_wrapper).to receive(:exist?).with( extras ).and_return( true )
|
|
360
287
|
|
|
361
|
-
@
|
|
288
|
+
expect(@file_wrapper).to receive(:rm_f).with( extras )
|
|
362
289
|
|
|
363
|
-
|
|
364
|
-
expect( @testable.partials.mocks ).to eq( ['Foo'] )
|
|
290
|
+
@manager.stage_generate_partials( @state )
|
|
365
291
|
end
|
|
366
292
|
|
|
367
293
|
it "does not add to tests when no implementation is extracted" do
|
|
@@ -385,6 +311,9 @@ describe PartialsManager do
|
|
|
385
311
|
end
|
|
386
312
|
|
|
387
313
|
it "skips writing types, implementation, and interface when the dependency tracker reports all three unchanged, but still updates tests/mocks bookkeeping" do
|
|
314
|
+
@config.tests = PartializerConfig::PartialFunctions.new( type: Partials::PUBLIC )
|
|
315
|
+
@config.mocks = PartializerConfig::PartialFunctions.new( type: Partials::PRIVATE )
|
|
316
|
+
allow(@file_wrapper).to receive(:exist?).and_return( true )
|
|
388
317
|
allow(@module_contents).to receive(:type_definitions).and_return( [double("TypeDef")] )
|
|
389
318
|
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
390
319
|
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
@@ -415,6 +344,48 @@ describe PartialsManager do
|
|
|
415
344
|
)
|
|
416
345
|
end
|
|
417
346
|
|
|
347
|
+
# Both include the types header, so each vouches for it
|
|
348
|
+
it "registers the types header as an output of both the implementation and the interface" do
|
|
349
|
+
allow(@module_contents).to receive(:type_definitions).and_return( [double("TypeDef")] )
|
|
350
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
351
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
352
|
+
|
|
353
|
+
@manager.stage_generate_partials( @state )
|
|
354
|
+
|
|
355
|
+
types = 'build/test/partials/a_test/ceedling_partial_Foo_types.h'
|
|
356
|
+
expect(@dependinator).to have_received(:register).with(
|
|
357
|
+
'build/test/partials/a_test/ceedling_partial_Foo_impl.c',
|
|
358
|
+
hash_including( outputs: ['build/test/partials/a_test/ceedling_partial_Foo_impl.h', types] )
|
|
359
|
+
)
|
|
360
|
+
expect(@dependinator).to have_received(:register).with(
|
|
361
|
+
'build/test/partials/a_test/ceedling_partial_Foo_interface.h', hash_including( outputs: [types] )
|
|
362
|
+
)
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
# Whether a types header exists follows from the module files the record already holds, so
|
|
366
|
+
# the record can be known before extraction while generation still includes the header
|
|
367
|
+
it "records include lists without the types header and still generates with it" do
|
|
368
|
+
types_include = UserInclude.new( 'ceedling_partial_Foo_types.h' )
|
|
369
|
+
allow(@module_contents).to receive(:type_definitions).and_return( [double("TypeDef")] )
|
|
370
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
371
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
372
|
+
[:remap_implementation_header_includes, :remap_interface_header_includes].each do |remap|
|
|
373
|
+
allow(@partializer).to receive(remap) do |types_header: nil, **|
|
|
374
|
+
Partials::IncludeGroups.new( leading: [types_header && types_include, UserInclude.new( 'dep.h' )].compact )
|
|
375
|
+
end
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
metas = []
|
|
379
|
+
allow(@dependinator).to receive(:register) { |_target, meta: {}, **| metas << meta }
|
|
380
|
+
expect(@generator).to receive(:generate_partial_implementation).with( hash_including( header_includes: [types_include, UserInclude.new( 'dep.h' )] ) )
|
|
381
|
+
expect(@generator).to receive(:generate_partial_interface).with( hash_including( includes: [types_include, UserInclude.new( 'dep.h' )] ) )
|
|
382
|
+
|
|
383
|
+
@manager.stage_generate_partials( @state )
|
|
384
|
+
|
|
385
|
+
recorded = { leading: ['#include "dep.h"'], following: [] }
|
|
386
|
+
expect( metas.map { |meta| meta.values_at( :impl_header_includes, :interface_includes ) }.uniq ).to eq( [[recorded, recorded]] )
|
|
387
|
+
end
|
|
388
|
+
|
|
418
389
|
it "registers the whole :partials config as meta, and an empty tools list since this stage runs no shell tool" do
|
|
419
390
|
allow(@module_contents).to receive(:type_definitions).and_return( [double("TypeDef")] )
|
|
420
391
|
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
@@ -436,11 +407,210 @@ describe PartialsManager do
|
|
|
436
407
|
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
437
408
|
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
438
409
|
allow(@partializer).to receive(:remap_types_header_includes)
|
|
439
|
-
.and_return( [UserInclude.new('foundation.h')] )
|
|
410
|
+
.and_return( Partials::IncludeGroups.new( leading: [UserInclude.new('foundation.h')], following: [UserInclude.new('log.h')] ) )
|
|
440
411
|
|
|
441
412
|
expect(@dependinator).to receive(:register).at_least(:once) do |_target, meta: {}, **|
|
|
442
413
|
expect( meta[:include_guard] ).to eq( 'FOO_H' )
|
|
443
|
-
expect( meta[:types_includes] ).to eq( ['#include "foundation.h"'] )
|
|
414
|
+
expect( meta[:types_includes] ).to eq( { leading: ['#include "foundation.h"'], following: ['#include "log.h"'] } )
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
@manager.stage_generate_partials( @state )
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
# What a test selects decides what is generated, so switching TEST_PARTIAL_PUBLIC_MODULE to
|
|
421
|
+
# TEST_PARTIAL_ALL_MODULE, or adding a function, has to regenerate the Partial.
|
|
422
|
+
it "registers the module's selection, both sides, as meta" do
|
|
423
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
424
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
425
|
+
@config.tests = PartializerConfig::PartialFunctions.new( type: Partials::PUBLIC, additions: ['bar'] )
|
|
426
|
+
@config.mocks = PartializerConfig::PartialFunctions.new( type: Partials::PRIVATE, subtractions: ['baz'] )
|
|
427
|
+
|
|
428
|
+
expect(@dependinator).to receive(:register).at_least(:once) do |_target, meta: {}, **|
|
|
429
|
+
expect( meta[:selection] ).to eq(
|
|
430
|
+
tests: { type: Partials::PUBLIC, additions: ['bar'], subtractions: [] },
|
|
431
|
+
mocks: { type: Partials::PRIVATE, additions: [], subtractions: ['baz'] }
|
|
432
|
+
)
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
@manager.stage_generate_partials( @state )
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
it "registers different meta for selections that differ only in mode or additions" do
|
|
439
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
440
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( nil )
|
|
441
|
+
|
|
442
|
+
metas = []
|
|
443
|
+
allow(@dependinator).to receive(:register) { |_target, meta: {}, **| metas << meta }
|
|
444
|
+
|
|
445
|
+
[
|
|
446
|
+
PartializerConfig::PartialFunctions.new( type: Partials::PUBLIC ),
|
|
447
|
+
PartializerConfig::PartialFunctions.new( type: Partials::DEDUCT ),
|
|
448
|
+
PartializerConfig::PartialFunctions.new( type: Partials::PUBLIC, additions: ['helper'] )
|
|
449
|
+
].each do |tests|
|
|
450
|
+
@config.tests = tests
|
|
451
|
+
@manager.stage_generate_partials( @state )
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
expect( metas.uniq.length ).to eq( 3 )
|
|
455
|
+
end
|
|
456
|
+
|
|
457
|
+
# Each generated file's includes depend on the test's other Partial modules and how each is
|
|
458
|
+
# selected, so a change to any of those lists has to regenerate.
|
|
459
|
+
it "registers every generated file's include list as meta" do
|
|
460
|
+
allow(@module_contents).to receive(:type_definitions).and_return( [double("TypeDef")] )
|
|
461
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
462
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
463
|
+
allow(@partializer).to receive(:remap_types_header_includes).and_return( Partials::IncludeGroups.new( leading: [UserInclude.new('types_dep.h')] ) )
|
|
464
|
+
allow(@partializer).to receive(:remap_implementation_header_includes).and_return( Partials::IncludeGroups.new( following: [UserInclude.new('impl_h_dep.h')] ) )
|
|
465
|
+
allow(@partializer).to receive(:remap_implementation_source_includes).and_return( [UserInclude.new('impl_c_dep.h')] )
|
|
466
|
+
allow(@partializer).to receive(:remap_interface_header_includes).and_return( Partials::IncludeGroups.new( leading: [UserInclude.new('interface_dep.h')] ) )
|
|
467
|
+
|
|
468
|
+
expect(@dependinator).to receive(:register).at_least(:once) do |_target, meta: {}, **|
|
|
469
|
+
expect( meta[:types_includes] ).to eq( { leading: ['#include "types_dep.h"'], following: [] } )
|
|
470
|
+
expect( meta[:impl_header_includes] ).to eq( { leading: [], following: ['#include "impl_h_dep.h"'] } )
|
|
471
|
+
expect( meta[:impl_source_includes] ).to eq( ['#include "impl_c_dep.h"'] )
|
|
472
|
+
expect( meta[:interface_includes] ).to eq( { leading: ['#include "interface_dep.h"'], following: [] } )
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
@manager.stage_generate_partials( @state )
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
# Remapping logs each list it computes for a named test, so generation's lists are the only ones named
|
|
479
|
+
it "computes generation's include lists once, logged under the test's name, and hands them to generation" do
|
|
480
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
481
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
482
|
+
|
|
483
|
+
impl_h = Partials::IncludeGroups.new( leading: [UserInclude.new('impl_h_dep.h')], following: [UserInclude.new('impl_h_later.h')] )
|
|
484
|
+
impl_c = [UserInclude.new('impl_c_dep.h')]
|
|
485
|
+
interface = Partials::IncludeGroups.new( leading: [UserInclude.new('interface_dep.h')], following: [UserInclude.new('interface_later.h')] )
|
|
486
|
+
expect(@partializer).to receive(:remap_implementation_header_includes).with( hash_including( test: 'a_test' ) ).once.and_return( impl_h )
|
|
487
|
+
expect(@partializer).to receive(:remap_implementation_source_includes).with( hash_including( test: 'a_test' ) ).once.and_return( impl_c )
|
|
488
|
+
expect(@partializer).to receive(:remap_interface_header_includes).with( hash_including( test: 'a_test' ) ).once.and_return( interface )
|
|
489
|
+
expect(@partializer).to receive(:remap_types_header_includes).with( hash_including( test: 'a_test' ) ).once.and_return( Partials::IncludeGroups.new )
|
|
490
|
+
|
|
491
|
+
expect(@generator).to receive(:generate_partial_implementation).with(
|
|
492
|
+
hash_including( header_includes: impl_h.leading, header_following_includes: impl_h.following, source_includes: impl_c )
|
|
493
|
+
)
|
|
494
|
+
expect(@generator).to receive(:generate_partial_interface).with(
|
|
495
|
+
hash_including( includes: interface.leading, following_includes: interface.following )
|
|
496
|
+
)
|
|
497
|
+
|
|
498
|
+
@manager.stage_generate_partials( @state )
|
|
499
|
+
end
|
|
500
|
+
|
|
501
|
+
# A generated header's includes split where the source includes the module's header, so the
|
|
502
|
+
# header remaps need the two lists apart. The implementation source keeps one list.
|
|
503
|
+
it "hands the header remaps the source's and the header's includes apart" do
|
|
504
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
505
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
506
|
+
@config.source.includes = [UserInclude.new( 'Foo.h' ), UserInclude.new( 'log.h' )]
|
|
507
|
+
@config.header.includes = [UserInclude.new( 'base.h' )]
|
|
508
|
+
apart = hash_including( source_includes: @config.source.includes, header_includes: @config.header.includes )
|
|
509
|
+
|
|
510
|
+
%i[remap_types_header_includes remap_implementation_header_includes remap_interface_header_includes].each do |remap|
|
|
511
|
+
expect(@partializer).to receive(remap).with( apart ).twice.and_return( Partials::IncludeGroups.new )
|
|
512
|
+
end
|
|
513
|
+
expect(@partializer).to receive(:remap_implementation_source_includes)
|
|
514
|
+
.with( hash_including( includes: @config.source.includes + @config.header.includes ) ).twice.and_return( [] )
|
|
515
|
+
|
|
516
|
+
@manager.stage_generate_partials( @state )
|
|
517
|
+
end
|
|
518
|
+
|
|
519
|
+
# A real search over `tree`, a list of header paths, as IncludePathinator lists a directory
|
|
520
|
+
def header_search_over(paths, tree)
|
|
521
|
+
return HeaderSearch.new( paths, ->(dir) { tree.select { |header| File.dirname( header ) == dir }.sort } )
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
# The source includes both remaps of the module's includes receive
|
|
525
|
+
def expect_source_includes(includes)
|
|
526
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
527
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
528
|
+
|
|
529
|
+
expect(@partializer).to receive(:remap_types_header_includes)
|
|
530
|
+
.with( hash_including( source_includes: includes ) ).twice.and_return( Partials::IncludeGroups.new )
|
|
531
|
+
expect(@partializer).to receive(:remap_implementation_source_includes)
|
|
532
|
+
.with( hash_including( includes: includes ) ).twice.and_return( [] )
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
# A generated file writes each #include by the text the test's search paths reach its header by
|
|
536
|
+
it "hands the remaps each include spelled as the test's search paths reach its header" do
|
|
537
|
+
@config.source.includes = [UserInclude.new( 'src/drivers/foo.h' )]
|
|
538
|
+
allow(@mock_locator).to receive(:header_search).and_return( header_search_over( ['src'], ['src/drivers/foo.h'] ) )
|
|
539
|
+
|
|
540
|
+
expect_source_includes( [UserInclude.new( 'src/drivers/foo.h', include_path: 'drivers/foo.h' )] )
|
|
541
|
+
|
|
542
|
+
@manager.stage_generate_partials( @state )
|
|
543
|
+
end
|
|
544
|
+
|
|
545
|
+
# A preprocessor's #include holds the path the compiler found its header by
|
|
546
|
+
it "spells a preprocessed #include by the header the compiler found" do
|
|
547
|
+
@config.source.includes = [UserInclude.new( 'include/config.h' )]
|
|
548
|
+
allow(@mock_locator).to receive(:header_search)
|
|
549
|
+
.and_return( header_search_over( ['include', 'third_party/mylib'], ['include/config.h', 'third_party/mylib/include/config.h'] ) )
|
|
550
|
+
|
|
551
|
+
expect_source_includes( [UserInclude.new( 'include/config.h', include_path: 'config.h' )] )
|
|
552
|
+
|
|
553
|
+
@manager.stage_generate_partials( @state )
|
|
554
|
+
end
|
|
555
|
+
|
|
556
|
+
# Fallback's text scan holds an #include as written, which the compiler looks for beside the
|
|
557
|
+
# file holding it before any search path
|
|
558
|
+
it "spells a fallback #include by the header beside the file holding it" do
|
|
559
|
+
@config.source = Partials::ConfigFileInfo.new( filepath: 'src/drivers/uart/config.c', fallback: true, includes: [UserInclude.new( 'config.h' )] )
|
|
560
|
+
allow(@mock_locator).to receive(:header_search)
|
|
561
|
+
.and_return( header_search_over( ['src', 'src/drivers/uart'], ['src/config.h', 'src/drivers/uart/config.h'] ) )
|
|
562
|
+
|
|
563
|
+
expect(@partializer).to receive(:remap_types_header_includes) do |source_includes:, **|
|
|
564
|
+
expect( source_includes.map( &:filepath ) ).to eq( ['src/drivers/uart/config.h'] )
|
|
565
|
+
Partials::IncludeGroups.new
|
|
566
|
+
end.twice
|
|
567
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
568
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
569
|
+
|
|
570
|
+
@manager.stage_generate_partials( @state )
|
|
571
|
+
end
|
|
572
|
+
|
|
573
|
+
it "searches once per test, however many Partials it holds" do
|
|
574
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
575
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
576
|
+
@testable.partials.configs = { 'Foo' => @config, 'Bar' => @config.dup.tap { |c| c.module = 'Bar' } }
|
|
577
|
+
|
|
578
|
+
expect(@mock_locator).to receive(:header_search).with( @testable ).once.and_return( @header_search )
|
|
579
|
+
|
|
580
|
+
@manager.stage_generate_partials( @state )
|
|
581
|
+
end
|
|
582
|
+
|
|
583
|
+
it "computes the record's include lists without a test name, so nothing logs them" do
|
|
584
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
585
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
586
|
+
|
|
587
|
+
%i[remap_types_header_includes remap_implementation_header_includes remap_implementation_source_includes remap_interface_header_includes].each do |remap|
|
|
588
|
+
result = (remap == :remap_implementation_source_includes) ? [] : Partials::IncludeGroups.new
|
|
589
|
+
expect(@partializer).to receive(remap).with( hash_including( test: nil ) ).once.and_return( result )
|
|
590
|
+
end
|
|
591
|
+
|
|
592
|
+
@manager.stage_generate_partials( @state )
|
|
593
|
+
end
|
|
594
|
+
|
|
595
|
+
# Generation reads the preprocessed copies, not the originals. A change that rewrites the
|
|
596
|
+
# copies without touching the originals -- forced fallback toggled, a different
|
|
597
|
+
# preprocessor -- has to regenerate.
|
|
598
|
+
it "registers the preprocessed copies generation reads as antecedent files" do
|
|
599
|
+
allow(@module_contents).to receive(:type_definitions).and_return( [double("TypeDef")] )
|
|
600
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
601
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
602
|
+
@config.header.assembled_filepath = 'build/pp/src/Foo.h'
|
|
603
|
+
@config.header.expansion_filepath = 'build/pp/expanded_code/src/Foo.h'
|
|
604
|
+
@config.source.assembled_filepath = 'build/pp/src/Foo.c'
|
|
605
|
+
@config.source.expansion_filepath = 'build/pp/expanded_code/src/Foo.c'
|
|
606
|
+
@config.header.raw_directives_only_filepath = 'build/pp/directives_only/raw/src/Foo.h'
|
|
607
|
+
|
|
608
|
+
expect(@dependinator).to receive(:register).exactly(3).times do |_target, files: [], **|
|
|
609
|
+
expect( files ).to contain_exactly(
|
|
610
|
+
'src/Foo.h', 'src/Foo.c',
|
|
611
|
+
'build/pp/src/Foo.h', 'build/pp/expanded_code/src/Foo.h',
|
|
612
|
+
'build/pp/src/Foo.c', 'build/pp/expanded_code/src/Foo.c', 'build/pp/directives_only/raw/src/Foo.h'
|
|
613
|
+
)
|
|
444
614
|
end
|
|
445
615
|
|
|
446
616
|
@manager.stage_generate_partials( @state )
|
|
@@ -451,11 +621,11 @@ describe PartialsManager do
|
|
|
451
621
|
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
452
622
|
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
453
623
|
|
|
454
|
-
carried = [UserInclude.new('foundation.h')]
|
|
624
|
+
carried = Partials::IncludeGroups.new( leading: [UserInclude.new('foundation.h')], following: [UserInclude.new('log.h')] )
|
|
455
625
|
allow(@partializer).to receive(:remap_types_header_includes).and_return( carried )
|
|
456
626
|
|
|
457
627
|
expect(@generator).to receive(:generate_partial_types).with(
|
|
458
|
-
hash_including( includes: carried, include_guard: 'FOO_H' )
|
|
628
|
+
hash_including( includes: carried.leading, following_includes: carried.following, include_guard: 'FOO_H' )
|
|
459
629
|
)
|
|
460
630
|
|
|
461
631
|
@manager.stage_generate_partials( @state )
|
|
@@ -477,6 +647,16 @@ describe PartialsManager do
|
|
|
477
647
|
@manager.stage_generate_partials( @state )
|
|
478
648
|
end
|
|
479
649
|
|
|
650
|
+
# Every generated file states the guard, so extraction's copy of it is removed
|
|
651
|
+
it "hands the guard to sanitizing the extracted module" do
|
|
652
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [] )
|
|
653
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [] )
|
|
654
|
+
|
|
655
|
+
expect(@partializer).to receive(:sanitize).with( @module_contents, include_guard: 'FOO_H' )
|
|
656
|
+
|
|
657
|
+
@manager.stage_generate_partials( @state )
|
|
658
|
+
end
|
|
659
|
+
|
|
480
660
|
it "reads the guard from the module's own header" do
|
|
481
661
|
allow(@partializer).to receive(:extract_implementation_functions).and_return( [] )
|
|
482
662
|
allow(@partializer).to receive(:extract_interface_functions).and_return( [] )
|
|
@@ -487,12 +667,12 @@ describe PartialsManager do
|
|
|
487
667
|
end
|
|
488
668
|
|
|
489
669
|
# Fallback resolves strictly less than the accurate pass, and validate_config refuses the
|
|
490
|
-
# shapes it cannot handle. The
|
|
491
|
-
it "
|
|
670
|
+
# shapes it cannot handle. The Partial's own files record which path ran.
|
|
671
|
+
it "hands config validation the Partial whose files record how they were preprocessed" do
|
|
492
672
|
allow(@partializer).to receive(:extract_implementation_functions).and_return( [] )
|
|
493
673
|
allow(@partializer).to receive(:extract_interface_functions).and_return( [] )
|
|
494
674
|
|
|
495
|
-
expect(@partializer).to receive(:validate_config).with(
|
|
675
|
+
expect(@partializer).to receive(:validate_config).with( c_module: @module_contents, config: @config, name: 'a_test' )
|
|
496
676
|
|
|
497
677
|
@manager.stage_generate_partials( @state )
|
|
498
678
|
end
|
|
@@ -522,7 +702,137 @@ describe PartialsManager do
|
|
|
522
702
|
@manager.stage_generate_partials( @state )
|
|
523
703
|
end
|
|
524
704
|
|
|
705
|
+
# Generated files that are all fresh already hold what extraction would produce
|
|
706
|
+
context "when the implementation and interface are both fresh" do
|
|
707
|
+
before(:each) do
|
|
708
|
+
@config.tests = PartializerConfig::PartialFunctions.new( type: Partials::PUBLIC )
|
|
709
|
+
@config.mocks = PartializerConfig::PartialFunctions.new( type: Partials::PRIVATE )
|
|
710
|
+
allow(@dependinator).to receive(:stale?).and_return( false )
|
|
711
|
+
end
|
|
712
|
+
|
|
713
|
+
it "extracts nothing, yet adds the module to tests and mocks" do
|
|
714
|
+
expect(@partializer).not_to receive(:extract_module_contents)
|
|
715
|
+
expect(@partializer).not_to receive(:validate_config)
|
|
716
|
+
expect(@generator).not_to receive(:generate_partial_implementation)
|
|
717
|
+
|
|
718
|
+
@manager.stage_generate_partials( @state )
|
|
719
|
+
|
|
720
|
+
expect( @testable.partials.tests ).to eq( ['Foo'] )
|
|
721
|
+
expect( @testable.partials.mocks ).to eq( ['Foo'] )
|
|
722
|
+
end
|
|
723
|
+
|
|
724
|
+
it "adds the module only to the list its selection names" do
|
|
725
|
+
@config.mocks = PartializerConfig::PartialFunctions.new
|
|
726
|
+
|
|
727
|
+
@manager.stage_generate_partials( @state )
|
|
728
|
+
|
|
729
|
+
expect( @testable.partials.tests ).to eq( ['Foo'] )
|
|
730
|
+
expect( @testable.partials.mocks ).to eq( [] )
|
|
731
|
+
end
|
|
732
|
+
|
|
733
|
+
# A module mocked from its header alone has only an interface to vouch for it
|
|
734
|
+
it "skips a mock-only Partial on its interface alone" do
|
|
735
|
+
@config.tests = PartializerConfig::PartialFunctions.new
|
|
736
|
+
|
|
737
|
+
expect(@partializer).not_to receive(:extract_module_contents)
|
|
738
|
+
expect(@reportinator).not_to receive(:generate_module_progress).with( hash_including( operation: "Skipping Partial implementation generation for" ) )
|
|
739
|
+
|
|
740
|
+
@manager.stage_generate_partials( @state )
|
|
741
|
+
|
|
742
|
+
expect( @testable.partials.tests ).to eq( [] )
|
|
743
|
+
expect( @testable.partials.mocks ).to eq( ['Foo'] )
|
|
744
|
+
end
|
|
745
|
+
|
|
746
|
+
# A full run prunes the record of any target it never registers
|
|
747
|
+
it "registers a types header still on disk, so its record survives" do
|
|
748
|
+
types = 'build/test/partials/a_test/ceedling_partial_Foo_types.h'
|
|
749
|
+
allow(@file_wrapper).to receive(:exist?).with( types ).and_return( true )
|
|
750
|
+
|
|
751
|
+
@manager.stage_generate_partials( @state )
|
|
752
|
+
|
|
753
|
+
expect(@dependinator).to have_received(:register).with( types, hash_including( :files, :meta ) )
|
|
754
|
+
end
|
|
755
|
+
|
|
756
|
+
# The implementation and interface vouch for the types header they include
|
|
757
|
+
it "leaves the types header's own record out of the decision" do
|
|
758
|
+
types = 'build/test/partials/a_test/ceedling_partial_Foo_types.h'
|
|
759
|
+
allow(@file_wrapper).to receive(:exist?).with( types ).and_return( true )
|
|
760
|
+
allow(@dependinator).to receive(:stale?) { |target| target == types }
|
|
761
|
+
|
|
762
|
+
expect(@partializer).not_to receive(:extract_module_contents)
|
|
763
|
+
|
|
764
|
+
@manager.stage_generate_partials( @state )
|
|
765
|
+
end
|
|
766
|
+
|
|
767
|
+
it "logs a skip line and counts a skip for each file it would have generated" do
|
|
768
|
+
allow(@file_wrapper).to receive(:exist?).and_return( true )
|
|
769
|
+
%w[types implementation interface].each do |kind|
|
|
770
|
+
expect(@reportinator).to receive(:generate_module_progress)
|
|
771
|
+
.with( hash_including( operation: "Skipping Partial #{kind} generation for" ) ).and_return( '' )
|
|
772
|
+
end
|
|
773
|
+
[
|
|
774
|
+
['Partial types generation', 'types headers'],
|
|
775
|
+
['Partial implementation generation', 'implementations'],
|
|
776
|
+
['Partial interface generation', 'interfaces']
|
|
777
|
+
].each do |task, noun|
|
|
778
|
+
expect(@reportinator).to receive(:generate_skip_summary).with( hash_including( task: task, count: 1, noun: noun ) )
|
|
779
|
+
end
|
|
780
|
+
|
|
781
|
+
@manager.stage_generate_partials( @state )
|
|
782
|
+
end
|
|
783
|
+
|
|
784
|
+
it "extracts and generates when the interface alone is stale" do
|
|
785
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
786
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
787
|
+
allow(@dependinator).to receive(:stale?) { |target| target.end_with?( '_interface.h' ) }
|
|
788
|
+
|
|
789
|
+
expect(@partializer).to receive(:extract_module_contents).and_return( @module_contents )
|
|
790
|
+
expect(@generator).to receive(:generate_partial_interface)
|
|
791
|
+
|
|
792
|
+
@manager.stage_generate_partials( @state )
|
|
793
|
+
end
|
|
794
|
+
end
|
|
795
|
+
|
|
796
|
+
# A types header an earlier build left would pass for current whenever the Partial is next fresh
|
|
797
|
+
it "removes a types header an earlier build left once the module has no types" do
|
|
798
|
+
types = 'build/test/partials/a_test/ceedling_partial_Foo_types.h'
|
|
799
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
800
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
801
|
+
allow(@file_wrapper).to receive(:exist?).with( types ).and_return( true )
|
|
802
|
+
|
|
803
|
+
expect(@file_wrapper).to receive(:rm_f).with( types )
|
|
804
|
+
expect(@dependinator).to receive(:invalidate).with( types )
|
|
805
|
+
|
|
806
|
+
@manager.stage_generate_partials( @state )
|
|
807
|
+
end
|
|
808
|
+
|
|
809
|
+
it "keeps the types header of a module that still has types" do
|
|
810
|
+
allow(@module_contents).to receive(:type_definitions).and_return( [double("TypeDef")] )
|
|
811
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
812
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
813
|
+
allow(@file_wrapper).to receive(:exist?).and_return( true )
|
|
814
|
+
allow(@file_wrapper).to receive(:rm_f)
|
|
815
|
+
|
|
816
|
+
@manager.stage_generate_partials( @state )
|
|
817
|
+
|
|
818
|
+
expect(@file_wrapper).not_to have_received(:rm_f).with( 'build/test/partials/a_test/ceedling_partial_Foo_types.h' )
|
|
819
|
+
end
|
|
820
|
+
|
|
821
|
+
# Nothing else can vouch for what the module's files would generate
|
|
822
|
+
it "extracts a Partial whose selection names neither an implementation nor an interface" do
|
|
823
|
+
allow(@partializer).to receive(:extract_implementation_functions).and_return( nil )
|
|
824
|
+
allow(@partializer).to receive(:extract_interface_functions).and_return( nil )
|
|
825
|
+
allow(@dependinator).to receive(:stale?).and_return( false )
|
|
826
|
+
|
|
827
|
+
expect(@partializer).to receive(:extract_module_contents).and_return( @module_contents )
|
|
828
|
+
|
|
829
|
+
@manager.stage_generate_partials( @state )
|
|
830
|
+
end
|
|
831
|
+
|
|
525
832
|
it "logs summary lines stating how many of each Partial artifact were recalled from cache" do
|
|
833
|
+
@config.tests = PartializerConfig::PartialFunctions.new( type: Partials::PUBLIC )
|
|
834
|
+
@config.mocks = PartializerConfig::PartialFunctions.new( type: Partials::PRIVATE )
|
|
835
|
+
allow(@file_wrapper).to receive(:exist?).and_return( true )
|
|
526
836
|
allow(@partializer).to receive(:extract_implementation_functions).and_return( [double("FunctionDefinition")] )
|
|
527
837
|
allow(@partializer).to receive(:extract_interface_functions).and_return( [double("FunctionDeclaration")] )
|
|
528
838
|
allow(@module_contents).to receive(:type_definitions).and_return( [double("TypeDef")] )
|