Commit 280fb74
Fix deterministic MountVolume test failures on ARM64 Helix machines (#126660)
> [!NOTE]
> This PR was created with Copilot assistance.
## Fix deterministic MountVolume test failures on ARM64 Helix machines
Fixes #125295, fixes #125624, fixes #126627
### Problem
`Directory_Delete_MountVolume.RunTest` and
`Directory_ReparsePoints_MountVolume.runTest` fail deterministically
(~100% of the time, ~750ms duration) on the `Windows.11.Arm64.Open`
Helix machine pool. This is **not timing-related** and was not addressed
by the delay/polling fixes in #125914 or the Unmount resilience fix in
#125625 (those PRs fixed real timing issues -- pre-fix failures on other
configurations have since expired from AzDO retention, so we can't
verify directly, but there is no evidence they were ineffective for
their intended purpose).
**Root cause**: The ARM64 Helix machines have an E:\ drive (likely an
Azure resource/temp disk) that passes all `DriveInfo` checks --
`DriveType=Fixed`, `DriveFormat=NTFS`, `IsReady=True` -- but
`GetVolumeNameForVolumeMountPoint` fails with `ERROR_INVALID_PARAMETER`
(87). The drive has no volume GUID and doesn't support volume mount
point operations. `IOServices.GetNtfsDriveOtherThanCurrent()` returns
this drive, and the test crashes trying to use it.
Some ARM64 Helix machines have only C:\ and a CD-ROM (no second drive at
all). On those machines, the cross-drive scenarios already skip
gracefully and only same-drive scenarios 3.x run.
### Evidence
Analyzed Helix console logs from 5 post-fix builds (all
`arm64-NativeAOT-Win11`, same C:\ volume GUID). Every failure shows the
identical pattern:
- Scenario 1: `GetVolumeNameForVolumeMountPoint("E:\")` -> error 87
- Scenario 2: `SetVolumeMountPoint` onto E:\ succeeds but path traversal
through the mount point fails with `DirectoryNotFoundException`
- Scenarios 3.x (same-drive): Always pass
Reproduced locally by removing the real E: drive letter and creating
`SUBST E:` which exhibits identical error 87 behavior.
### Changes
1. **`IOServices.GetNtfsDriveOtherThan()`**: After the existing
Fixed/Ready/NTFS checks, also verify the drive has a volume GUID via
`GetVolumeNameForVolumeMountPoint`. Drives without one (SUBST drives,
Azure resource disks) are skipped.
2. **`DumpDriveInformation` diagnostic test**: New Helix-only test
(following the `DescriptionNameTests.DumpRuntimeInformationToConsole`
pattern) that dumps all drives with their volume GUIDs to the console
log. Makes future drive-related CI issues immediately diagnosable from
the same Helix work item log.
3. **`GetVolumeNameForVolumeMountPoint` P/Invoke in DllImports.cs**:
Uses `char[]` (not `StringBuilder`) because this file uses
`LibraryImport` which does not support `StringBuilder`.
### Local validation
| Scenario | Before fix | After fix |
|---|---|---|
| SUBST E: (no volume GUID) | Error 87 / DirectoryNotFoundException |
Pass (SUBST filtered, scenarios 3.x run) |
| Real NTFS E: | Pass (all scenarios) | Pass (all scenarios) |
| Single-drive machine | Scenarios 1/2 skip, 3.x pass | Same -- no
change |
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent d38d8f7 commit 280fb74
File tree
4 files changed
+103
-3
lines changed- src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests
- PortedCommon
4 files changed
+103
-3
lines changedLines changed: 82 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
69 | 77 | | |
70 | 78 | | |
71 | 79 | | |
72 | 80 | | |
73 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
74 | 88 | | |
75 | 89 | | |
76 | 90 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
0 commit comments