build: add test-mach step to test src/ and test for testing all sub-projects
This commit is contained in:
parent
08cfc2368f
commit
d194dafb79
7 changed files with 73 additions and 77 deletions
|
|
@ -1,14 +1,12 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) void {
|
pub fn build(b: *std.build.Builder) void {
|
||||||
const mode = b.standardReleaseOptions();
|
|
||||||
|
|
||||||
const main_tests = b.addTest("src/main.zig");
|
|
||||||
main_tests.addPackage(pkg);
|
|
||||||
main_tests.setBuildMode(mode);
|
|
||||||
|
|
||||||
const test_step = b.step("test", "Run library tests");
|
const test_step = b.step("test", "Run library tests");
|
||||||
test_step.dependOn(&main_tests.step);
|
test_step.dependOn(&testStep(b).step);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn testStep(b: *std.build.Builder) *std.build.LibExeObjStep {
|
||||||
|
return b.addTest(thisDir() ++ "/src/main.zig");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const pkg = std.build.Pkg{
|
pub const pkg = std.build.Pkg{
|
||||||
|
|
|
||||||
|
|
@ -48,40 +48,8 @@ pub fn build(b: *std.build.Builder) !void {
|
||||||
const mode = b.standardReleaseOptions();
|
const mode = b.standardReleaseOptions();
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
const freetype_tests = b.addTestSource(pkg.source);
|
|
||||||
freetype_tests.setBuildMode(mode);
|
|
||||||
freetype_tests.setTarget(target);
|
|
||||||
freetype_tests.addPackage(c_pkg);
|
|
||||||
freetype_tests.addPackage(utils_pkg);
|
|
||||||
link(b, freetype_tests, .{});
|
|
||||||
|
|
||||||
const harfbuzz_tests = b.addTestSource(harfbuzz_pkg.source);
|
|
||||||
harfbuzz_tests.setBuildMode(mode);
|
|
||||||
harfbuzz_tests.setTarget(target);
|
|
||||||
harfbuzz_tests.addPackage(c_pkg);
|
|
||||||
harfbuzz_tests.addPackage(utils_pkg);
|
|
||||||
harfbuzz_tests.addPackage(pkg);
|
|
||||||
link(b, harfbuzz_tests, .{ .harfbuzz = .{} });
|
|
||||||
|
|
||||||
const main_tests = b.addTest("test/main.zig");
|
|
||||||
main_tests.setBuildMode(mode);
|
|
||||||
main_tests.setTarget(target);
|
|
||||||
main_tests.addPackage(c_pkg);
|
|
||||||
|
|
||||||
// Remove once the stage2 compiler fixes pkg std not found
|
|
||||||
main_tests.addPackage(utils_pkg);
|
|
||||||
|
|
||||||
main_tests.addPackage(pkg);
|
|
||||||
link(b, main_tests, .{ .freetype = .{
|
|
||||||
.ft_config_path = "./test/ft",
|
|
||||||
.brotli = true,
|
|
||||||
} });
|
|
||||||
main_tests.main_pkg_path = thisDir();
|
|
||||||
|
|
||||||
const test_step = b.step("test", "Run library tests");
|
const test_step = b.step("test", "Run library tests");
|
||||||
test_step.dependOn(&freetype_tests.step);
|
test_step.dependOn(&testStep(b).step);
|
||||||
test_step.dependOn(&harfbuzz_tests.step);
|
|
||||||
test_step.dependOn(&main_tests.step);
|
|
||||||
|
|
||||||
inline for ([_][]const u8{
|
inline for ([_][]const u8{
|
||||||
"single-glyph",
|
"single-glyph",
|
||||||
|
|
@ -112,6 +80,36 @@ pub fn build(b: *std.build.Builder) !void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn testStep(b: *Builder) *std.build.LibExeObjStep {
|
||||||
|
const freetype_tests = b.addTestSource(pkg.source);
|
||||||
|
freetype_tests.addPackage(c_pkg);
|
||||||
|
freetype_tests.addPackage(utils_pkg);
|
||||||
|
link(b, freetype_tests, .{});
|
||||||
|
|
||||||
|
const harfbuzz_tests = b.addTestSource(harfbuzz_pkg.source);
|
||||||
|
harfbuzz_tests.addPackage(c_pkg);
|
||||||
|
harfbuzz_tests.addPackage(utils_pkg);
|
||||||
|
harfbuzz_tests.addPackage(pkg);
|
||||||
|
link(b, harfbuzz_tests, .{ .harfbuzz = .{} });
|
||||||
|
|
||||||
|
const main_tests = b.addTest(thisDir() ++ "/test/main.zig");
|
||||||
|
main_tests.addPackage(c_pkg);
|
||||||
|
|
||||||
|
// Remove once the stage2 compiler fixes pkg std not found
|
||||||
|
main_tests.addPackage(utils_pkg);
|
||||||
|
|
||||||
|
main_tests.addPackage(pkg);
|
||||||
|
link(b, main_tests, .{ .freetype = .{
|
||||||
|
.ft_config_path = thisDir() ++ "/test/ft",
|
||||||
|
.brotli = true,
|
||||||
|
} });
|
||||||
|
main_tests.main_pkg_path = thisDir();
|
||||||
|
main_tests.step.dependOn(&freetype_tests.step);
|
||||||
|
main_tests.step.dependOn(&harfbuzz_tests.step);
|
||||||
|
|
||||||
|
return main_tests;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn link(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void {
|
pub fn link(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void {
|
||||||
const ft_lib = buildFreetype(b, step, options.freetype);
|
const ft_lib = buildFreetype(b, step, options.freetype);
|
||||||
step.linkLibrary(ft_lib);
|
step.linkLibrary(ft_lib);
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,14 @@ const Builder = std.build.Builder;
|
||||||
const system_sdk = @import("system_sdk.zig");
|
const system_sdk = @import("system_sdk.zig");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *Builder) void {
|
||||||
const mode = b.standardReleaseOptions();
|
|
||||||
const target = b.standardTargetOptions(.{});
|
|
||||||
|
|
||||||
const main_tests = b.addTest("src/main.zig");
|
|
||||||
main_tests.setBuildMode(mode);
|
|
||||||
main_tests.setTarget(target);
|
|
||||||
link(b, main_tests, .{});
|
|
||||||
|
|
||||||
const test_step = b.step("test", "Run library tests");
|
const test_step = b.step("test", "Run library tests");
|
||||||
test_step.dependOn(&main_tests.step);
|
test_step.dependOn(&testStep(b).step);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn testStep(b: *Builder) *std.build.LibExeObjStep {
|
||||||
|
const main_tests = b.addTest(thisDir() ++ "/src/main.zig");
|
||||||
|
link(b, main_tests, .{});
|
||||||
|
return main_tests;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const LinuxWindowManager = enum {
|
pub const LinuxWindowManager = enum {
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,8 @@ pub fn build(b: *Builder) void {
|
||||||
lib.install();
|
lib.install();
|
||||||
link(b, lib, options);
|
link(b, lib, options);
|
||||||
|
|
||||||
const main_tests = b.addTest("src/main.zig");
|
|
||||||
main_tests.setBuildMode(mode);
|
|
||||||
|
|
||||||
const test_step = b.step("test", "Run library tests");
|
const test_step = b.step("test", "Run library tests");
|
||||||
test_step.dependOn(&main_tests.step);
|
test_step.dependOn(&testStep(b).step);
|
||||||
|
|
||||||
const dawn_example = b.addExecutable("dawn-example", "src/dawn/hello_triangle.zig");
|
const dawn_example = b.addExecutable("dawn-example", "src/dawn/hello_triangle.zig");
|
||||||
dawn_example.setBuildMode(mode);
|
dawn_example.setBuildMode(mode);
|
||||||
|
|
@ -37,6 +34,10 @@ pub fn build(b: *Builder) void {
|
||||||
dawn_example_run_step.dependOn(&dawn_example_run_cmd.step);
|
dawn_example_run_step.dependOn(&dawn_example_run_cmd.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn testStep(b: *std.build.Builder) *std.build.LibExeObjStep {
|
||||||
|
return b.addTest(thisDir() ++ "/src/main.zig");
|
||||||
|
}
|
||||||
|
|
||||||
pub const LinuxWindowManager = enum {
|
pub const LinuxWindowManager = enum {
|
||||||
X11,
|
X11,
|
||||||
Wayland,
|
Wayland,
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,8 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
.from_source = b.option(bool, "dawn-from-source", "Build Dawn from source") orelse false,
|
.from_source = b.option(bool, "dawn-from-source", "Build Dawn from source") orelse false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const main_tests = b.addTest("src/main.zig");
|
|
||||||
main_tests.setTarget(target);
|
|
||||||
main_tests.setBuildMode(mode);
|
|
||||||
link(b, main_tests, .{ .gpu_dawn_options = gpu_dawn_options });
|
|
||||||
|
|
||||||
const test_step = b.step("test", "Run library tests");
|
const test_step = b.step("test", "Run library tests");
|
||||||
test_step.dependOn(&main_tests.step);
|
test_step.dependOn(&testStep(b, .{ .gpu_dawn_options = gpu_dawn_options }).step);
|
||||||
|
|
||||||
const example = b.addExecutable("gpu-hello-triangle", "examples/main.zig");
|
const example = b.addExecutable("gpu-hello-triangle", "examples/main.zig");
|
||||||
example.setTarget(target);
|
example.setTarget(target);
|
||||||
|
|
@ -33,6 +28,12 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
example_run_step.dependOn(&example_run_cmd.step);
|
example_run_step.dependOn(&example_run_cmd.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn testStep(b: *std.build.Builder, options: Options) *std.build.LibExeObjStep {
|
||||||
|
const main_tests = b.addTest(thisDir() ++ "/src/main.zig");
|
||||||
|
link(b, main_tests, options);
|
||||||
|
return main_tests;
|
||||||
|
}
|
||||||
|
|
||||||
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 = .{},
|
||||||
|
|
|
||||||
|
|
@ -21,18 +21,8 @@ pub fn build(b: *Builder) void {
|
||||||
const mode = b.standardReleaseOptions();
|
const mode = b.standardReleaseOptions();
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
const soundio_tests = b.addTest("soundio/main.zig");
|
|
||||||
soundio_tests.setBuildMode(mode);
|
|
||||||
link(b, soundio_tests, .{});
|
|
||||||
|
|
||||||
const main_tests = b.addTest("src/main.zig");
|
|
||||||
main_tests.setBuildMode(mode);
|
|
||||||
main_tests.addPackage(soundio_pkg);
|
|
||||||
link(b, main_tests, .{});
|
|
||||||
|
|
||||||
const test_step = b.step("test", "Run library tests");
|
const test_step = b.step("test", "Run library tests");
|
||||||
test_step.dependOn(&soundio_tests.step);
|
test_step.dependOn(&testStep(b, .{}).step);
|
||||||
test_step.dependOn(&main_tests.step);
|
|
||||||
|
|
||||||
inline for ([_][]const u8{
|
inline for ([_][]const u8{
|
||||||
"soundio-sine-wave",
|
"soundio-sine-wave",
|
||||||
|
|
@ -58,6 +48,18 @@ pub fn build(b: *Builder) void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn testStep(b: *std.build.Builder, options: Options) *std.build.LibExeObjStep {
|
||||||
|
const soundio_tests = b.addTest(thisDir() ++ "/soundio/main.zig");
|
||||||
|
link(b, soundio_tests, options);
|
||||||
|
|
||||||
|
const main_tests = b.addTest(thisDir() ++ "/src/main.zig");
|
||||||
|
main_tests.addPackage(soundio_pkg);
|
||||||
|
main_tests.step.dependOn(&soundio_tests.step);
|
||||||
|
link(b, main_tests, options);
|
||||||
|
|
||||||
|
return main_tests;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn link(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void {
|
pub fn link(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void {
|
||||||
_ = options;
|
_ = options;
|
||||||
if (step.target.toTarget().cpu.arch != .wasm32) {
|
if (step.target.toTarget().cpu.arch != .wasm32) {
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) void {
|
pub fn build(b: *std.build.Builder) void {
|
||||||
const mode = b.standardReleaseOptions();
|
|
||||||
|
|
||||||
const main_tests = b.addTest("src/main.zig");
|
|
||||||
main_tests.addPackage(pkg);
|
|
||||||
main_tests.setBuildMode(mode);
|
|
||||||
|
|
||||||
const test_step = b.step("test", "Run library tests");
|
const test_step = b.step("test", "Run library tests");
|
||||||
test_step.dependOn(&main_tests.step);
|
test_step.dependOn(&testStep(b).step);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn testStep(b: *std.build.Builder) *std.build.LibExeObjStep {
|
||||||
|
return b.addTest(thisDir() ++ "/src/main.zig");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const pkg = std.build.Pkg{
|
pub const pkg = std.build.Pkg{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue