| author | |
| committer | |
| log | 50056a5b3ad29695c795534cebbd031408633813 |
| tree | 10a8be75d6a44a93451a92aa1aeabfd1538d5f74 |
| parent | db8330adaf760a1a73237bfb90428d5d22610657 |
| signature |
The unit can now be specified in the argument.18 files changed, 55 insertions(+), 30 deletions(-)
ci/aarch64-linux-debug.sh+1-1| ... | @@ -51,7 +51,7 @@ stage3-debug/bin/zig build test docs \ | ... | @@ -51,7 +51,7 @@ stage3-debug/bin/zig build test docs \ |
| 51 | --search-prefix "$PREFIX" \ | 51 | --search-prefix "$PREFIX" \ |
| 52 | --zig-lib-dir "$PWD/../lib" \ | 52 | --zig-lib-dir "$PWD/../lib" \ |
| 53 | -Denable-superhtml \ | 53 | -Denable-superhtml \ |
| 54 | --test-timeout-ms 60_000 | 54 | --test-timeout 60s |
| 55 | 55 | ||
| 56 | stage3-debug/bin/zig build \ | 56 | stage3-debug/bin/zig build \ |
| 57 | --prefix stage4-debug \ | 57 | --prefix stage4-debug \ |
ci/aarch64-linux-release.sh+1-1| ... | @@ -51,7 +51,7 @@ stage3-release/bin/zig build test docs \ | ... | @@ -51,7 +51,7 @@ stage3-release/bin/zig build test docs \ |
| 51 | --search-prefix "$PREFIX" \ | 51 | --search-prefix "$PREFIX" \ |
| 52 | --zig-lib-dir "$PWD/../lib" \ | 52 | --zig-lib-dir "$PWD/../lib" \ |
| 53 | -Denable-superhtml \ | 53 | -Denable-superhtml \ |
| 54 | --test-timeout-ms 60_000 | 54 | --test-timeout 60s |
| 55 | 55 | ||
| 56 | # Ensure that stage3 and stage4 are byte-for-byte identical. | 56 | # Ensure that stage3 and stage4 are byte-for-byte identical. |
| 57 | stage3-release/bin/zig build \ | 57 | stage3-release/bin/zig build \ |
ci/aarch64-macos-debug.sh+1-1| ... | @@ -47,4 +47,4 @@ stage3-debug/bin/zig build test docs \ | ... | @@ -47,4 +47,4 @@ stage3-debug/bin/zig build test docs \ |
| 47 | -Dstatic-llvm \ | 47 | -Dstatic-llvm \ |
| 48 | -Dskip-non-native \ | 48 | -Dskip-non-native \ |
| 49 | --search-prefix "$PREFIX" \ | 49 | --search-prefix "$PREFIX" \ |
| 50 | --test-timeout-ms 60_000 | 50 | --test-timeout 60s |
ci/aarch64-macos-release.sh+1-1| ... | @@ -47,7 +47,7 @@ stage3-release/bin/zig build test docs \ | ... | @@ -47,7 +47,7 @@ stage3-release/bin/zig build test docs \ |
| 47 | -Dstatic-llvm \ | 47 | -Dstatic-llvm \ |
| 48 | -Dskip-non-native \ | 48 | -Dskip-non-native \ |
| 49 | --search-prefix "$PREFIX" \ | 49 | --search-prefix "$PREFIX" \ |
| 50 | --test-timeout-ms 60_000 | 50 | --test-timeout 60s |
| 51 | 51 | ||
| 52 | # Ensure that stage3 and stage4 are byte-for-byte identical. | 52 | # Ensure that stage3 and stage4 are byte-for-byte identical. |
| 53 | stage3-release/bin/zig build \ | 53 | stage3-release/bin/zig build \ |
ci/aarch64-windows.ps1+1-1| ... | @@ -59,7 +59,7 @@ Write-Output "Main test suite..." | ... | @@ -59,7 +59,7 @@ Write-Output "Main test suite..." |
| 59 | -Dstatic-llvm ` | 59 | -Dstatic-llvm ` |
| 60 | -Dskip-non-native ` | 60 | -Dskip-non-native ` |
| 61 | -Denable-symlinks-windows ` | 61 | -Denable-symlinks-windows ` |
| 62 | --test-timeout-ms 60_000 | 62 | --test-timeout 60s |
| 63 | CheckLastExitCode | 63 | CheckLastExitCode |
| 64 | 64 | ||
| 65 | # Ensure that stage3 and stage4 are byte-for-byte identical. | 65 | # Ensure that stage3 and stage4 are byte-for-byte identical. |
ci/loongarch64-linux-debug.sh+1-1| ... | @@ -51,7 +51,7 @@ stage3-debug/bin/zig build test docs \ | ... | @@ -51,7 +51,7 @@ stage3-debug/bin/zig build test docs \ |
| 51 | -Dtarget=native-native-musl \ | 51 | -Dtarget=native-native-musl \ |
| 52 | --search-prefix "$PREFIX" \ | 52 | --search-prefix "$PREFIX" \ |
| 53 | --zig-lib-dir "$PWD/../lib" \ | 53 | --zig-lib-dir "$PWD/../lib" \ |
| 54 | --test-timeout-ms 120_000 | 54 | --test-timeout 2m |
| 55 | 55 | ||
| 56 | stage3-debug/bin/zig build \ | 56 | stage3-debug/bin/zig build \ |
| 57 | --prefix stage4-debug \ | 57 | --prefix stage4-debug \ |
ci/loongarch64-linux-release.sh+1-1| ... | @@ -51,7 +51,7 @@ stage3-release/bin/zig build test docs \ | ... | @@ -51,7 +51,7 @@ stage3-release/bin/zig build test docs \ |
| 51 | -Dtarget=native-native-musl \ | 51 | -Dtarget=native-native-musl \ |
| 52 | --search-prefix "$PREFIX" \ | 52 | --search-prefix "$PREFIX" \ |
| 53 | --zig-lib-dir "$PWD/../lib" \ | 53 | --zig-lib-dir "$PWD/../lib" \ |
| 54 | --test-timeout-ms 120_000 | 54 | --test-timeout 2m |
| 55 | 55 | ||
| 56 | # Ensure that stage3 and stage4 are byte-for-byte identical. | 56 | # Ensure that stage3 and stage4 are byte-for-byte identical. |
| 57 | stage3-release/bin/zig build \ | 57 | stage3-release/bin/zig build \ |
ci/riscv64-linux-debug.sh+1-1| ... | @@ -52,4 +52,4 @@ stage3-debug/bin/zig build test-cases test-modules test-unit test-c-abi test-sta | ... | @@ -52,4 +52,4 @@ stage3-debug/bin/zig build test-cases test-modules test-unit test-c-abi test-sta |
| 52 | -Dtarget=native-native-musl \ | 52 | -Dtarget=native-native-musl \ |
| 53 | --search-prefix "$PREFIX" \ | 53 | --search-prefix "$PREFIX" \ |
| 54 | --zig-lib-dir "$PWD/../lib" \ | 54 | --zig-lib-dir "$PWD/../lib" \ |
| 55 | --test-timeout-ms 120_000 | 55 | --test-timeout 2m |
ci/riscv64-linux-release.sh+1-1| ... | @@ -52,4 +52,4 @@ stage3-release/bin/zig build test-cases test-modules test-unit test-c-abi test-s | ... | @@ -52,4 +52,4 @@ stage3-release/bin/zig build test-cases test-modules test-unit test-c-abi test-s |
| 52 | -Dtarget=native-native-musl \ | 52 | -Dtarget=native-native-musl \ |
| 53 | --search-prefix "$PREFIX" \ | 53 | --search-prefix "$PREFIX" \ |
| 54 | --zig-lib-dir "$PWD/../lib" \ | 54 | --zig-lib-dir "$PWD/../lib" \ |
| 55 | --test-timeout-ms 120_000 | 55 | --test-timeout 2m |
ci/x86_64-freebsd-debug.sh+1-1| ... | @@ -52,7 +52,7 @@ stage3-debug/bin/zig build test docs \ | ... | @@ -52,7 +52,7 @@ stage3-debug/bin/zig build test docs \ |
| 52 | -Dskip-macos \ | 52 | -Dskip-macos \ |
| 53 | --search-prefix "$PREFIX" \ | 53 | --search-prefix "$PREFIX" \ |
| 54 | --zig-lib-dir "$PWD/../lib" \ | 54 | --zig-lib-dir "$PWD/../lib" \ |
| 55 | --test-timeout-ms 60_000 | 55 | --test-timeout 60s |
| 56 | 56 | ||
| 57 | stage3-debug/bin/zig build \ | 57 | stage3-debug/bin/zig build \ |
| 58 | --prefix stage4-debug \ | 58 | --prefix stage4-debug \ |
ci/x86_64-freebsd-release.sh+1-1| ... | @@ -52,7 +52,7 @@ stage3-release/bin/zig build test docs \ | ... | @@ -52,7 +52,7 @@ stage3-release/bin/zig build test docs \ |
| 52 | -Dskip-macos \ | 52 | -Dskip-macos \ |
| 53 | --search-prefix "$PREFIX" \ | 53 | --search-prefix "$PREFIX" \ |
| 54 | --zig-lib-dir "$PWD/../lib" \ | 54 | --zig-lib-dir "$PWD/../lib" \ |
| 55 | --test-timeout-ms 60_000 | 55 | --test-timeout 60s |
| 56 | 56 | ||
| 57 | # Ensure that stage3 and stage4 are byte-for-byte identical. | 57 | # Ensure that stage3 and stage4 are byte-for-byte identical. |
| 58 | stage3-release/bin/zig build \ | 58 | stage3-release/bin/zig build \ |
ci/x86_64-linux-debug-llvm.sh+1-1| ... | @@ -62,4 +62,4 @@ stage3-debug/bin/zig build test docs \ | ... | @@ -62,4 +62,4 @@ stage3-debug/bin/zig build test docs \ |
| 62 | --search-prefix "$PREFIX" \ | 62 | --search-prefix "$PREFIX" \ |
| 63 | --zig-lib-dir "$PWD/../lib" \ | 63 | --zig-lib-dir "$PWD/../lib" \ |
| 64 | -Denable-superhtml \ | 64 | -Denable-superhtml \ |
| 65 | --test-timeout-ms 240_000 | 65 | --test-timeout 4m |
ci/x86_64-linux-debug.sh+1-1| ... | @@ -62,4 +62,4 @@ stage3-debug/bin/zig build test docs \ | ... | @@ -62,4 +62,4 @@ stage3-debug/bin/zig build test docs \ |
| 62 | --search-prefix "$PREFIX" \ | 62 | --search-prefix "$PREFIX" \ |
| 63 | --zig-lib-dir "$PWD/../lib" \ | 63 | --zig-lib-dir "$PWD/../lib" \ |
| 64 | -Denable-superhtml \ | 64 | -Denable-superhtml \ |
| 65 | --test-timeout-ms 240_000 | 65 | --test-timeout 4m |
ci/x86_64-linux-release.sh+1-1| ... | @@ -64,7 +64,7 @@ stage3-release/bin/zig build test docs \ | ... | @@ -64,7 +64,7 @@ stage3-release/bin/zig build test docs \ |
| 64 | --search-prefix "$PREFIX" \ | 64 | --search-prefix "$PREFIX" \ |
| 65 | --zig-lib-dir "$PWD/../lib" \ | 65 | --zig-lib-dir "$PWD/../lib" \ |
| 66 | -Denable-superhtml \ | 66 | -Denable-superhtml \ |
| 67 | --test-timeout-ms 240_000 | 67 | --test-timeout 4m |
| 68 | 68 | ||
| 69 | # Ensure that stage3 and stage4 are byte-for-byte identical. | 69 | # Ensure that stage3 and stage4 are byte-for-byte identical. |
| 70 | stage3-release/bin/zig build \ | 70 | stage3-release/bin/zig build \ |
ci/x86_64-windows-debug.ps1+1-1| ... | @@ -60,7 +60,7 @@ Write-Output "Main test suite..." | ... | @@ -60,7 +60,7 @@ Write-Output "Main test suite..." |
| 60 | -Dskip-non-native ` | 60 | -Dskip-non-native ` |
| 61 | -Dskip-release ` | 61 | -Dskip-release ` |
| 62 | -Denable-symlinks-windows ` | 62 | -Denable-symlinks-windows ` |
| 63 | --test-timeout-ms 240_000 | 63 | --test-timeout 4m |
| 64 | CheckLastExitCode | 64 | CheckLastExitCode |
| 65 | 65 | ||
| 66 | Write-Output "Build x86_64-windows-msvc behavior tests using the C backend..." | 66 | Write-Output "Build x86_64-windows-msvc behavior tests using the C backend..." |
ci/x86_64-windows-release.ps1+1-1| ... | @@ -59,7 +59,7 @@ Write-Output "Main test suite..." | ... | @@ -59,7 +59,7 @@ Write-Output "Main test suite..." |
| 59 | -Dstatic-llvm ` | 59 | -Dstatic-llvm ` |
| 60 | -Dskip-non-native ` | 60 | -Dskip-non-native ` |
| 61 | -Denable-symlinks-windows ` | 61 | -Denable-symlinks-windows ` |
| 62 | --test-timeout-ms 240_000 | 62 | --test-timeout 4m |
| 63 | CheckLastExitCode | 63 | CheckLastExitCode |
| 64 | 64 | ||
| 65 | # Ensure that stage3 and stage4 are byte-for-byte identical. | 65 | # Ensure that stage3 and stage4 are byte-for-byte identical. |
lib/compiler/build_runner.zig+38-13| ... | @@ -108,7 +108,7 @@ pub fn main() !void { | ... | @@ -108,7 +108,7 @@ pub fn main() !void { |
| 108 | var summary: ?Summary = null; | 108 | var summary: ?Summary = null; |
| 109 | var max_rss: u64 = 0; | 109 | var max_rss: u64 = 0; |
| 110 | var skip_oom_steps = false; | 110 | var skip_oom_steps = false; |
| 111 | var test_timeout_ms: ?u64 = null; | 111 | var test_timeout_ns: ?u64 = null; |
| 112 | var color: Color = .auto; | 112 | var color: Color = .auto; |
| 113 | var help_menu = false; | 113 | var help_menu = false; |
| 114 | var steps_menu = false; | 114 | var steps_menu = false; |
| ... | @@ -189,14 +189,41 @@ pub fn main() !void { | ... | @@ -189,14 +189,41 @@ pub fn main() !void { |
| 189 | }; | 189 | }; |
| 190 | } else if (mem.eql(u8, arg, "--skip-oom-steps")) { | 190 | } else if (mem.eql(u8, arg, "--skip-oom-steps")) { |
| 191 | skip_oom_steps = true; | 191 | skip_oom_steps = true; |
| 192 | } else if (mem.eql(u8, arg, "--test-timeout-ms")) { | 192 | } else if (mem.eql(u8, arg, "--test-timeout")) { |
| 193 | const millis_str = nextArgOrFatal(args, &arg_idx); | 193 | const units: []const struct { []const u8, u64 } = &.{ |
| 194 | test_timeout_ms = std.fmt.parseInt(u64, millis_str, 10) catch |err| { | 194 | .{ "ns", 1 }, |
| 195 | std.debug.print("invalid millisecond count: '{s}': {s}\n", .{ | 195 | .{ "nanosecond", 1 }, |
| 196 | millis_str, @errorName(err), | 196 | .{ "us", std.time.ns_per_us }, |
| 197 | }); | 197 | .{ "microsecond", std.time.ns_per_us }, |
| 198 | process.exit(1); | 198 | .{ "ms", std.time.ns_per_ms }, |
| 199 | .{ "millisecond", std.time.ns_per_ms }, | ||
| 200 | .{ "s", std.time.ns_per_s }, | ||
| 201 | .{ "second", std.time.ns_per_s }, | ||
| 202 | .{ "m", std.time.ns_per_min }, | ||
| 203 | .{ "minute", std.time.ns_per_min }, | ||
| 204 | .{ "h", std.time.ns_per_hour }, | ||
| 205 | .{ "hour", std.time.ns_per_hour }, | ||
| 199 | }; | 206 | }; |
| 207 | const timeout_str = nextArgOrFatal(args, &arg_idx); | ||
| 208 | const num_end_idx = std.mem.findLastNone(u8, timeout_str, "abcdefghijklmnopqrstuvwxyz") orelse fatal( | ||
| 209 | "invalid timeout '{s}': expected unit (ns, us, ms, s, m, h)", | ||
| 210 | .{timeout_str}, | ||
| 211 | ); | ||
| 212 | const num_str = timeout_str[0 .. num_end_idx + 1]; | ||
| 213 | const unit_str = timeout_str[num_end_idx + 1 ..]; | ||
| 214 | const unit_factor: f64 = for (units) |unit_and_factor| { | ||
| 215 | if (std.mem.eql(u8, unit_str, unit_and_factor[0])) { | ||
| 216 | break @floatFromInt(unit_and_factor[1]); | ||
| 217 | } | ||
| 218 | } else fatal( | ||
| 219 | "invalid timeout '{s}': invalid unit '{s}' (expected ns, us, ms, s, m, h)", | ||
| 220 | .{ timeout_str, unit_str }, | ||
| 221 | ); | ||
| 222 | const num_parsed = std.fmt.parseFloat(f64, num_str) catch |err| fatal( | ||
| 223 | "invalid timeout '{s}': invalid number '{s}' ({t})", | ||
| 224 | .{ timeout_str, num_str, err }, | ||
| 225 | ); | ||
| 226 | test_timeout_ns = std.math.lossyCast(u64, unit_factor * num_parsed); | ||
| 200 | } else if (mem.eql(u8, arg, "--search-prefix")) { | 227 | } else if (mem.eql(u8, arg, "--search-prefix")) { |
| 201 | const search_prefix = nextArgOrFatal(args, &arg_idx); | 228 | const search_prefix = nextArgOrFatal(args, &arg_idx); |
| 202 | builder.addSearchPrefix(search_prefix); | 229 | builder.addSearchPrefix(search_prefix); |
| ... | @@ -480,10 +507,7 @@ pub fn main() !void { | ... | @@ -480,10 +507,7 @@ pub fn main() !void { |
| 480 | .max_rss_is_default = false, | 507 | .max_rss_is_default = false, |
| 481 | .max_rss_mutex = .{}, | 508 | .max_rss_mutex = .{}, |
| 482 | .skip_oom_steps = skip_oom_steps, | 509 | .skip_oom_steps = skip_oom_steps, |
| 483 | .unit_test_timeout_ns = ns: { | 510 | .unit_test_timeout_ns = test_timeout_ns, |
| 484 | const ms = test_timeout_ms orelse break :ns null; | ||
| 485 | break :ns std.math.mul(u64, ms, std.time.ns_per_ms) catch null; | ||
| 486 | }, | ||
| 487 | 511 | ||
| 488 | .watch = watch, | 512 | .watch = watch, |
| 489 | .web_server = undefined, // set after `prepare` | 513 | .web_server = undefined, // set after `prepare` |
| ... | @@ -1584,7 +1608,8 @@ fn printUsage(b: *std.Build, w: *Writer) !void { | ... | @@ -1584,7 +1608,8 @@ fn printUsage(b: *std.Build, w: *Writer) !void { |
| 1584 | \\ -j<N> Limit concurrent jobs (default is to use all CPU cores) | 1608 | \\ -j<N> Limit concurrent jobs (default is to use all CPU cores) |
| 1585 | \\ --maxrss <bytes> Limit memory usage (default is to use available memory) | 1609 | \\ --maxrss <bytes> Limit memory usage (default is to use available memory) |
| 1586 | \\ --skip-oom-steps Instead of failing, skip steps that would exceed --maxrss | 1610 | \\ --skip-oom-steps Instead of failing, skip steps that would exceed --maxrss |
| 1587 | \\ --test-timeout-ms <ms> Limit execution time of unit tests, terminating if exceeded | 1611 | \\ --test-timeout <timeout> Limit execution time of unit tests, terminating if exceeded. |
| 1612 | \\ The timeout must include a unit: ns, us, ms, s, m, h | ||
| 1588 | \\ --fetch[=mode] Fetch dependency tree (optionally choose laziness) and exit | 1613 | \\ --fetch[=mode] Fetch dependency tree (optionally choose laziness) and exit |
| 1589 | \\ needed (Default) Lazy dependencies are fetched as needed | 1614 | \\ needed (Default) Lazy dependencies are fetched as needed |
| 1590 | \\ all Lazy dependencies are always fetched | 1615 | \\ all Lazy dependencies are always fetched |
lib/std/Build/Step/Run.zig+1-1| ... | @@ -1814,7 +1814,7 @@ fn pollZigTest( | ... | @@ -1814,7 +1814,7 @@ fn pollZigTest( |
| 1814 | // test. For instance, if the test runner leaves this much time between us requesting a test to | 1814 | // test. For instance, if the test runner leaves this much time between us requesting a test to |
| 1815 | // start and it acknowledging the test starting, we terminate the child and raise an error. This | 1815 | // start and it acknowledging the test starting, we terminate the child and raise an error. This |
| 1816 | // *should* never happen, but could in theory be caused by some very unlucky IB in a test. | 1816 | // *should* never happen, but could in theory be caused by some very unlucky IB in a test. |
| 1817 | const response_timeout_ns = options.unit_test_timeout_ns orelse 60 * std.time.ns_per_s; | 1817 | const response_timeout_ns = @max(options.unit_test_timeout_ns orelse 0, 60 * std.time.ns_per_s); |
| 1818 | 1818 | ||
| 1819 | const stdout = poller.reader(.stdout); | 1819 | const stdout = poller.reader(.stdout); |
| 1820 | const stderr = poller.reader(.stderr); | 1820 | const stderr = poller.reader(.stderr); |