Skip to content

Commit d7ac8c8

Browse files
committed
wasi: don't try to test http
wasi does not support networking
1 parent 483b63d commit d7ac8c8

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/std/http.zig

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
const std = @import("std.zig");
2-
31
pub const Client = @import("http/Client.zig");
42
pub const Server = @import("http/Server.zig");
53
pub const protocol = @import("http/protocol.zig");
@@ -308,12 +306,17 @@ pub const Header = struct {
308306
value: []const u8,
309307
};
310308

309+
const builtin = @import("builtin");
310+
const std = @import("std.zig");
311+
311312
test {
312313
_ = Client;
313314
_ = Method;
314315
_ = Server;
315316
_ = Status;
316317
_ = HeadParser;
317318
_ = ChunkParser;
318-
_ = @import("http/test.zig");
319+
if (builtin.os.tag != .wasi) {
320+
_ = @import("http/test.zig");
321+
}
319322
}

lib/std/http/test.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,7 @@ const TestServer = struct {
914914

915915
fn destroy(self: *@This()) void {
916916
self.server_thread.join();
917+
self.net_server.deinit();
917918
std.testing.allocator.destroy(self);
918919
}
919920

@@ -924,7 +925,6 @@ const TestServer = struct {
924925

925926
fn createTestServer(S: type) !*TestServer {
926927
if (builtin.single_threaded) return error.SkipZigTest;
927-
if (builtin.os.tag == .wasi) return error.SkipZigTest;
928928
if (builtin.zig_backend == .stage2_llvm and native_endian == .big) {
929929
// https://github.com/ziglang/zig/issues/13782
930930
return error.SkipZigTest;

0 commit comments

Comments
 (0)