You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Mac-14] macOS xcodebuild test fails with "Test runner never began executing tests after launching" #149264
App Sandbox now associates your macOS app with its sandbox container using its code signature. The operating system asks the person using your app to grant permission if it tries to access a sandbox container associated with a different app. For more information, see Accessing files from the macOS App Sandbox.
And that link explains why this is happening on a macOS 14 update:
In macOS 14 and later, the operating system uses your app’s code signature to associate it with its sandbox container. If your app tries to access the sandbox container owned by another app, the system asks the person using your app whether to grant access. If the person denies access and your app is already running, then it can’t read or write the files in the other app’s sandbox container. If the person denies access while your app is launching and trying to enter the other app’s sandbox container, your app fails to launch.
The operating system also tracks the association between an app’s code signing identity and its sandbox container for helper tools, including launch agents. If a person denies permission for a launch agent to enter its sandbox container and the app fails to start, launchd starts the launch agent again and the operating system re-requests access.
Xcode 13 includes significant changes in how it handles Info.plist properties and entitlements. The source of truth for some items is now a build setting rather than the property list. In your specific example, in Xcode 12 and earlier the source of truth for the App Sandbox setting was the presence of com.apple.security.app-sandbox in your entitlements file, whereas now it’s the ENABLE_APP_SANDBOX build setting.
Add ENABLE_APP_SANDBOX=YES to the macOS Xcode project template
In the test runner an environment variable to override that FLUTTER_XCODE_ENABLE_APP_SANDBOX=NO.
I don't think this would be worth a project migration, since the entitlement seems to be working fine, just I don't know of a way to easily override an entitlement key without editing the plist.
Perhaps another option could also be to generate a entitlement file for CI with it disabled and override CODE_SIGN_ENTITLEMENTS. Not sure if it would work, but may be worth a shot
2. Add ENABLE_APP_SANDBOX=YES to the macOS Xcode project template
Hm, on second thought my plan isn't a good idea, I just created a new blank macOS app in Xcode 15.4 and there's an entitlements file with com.apple.security.app-sandbox set to YES, and ENABLE_APP_SANDBOX is not set at all. We're better off hewing to the Xcode defaults.
Actually, codesigning works on these chromium bots, but we're telling it not to codesign to run the tests. Removing these lines might be all we have to do:
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
martinverhey commentedon May 29, 2024
Is this related to #145143?
jmagman commentedon May 30, 2024
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac%20plugin_test_macos/1/overview xcresults zip have a spindump attached, which shows process
plugintest_examplewaiting for an xpc call tosecinitdwhile it's dyld loading:man secinitdsays:The
secinitdprocess is waiting on-[AppSandboxRequest displaySharingConsentPrompt:]so probably some UI popping up asking for permissions:spindump.txt
jmagman commentedon May 30, 2024
I was able to reproduce this locally. The pop up is:
I took a
sudo spindumpand I see the same stacks:and
jmagman commentedon May 30, 2024
https://developer.apple.com/documentation/updates/security#June-2023)
And that link explains why this is happening on a macOS 14 update:
jmagman commentedon May 30, 2024
In 2021 Quinn said:
https://forums.developer.apple.com/forums/thread/691164?answerId=689678022#689678022
One solution would be to turn off the sandbox in CI:
flutter/packages/flutter_tools/templates/app_shared/macos.tmpl/Runner/DebugProfile.entitlements
Lines 5 to 6 in 488fb09
flutter/packages/flutter_tools/templates/app_shared/macos.tmpl/Runner/Release.entitlements
Lines 5 to 6 in 488fb09
ENABLE_APP_SANDBOX=YESto the macOS Xcode project templateFLUTTER_XCODE_ENABLE_APP_SANDBOX=NO.I don't think this would be worth a project migration, since the entitlement seems to be working fine, just I don't know of a way to easily override an entitlement key without editing the plist.
vashworth commentedon May 30, 2024
Perhaps another option could also be to generate a entitlement file for CI with it disabled and override
CODE_SIGN_ENTITLEMENTS. Not sure if it would work, but may be worth a shotjmagman commentedon May 30, 2024
Hm, on second thought my plan isn't a good idea, I just created a new blank macOS app in Xcode 15.4 and there's an entitlements file with
com.apple.security.app-sandboxset to YES, andENABLE_APP_SANDBOXis not set at all. We're better off hewing to the Xcode defaults.jmagman commentedon May 30, 2024
Actually, codesigning works on these chromium bots, but we're telling it not to codesign to run the tests. Removing these lines might be all we have to do:
flutter/dev/devicelab/bin/tasks/native_ui_tests_macos.dart
Line 34 in 557a959
flutter/dev/devicelab/lib/tasks/plugin_tests.dart
Line 333 in 557a959
Disable sandboxing for macOS apps and tests in CI (#149618)
Disable sandboxing for macOS tests in CI (#6866)
vashworth commentedon Jun 6, 2024
Fixed by #149618 and flutter/packages#6866.
Disable sandboxing for macOS apps and tests in CI (flutter#149618)
github-actions commentedon Jun 20, 2024
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.