Commit d51aa9748f

Andrew Kelley <andrew@ziglang.org>
2024-02-17 10:44:16
change default WASI stack size
to match the other operating systems. 16 MiB closes #18885
1 parent 031f231
Changed files (4)
lib
std
compress
src
test
lib/std/compress/flate/deflate.zig
@@ -530,9 +530,7 @@ fn SimpleCompressor(
 
 const builtin = @import("builtin");
 
-test "flate.Deflate tokenization" {
-    if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest;
-
+test "tokenization" {
     const L = Token.initLiteral;
     const M = Token.initMatch;
 
@@ -607,9 +605,7 @@ const TestTokenWriter = struct {
     pub fn flush(_: *Self) !void {}
 };
 
-test "flate deflate file tokenization" {
-    if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest;
-
+test "file tokenization" {
     const levels = [_]Level{ .level_4, .level_5, .level_6, .level_7, .level_8, .level_9 };
     const cases = [_]struct {
         data: []const u8, // uncompressed content
@@ -718,7 +714,7 @@ fn TokenDecoder(comptime WriterType: type) type {
     };
 }
 
-test "flate.Deflate store simple compressor" {
+test "store simple compressor" {
     const data = "Hello world!";
     const expected = [_]u8{
         0x1, // block type 0, final bit set
lib/std/compress/flate.zig
@@ -79,9 +79,9 @@ const fixedBufferStream = std.io.fixedBufferStream;
 const print = std.debug.print;
 const builtin = @import("builtin");
 
-test "flate" {
-    _ = @import("flate/deflate.zig");
-    _ = @import("flate/inflate.zig");
+test {
+    _ = deflate;
+    _ = inflate;
 }
 
 test "flate compress/decompress" {
src/link/Wasm.zig
@@ -418,7 +418,10 @@ pub fn createEmpty(
             .zcu_object_sub_path = zcu_object_sub_path,
             .gc_sections = options.gc_sections orelse (output_mode != .Obj),
             .print_gc_sections = options.print_gc_sections,
-            .stack_size = options.stack_size orelse std.wasm.page_size * 16, // 1MB
+            .stack_size = options.stack_size orelse switch (target.os.tag) {
+                .freestanding => 1 * 1024 * 1024, // 1 MiB
+                else => 16 * 1024 * 1024, // 16 MiB
+            },
             .allow_shlib_undefined = options.allow_shlib_undefined orelse false,
             .file = null,
             .disable_lld_caching = options.disable_lld_caching,
test/tests.zig
@@ -1138,11 +1138,6 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
 
         for (options.include_paths) |include_path| these_tests.addIncludePath(.{ .path = include_path });
 
-        if (target.os.tag == .wasi) {
-            // WASI's default stack size can be too small for some big tests.
-            these_tests.stack_size = 2 * 1024 * 1024;
-        }
-
         const qualified_name = b.fmt("{s}-{s}-{s}-{s}{s}{s}{s}{s}{s}", .{
             options.name,
             triple_txt,