[Perf] Migrate unswizzle-based unit tests to SPM (#11903)#16276
[Perf] Migrate unswizzle-based unit tests to SPM (#11903)#16276JesusRojass wants to merge 17 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. |
|
Ready for review @paulb777 |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors unswizzling capabilities in Firebase Performance, moving from compile-time preprocessor flags to runtime selector checks, enabling unswizzle-based unit tests to run under Swift Package Manager. It also stabilizes network and view controller tests, and improves the SPM dependency update scripts to safely handle special characters via environment variables. Feedback suggests avoiding the deprecated [UIScreen mainScreen] in tests by using a constant frame, and adding error handling to the jq parsing in quickstart_build_spm.sh to prevent unexpected script failures.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
6b31a19 to
539733b
Compare
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