WIP - [Perf] Migrate unswizzle-based unit tests to SPM (#11903)#16276
WIP - [Perf] Migrate unswizzle-based unit tests to SPM (#11903)#16276JesusRojass wants to merge 7 commits into
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
Addresses #11903
This migrates the unswizzle-based FirebasePerformance unit tests to run under Swift Package Manager. These suites currently run only through the CocoaPods
pod genbased CI job, so their coverage disappears once CocoaPods tooling is retired.Discussion
The seven gated suites (selector/class instrumentor, instrument, instrumentation, NSURLSession, NSURLConnection, and UIViewController instrumentation tests) were excluded from SPM with
#if !SWIFT_PACKAGEwhen SPM support landed in #8412. The underlying reason is that unswizzling inFPRSelectorInstrumentorwas compiled only whenUNSWIZZLE_AVAILABLEwas defined, which only the CocoaPods path wired up via theFPR_UNSWIZZLE_AVAILABLEenv var and a test dependency onGoogleUtilities/SwizzlerTestHelpers.Changes:
FPRSelectorInstrumentornow detects theGULSwizzlerunswizzle category at runtime instead of using the compile-time flag. Behavior for production apps is unchanged: the category is absent, so unswizzle still hits the same assertion as before.PerformanceUnitSPM test target linksGULSwizzlerTestHelpers(andGULMethodSwizzler), making the category available to tests.#if !SWIFT_PACKAGEtest gates are removed, plus the#ifdef UNSWIZZLE_AVAILABLEgates inFPRCounterListTest.FPRUIViewControllerInstrumentTestno longer depends on a host app key window; the shared application and key window are stubbed so the test is deterministic both hosted (CocoaPods) and unhosted (SPM).FPR_UNSWIZZLE_AVAILABLEwiring from the podspec,scripts/build.sh, andgenerate_project.sh.Testing
PerformanceUnitscheme on iOS and tvOS simulatorsscripts/build.sh Performance-iOS-unit(no longer needs the env var)API Changes