Skip to content

Add support for patching DYLD_FRAMEWORK_PATH in xctestrun for Xcode 26+#3006

Open
Kendru98 wants to merge 4 commits intomasterfrom
fix/xcode-26-4-issue
Open

Add support for patching DYLD_FRAMEWORK_PATH in xctestrun for Xcode 26+#3006
Kendru98 wants to merge 4 commits intomasterfrom
fix/xcode-26-4-issue

Conversation

@Kendru98
Copy link
Copy Markdown
Collaborator

@Kendru98 Kendru98 commented Mar 26, 2026

Fix ios simulator and physical devices on xcode 26.4

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the iOS test backend to ensure proper test execution on simulators with Xcode 26 and later versions. It resolves an issue where _Testing_Foundation.framework was not correctly included in the DYLD_FRAMEWORK_PATH of xctestrun files, which could lead to test failures. The changes involve conditionally modifying the xctestrun plist to append the necessary framework path, thereby improving the reliability of the test suite for newer Xcode environments.

Highlights

  • Xcode 26+ Compatibility: Implemented a fix to address compatibility issues with Xcode 26 and newer versions when running tests on simulators.
  • DYLD_FRAMEWORK_PATH Patching: Introduced logic to dynamically patch the DYLD_FRAMEWORK_PATH within xctestrun files, specifically appending the _Testing_Foundation.framework path if it's missing for Xcode 26+.
  • Simulator-Specific Fix: The patching mechanism is applied only when tests are executed on a simulator, ensuring targeted intervention without affecting other test environments.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize 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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. 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.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added the package: patrol_cli Related to the patrol_cli package label Mar 26, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new private method, _patchXcTestRunDyldPath, to IOSTestBackend. This method addresses an issue in Xcode 26+ by appending the _Testing_Foundation.framework path to the DYLD_FRAMEWORK_PATH within xctestrun plist files when running tests on a simulator. The new patching logic is invoked after a successful build. A review comment highlights a potential silent failure: the PlistBuddy command used to set the DYLD_FRAMEWORK_PATH does not check its exit code, suggesting that error handling should be added to ensure the patching operation's success is verified.

Comment on lines +346 to +355
await _processManager.run(
[
'/usr/libexec/PlistBuddy',
'-c',
'Set $key $current:$addition',
plist,
],
);
_logger.detail('Patched xctestrun DYLD_FRAMEWORK_PATH for Xcode 26+');
return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The PlistBuddy command for setting the DYLD_FRAMEWORK_PATH does not check its exit code. If the Set operation fails, the issue might go unnoticed, leading to silent failures in the patching process. It's important to verify the success of this critical operation.

Consider checking the exitCode of the _processManager.run call for the Set command and logging an error or throwing an exception if it's not successful.

      final setResult = await _processManager.run(
        [
          '/usr/libexec/PlistBuddy',
          '-c',
          'Set $key $current:$addition',
          plist,
        ],
      );
      if (setResult.exitCode != 0) {
        _logger.warn('Failed to patch xctestrun DYLD_FRAMEWORK_PATH for key "$key": ${setResult.stdErr.trim()}');
        // Optionally, throw an exception here if a failed patch is critical
        // throwToolExit('Failed to patch xctestrun DYLD_FRAMEWORK_PATH');
      } else {
        _logger.detail('Patched xctestrun DYLD_FRAMEWORK_PATH for Xcode 26+');
      }
      return;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is done on purpose, to not crash the process if this workaround will not work 🤔

@Kendru98 Kendru98 marked this pull request as ready for review March 27, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: patrol_cli Related to the patrol_cli package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant