| pubfnaddCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *Step { |
| conststep=b.step("test-c-abi", "Run the C ABI tests"); |
| |
| constoptimize_modes: [2]OptimizeMode= .{ .Debug, .ReleaseFast }; |
| |
| for (optimize_modes) |optimize_mode| { |
| if (optimize_mode!=.Debugandskip_release) continue; |
| |
| for (c_abi_targets) |c_abi_target| { |
| if (skip_non_nativeand!c_abi_target.isNative()) continue; |
| |
| if (c_abi_target.isWindows() andc_abi_target.getCpuArch() ==.aarch64) { |
| // https://github.com/ziglang/zig/issues/14908 |
| continue; |
| } |
| |
| consttest_step=b.addTest(.{ |
| .root_source_file= .{ .path="test/c_abi/main.zig" }, |
| .optimize=optimize_mode, |
| .target=c_abi_target, |
| }); |
| if (c_abi_target.abi!=nullandc_abi_target.abi.?.isMusl()) { |
| // TODO NativeTargetInfo insists on dynamically linking musl |
| // for some reason? |
| test_step.target_info.dynamic_linker.max_byte=null; |
| } |
| test_step.linkLibC(); |
| test_step.addCSourceFile("test/c_abi/cfuncs.c", &.{"-std=c99"}); |
| |
| // test-c-abi should test both with LTO on and with LTO off. Only |
| // some combinations are passing currently: |
| // https://github.com/ziglang/zig/issues/14908 |
| if (c_abi_target.isWindows()) { |
| test_step.want_lto=false; |
| } |
| |
| consttriple_prefix=c_abi_target.zigTriple(b.allocator) catch@panic("OOM"); |
| test_step.setName(b.fmt("test-c-abi-{s}-{s} ", .{ |
| triple_prefix, @tagName(optimize_mode), |
| })); |
| |
| construn=test_step.run(); |
| run.skip_foreign_checks=true; |
| step.dependOn(&run.step); |
| } |
| } |
| returnstep; |
| } |
Extracted from #14647.
There are two problems here. One is #14908. The other looks like zig is failing to put the subarch into the llvm triple. This issue is to track the latter issue.
zig/test/tests.zig
Lines 1019 to 1066 in b4d58e9