Skip to content

Run the tray core's tests on every platform - #985

Merged
SimonCropp merged 2 commits into
mainfrom
tray-core-tests
Oct 28, 2026
Merged

SimonCropp merged 2 commits into
mainfrom
tray-core-tests

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

Phase 2b of the cross-platform tray plan: the tray core's tests move to a project that runs on macOS and Linux as well as Windows. Nothing about the tray changes.

DiffEngineTray.Core.Tests (net10.0) takes 33 test classes and their snapshots, moved with git mv. It is in Release-NotWindows, so the unix job builds and runs it on ubuntu and macOS with no workflow change.

DiffEngineTray.Tests keeps what needs the head: the menu, the forms, the hot keys and TrayViewerSyncTest. Two tests moved into it out of classes that went to the core, because they use head types: LockedFilesHandlerTest and DiffToolLauncherTest. The eight helpers both projects use (RecordingTracker, FakeViewer, FileLockUtils and the rest) live with the core's tests and are linked into the head's.

43 tests stay Windows only, marked with the repo's [RunOn(OS.Windows)] and the reason in each summary. There are three kinds:

  • ProcessEx and FileLockKiller, which call kernel32, ntdll and the restart manager.
  • Tests whose lock is held by a Windows PowerShell process.
  • Windows' file semantics: a file open with no sharing, or marked read-only, cannot be moved over or deleted. On Unix the lock is advisory and a rename or unlink goes through.

The rest needed portable test data, not skips:

  • OwnedInlineHostTest builds its paths as the platform roots one. On Linux c:\repo\X.cs is one file name of the whole string, so every entry had the same name.
  • DebugReportTests builds its viewer path the same way, since C:\tools\DiffEngineViewer.exe wasn't the viewer on Linux. The report also writes {Directory}\ for the separator everywhere, so one snapshot holds.
  • The Owned report's source is named in lower case. Inline keys are case folded on Windows and macOS and not on Linux.
  • Two Windows snapshots changed to match: the viewer shows as {Directory}\DiffEngineViewer.exe, and the source as sampletests.cs.

Tests:

  • Linux, in a dotnet/sdk:10.0 container: 210 pass and 43 are skipped, out of 253.
  • Windows: all 253 core tests pass, and the full solution in Release passes (3,747 tests).
  • macOS runs these for the first time in this PR's CI.

Still to come in phase 2: the menu becomes a model snapshot tested as text (2c).

Moves the tests of DiffEngineTray.Core into DiffEngineTray.Core.Tests
(net10.0), which the unix CI job builds and runs under Release-NotWindows.
DiffEngineTray.Tests keeps what needs the head, and links the helpers both
use from the core's tests.

What stays Windows only is marked [RunOn(OS.Windows)] with the reason in
its summary: ProcessEx and FileLockKiller, a lock held by a Windows
PowerShell process, and Windows' refusal to move over or delete a file
open with no sharing or marked read-only.

Test data is written as the platform roots a path, and DebugReportTests
writes {Directory}\ for the separator everywhere, so one snapshot holds.
On macOS the inline key is case folded, so the Owned test's scrubber for the lowercased directory took the directory from in front of the separator before the separator scrubber ran, and the key read {Directory}/ there.
@SimonCropp
SimonCropp merged commit 7c33704 into main Oct 28, 2026
11 checks passed
@SimonCropp
SimonCropp deleted the tray-core-tests branch October 28, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant