| ... | @@ -56,8 +56,7 @@ global_base: ?u64 = null, | ... | @@ -56,8 +56,7 @@ global_base: ?u64 = null, |
| 56 | zig_lib_dir: ?LazyPath, | 56 | zig_lib_dir: ?LazyPath, |
| 57 | exec_cmd_args: ?[]const ?[]const u8, | 57 | exec_cmd_args: ?[]const ?[]const u8, |
| 58 | filters: []const []const u8, | 58 | filters: []const []const u8, |
| 59 | test_runner: ?LazyPath, | 59 | test_runner: ?TestRunner, |
| 60 | test_server_mode: bool, | | |
| 61 | wasi_exec_model: ?std.builtin.WasiExecModel = null, | 60 | wasi_exec_model: ?std.builtin.WasiExecModel = null, |
| 62 | | 61 | |
| 63 | installed_headers: ArrayList(HeaderInstallation), | 62 | installed_headers: ArrayList(HeaderInstallation), |
| ... | @@ -268,7 +267,7 @@ pub const Options = struct { | ... | @@ -268,7 +267,7 @@ pub const Options = struct { |
| 268 | version: ?std.SemanticVersion = null, | 267 | version: ?std.SemanticVersion = null, |
| 269 | max_rss: usize = 0, | 268 | max_rss: usize = 0, |
| 270 | filters: []const []const u8 = &.{}, | 269 | filters: []const []const u8 = &.{}, |
| 271 | test_runner: ?LazyPath = null, | 270 | test_runner: ?TestRunner = null, |
| 272 | use_llvm: ?bool = null, | 271 | use_llvm: ?bool = null, |
| 273 | use_lld: ?bool = null, | 272 | use_lld: ?bool = null, |
| 274 | zig_lib_dir: ?LazyPath = null, | 273 | zig_lib_dir: ?LazyPath = null, |
| ... | @@ -347,6 +346,14 @@ pub const HeaderInstallation = union(enum) { | ... | @@ -347,6 +346,14 @@ pub const HeaderInstallation = union(enum) { |
| 347 | } | 346 | } |
| 348 | }; | 347 | }; |
| 349 | | 348 | |
| | 349 | pub const TestRunner = struct { |
| | 350 | path: LazyPath, |
| | 351 | /// Test runners can either be "simple", running tests when spawned and terminating when the |
| | 352 | /// tests are complete, or they can use `std.zig.Server` over stdio to interact more closely |
| | 353 | /// with the build system. |
| | 354 | mode: enum { simple, server }, |
| | 355 | }; |
| | 356 | |
| 350 | pub fn create(owner: *std.Build, options: Options) *Compile { | 357 | pub fn create(owner: *std.Build, options: Options) *Compile { |
| 351 | const name = owner.dupe(options.name); | 358 | const name = owner.dupe(options.name); |
| 352 | if (mem.indexOf(u8, name, "/") != null or mem.indexOf(u8, name, "\\") != null) { | 359 | if (mem.indexOf(u8, name, "/") != null or mem.indexOf(u8, name, "\\") != null) { |
| ... | @@ -411,8 +418,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile { | ... | @@ -411,8 +418,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile { |
| 411 | .zig_lib_dir = null, | 418 | .zig_lib_dir = null, |
| 412 | .exec_cmd_args = null, | 419 | .exec_cmd_args = null, |
| 413 | .filters = options.filters, | 420 | .filters = options.filters, |
| 414 | .test_runner = null, | 421 | .test_runner = null, // set below |
| 415 | .test_server_mode = options.test_runner == null, | | |
| 416 | .rdynamic = false, | 422 | .rdynamic = false, |
| 417 | .installed_path = null, | 423 | .installed_path = null, |
| 418 | .force_undefined_symbols = StringHashMap(void).init(owner.allocator), | 424 | .force_undefined_symbols = StringHashMap(void).init(owner.allocator), |
| ... | @@ -438,9 +444,12 @@ pub fn create(owner: *std.Build, options: Options) *Compile { | ... | @@ -438,9 +444,12 @@ pub fn create(owner: *std.Build, options: Options) *Compile { |
| 438 | lp.addStepDependencies(&compile.step); | 444 | lp.addStepDependencies(&compile.step); |
| 439 | } | 445 | } |
| 440 | | 446 | |
| 441 | if (options.test_runner) |lp| { | 447 | if (options.test_runner) |runner| { |
| 442 | compile.test_runner = lp.dupe(compile.step.owner); | 448 | compile.test_runner = .{ |
| 443 | lp.addStepDependencies(&compile.step); | 449 | .path = runner.path.dupe(compile.step.owner), |
| | 450 | .mode = runner.mode, |
| | 451 | }; |
| | 452 | runner.path.addStepDependencies(&compile.step); |
| 444 | } | 453 | } |
| 445 | | 454 | |
| 446 | // Only the PE/COFF format has a Resource Table which is where the manifest | 455 | // Only the PE/COFF format has a Resource Table which is where the manifest |
| ... | @@ -1399,7 +1408,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { | ... | @@ -1399,7 +1408,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { |
| 1399 | | 1408 | |
| 1400 | if (compile.test_runner) |test_runner| { | 1409 | if (compile.test_runner) |test_runner| { |
| 1401 | try zig_args.append("--test-runner"); | 1410 | try zig_args.append("--test-runner"); |
| 1402 | try zig_args.append(test_runner.getPath2(b, step)); | 1411 | try zig_args.append(test_runner.path.getPath2(b, step)); |
| 1403 | } | 1412 | } |
| 1404 | | 1413 | |
| 1405 | for (b.debug_log_scopes) |log_scope| { | 1414 | for (b.debug_log_scopes) |log_scope| { |