Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow GoogleTest to Test STATIC Functions
> This is a cherry-pick to keep the -D GOOGLETEST_HOST_UNIT_TEST_BUILD=1 Cmocka is able to test STATIC functions by including the C file in the test file. However, in many scenarios, GoogleTest files cannot do this as the C++ compiler has stricter rules than the C compiler. This patch updates the UnitTestFrameworkPkgHost.dsc.in to add a new build flag GOOGLETEST_HOST_UNIT_TEST_BUILD for HOST_APPLICATIONS only. Base.h is then updated to undef STATIC if this flag is set. This allows for STATIC functions to be tested in GoogleTest. There is less danger of symbol collision here, because HOST_APPLICATIONS are running with the least amount of dependencies possible. This still allows for interfaces tests (where a Library Class is tested, not an instance, so the library is linked in to the test instead of compiled) as the library in this case will not be compiled as a HOST_APPLICATION and so the STATIC functions will remain STATIC.
- Loading branch information