Start a Windows build of the simulator through Wine on Linux

Where wine is on the PATH, an eu07.exe in the installation is found after any
native binary and needs no execute bit.
This commit is contained in:
maj00r
2026-10-04 13:28:07 +02:00
parent 3083523ceb
commit 76f104798c
5 changed files with 204 additions and 22 deletions

View File

@@ -33,6 +33,27 @@ public class StartSimulationTests
Assert.NotNull(launcher.Executable);
}
[Fact]
public void A_windows_build_on_linux_is_started_through_wine()
{
string wine = Path.Combine("/usr/bin", "wine");
string exe = Path.Combine(Path.GetTempPath(), "maszyna", "eu07.exe");
var (start, launcher, installation) = Rig(files => files
.WithExecutable(wine)
.WithFile(exe, "MZ\u0090\u0000"));
installation.Environment.With("PATH", "/usr/bin");
installation.SettingsStore.Settings.ExecutablePath = exe;
var result = start.Execute(freeFly: true, saveSettings: false);
// Unpacked from the Windows zip, it has no execute bit - Wine does not need one.
Assert.Equal(SimulationStartOutcome.Started, result.Outcome);
Assert.Equal(wine, launcher.Executable);
Assert.Equal(exe, launcher.Arguments![0]);
Assert.Equal("-s", launcher.Arguments[1]);
Assert.Equal(installation.Paths.Root, launcher.WorkingDirectory);
}
[Fact]
public void A_file_that_cannot_be_run_is_not()
{
@@ -68,8 +89,8 @@ public class StartSimulationTests
var launcher = new RecordingLauncher();
var start = new StartSimulation(state, installation.SettingsStore, installation.Library.Vehicles,
installation.Files, installation.Paths, launcher, installation.Random,
installation.Log);
installation.Executables, installation.Files, installation.Paths, launcher,
installation.Random, installation.Log);
return (start, launcher, installation);
}