| ... | @@ -49,6 +49,8 @@ export fn zig_five_integers(a: i32, b: i32, c: i32, d: i32, e: i32) void { | ... | @@ -49,6 +49,8 @@ export fn zig_five_integers(a: i32, b: i32, c: i32, d: i32, e: i32) void { |
| 49 | } | 49 | } |
| 50 | | 50 | |
| 51 | test "C ABI integers" { | 51 | test "C ABI integers" { |
| | 52 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 53 | |
| 52 | c_u8(0xff); | 54 | c_u8(0xff); |
| 53 | c_u16(0xfffe); | 55 | c_u16(0xfffe); |
| 54 | c_u32(0xfffffffd); | 56 | c_u32(0xfffffffd); |
| ... | @@ -185,6 +187,8 @@ const complex_abi_compatible = builtin.cpu.arch != .x86 and !builtin.cpu.arch.is | ... | @@ -185,6 +187,8 @@ const complex_abi_compatible = builtin.cpu.arch != .x86 and !builtin.cpu.arch.is |
| 185 | !builtin.cpu.arch.isARM() and !builtin.cpu.arch.isPPC() and !builtin.cpu.arch.isRISCV(); | 187 | !builtin.cpu.arch.isARM() and !builtin.cpu.arch.isPPC() and !builtin.cpu.arch.isRISCV(); |
| 186 | | 188 | |
| 187 | test "C ABI complex float" { | 189 | test "C ABI complex float" { |
| | 190 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 191 | |
| 188 | if (!complex_abi_compatible) return error.SkipZigTest; | 192 | if (!complex_abi_compatible) return error.SkipZigTest; |
| 189 | if (builtin.cpu.arch == .x86_64) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/8465 | 193 | if (builtin.cpu.arch == .x86_64) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/8465 |
| 190 | | 194 | |
| ... | @@ -197,6 +201,8 @@ test "C ABI complex float" { | ... | @@ -197,6 +201,8 @@ test "C ABI complex float" { |
| 197 | } | 201 | } |
| 198 | | 202 | |
| 199 | test "C ABI complex float by component" { | 203 | test "C ABI complex float by component" { |
| | 204 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 205 | |
| 200 | if (!complex_abi_compatible) return error.SkipZigTest; | 206 | if (!complex_abi_compatible) return error.SkipZigTest; |
| 201 | | 207 | |
| 202 | const a = ComplexFloat{ .real = 1.25, .imag = 2.6 }; | 208 | const a = ComplexFloat{ .real = 1.25, .imag = 2.6 }; |
| ... | @@ -208,6 +214,8 @@ test "C ABI complex float by component" { | ... | @@ -208,6 +214,8 @@ test "C ABI complex float by component" { |
| 208 | } | 214 | } |
| 209 | | 215 | |
| 210 | test "C ABI complex double" { | 216 | test "C ABI complex double" { |
| | 217 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 218 | |
| 211 | if (!complex_abi_compatible) return error.SkipZigTest; | 219 | if (!complex_abi_compatible) return error.SkipZigTest; |
| 212 | | 220 | |
| 213 | const a = ComplexDouble{ .real = 1.25, .imag = 2.6 }; | 221 | const a = ComplexDouble{ .real = 1.25, .imag = 2.6 }; |
| ... | @@ -219,6 +227,8 @@ test "C ABI complex double" { | ... | @@ -219,6 +227,8 @@ test "C ABI complex double" { |
| 219 | } | 227 | } |
| 220 | | 228 | |
| 221 | test "C ABI complex double by component" { | 229 | test "C ABI complex double by component" { |
| | 230 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 231 | |
| 222 | if (!complex_abi_compatible) return error.SkipZigTest; | 232 | if (!complex_abi_compatible) return error.SkipZigTest; |
| 223 | | 233 | |
| 224 | const a = ComplexDouble{ .real = 1.25, .imag = 2.6 }; | 234 | const a = ComplexDouble{ .real = 1.25, .imag = 2.6 }; |
| ... | @@ -230,6 +240,8 @@ test "C ABI complex double by component" { | ... | @@ -230,6 +240,8 @@ test "C ABI complex double by component" { |
| 230 | } | 240 | } |
| 231 | | 241 | |
| 232 | export fn zig_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat { | 242 | export fn zig_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat { |
| | 243 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 244 | |
| 233 | expect(a.real == 1.25) catch @panic("test failure: zig_cmultf 1"); | 245 | expect(a.real == 1.25) catch @panic("test failure: zig_cmultf 1"); |
| 234 | expect(a.imag == 2.6) catch @panic("test failure: zig_cmultf 2"); | 246 | expect(a.imag == 2.6) catch @panic("test failure: zig_cmultf 2"); |
| 235 | expect(b.real == 11.3) catch @panic("test failure: zig_cmultf 3"); | 247 | expect(b.real == 11.3) catch @panic("test failure: zig_cmultf 3"); |
| ... | @@ -239,6 +251,8 @@ export fn zig_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat { | ... | @@ -239,6 +251,8 @@ export fn zig_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat { |
| 239 | } | 251 | } |
| 240 | | 252 | |
| 241 | export fn zig_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble { | 253 | export fn zig_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble { |
| | 254 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 255 | |
| 242 | expect(a.real == 1.25) catch @panic("test failure: zig_cmultd 1"); | 256 | expect(a.real == 1.25) catch @panic("test failure: zig_cmultd 1"); |
| 243 | expect(a.imag == 2.6) catch @panic("test failure: zig_cmultd 2"); | 257 | expect(a.imag == 2.6) catch @panic("test failure: zig_cmultd 2"); |
| 244 | expect(b.real == 11.3) catch @panic("test failure: zig_cmultd 3"); | 258 | expect(b.real == 11.3) catch @panic("test failure: zig_cmultd 3"); |
| ... | @@ -248,6 +262,8 @@ export fn zig_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble { | ... | @@ -248,6 +262,8 @@ export fn zig_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble { |
| 248 | } | 262 | } |
| 249 | | 263 | |
| 250 | export fn zig_cmultf_comp(a_r: f32, a_i: f32, b_r: f32, b_i: f32) ComplexFloat { | 264 | export fn zig_cmultf_comp(a_r: f32, a_i: f32, b_r: f32, b_i: f32) ComplexFloat { |
| | 265 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 266 | |
| 251 | expect(a_r == 1.25) catch @panic("test failure: zig_cmultf_comp 1"); | 267 | expect(a_r == 1.25) catch @panic("test failure: zig_cmultf_comp 1"); |
| 252 | expect(a_i == 2.6) catch @panic("test failure: zig_cmultf_comp 2"); | 268 | expect(a_i == 2.6) catch @panic("test failure: zig_cmultf_comp 2"); |
| 253 | expect(b_r == 11.3) catch @panic("test failure: zig_cmultf_comp 3"); | 269 | expect(b_r == 11.3) catch @panic("test failure: zig_cmultf_comp 3"); |
| ... | @@ -257,6 +273,8 @@ export fn zig_cmultf_comp(a_r: f32, a_i: f32, b_r: f32, b_i: f32) ComplexFloat { | ... | @@ -257,6 +273,8 @@ export fn zig_cmultf_comp(a_r: f32, a_i: f32, b_r: f32, b_i: f32) ComplexFloat { |
| 257 | } | 273 | } |
| 258 | | 274 | |
| 259 | export fn zig_cmultd_comp(a_r: f64, a_i: f64, b_r: f64, b_i: f64) ComplexDouble { | 275 | export fn zig_cmultd_comp(a_r: f64, a_i: f64, b_r: f64, b_i: f64) ComplexDouble { |
| | 276 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 277 | |
| 260 | expect(a_r == 1.25) catch @panic("test failure: zig_cmultd_comp 1"); | 278 | expect(a_r == 1.25) catch @panic("test failure: zig_cmultd_comp 1"); |
| 261 | expect(a_i == 2.6) catch @panic("test failure: zig_cmultd_comp 2"); | 279 | expect(a_i == 2.6) catch @panic("test failure: zig_cmultd_comp 2"); |
| 262 | expect(b_r == 11.3) catch @panic("test failure: zig_cmultd_comp 3"); | 280 | expect(b_r == 11.3) catch @panic("test failure: zig_cmultd_comp 3"); |
| ... | @@ -334,6 +352,8 @@ extern fn c_med_struct_mixed(MedStructMixed) void; | ... | @@ -334,6 +352,8 @@ extern fn c_med_struct_mixed(MedStructMixed) void; |
| 334 | extern fn c_ret_med_struct_mixed() MedStructMixed; | 352 | extern fn c_ret_med_struct_mixed() MedStructMixed; |
| 335 | | 353 | |
| 336 | test "C ABI medium struct of ints and floats" { | 354 | test "C ABI medium struct of ints and floats" { |
| | 355 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 356 | |
| 337 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; | 357 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; |
| 338 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; | 358 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 339 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 359 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | @@ -402,6 +422,8 @@ extern fn c_med_struct_ints(MedStructInts) void; | ... | @@ -402,6 +422,8 @@ extern fn c_med_struct_ints(MedStructInts) void; |
| 402 | extern fn c_ret_med_struct_ints() MedStructInts; | 422 | extern fn c_ret_med_struct_ints() MedStructInts; |
| 403 | | 423 | |
| 404 | test "C ABI medium struct of ints" { | 424 | test "C ABI medium struct of ints" { |
| | 425 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 426 | |
| 405 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; | 427 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; |
| 406 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; | 428 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 407 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 429 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | @@ -509,6 +531,8 @@ extern fn c_split_struct_mixed(SplitStructMixed) void; | ... | @@ -509,6 +531,8 @@ extern fn c_split_struct_mixed(SplitStructMixed) void; |
| 509 | extern fn c_ret_split_struct_mixed() SplitStructMixed; | 531 | extern fn c_ret_split_struct_mixed() SplitStructMixed; |
| 510 | | 532 | |
| 511 | test "C ABI split struct of ints and floats" { | 533 | test "C ABI split struct of ints and floats" { |
| | 534 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 535 | |
| 512 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; | 536 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; |
| 513 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; | 537 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 514 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 538 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | @@ -590,6 +614,8 @@ const Vector5 = extern struct { | ... | @@ -590,6 +614,8 @@ const Vector5 = extern struct { |
| 590 | extern fn c_big_struct_floats(Vector5) void; | 614 | extern fn c_big_struct_floats(Vector5) void; |
| 591 | | 615 | |
| 592 | test "C ABI structs of floats as parameter" { | 616 | test "C ABI structs of floats as parameter" { |
| | 617 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 618 | |
| 593 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; | 619 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 594 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 620 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 595 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; | 621 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| ... | @@ -657,6 +683,8 @@ const FloatRect = extern struct { | ... | @@ -657,6 +683,8 @@ const FloatRect = extern struct { |
| 657 | }; | 683 | }; |
| 658 | | 684 | |
| 659 | export fn zig_multiple_struct_floats(x: FloatRect, y: FloatRect) void { | 685 | export fn zig_multiple_struct_floats(x: FloatRect, y: FloatRect) void { |
| | 686 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 687 | |
| 660 | expect(x.left == 1) catch @panic("test failure"); | 688 | expect(x.left == 1) catch @panic("test failure"); |
| 661 | expect(x.right == 21) catch @panic("test failure"); | 689 | expect(x.right == 21) catch @panic("test failure"); |
| 662 | expect(x.top == 16) catch @panic("test failure"); | 690 | expect(x.top == 16) catch @panic("test failure"); |
| ... | @@ -668,6 +696,8 @@ export fn zig_multiple_struct_floats(x: FloatRect, y: FloatRect) void { | ... | @@ -668,6 +696,8 @@ export fn zig_multiple_struct_floats(x: FloatRect, y: FloatRect) void { |
| 668 | } | 696 | } |
| 669 | | 697 | |
| 670 | test "C ABI structs of floats as multiple parameters" { | 698 | test "C ABI structs of floats as multiple parameters" { |
| | 699 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 700 | |
| 671 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; | 701 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 672 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 702 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| 673 | | 703 | |
| ... | @@ -724,6 +754,8 @@ export fn zig_ret_small_struct_ints() SmallStructInts { | ... | @@ -724,6 +754,8 @@ export fn zig_ret_small_struct_ints() SmallStructInts { |
| 724 | } | 754 | } |
| 725 | | 755 | |
| 726 | export fn zig_ret_med_struct_ints() MedStructInts { | 756 | export fn zig_ret_med_struct_ints() MedStructInts { |
| | 757 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 758 | |
| 727 | return .{ | 759 | return .{ |
| 728 | .x = 1, | 760 | .x = 1, |
| 729 | .y = 2, | 761 | .y = 2, |
| ... | @@ -732,6 +764,8 @@ export fn zig_ret_med_struct_ints() MedStructInts { | ... | @@ -732,6 +764,8 @@ export fn zig_ret_med_struct_ints() MedStructInts { |
| 732 | } | 764 | } |
| 733 | | 765 | |
| 734 | export fn zig_ret_med_struct_mixed() MedStructMixed { | 766 | export fn zig_ret_med_struct_mixed() MedStructMixed { |
| | 767 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 768 | |
| 735 | return .{ | 769 | return .{ |
| 736 | .a = 1234, | 770 | .a = 1234, |
| 737 | .b = 100.0, | 771 | .b = 100.0, |
| ... | @@ -740,6 +774,8 @@ export fn zig_ret_med_struct_mixed() MedStructMixed { | ... | @@ -740,6 +774,8 @@ export fn zig_ret_med_struct_mixed() MedStructMixed { |
| 740 | } | 774 | } |
| 741 | | 775 | |
| 742 | export fn zig_ret_split_struct_mixed() SplitStructMixed { | 776 | export fn zig_ret_split_struct_mixed() SplitStructMixed { |
| | 777 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 778 | |
| 743 | return .{ | 779 | return .{ |
| 744 | .a = 1234, | 780 | .a = 1234, |
| 745 | .b = 100, | 781 | .b = 100, |
| ... | @@ -780,6 +816,8 @@ extern fn c_struct_with_array(StructWithArray) void; | ... | @@ -780,6 +816,8 @@ extern fn c_struct_with_array(StructWithArray) void; |
| 780 | extern fn c_ret_struct_with_array() StructWithArray; | 816 | extern fn c_ret_struct_with_array() StructWithArray; |
| 781 | | 817 | |
| 782 | test "Struct with array as padding." { | 818 | test "Struct with array as padding." { |
| | 819 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 820 | |
| 783 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; | 821 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; |
| 784 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; | 822 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 785 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 823 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | @@ -851,6 +889,8 @@ extern fn c_medium_vec(MediumVec) void; | ... | @@ -851,6 +889,8 @@ extern fn c_medium_vec(MediumVec) void; |
| 851 | extern fn c_ret_medium_vec() MediumVec; | 889 | extern fn c_ret_medium_vec() MediumVec; |
| 852 | | 890 | |
| 853 | test "medium simd vector" { | 891 | test "medium simd vector" { |
| | 892 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 893 | |
| 854 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; | 894 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 855 | | 895 | |
| 856 | c_medium_vec(.{ 1, 2, 3, 4 }); | 896 | c_medium_vec(.{ 1, 2, 3, 4 }); |
| ... | @@ -868,6 +908,8 @@ extern fn c_big_vec(BigVec) void; | ... | @@ -868,6 +908,8 @@ extern fn c_big_vec(BigVec) void; |
| 868 | extern fn c_ret_big_vec() BigVec; | 908 | extern fn c_ret_big_vec() BigVec; |
| 869 | | 909 | |
| 870 | test "big simd vector" { | 910 | test "big simd vector" { |
| | 911 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 912 | |
| 871 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; | 913 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; |
| 872 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; | 914 | if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; |
| 873 | if (builtin.cpu.arch == .x86_64 and builtin.os.tag == .macos and builtin.mode != .Debug) return error.SkipZigTest; | 915 | if (builtin.cpu.arch == .x86_64 and builtin.os.tag == .macos and builtin.mode != .Debug) return error.SkipZigTest; |
| ... | @@ -891,6 +933,8 @@ extern fn c_ptr_size_float_struct(Vector2) void; | ... | @@ -891,6 +933,8 @@ extern fn c_ptr_size_float_struct(Vector2) void; |
| 891 | extern fn c_ret_ptr_size_float_struct() Vector2; | 933 | extern fn c_ret_ptr_size_float_struct() Vector2; |
| 892 | | 934 | |
| 893 | test "C ABI pointer sized float struct" { | 935 | test "C ABI pointer sized float struct" { |
| | 936 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 937 | |
| 894 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; | 938 | if (builtin.cpu.arch == .x86) return error.SkipZigTest; |
| 895 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; | 939 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 896 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; | 940 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| ... | @@ -914,6 +958,8 @@ pub inline fn expectOk(c_err: c_int) !void { | ... | @@ -914,6 +958,8 @@ pub inline fn expectOk(c_err: c_int) !void { |
| 914 | /// Tests for Double + Char struct | 958 | /// Tests for Double + Char struct |
| 915 | const DC = extern struct { v1: f64, v2: u8 }; | 959 | const DC = extern struct { v1: f64, v2: u8 }; |
| 916 | test "DC: Zig passes to C" { | 960 | test "DC: Zig passes to C" { |
| | 961 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 962 | |
| 917 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; | 963 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 918 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; | 964 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 919 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 965 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | @@ -921,6 +967,8 @@ test "DC: Zig passes to C" { | ... | @@ -921,6 +967,8 @@ test "DC: Zig passes to C" { |
| 921 | try expectOk(c_assert_DC(.{ .v1 = -0.25, .v2 = 15 })); | 967 | try expectOk(c_assert_DC(.{ .v1 = -0.25, .v2 = 15 })); |
| 922 | } | 968 | } |
| 923 | test "DC: Zig returns to C" { | 969 | test "DC: Zig returns to C" { |
| | 970 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 971 | |
| 924 | if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest; | 972 | if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest; |
| 925 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; | 973 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; |
| 926 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; | 974 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| ... | @@ -929,6 +977,8 @@ test "DC: Zig returns to C" { | ... | @@ -929,6 +977,8 @@ test "DC: Zig returns to C" { |
| 929 | try expectOk(c_assert_ret_DC()); | 977 | try expectOk(c_assert_ret_DC()); |
| 930 | } | 978 | } |
| 931 | test "DC: C passes to Zig" { | 979 | test "DC: C passes to Zig" { |
| | 980 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 981 | |
| 932 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; | 982 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 933 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; | 983 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 934 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 984 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | @@ -936,6 +986,8 @@ test "DC: C passes to Zig" { | ... | @@ -936,6 +986,8 @@ test "DC: C passes to Zig" { |
| 936 | try expectOk(c_send_DC()); | 986 | try expectOk(c_send_DC()); |
| 937 | } | 987 | } |
| 938 | test "DC: C returns to Zig" { | 988 | test "DC: C returns to Zig" { |
| | 989 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 990 | |
| 939 | if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest; | 991 | if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest; |
| 940 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; | 992 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; |
| 941 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; | 993 | if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| ... | @@ -949,6 +1001,8 @@ pub extern fn c_assert_ret_DC() c_int; | ... | @@ -949,6 +1001,8 @@ pub extern fn c_assert_ret_DC() c_int; |
| 949 | pub extern fn c_send_DC() c_int; | 1001 | pub extern fn c_send_DC() c_int; |
| 950 | pub extern fn c_ret_DC() DC; | 1002 | pub extern fn c_ret_DC() DC; |
| 951 | pub export fn zig_assert_DC(lv: DC) c_int { | 1003 | pub export fn zig_assert_DC(lv: DC) c_int { |
| | 1004 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 1005 | |
| 952 | var err: c_int = 0; | 1006 | var err: c_int = 0; |
| 953 | if (lv.v1 != -0.25) err = 1; | 1007 | if (lv.v1 != -0.25) err = 1; |
| 954 | if (lv.v2 != 15) err = 2; | 1008 | if (lv.v2 != 15) err = 2; |
| ... | @@ -956,6 +1010,8 @@ pub export fn zig_assert_DC(lv: DC) c_int { | ... | @@ -956,6 +1010,8 @@ pub export fn zig_assert_DC(lv: DC) c_int { |
| 956 | return err; | 1010 | return err; |
| 957 | } | 1011 | } |
| 958 | pub export fn zig_ret_DC() DC { | 1012 | pub export fn zig_ret_DC() DC { |
| | 1013 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 1014 | |
| 959 | return .{ .v1 = -0.25, .v2 = 15 }; | 1015 | return .{ .v1 = -0.25, .v2 = 15 }; |
| 960 | } | 1016 | } |
| 961 | | 1017 | |
| ... | @@ -963,6 +1019,8 @@ pub export fn zig_ret_DC() DC { | ... | @@ -963,6 +1019,8 @@ pub export fn zig_ret_DC() DC { |
| 963 | const CFF = extern struct { v1: u8, v2: f32, v3: f32 }; | 1019 | const CFF = extern struct { v1: u8, v2: f32, v3: f32 }; |
| 964 | | 1020 | |
| 965 | test "CFF: Zig passes to C" { | 1021 | test "CFF: Zig passes to C" { |
| | 1022 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 1023 | |
| 966 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; | 1024 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 967 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; | 1025 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 968 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 1026 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | @@ -970,6 +1028,8 @@ test "CFF: Zig passes to C" { | ... | @@ -970,6 +1028,8 @@ test "CFF: Zig passes to C" { |
| 970 | try expectOk(c_assert_CFF(.{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 })); | 1028 | try expectOk(c_assert_CFF(.{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 })); |
| 971 | } | 1029 | } |
| 972 | test "CFF: Zig returns to C" { | 1030 | test "CFF: Zig returns to C" { |
| | 1031 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 1032 | |
| 973 | if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest; | 1033 | if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest; |
| 974 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; | 1034 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 975 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 1035 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | @@ -977,6 +1037,8 @@ test "CFF: Zig returns to C" { | ... | @@ -977,6 +1037,8 @@ test "CFF: Zig returns to C" { |
| 977 | try expectOk(c_assert_ret_CFF()); | 1037 | try expectOk(c_assert_ret_CFF()); |
| 978 | } | 1038 | } |
| 979 | test "CFF: C passes to Zig" { | 1039 | test "CFF: C passes to Zig" { |
| | 1040 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 1041 | |
| 980 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; | 1042 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 981 | if (comptime builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest; | 1043 | if (comptime builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest; |
| 982 | if (builtin.cpu.arch == .aarch64 and builtin.mode != .Debug) return error.SkipZigTest; | 1044 | if (builtin.cpu.arch == .aarch64 and builtin.mode != .Debug) return error.SkipZigTest; |
| ... | @@ -987,6 +1049,8 @@ test "CFF: C passes to Zig" { | ... | @@ -987,6 +1049,8 @@ test "CFF: C passes to Zig" { |
| 987 | try expectOk(c_send_CFF()); | 1049 | try expectOk(c_send_CFF()); |
| 988 | } | 1050 | } |
| 989 | test "CFF: C returns to Zig" { | 1051 | test "CFF: C returns to Zig" { |
| | 1052 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 1053 | |
| 990 | if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest; | 1054 | if (builtin.cpu.arch == .x86 and builtin.mode != .Debug) return error.SkipZigTest; |
| 991 | if (builtin.cpu.arch == .aarch64 and builtin.mode != .Debug) return error.SkipZigTest; | 1055 | if (builtin.cpu.arch == .aarch64 and builtin.mode != .Debug) return error.SkipZigTest; |
| 992 | if (comptime builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest; | 1056 | if (comptime builtin.cpu.arch.isRISCV() and builtin.mode != .Debug) return error.SkipZigTest; |
| ... | @@ -1000,6 +1064,8 @@ pub extern fn c_assert_ret_CFF() c_int; | ... | @@ -1000,6 +1064,8 @@ pub extern fn c_assert_ret_CFF() c_int; |
| 1000 | pub extern fn c_send_CFF() c_int; | 1064 | pub extern fn c_send_CFF() c_int; |
| 1001 | pub extern fn c_ret_CFF() CFF; | 1065 | pub extern fn c_ret_CFF() CFF; |
| 1002 | pub export fn zig_assert_CFF(lv: CFF) c_int { | 1066 | pub export fn zig_assert_CFF(lv: CFF) c_int { |
| | 1067 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 1068 | |
| 1003 | var err: c_int = 0; | 1069 | var err: c_int = 0; |
| 1004 | if (lv.v1 != 39) err = 1; | 1070 | if (lv.v1 != 39) err = 1; |
| 1005 | if (lv.v2 != 0.875) err = 2; | 1071 | if (lv.v2 != 0.875) err = 2; |
| ... | @@ -1008,6 +1074,8 @@ pub export fn zig_assert_CFF(lv: CFF) c_int { | ... | @@ -1008,6 +1074,8 @@ pub export fn zig_assert_CFF(lv: CFF) c_int { |
| 1008 | return err; | 1074 | return err; |
| 1009 | } | 1075 | } |
| 1010 | pub export fn zig_ret_CFF() CFF { | 1076 | pub export fn zig_ret_CFF() CFF { |
| | 1077 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 1078 | |
| 1011 | return .{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 }; | 1079 | return .{ .v1 = 39, .v2 = 0.875, .v3 = 1.0 }; |
| 1012 | } | 1080 | } |
| 1013 | | 1081 | |
| ... | @@ -1015,6 +1083,8 @@ pub export fn zig_ret_CFF() CFF { | ... | @@ -1015,6 +1083,8 @@ pub export fn zig_ret_CFF() CFF { |
| 1015 | const PD = extern struct { v1: ?*anyopaque, v2: f64 }; | 1083 | const PD = extern struct { v1: ?*anyopaque, v2: f64 }; |
| 1016 | | 1084 | |
| 1017 | test "PD: Zig passes to C" { | 1085 | test "PD: Zig passes to C" { |
| | 1086 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 1087 | |
| 1018 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; | 1088 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 1019 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; | 1089 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 1020 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 1090 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | @@ -1022,6 +1092,8 @@ test "PD: Zig passes to C" { | ... | @@ -1022,6 +1092,8 @@ test "PD: Zig passes to C" { |
| 1022 | try expectOk(c_assert_PD(.{ .v1 = null, .v2 = 0.5 })); | 1092 | try expectOk(c_assert_PD(.{ .v1 = null, .v2 = 0.5 })); |
| 1023 | } | 1093 | } |
| 1024 | test "PD: Zig returns to C" { | 1094 | test "PD: Zig returns to C" { |
| | 1095 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 1096 | |
| 1025 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; | 1097 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 1026 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; | 1098 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; |
| 1027 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 1099 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | @@ -1029,6 +1101,8 @@ test "PD: Zig returns to C" { | ... | @@ -1029,6 +1101,8 @@ test "PD: Zig returns to C" { |
| 1029 | try expectOk(c_assert_ret_PD()); | 1101 | try expectOk(c_assert_ret_PD()); |
| 1030 | } | 1102 | } |
| 1031 | test "PD: C passes to Zig" { | 1103 | test "PD: C passes to Zig" { |
| | 1104 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 1105 | |
| 1032 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; | 1106 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 1033 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; | 1107 | if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; |
| 1034 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 1108 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | @@ -1036,6 +1110,8 @@ test "PD: C passes to Zig" { | ... | @@ -1036,6 +1110,8 @@ test "PD: C passes to Zig" { |
| 1036 | try expectOk(c_send_PD()); | 1110 | try expectOk(c_send_PD()); |
| 1037 | } | 1111 | } |
| 1038 | test "PD: C returns to Zig" { | 1112 | test "PD: C returns to Zig" { |
| | 1113 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 1114 | |
| 1039 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; | 1115 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 1040 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; | 1116 | if (comptime builtin.cpu.arch.isMIPS() and builtin.mode != .Debug) return error.SkipZigTest; |
| 1041 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; | 1117 | if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; |
| ... | @@ -1047,6 +1123,8 @@ pub extern fn c_assert_ret_PD() c_int; | ... | @@ -1047,6 +1123,8 @@ pub extern fn c_assert_ret_PD() c_int; |
| 1047 | pub extern fn c_send_PD() c_int; | 1123 | pub extern fn c_send_PD() c_int; |
| 1048 | pub extern fn c_ret_PD() PD; | 1124 | pub extern fn c_ret_PD() PD; |
| 1049 | pub export fn zig_c_assert_PD(lv: PD) c_int { | 1125 | pub export fn zig_c_assert_PD(lv: PD) c_int { |
| | 1126 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 1127 | |
| 1050 | var err: c_int = 0; | 1128 | var err: c_int = 0; |
| 1051 | if (lv.v1 != null) err = 1; | 1129 | if (lv.v1 != null) err = 1; |
| 1052 | if (lv.v2 != 0.5) err = 2; | 1130 | if (lv.v2 != 0.5) err = 2; |
| ... | @@ -1054,9 +1132,13 @@ pub export fn zig_c_assert_PD(lv: PD) c_int { | ... | @@ -1054,9 +1132,13 @@ pub export fn zig_c_assert_PD(lv: PD) c_int { |
| 1054 | return err; | 1132 | return err; |
| 1055 | } | 1133 | } |
| 1056 | pub export fn zig_ret_PD() PD { | 1134 | pub export fn zig_ret_PD() PD { |
| | 1135 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 1136 | |
| 1057 | return .{ .v1 = null, .v2 = 0.5 }; | 1137 | return .{ .v1 = null, .v2 = 0.5 }; |
| 1058 | } | 1138 | } |
| 1059 | pub export fn zig_assert_PD(lv: PD) c_int { | 1139 | pub export fn zig_assert_PD(lv: PD) c_int { |
| | 1140 | if (builtin.zig_backend == .stage2_x86_64) @panic("error.SkipZigTest"); |
| | 1141 | |
| 1060 | var err: c_int = 0; | 1142 | var err: c_int = 0; |
| 1061 | if (lv.v1 != null) err = 1; | 1143 | if (lv.v1 != null) err = 1; |
| 1062 | if (lv.v2 != 0.5) err = 2; | 1144 | if (lv.v2 != 0.5) err = 2; |
| ... | @@ -1146,6 +1228,8 @@ const f80_struct = extern struct { | ... | @@ -1146,6 +1228,8 @@ const f80_struct = extern struct { |
| 1146 | }; | 1228 | }; |
| 1147 | extern fn c_f80_struct(f80_struct) f80_struct; | 1229 | extern fn c_f80_struct(f80_struct) f80_struct; |
| 1148 | test "f80 struct" { | 1230 | test "f80 struct" { |
| | 1231 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 1232 | |
| 1149 | if (!has_f80) return error.SkipZigTest; | 1233 | if (!has_f80) return error.SkipZigTest; |
| 1150 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; | 1234 | if (builtin.target.cpu.arch == .x86) return error.SkipZigTest; |
| 1151 | if (builtin.mode != .Debug) return error.SkipZigTest; | 1235 | if (builtin.mode != .Debug) return error.SkipZigTest; |
| ... | @@ -1233,6 +1317,8 @@ test "Stdcall ABI big union" { | ... | @@ -1233,6 +1317,8 @@ test "Stdcall ABI big union" { |
| 1233 | | 1317 | |
| 1234 | extern fn c_explict_win64(ByRef) callconv(.Win64) ByRef; | 1318 | extern fn c_explict_win64(ByRef) callconv(.Win64) ByRef; |
| 1235 | test "explicit SysV calling convention" { | 1319 | test "explicit SysV calling convention" { |
| | 1320 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 1321 | |
| 1236 | if (builtin.cpu.arch != .x86_64) return error.SkipZigTest; | 1322 | if (builtin.cpu.arch != .x86_64) return error.SkipZigTest; |
| 1237 | | 1323 | |
| 1238 | const res = c_explict_win64(.{ .val = 1, .arr = undefined }); | 1324 | const res = c_explict_win64(.{ .val = 1, .arr = undefined }); |