Commit bb4002f
[tests] Avoid writing to the Documents directory in UrlTest and AudioConverterTest.
CI run 15215315 (PR #24249) showed the exact same class of hang as the
previous fix (ccc70fb), just one test further down the alphabetical
list: after the Documents-directory write in
FileManagerTest.GetSkipBackupAttribute was fixed, macOS/Mac Catalyst
runs progressed further into Foundation.UrlTest, then hung again with
the same getxattr-on-main-thread signature right after
UrlTest.Invalid_29510 - i.e. at UrlTest.IsExcludedFromBackupKey, the
next test alphabetically.
IsExcludedFromBackupKey also writes a scratch file into the user's
Documents directory (NSSearchPathDirectory.DocumentDirectory) before
manipulating NSUrl.IsExcludedFromBackupKey on it. Now that tests run
through the new spawner tool (which disclaims process responsibility,
so the ephemeral test app is checked on its own TCC status instead of
inheriting an already-approved ancestor's), this write triggers a
fresh 'Files and Folders' authorization prompt that hangs forever with
no interactive session to answer it.
Fix it the same way as the previous commit: use
NSFileManager.TemporaryDirectory instead, which isn't behind a TCC
prompt and is already the established convention for scratch files
elsewhere in this test suite.
While auditing the rest of the test suite for the same anti-pattern (a
search for NSSearchPathDirectory.DocumentDirectory across
tests/monotouch-test), also fix
AudioConverterTest.ConvertWithPacketDependencies, which wrote its
output audio file into the Documents directory instead of using the
DoWithTemporaryDirectory helper that its sibling tests in the same
file (Convert, CreateWithOptions) already use for exactly this reason.
This wasn't yet confirmed as an observed CI hang (it likely wasn't
reached before the UrlTest hang), but it has the identical risk and
would very likely have been the next hang once UrlTest was fixed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ca98fc3c-135b-4bad-80dc-50262be55c901 parent ccc70fb commit bb4002f
2 files changed
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | 170 | | |
172 | | - | |
173 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
174 | 175 | | |
175 | 176 | | |
176 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
0 commit comments