build: make libs tests seprate step
This commit is contained in:
parent
af8310f2df
commit
80266c577e
2 changed files with 39 additions and 22 deletions
55
build.zig
55
build.zig
|
|
@ -30,27 +30,32 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
};
|
};
|
||||||
const options = Options{ .gpu_dawn_options = gpu_dawn_options };
|
const options = Options{ .gpu_dawn_options = gpu_dawn_options };
|
||||||
|
|
||||||
const main_tests = b.addTestExe("mach-tests", "src/main.zig");
|
const all_tests_step = b.step("test", "Run library tests");
|
||||||
main_tests.setBuildMode(mode);
|
const gpu_test_step = b.step("test-gpu", "Run GPU library tests");
|
||||||
main_tests.setTarget(target);
|
const ecs_test_step = b.step("test-ecs", "Run ECS library tests");
|
||||||
main_tests.addPackage(pkg);
|
const freetype_test_step = b.step("test-freetype", "Run Freetype library tests");
|
||||||
main_tests.addPackage(gpu.pkg);
|
const basisu_test_step = b.step("test-basisu", "Run Basis-Universal library tests");
|
||||||
main_tests.addPackage(glfw.pkg);
|
const sysaudio_test_step = b.step("test-sysaudio", "Run sysaudio library tests");
|
||||||
main_tests.install();
|
const mach_test_step = b.step("test-mach", "Run Mach Core library tests");
|
||||||
|
|
||||||
|
gpu_test_step.dependOn(&gpu.testStep(b, mode, target, options.gpuOptions()).step);
|
||||||
|
freetype_test_step.dependOn(&freetype.testStep(b, mode, target).step);
|
||||||
|
ecs_test_step.dependOn(&ecs.testStep(b, mode, target).step);
|
||||||
|
basisu_test_step.dependOn(&basisu.testStep(b, mode, target).step);
|
||||||
|
sysaudio_test_step.dependOn(&sysaudio.testStep(b, mode, target).step);
|
||||||
|
mach_test_step.dependOn(&testStep(b, mode, target).step);
|
||||||
|
|
||||||
|
all_tests_step.dependOn(gpu_test_step);
|
||||||
|
all_tests_step.dependOn(ecs_test_step);
|
||||||
|
all_tests_step.dependOn(freetype_test_step);
|
||||||
|
all_tests_step.dependOn(basisu_test_step);
|
||||||
|
all_tests_step.dependOn(sysaudio_test_step);
|
||||||
|
all_tests_step.dependOn(mach_test_step);
|
||||||
|
|
||||||
const test_step = b.step("test", "Run library tests");
|
|
||||||
test_step.dependOn(&main_tests.run().step);
|
|
||||||
test_step.dependOn(&gpu.testStep(b, mode, target, options.gpuOptions()).step);
|
|
||||||
test_step.dependOn(&glfw.testStep(b, mode, target).step);
|
|
||||||
test_step.dependOn(&ecs.testStep(b, mode, target).step);
|
|
||||||
test_step.dependOn(&freetype.testStep(b, mode, target).step);
|
|
||||||
test_step.dependOn(&basisu.testStep(b, mode, target).step);
|
|
||||||
test_step.dependOn(&sysaudio.testStep(b, mode, target, .{}).step);
|
|
||||||
// TODO: we need a way to test wasm stuff
|
// TODO: we need a way to test wasm stuff
|
||||||
// test_mach_step.dependOn(&sysjs.testStep(b, mode, target).step);
|
// const sysjs_test_step = b.step( "test-sysjs", "Run sysjs library tests");
|
||||||
|
// sysjs_test_step.dependOn(&sysjs.testStep(b, mode, target).step);
|
||||||
const test_mach_step = b.step("test-mach", "Run Mach Core library tests");
|
// all_tests_step.dependOn(sysjs_test_step);
|
||||||
test_mach_step.dependOn(&main_tests.run().step);
|
|
||||||
|
|
||||||
// TODO(build-system): https://github.com/hexops/mach/issues/229#issuecomment-1100958939
|
// TODO(build-system): https://github.com/hexops/mach/issues/229#issuecomment-1100958939
|
||||||
ensureGit(b.allocator);
|
ensureGit(b.allocator);
|
||||||
|
|
@ -157,6 +162,18 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
lib.install();
|
lib.install();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget) *std.build.RunStep {
|
||||||
|
const main_tests = b.addTestExe("mach-tests", "src/main.zig");
|
||||||
|
main_tests.setBuildMode(mode);
|
||||||
|
main_tests.setTarget(target);
|
||||||
|
main_tests.addPackage(pkg);
|
||||||
|
main_tests.addPackage(gpu.pkg);
|
||||||
|
main_tests.addPackage(glfw.pkg);
|
||||||
|
main_tests.install();
|
||||||
|
|
||||||
|
return main_tests.run();
|
||||||
|
}
|
||||||
|
|
||||||
pub const Options = struct {
|
pub const Options = struct {
|
||||||
glfw_options: glfw.Options = .{},
|
glfw_options: glfw.Options = .{},
|
||||||
gpu_dawn_options: gpu_dawn.Options = .{},
|
gpu_dawn_options: gpu_dawn.Options = .{},
|
||||||
|
|
|
||||||
|
|
@ -50,18 +50,18 @@ pub fn build(b: *Builder) void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget, options: Options) *std.build.RunStep {
|
pub fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget) *std.build.RunStep {
|
||||||
const soundio_tests = b.addTestExe("soundio-tests", (comptime thisDir()) ++ "/soundio/main.zig");
|
const soundio_tests = b.addTestExe("soundio-tests", (comptime thisDir()) ++ "/soundio/main.zig");
|
||||||
soundio_tests.setBuildMode(mode);
|
soundio_tests.setBuildMode(mode);
|
||||||
soundio_tests.setTarget(target);
|
soundio_tests.setTarget(target);
|
||||||
link(b, soundio_tests, options);
|
link(b, soundio_tests, .{});
|
||||||
soundio_tests.install();
|
soundio_tests.install();
|
||||||
|
|
||||||
const main_tests = b.addTestExe("sysaudio-tests", (comptime thisDir()) ++ "/src/main.zig");
|
const main_tests = b.addTestExe("sysaudio-tests", (comptime thisDir()) ++ "/src/main.zig");
|
||||||
main_tests.setBuildMode(mode);
|
main_tests.setBuildMode(mode);
|
||||||
main_tests.setTarget(target);
|
main_tests.setTarget(target);
|
||||||
main_tests.addPackage(soundio_pkg);
|
main_tests.addPackage(soundio_pkg);
|
||||||
link(b, main_tests, options);
|
link(b, main_tests, .{});
|
||||||
main_tests.install();
|
main_tests.install();
|
||||||
|
|
||||||
const main_tests_run = main_tests.run();
|
const main_tests_run = main_tests.run();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue