| author | |
| committer | |
| log | d0b92a80224e1ed44434ed8546fa2ff497cc5312 |
| tree | 824e3202bef34232da55fdf4fcd9e73dc32af57d |
| parent | b43bb3a32a3b447e9b320f34e046946bcca0037f |
| signature |
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.2 files changed, 36 insertions(+), 5 deletions(-)
lib/compiler/test_runner.zig+5-3| ... | ... | @@ -17,7 +17,9 @@ var fba_buffer: [8192]u8 = undefined; |
| 17 | 17 | var stdin_buffer: [4096]u8 = undefined; |
| 18 | 18 | var stdout_buffer: [4096]u8 = undefined; |
| 19 | 19 | |
| 20 | const crippled = switch (builtin.zig_backend) { | |
| 20 | /// Keep in sync with logic in `std.Build.addRunArtifact` which decides whether | |
| 21 | /// the test runner will communicate with the build runner via `std.zig.Server`. | |
| 22 | const need_simple = switch (builtin.zig_backend) { | |
| 21 | 23 | .stage2_aarch64, |
| 22 | 24 | .stage2_powerpc, |
| 23 | 25 | .stage2_riscv64, |
| ... | ... | @@ -33,7 +35,7 @@ pub fn main() void { |
| 33 | 35 | return; |
| 34 | 36 | } |
| 35 | 37 | |
| 36 | if (crippled) { | |
| 38 | if (need_simple) { | |
| 37 | 39 | return mainSimple() catch @panic("test failure\n"); |
| 38 | 40 | } |
| 39 | 41 | |
| ... | ... | @@ -380,7 +382,7 @@ pub fn fuzz( |
| 380 | 382 | |
| 381 | 383 | // Some compiler backends are not capable of handling fuzz testing yet but |
| 382 | 384 | // we still want CI test coverage enabled. |
| 383 | if (crippled) return; | |
| 385 | if (need_simple) return; | |
| 384 | 386 | |
| 385 | 387 | // Smoke test to ensure the test did not use conditional compilation to |
| 386 | 388 | // contradict itself by making it not actually be a fuzz test when the test |
lib/std/Build.zig+31-2| ... | ... | @@ -956,8 +956,37 @@ pub fn addRunArtifact(b: *Build, exe: *Step.Compile) *Step.Run { |
| 956 | 956 | run_step.addArtifactArg(exe); |
| 957 | 957 | } |
| 958 | 958 | |
| 959 | const test_server_mode = if (exe.test_runner) |r| r.mode == .server else true; | |
| 960 | if (test_server_mode) run_step.enableTestRunnerMode(); | |
| 959 | const test_server_mode: bool = s: { | |
| 960 | if (exe.test_runner) |r| break :s r.mode == .server; | |
| 961 | if (exe.use_llvm == false) { | |
| 962 | // The default test runner does not use the server protocol if the selected backend | |
| 963 | // is too immature to support it. Keep this logic in sync with `need_simple` in the | |
| 964 | // default test runner implementation. | |
| 965 | switch (exe.rootModuleTarget().cpu.arch) { | |
| 966 | // stage2_aarch64 | |
| 967 | .aarch64, | |
| 968 | .aarch64_be, | |
| 969 | // stage2_powerpc | |
| 970 | .powerpc, | |
| 971 | .powerpcle, | |
| 972 | .powerpc64, | |
| 973 | .powerpc64le, | |
| 974 | // stage2_riscv64 | |
| 975 | .riscv64, | |
| 976 | => break :s false, | |
| 977 | ||
| 978 | else => {}, | |
| 979 | } | |
| 980 | } | |
| 981 | break :s true; | |
| 982 | }; | |
| 983 | if (test_server_mode) { | |
| 984 | run_step.enableTestRunnerMode(); | |
| 985 | } else if (exe.test_runner == null) { | |
| 986 | // If a test runner does not use the `std.zig.Server` protocol, it can instead | |
| 987 | // communicate failure via its exit code. | |
| 988 | run_step.expectExitCode(0); | |
| 989 | } | |
| 961 | 990 | } else { |
| 962 | 991 | run_step.addArtifactArg(exe); |
| 963 | 992 | } |