mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
std.Build: do not expect server protocol for tests using immature backends
For instance, when running a Zig test using the self-hosted aarch64 backend, this logic was previously expecting `std.zig.Server` to be used, but the default test runner intentionally does not do this because the backend is too immature to handle it. On 'master', this is causing sporadic failures; on this branch, they became consistent failures.
This commit is contained in:
+31
-2
@@ -956,8 +956,37 @@ pub fn addRunArtifact(b: *Build, exe: *Step.Compile) *Step.Run {
|
||||
run_step.addArtifactArg(exe);
|
||||
}
|
||||
|
||||
const test_server_mode = if (exe.test_runner) |r| r.mode == .server else true;
|
||||
if (test_server_mode) run_step.enableTestRunnerMode();
|
||||
const test_server_mode: bool = s: {
|
||||
if (exe.test_runner) |r| break :s r.mode == .server;
|
||||
if (exe.use_llvm == false) {
|
||||
// The default test runner does not use the server protocol if the selected backend
|
||||
// is too immature to support it. Keep this logic in sync with `need_simple` in the
|
||||
// default test runner implementation.
|
||||
switch (exe.rootModuleTarget().cpu.arch) {
|
||||
// stage2_aarch64
|
||||
.aarch64,
|
||||
.aarch64_be,
|
||||
// stage2_powerpc
|
||||
.powerpc,
|
||||
.powerpcle,
|
||||
.powerpc64,
|
||||
.powerpc64le,
|
||||
// stage2_riscv64
|
||||
.riscv64,
|
||||
=> break :s false,
|
||||
|
||||
else => {},
|
||||
}
|
||||
}
|
||||
break :s true;
|
||||
};
|
||||
if (test_server_mode) {
|
||||
run_step.enableTestRunnerMode();
|
||||
} else if (exe.test_runner == null) {
|
||||
// If a test runner does not use the `std.zig.Server` protocol, it can instead
|
||||
// communicate failure via its exit code.
|
||||
run_step.expectExitCode(0);
|
||||
}
|
||||
} else {
|
||||
run_step.addArtifactArg(exe);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user