| ... | @@ -985,37 +985,37 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S | ... | @@ -985,37 +985,37 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S |
| 985 | | 985 | |
| 986 | const optimize_modes: [2]OptimizeMode = .{ .Debug, .ReleaseFast }; | 986 | const optimize_modes: [2]OptimizeMode = .{ .Debug, .ReleaseFast }; |
| 987 | | 987 | |
| 988 | for (optimize_modes[0 .. @as(u8, 1) + @boolToInt(!skip_release)]) |optimize_mode| for (c_abi_targets) |c_abi_target| { | 988 | for (optimize_modes) |optimize_mode| { |
| 989 | if (skip_non_native and !c_abi_target.isNative()) | 989 | if (optimize_mode != .Debug and skip_release) continue; |
| 990 | continue; | 990 | |
| 991 | | 991 | for (c_abi_targets) |c_abi_target| { |
| 992 | const test_step = b.addTest(.{ | 992 | if (skip_non_native and !c_abi_target.isNative()) continue; |
| 993 | .root_source_file = .{ .path = "test/c_abi/main.zig" }, | 993 | |
| 994 | .optimize = optimize_mode, | 994 | const test_step = b.addTest(.{ |
| 995 | .target = c_abi_target, | 995 | .root_source_file = .{ .path = "test/c_abi/main.zig" }, |
| 996 | }); | 996 | .optimize = optimize_mode, |
| 997 | if (c_abi_target.abi != null and c_abi_target.abi.?.isMusl()) { | 997 | .target = c_abi_target, |
| 998 | // TODO NativeTargetInfo insists on dynamically linking musl | 998 | }); |
| 999 | // for some reason? | 999 | if (c_abi_target.abi != null and c_abi_target.abi.?.isMusl()) { |
| 1000 | test_step.target_info.dynamic_linker.max_byte = null; | 1000 | // TODO NativeTargetInfo insists on dynamically linking musl |
| 1001 | } | 1001 | // for some reason? |
| 1002 | test_step.linkLibC(); | 1002 | test_step.target_info.dynamic_linker.max_byte = null; |
| 1003 | test_step.addCSourceFile("test/c_abi/cfuncs.c", &.{"-std=c99"}); | 1003 | } |
| 1004 | | 1004 | test_step.linkLibC(); |
| 1005 | if (c_abi_target.isWindows() and (c_abi_target.getCpuArch() == .x86 or builtin.target.os.tag == .linux)) { | 1005 | test_step.addCSourceFile("test/c_abi/cfuncs.c", &.{"-std=c99"}); |
| 1006 | // LTO currently incorrectly strips stdcall name-mangled functions | 1006 | // This test is intentionally trying to check if the external ABI is |
| 1007 | // LLD crashes in LTO here when cross compiling for windows on linux | 1007 | // done properly. LTO would be a hindrance to this. |
| 1008 | test_step.want_lto = false; | 1008 | test_step.want_lto = false; |
| 1009 | } | | |
| 1010 | | 1009 | |
| 1011 | const triple_prefix = c_abi_target.zigTriple(b.allocator) catch @panic("OOM"); | 1010 | const triple_prefix = c_abi_target.zigTriple(b.allocator) catch @panic("OOM"); |
| 1012 | test_step.setNamePrefix(b.fmt("{s}-{s}-{s} ", .{ | 1011 | test_step.setNamePrefix(b.fmt("{s}-{s}-{s} ", .{ |
| 1013 | "test-c-abi", | 1012 | "test-c-abi", |
| 1014 | triple_prefix, | 1013 | triple_prefix, |
| 1015 | @tagName(optimize_mode), | 1014 | @tagName(optimize_mode), |
| 1016 | })); | 1015 | })); |
| 1017 | | 1016 | |
| 1018 | step.dependOn(&test_step.step); | 1017 | step.dependOn(&test_step.step); |
| 1019 | }; | 1018 | } |
| | 1019 | } |
| 1020 | return step; | 1020 | return step; |
| 1021 | } | 1021 | } |