Add setUseTestEventedIO for test steps in build.zig

master
Haze Booth 2020-05-05 11:49:33 -04:00 committed by Andrew Kelley
parent b13a02ed1a
commit a39cb034ea
1 changed files with 10 additions and 0 deletions

View File

@ -1132,6 +1132,7 @@ pub const LibExeObjStep = struct {
name_prefix: []const u8, name_prefix: []const u8,
filter: ?[]const u8, filter: ?[]const u8,
single_threaded: bool, single_threaded: bool,
evented_io: bool = false,
code_model: builtin.CodeModel = .default, code_model: builtin.CodeModel = .default,
root_src: ?FileSource, root_src: ?FileSource,
@ -1559,6 +1560,11 @@ pub const LibExeObjStep = struct {
self.filter = text; self.filter = text;
} }
pub fn setUseTestEventedIo(self: *LibExeObjStep, use_evented_io: bool) void {
assert(self.kind == Kind.Test);
self.evented_io = use_evented_io;
}
pub fn addCSourceFile(self: *LibExeObjStep, file: []const u8, args: []const []const u8) void { pub fn addCSourceFile(self: *LibExeObjStep, file: []const u8, args: []const []const u8) void {
self.addCSourceFileSource(.{ self.addCSourceFileSource(.{
.args = args, .args = args,
@ -1864,6 +1870,10 @@ pub const LibExeObjStep = struct {
try zig_args.append(filter); try zig_args.append(filter);
} }
if (self.evented_io) {
try zig_args.append("--test-evented-io");
}
if (self.name_prefix.len != 0) { if (self.name_prefix.len != 0) {
try zig_args.append("--test-name-prefix"); try zig_args.append("--test-name-prefix");
try zig_args.append(self.name_prefix); try zig_args.append(self.name_prefix);