Skip to content

[release/11.0.1xx] [tests] Use temporary directory in DocumentTest/FileCoordinatorTest and launch packaged macOS tests with spawner. Fixes #27138 - #27200

Merged
rolfbjarne merged 4 commits into
release/11.0.1xxfrom
dev/rolf/backport-pr-27145-release/11.0.1xx-2026-10-30
Oct 30, 2026
Merged

rolfbjarne merged 4 commits into
release/11.0.1xxfrom
dev/rolf/backport-pr-27145-release/11.0.1xx-2026-10-30

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

On the Sonoma (mac_14_x64) and Sequoia (mac_15_arm64) CI bots, DocumentTest.PerformAsynchronousFileAccess_Null hung for 600s in File.Delete ('/Users/builder/Documents/mydocument.txt'):

  • DocumentTest.GetFileName () (and FileCoordinatorTest.GetUrl ()) used Environment.SpecialFolder.MyDocuments, which resolves to ~/Documents on Mac Catalyst.
  • Packaged macOS test runs did not launch test apps via tools/spawner/spawner, so tccd attributed TCC checks to the Azure DevOps agent's node binary. After an agent update on the bots, the new node binary path lacked Full Disk Access and did not match the com.apple.macl xattr on the leftover ~/Documents/mydocument.txt file created before the update, causing sandboxd/tccd to block unlink() on a modal kTCCServiceSystemPolicyDocumentsFolder prompt.
  • Even with spawner, test apps do not have TCC grants for ~/Documents (which is why FileManagerTest, UrlTest, and AudioConverterTest were moved off NSSearchPathDirectory.DocumentDirectory in [tools] Add a tool to launch processes disclaming responsibility. #24249).

Switch DocumentTest and FileCoordinatorTest to use NSFileManager.TemporaryDirectory with per-process file names, and package and use tools/spawner/spawner when executing packaged macOS tests.

Fixes #27138

🤖 Pull request created by Copilot

Backport of #27145.

rolfbjarne and others added 3 commits October 30, 2026 10:57
…nd launch packaged macOS tests with spawner. Fixes #27138

On the Sonoma (mac_14_x64) and Sequoia (mac_15_arm64) CI bots, DocumentTest.PerformAsynchronousFileAccess_Null hung for 600s in File.Delete ('/Users/builder/Documents/mydocument.txt'):
- DocumentTest.GetFileName () (and FileCoordinatorTest.GetUrl ()) used Environment.SpecialFolder.MyDocuments, which resolves to ~/Documents on Mac Catalyst.
- Packaged macOS test runs did not launch test apps via tools/spawner/spawner, so tccd attributed TCC checks to the Azure DevOps agent's node binary. After an agent update on the bots, the new node binary path lacked Full Disk Access and did not match the com.apple.macl xattr on the leftover ~/Documents/mydocument.txt file created before the update, causing sandboxd/tccd to block unlink() on a modal kTCCServiceSystemPolicyDocumentsFolder prompt.
- Even with spawner, test apps do not have TCC grants for ~/Documents (which is why FileManagerTest, UrlTest, and AudioConverterTest were moved off NSSearchPathDirectory.DocumentDirectory in #24249).

Switch DocumentTest and FileCoordinatorTest to use NSFileManager.TemporaryDirectory with per-process file names, and package and use tools/spawner/spawner when executing packaged macOS tests.

Fixes #27138

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… in monotouch-test.

When monotouch-test is launched via 'spawner' on macOS and Mac Catalyst, the test app is evaluated on its own TCC identity rather than inheriting permissions from the parent process. Unlike iOS/tvOS simulators, the system TCC database cannot be pre-populated, so any test that triggers a TCC prompt (Contacts, Bluetooth, Microphone) can block or pop up modal dialogs:

- Default TestRuntime.IgnoreTestThatRequiresSystemPermissions () to true on macOS and Mac Catalyst (unless ENABLE_SYSTEM_PERMISSION_TESTS is set).
- Remove unnecessary TestRuntime.RequestContactsPermission () calls from ContactFetchRequestTest and ContactVCardSerializationTest (neither test accesses CNContactStore, and calling RequestAccess hung macOS/Mac Catalyst x64 on Sonoma in CI).
- Check Bluetooth permission in RegistrarTest.EventTestOSType before creating CBCentralManager.
- Ignore microphone-dependent tests on macOS in TestRuntime.RequestMicrophonePermission () (just like Mac Catalyst), add missing RequestMicrophonePermission () calls to AVAudioSinkNodeTest, AVAudioSourceNodeTest, AudioToolbox.AudioUnitTest.Callbacks, AVAudioIONodeTests, AudioUnitTests.GetCurrentDevice_Test, and AUGraphTests.DoTest, and use GenericOutput instead of VoiceProcessingIO in AUAudioUnitFactoryTest and AudioUnitTest.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…and address review feedback.

- Call TestRuntime.CheckContactsPermission () in ContactFetchRequestTest and ContactVCardSerializationTest: CNContactVCardSerialization.GetDescriptorFromRequiredKeys () reads ~/Library/Preferences/com.apple.AddressBook.plist, which triggers sandboxd to request kTCCServiceAddressBook approval (preflight=no) on macOS 14 Sonoma and blocks when permission is NotDetermined.
- Set -mmacosx-version-min=$(DOTNET_MIN_MACOS_SDK_VERSION) in tools/spawner/Makefile so the packaged spawner binary targets the minimum supported macOS version.
- Pass ENABLE_SYSTEM_PERMISSION_TESTS=1 in MacExecuteTask when Harness.GetIncludeSystemPermissionTests returns true, and only override Harness.IncludeSystemPermissionTests in TestSelector when an explicit system-permission label is provided.
- Use TestRuntime.CheckBluetoothPermission () (assert_granted: false) in RegistrarTest.EventTestOSType.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@rolfbjarne rolfbjarne added backported ready-to-review This PR is ready to review/merge. labels Oct 30, 2026
Copilot AI balanced review requested due to automatic review settings October 30, 2026 09:57
@rolfbjarne
rolfbjarne requested a review from dalexsoto as a code owner October 30, 2026 09:57

Copilot AI left a comment

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.

🟡 Changes recommended

The change skips the iOS/tvOS introspection suites entirely and fails to clear inherited permission-test enable flags on explicit opt-out, allowing blocking macOS permission dialogs.

2 open issues
What changed in this PR

This backport addresses macOS and Mac Catalyst test hangs associated with privacy prompts, including the document-file deletion hang reported in #27138.

Changes:

  • Move document and file-coordination tests to temporary, per-process paths.
  • Package and use spawner for macOS test execution, and preserve argument boundaries in the timeout launcher.
  • Make macOS permission-sensitive tests opt-in and update affected test guards.
File Description
tools/​spawner/​Makefile Set the minimum macOS deployment target.
tools/​devops/​automation/​templates/​common/​configure.yml Remove the default system-permission test opt-in.
tests/​xharness/​Jenkins/​TestTasks/​MacExecuteTask.cs Pass an explicit permission-test enable flag.
tests/​xharness/​Jenkins/​TestSelector.cs Apply permission overrides only for explicit labels.
tests/​packaged-macos-tests.mk Launch packaged tests through spawner.
tests/​package-mac-tests.sh Build and package spawner.
tests/​monotouch-test/​UIKit/​UIDocumentTest.cs Use a per-process temporary document path.
tests/​monotouch-test/​ObjCRuntime/​RegistrarTest.cs Check Bluetooth permission before manager creation.
tests/​monotouch-test/​Foundation/​FileCoordinatorTest.cs Use a per-process temporary file path.
tests/​monotouch-test/​Contacts/​ContactVCardSerializationTest.cs Check Contacts permission during setup.
tests/​monotouch-test/​Contacts/​ContactFetchRequestTest.cs Check Contacts permission during setup.
tests/​monotouch-test/​AVFoundation/​AVAudioSourceNodeTest.cs Add a microphone permission guard.
tests/​monotouch-test/​AVFoundation/​AVAudioSinkNodeTest.cs Add a microphone permission guard.
tests/​monotouch-test/​AVFoundation/​AVAudioIONode.cs Add a microphone permission guard.
tests/​monotouch-test/​AudioUnit/​AUGraphTestMac.cs Guard graph setup with microphone permission handling.
tests/​monotouch-test/​AudioUnit/​AudioUnitTest.cs Use generic output for macOS disposal testing.
tests/​monotouch-test/​AudioUnit/​AudioUnit.cs Guard device testing with microphone permission handling.
tests/​monotouch-test/​AudioUnit/​AUAudioUnitFactoryTest.cs Use generic output for macOS factory testing.
tests/​monotouch-test/​AudioToolbox/​AudioUnitTest.cs Require microphone permission for callback testing.
tests/​common/​TestRuntime.cs Revise macOS permission defaults and microphone-test exclusions.
scripts/​run-with-timeout/​run-with-timeout.cs Preserve individual launch arguments.
scripts/​run-packaged-macos-tests/​run-packaged-macos-tests.cs Validate and launch through the packaged spawner.

Review effort: Balanced

@vs-mobiletools-engineering-service2

This comment has been minimized.

Keep simulator introspection selected when permission tests use their platform defaults, while still honoring explicit run-all and system-permission labels. Also remove inherited permission environment flags that conflict with the selected setting.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 11:56

Copilot AI left a comment

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.

🔵 Needs a closer look

The default permission fallback fails to distinguish iOS simulators from devices, causing permission-sensitive tests with undetermined authorization to be skipped in CI.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Fix iOS simulator permission tests being skipped in CI

tests/​xharness/​Jenkins/​TestSelector.cs:225

🤖 ⚠️ Testing — With the permission override now unset by default, simulator launches receive DISABLE_SYSTEM_PERMISSION_TESTS=1: AppRunner.cs:237 passes TestPlatform.iOS, whose fallback in Harness.cs:316–322 returns !InCI without checking device. Permission-sensitive tests with undetermined authorization are therefore skipped in CI, even though the introspection projects remain selected. Remove iOS from the macOS fallback group so it uses the existing device/simulator distinction in the default branch.

[!NOTE]
Generated by GitHub Copilot.

2 resolved since last review

Review effort: Balanced

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: f9dd05370e4f8ad03dcba96006397160685a2dd3 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #f9dd053] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 269 tests passed 🎉

Tests counts

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 7 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 31 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 25 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Sonoma (14): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Golden Gate (27): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: f9dd05370e4f8ad03dcba96006397160685a2dd3 [PR build]

@rolfbjarne
rolfbjarne merged commit df1abee into release/11.0.1xx Oct 30, 2026
56 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/backport-pr-27145-release/11.0.1xx-2026-10-30 branch October 30, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants