| ... | @@ -467,6 +467,9 @@ pub fn lowerToBuildSteps( | ... | @@ -467,6 +467,9 @@ pub fn lowerToBuildSteps( |
| 467 | cases_dir_path: []const u8, | 467 | cases_dir_path: []const u8, |
| 468 | incremental_exe: *std.Build.Step.Compile, | 468 | incremental_exe: *std.Build.Step.Compile, |
| 469 | ) void { | 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 | for (self.incremental_cases.items) |incr_case| { | 473 | for (self.incremental_cases.items) |incr_case| { |
| 471 | if (true) { | 474 | if (true) { |
| 472 | // TODO: incremental tests are disabled for now, as incremental compilation bugs were | 475 | // TODO: incremental tests are disabled for now, as incremental compilation bugs were |
| ... | @@ -569,8 +572,34 @@ pub fn lowerToBuildSteps( | ... | @@ -569,8 +572,34 @@ pub fn lowerToBuildSteps( |
| 569 | artifact.expect_errors = expected_msgs; | 572 | artifact.expect_errors = expected_msgs; |
| 570 | parent_step.dependOn(&artifact.step); | 573 | parent_step.dependOn(&artifact.step); |
| 571 | }, | 574 | }, |
| 572 | .Execution => |expected_stdout| { | 575 | .Execution => |expected_stdout| no_exec: { |
| 573 | const run = b.addRunArtifact(artifact); | 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 | run.skip_foreign_checks = true; | 603 | run.skip_foreign_checks = true; |
| 575 | if (!case.is_test) { | 604 | if (!case.is_test) { |
| 576 | run.expectStdOutEqual(expected_stdout); | 605 | run.expectStdOutEqual(expected_stdout); |