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
|
|
@ -48,40 +48,8 @@ pub fn build(b: *std.build.Builder) !void {
|
|||
const mode = b.standardReleaseOptions();
|
||||
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");
|
||||
test_step.dependOn(&freetype_tests.step);
|
||||
test_step.dependOn(&harfbuzz_tests.step);
|
||||
test_step.dependOn(&main_tests.step);
|
||||
test_step.dependOn(&testStep(b).step);
|
||||
|
||||
inline for ([_][]const u8{
|
||||
"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 {
|
||||
const ft_lib = buildFreetype(b, step, options.freetype);
|
||||
step.linkLibrary(ft_lib);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue