fix(tests): the launcher/headless command-line contract needs executable stubs on Linux
Some checks failed
CI / linux-portable (push) Failing after 3m0s
CI / windows-gate (push) Failing after 5m0s
CI / release (push) Has been skipped

Run 173's Linux job failed on the contract test added one commit earlier — my
test, not the product.

LauncherExecutableSet refuses a host that exists but has no execute bit on
Linux (HasUnixExecutePermission), which is a real and useful check: an update
whose extraction lost its permissions would otherwise fail deep inside process
start instead of at the launch gate. The stubs were written with
File.WriteAllText, which is 0644, so on Linux every one of the four tests died
at that gate before reaching the command-line contract they exist to pin.

Windows never sees this — the predicate short-circuits to true off Linux — so
the test passed locally and could only fail on the runner.

Stubs are now created through a helper that chmods them executable on non-
Windows. Verified on Windows (4 passed); the Linux half is what run 174 checks.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-19 21:53:19 +02:00
parent 6ab5d8ce0f
commit d233538f2c

View file

@ -32,8 +32,28 @@ public sealed class LauncherHeadlessCommandLineContractTests : IDisposable
// the contract can only be exercised against files that exist.
Directory.CreateDirectory(AppDirectory);
string suffix = OperatingSystem.IsWindows() ? ".exe" : string.Empty;
File.WriteAllText(Path.Combine(AppDirectory, "AcDream.App" + suffix), "stub");
File.WriteAllText(Path.Combine(AppDirectory, "acdream-headless" + suffix), "stub");
CreateStubExecutable(Path.Combine(AppDirectory, "AcDream.App" + suffix));
CreateStubExecutable(Path.Combine(AppDirectory, "acdream-headless" + suffix));
}
/// <summary>
/// On Linux the spec builders also refuse a host that exists but has no
/// execute bit — a real check, since an extracted update that lost its
/// permissions would otherwise fail deep inside process start. A stub
/// written with WriteAllText is 0644, so it has to be made executable for
/// the command-line contract underneath to be reachable at all.
/// </summary>
private static void CreateStubExecutable(string path)
{
File.WriteAllText(path, "stub");
if (!OperatingSystem.IsWindows())
{
File.SetUnixFileMode(
path,
UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute
| UnixFileMode.GroupRead | UnixFileMode.GroupExecute
| UnixFileMode.OtherRead | UnixFileMode.OtherExecute);
}
}
public void Dispose()