mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
support unit testing wasm via wasmtime
This commit is contained in:
12
build.zig
12
build.zig
@ -73,6 +73,9 @@ pub fn build(b: *std.build.Builder) !void {
|
||||
"Build and install test executables with 'build'",
|
||||
) orelse false;
|
||||
|
||||
// We can use wasmtime to test wasm
|
||||
b.enable_wasmtime = true;
|
||||
|
||||
// Add our benchmarks
|
||||
try benchSteps(b, target, mode);
|
||||
|
||||
@ -124,6 +127,15 @@ pub fn build(b: *std.build.Builder) !void {
|
||||
|
||||
const step = b.step("wasm", "Build the wasm library");
|
||||
step.dependOn(&wasm.step);
|
||||
|
||||
// We support tests via wasmtime. wasmtime uses WASI so this
|
||||
// isn't an exact match to our freestanding target above but
|
||||
// it lets us test some basic functionality.
|
||||
const test_step = b.step("test-wasm", "Run all tests for wasm");
|
||||
const main_test = b.addTest("src/main_wasm.zig");
|
||||
main_test.setTarget(.{ .cpu_arch = .wasm32, .os_tag = .wasi });
|
||||
main_test.addOptions("build_options", exe_options);
|
||||
test_step.dependOn(&main_test.step);
|
||||
}
|
||||
|
||||
// Run
|
||||
|
Reference in New Issue
Block a user