| ... | ... | @@ -467,6 +467,9 @@ pub fn lowerToBuildSteps( |
| 467 | 467 | cases_dir_path: []const u8, |
| 468 | 468 | incremental_exe: *std.Build.Step.Compile, |
| 469 | 469 | ) void { |
| 470 | const host = std.zig.system.NativeTargetInfo.detect(.{}) catch |err| |
| 471 | std.debug.panic("unable to detect notive host: {s}\n", .{@errorName(err)}); |
| 472 | |
| 470 | 473 | for (self.incremental_cases.items) |incr_case| { |
| 471 | 474 | if (true) { |
| 472 | 475 | // TODO: incremental tests are disabled for now, as incremental compilation bugs were |
| ... | ... | @@ -569,8 +572,34 @@ pub fn lowerToBuildSteps( |
| 569 | 572 | artifact.expect_errors = expected_msgs; |
| 570 | 573 | parent_step.dependOn(&artifact.step); |
| 571 | 574 | }, |
| 572 | | .Execution => |expected_stdout| { |
| 573 | | const run = b.addRunArtifact(artifact); |
| 575 | .Execution => |expected_stdout| no_exec: { |
| 576 | const run = if (case.target.ofmt == .c) run_step: { |
| 577 | const target_info = std.zig.system.NativeTargetInfo.detect(case.target) catch |err| |
| 578 | std.debug.panic("unable to detect notive host: {s}\n", .{@errorName(err)}); |
| 579 | if (host.getExternalExecutor(target_info, .{ .link_libc = true }) != .native) { |
| 580 | // We wouldn't be able to run the compiled C code. |
| 581 | break :no_exec; |
| 582 | } |
| 583 | const run_c = b.addSystemCommand(&.{ |
| 584 | b.zig_exe, |
| 585 | "run", |
| 586 | "-cflags", |
| 587 | "-Ilib", |
| 588 | "-std=c99", |
| 589 | "-pedantic", |
| 590 | "-Werror", |
| 591 | "-Wno-dollar-in-identifier-extension", |
| 592 | "-Wno-incompatible-library-redeclaration", // https://github.com/ziglang/zig/issues/875 |
| 593 | "-Wno-incompatible-pointer-types", |
| 594 | "-Wno-overlength-strings", |
| 595 | "--", |
| 596 | "-lc", |
| 597 | "-target", |
| 598 | case.target.zigTriple(b.allocator) catch @panic("OOM"), |
| 599 | }); |
| 600 | run_c.addArtifactArg(artifact); |
| 601 | break :run_step run_c; |
| 602 | } else b.addRunArtifact(artifact); |
| 574 | 603 | run.skip_foreign_checks = true; |
| 575 | 604 | if (!case.is_test) { |
| 576 | 605 | run.expectStdOutEqual(expected_stdout); |