Repository navigation
Add reals for configuration_reader, the COM wrappers and sf_service_config consumers - #392
Open
Parth Aggarwal (parth21999) wants to merge 1 commit into
Open
Parth Aggarwal (parth21999) wants to merge 1 commit into
Parth Aggarwal (parth21999) wants to merge 1 commit into
Conversation
…onfig consumers A unit test that mocks c_pal could not build a real configuration through fc_activation_context, its COM wrapper, DEFINE_SF_SERVICE_CONFIG and configuration_reader. Parts of that chain had no reals, so plain sf_c_util code ran inside the test and its gballoc, interlocked and rc_string calls landed in the test's mocks. With interlocked mocked, the first Release of a configuration package freed it while the activation context still held it, and the next read access violated. - Add reals for configuration_reader and for the fc_activation_context, fc_package and fabric_string_list_result COM wrappers. - Add the missing dependency renames to the existing reals. - Add real_sf_service_config.h. DEFINE_SF_SERVICE_CONFIG expands in the consumer, so the header documents how a consumer builds the real of its configuration and provides DECLARE_REAL_SF_SERVICE_CONFIG and REGISTER_SF_SERVICE_CONFIG_GLOBAL_MOCK_HOOK. - Add real_sf_service_config_ut, which builds a configuration from argv entirely with reals and checks that no internal call reaches the mocks. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4c84832a-b5c4-4db4-b114-8aeb0a7dc11a
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Member
Author
|
/AzurePipelines run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A unit test that mocks c_pal (gballoc_hl, interlocked) cannot build a real configuration through
fc_activation_context, its COM wrapper,DEFINE_SF_SERVICE_CONFIGandconfiguration_reader. Several links in that chain have no reals, so plain sf_c_util code runs inside the test and its gballoc, interlocked and rc_string calls land in the test's mocks:interlocked_decrementreturns 0. The firstReleaseof a configuration package frees it while the activation context still holds it, and the next read access violates inGetConfigurationPackage.Changes
Test code only; no changes under
srcorinc.real_configuration_reader(.c,.h,_renames.h).fc_activation_context,fc_packageandfabric_string_list_result. Renaming the wrapped handle type renames every symbolcom_wrapper.hgenerates.real_fc_activation_context,real_fc_package,real_hresult_to_string, and string_utils in the argc/argv reals.real_sf_service_config.h.DEFINE_SF_SERVICE_CONFIGexpands in the consumer, so sf_c_util cannot ship its real. The header documents how a consumer builds it and providesDECLARE_REAL_SF_SERVICE_CONFIGandREGISTER_SF_SERVICE_CONFIG_GLOBAL_MOCK_HOOK.real_sf_service_config_dependencies_renames.hrenames everything the generated code calls.real_sf_service_config_ut. It builds a configuration from argv entirely with reals, reads all 8 supported types, refreshes and releases it. It also asserts that the actual calls are exactly the top-level calls the test expects.Consumer recipe:
Testing
run_unittests,run_int_tests,run_reals_check,run_repo_validationanduse_vldON.real_sf_service_config_utfail.