authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-07-19 18:19:48-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-07-19 23:20:25-04:00
loge7ea7d3480bd015053d34474a23cdf407a6a545f
treefc98a4630e04378699dbf7c51513e59f385524f0
parentce859cfcb8c87b83c55209b5321ee86b9e5e80a7

test: fix cbe execution tests


1 files changed, 31 insertions(+), 2 deletions(-)

test/src/Cases.zig+31-2
......@@ -467,6 +467,9 @@ pub fn lowerToBuildSteps(
467467 cases_dir_path: []const u8,
468468 incremental_exe: *std.Build.Step.Compile,
469469) 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
470473 for (self.incremental_cases.items) |incr_case| {
471474 if (true) {
472475 // TODO: incremental tests are disabled for now, as incremental compilation bugs were
......@@ -569,8 +572,34 @@ pub fn lowerToBuildSteps(
569572 artifact.expect_errors = expected_msgs;
570573 parent_step.dependOn(&artifact.step);
571574 },
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);
574603 run.skip_foreign_checks = true;
575604 if (!case.is_test) {
576605 run.expectStdOutEqual(expected_stdout);