Commit 33a401dd60

dweiller <4678790+dweiller@users.noreplay.github.com>
2022-11-01 01:57:43
std.build: add support for custom test runner
1 parent 55c91fc
Changed files (1)
lib
lib/std/build.zig
@@ -1509,6 +1509,7 @@ pub const LibExeObjStep = struct {
     name_prefix: []const u8,
     filter: ?[]const u8,
     test_evented_io: bool = false,
+    test_runner: ?[]const u8,
     code_model: std.builtin.CodeModel = .default,
     wasi_exec_model: ?std.builtin.WasiExecModel = null,
     /// Symbols to be exported when compiling to wasm
@@ -1772,6 +1773,7 @@ pub const LibExeObjStep = struct {
             .exec_cmd_args = null,
             .name_prefix = "",
             .filter = null,
+            .test_runner = null,
             .disable_stack_probing = false,
             .disable_sanitize_c = false,
             .sanitize_thread = false,
@@ -2670,6 +2672,11 @@ pub const LibExeObjStep = struct {
             try zig_args.append(self.name_prefix);
         }
 
+        if (self.test_runner) |test_runner| {
+            try zig_args.append("--test-runner");
+            try zig_args.append(builder.pathFromRoot(test_runner));
+        }
+
         for (builder.debug_log_scopes) |log_scope| {
             try zig_args.append("--debug-log");
             try zig_args.append(log_scope);