Rename TEST_SUITE_INITIALIZE/CLEANUP to _INTERNAL and guard behind DEFINE_ macros#287
Open
parth21999 wants to merge 1 commit intomasterfrom
Open
Rename TEST_SUITE_INITIALIZE/CLEANUP to _INTERNAL and guard behind DEFINE_ macros#287parth21999 wants to merge 1 commit intomasterfrom
parth21999 wants to merge 1 commit intomasterfrom
Conversation
…FINE_ macros TEST_SUITE_INITIALIZE and TEST_SUITE_CLEANUP are renamed to TEST_SUITE_INITIALIZE_INTERNAL and TEST_SUITE_CLEANUP_INTERNAL. They are now guarded behind DEFINE_TEST_SUITE_INITIALIZE and DEFINE_TEST_SUITE_CLEANUP preprocessor guards respectively. This prevents test code from using these macros directly, enforcing that all test suites go through an appropriate wrapper macro that defines the guards before including this header. The wrapper macro can inject additional fixtures (e.g. watchdog timers) while keeping testrunnerswitcher's CPP_UNITTEST/ctest abstraction intact. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
/AzurePipelines run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This was referenced Mar 2, 2026
Closed
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.
Summary
TEST_SUITE_INITIALIZEandTEST_SUITE_CLEANUPare renamed toTEST_SUITE_INITIALIZE_INTERNALandTEST_SUITE_CLEANUP_INTERNAL, and guarded behindDEFINE_TEST_SUITE_INITIALIZE/DEFINE_TEST_SUITE_CLEANUPpreprocessor guards.Why
We are introducing wrapper macros (in c-pal) that inject additional fixtures into suite init/cleanup - for example, a process watchdog that terminates test suites that hang. These wrapper macros need to call testrunnerswitcher's suite init/cleanup, but we want to prevent test code from bypassing the wrapper and calling the raw macros directly.
By renaming to
_INTERNALand gating behindDEFINE_guards:testrunnerswitcher.h, enabling them to use_INTERNALwhile keeping the abstraction intact.TEST_SUITE_INITIALIZE_INTERNAL/TEST_SUITE_CLEANUP_INTERNAL, without needing to know aboutCPP_UNITTEST,CTEST_SUITE_INITIALIZE, orcppunittest_mutex_fixtures_*._INTERNALname discourages direct use even if someone discovers the guard mechanism.Impact
CPP_UNITTESTand ctest paths are updated identically.TEST_FUNCTION_INITIALIZE/TEST_FUNCTION_CLEANUPare unchanged.TEST_SUITE_INITIALIZEdirectly will need to migrate to the new wrapper macros.