| author | |
| committer | |
| log | 2e6e39a7004dae626ad3088cbf1e652f157e6db8 |
| tree | 5f166132424d3da5d6e372ce836f7dbdc2e75987 |
| parent | c880644d929ff8e403494ff7e6e347b4857db263 |
92 files changed, 1068 insertions(+), 98 deletions(-)
lib/compiler_rt/addf3_test.zig+5| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | // https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/test/builtins/Unit/subtf3_test.c |
| 5 | 5 | |
| 6 | 6 | const std = @import("std"); |
| 7 | const builtin = @import("builtin"); | |
| 7 | 8 | const math = std.math; |
| 8 | 9 | const qnan128: f128 = @bitCast(@as(u128, 0x7fff800000000000) << 64); |
| 9 | 10 | |
| ... | ... | @@ -34,6 +35,8 @@ fn test__addtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void { |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | 37 | test "addtf3" { |
| 38 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 39 | ||
| 37 | 40 | try test__addtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0); |
| 38 | 41 | |
| 39 | 42 | // NaN + any = NaN |
| ... | ... | @@ -103,6 +106,8 @@ fn test__addxf3(a: f80, b: f80, expected: u80) !void { |
| 103 | 106 | } |
| 104 | 107 | |
| 105 | 108 | test "addxf3" { |
| 109 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 110 | ||
| 106 | 111 | // NaN + any = NaN |
| 107 | 112 | try test__addxf3(qnan80, 0x1.23456789abcdefp+5, @as(u80, @bitCast(qnan80))); |
| 108 | 113 | try test__addxf3(@as(f80, @bitCast(@as(u80, 0x7fff_8000_8000_3000_0000))), 0x1.23456789abcdefp+5, @as(u80, @bitCast(qnan80))); |
lib/compiler_rt/addoti4_test.zig+2| ... | ... | @@ -23,6 +23,8 @@ fn simple_addoti4(a: i128, b: i128, overflow: *c_int) i128 { |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | test "addoti4" { |
| 26 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 27 | ||
| 26 | 28 | const min: i128 = math.minInt(i128); |
| 27 | 29 | const max: i128 = math.maxInt(i128); |
| 28 | 30 | var i: i128 = 1; |
lib/compiler_rt/comparef.zig+2| ... | ... | @@ -98,6 +98,8 @@ pub inline fn cmp_f80(comptime RT: type, a: f80, b: f80) RT { |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | test "cmp_f80" { |
| 101 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 102 | ||
| 101 | 103 | inline for (.{ LE, GE }) |RT| { |
| 102 | 104 | try std.testing.expect(cmp_f80(RT, 1.0, 1.0) == RT.Equal); |
| 103 | 105 | try std.testing.expect(cmp_f80(RT, 0.0, -0.0) == RT.Equal); |
lib/compiler_rt/cos.zig+2-2| ... | ... | @@ -1,6 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | const arch = builtin.cpu.arch; | |
| 4 | 2 | const math = std.math; |
| 5 | 3 | const expect = std.testing.expect; |
| 6 | 4 | const common = @import("common.zig"); |
| ... | ... | @@ -136,6 +134,8 @@ pub fn cosl(x: c_longdouble) callconv(.C) c_longdouble { |
| 136 | 134 | } |
| 137 | 135 | |
| 138 | 136 | test "cos32" { |
| 137 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 138 | ||
| 139 | 139 | const epsilon = 0.00001; |
| 140 | 140 | |
| 141 | 141 | try expect(math.approxEqAbs(f32, cosf(0.0), 1.0, epsilon)); |
lib/compiler_rt/divxf3_test.zig+2| ... | ... | @@ -39,6 +39,8 @@ fn test__divxf3(a: f80, b: f80) !void { |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | test "divxf3" { |
| 42 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 43 | ||
| 42 | 44 | // NaN / any = NaN |
| 43 | 45 | try expect__divxf3_result(math.nan(f80), 0x1.23456789abcdefp+5, 0x7fffC000000000000000); |
| 44 | 46 | // inf / any(except inf and nan) = inf |
lib/compiler_rt/int.zig+2| ... | ... | @@ -42,6 +42,8 @@ pub fn __divmodti4(a: i128, b: i128, rem: *i128) callconv(.C) i128 { |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | test "test_divmodti4" { |
| 45 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 46 | ||
| 45 | 47 | const cases = [_][4]i128{ |
| 46 | 48 | [_]i128{ 0, 1, 0, 0 }, |
| 47 | 49 | [_]i128{ 0, -1, 0, 0 }, |
lib/compiler_rt/int_from_float_test.zig+37| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const testing = std.testing; |
| 3 | 4 | const math = std.math; |
| 4 | 5 | |
| ... | ... | @@ -40,6 +41,8 @@ fn test__fixunssfsi(a: f32, expected: u32) !void { |
| 40 | 41 | } |
| 41 | 42 | |
| 42 | 43 | test "fixsfsi" { |
| 44 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 45 | ||
| 43 | 46 | try test__fixsfsi(-math.floatMax(f32), math.minInt(i32)); |
| 44 | 47 | |
| 45 | 48 | try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32)); |
| ... | ... | @@ -103,6 +106,8 @@ test "fixsfsi" { |
| 103 | 106 | } |
| 104 | 107 | |
| 105 | 108 | test "fixunssfsi" { |
| 109 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 110 | ||
| 106 | 111 | try test__fixunssfsi(0.0, 0); |
| 107 | 112 | |
| 108 | 113 | try test__fixunssfsi(0.5, 0); |
| ... | ... | @@ -142,6 +147,8 @@ fn test__fixunssfdi(a: f32, expected: u64) !void { |
| 142 | 147 | } |
| 143 | 148 | |
| 144 | 149 | test "fixsfdi" { |
| 150 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 151 | ||
| 145 | 152 | try test__fixsfdi(-math.floatMax(f32), math.minInt(i64)); |
| 146 | 153 | |
| 147 | 154 | try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64)); |
| ... | ... | @@ -197,6 +204,8 @@ test "fixsfdi" { |
| 197 | 204 | } |
| 198 | 205 | |
| 199 | 206 | test "fixunssfdi" { |
| 207 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 208 | ||
| 200 | 209 | try test__fixunssfdi(0.0, 0); |
| 201 | 210 | |
| 202 | 211 | try test__fixunssfdi(0.5, 0); |
| ... | ... | @@ -235,6 +244,8 @@ fn test__fixunssfti(a: f32, expected: u128) !void { |
| 235 | 244 | } |
| 236 | 245 | |
| 237 | 246 | test "fixsfti" { |
| 247 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 248 | ||
| 238 | 249 | try test__fixsfti(-math.floatMax(f32), math.minInt(i128)); |
| 239 | 250 | |
| 240 | 251 | try test__fixsfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128)); |
| ... | ... | @@ -306,6 +317,8 @@ test "fixsfti" { |
| 306 | 317 | } |
| 307 | 318 | |
| 308 | 319 | test "fixunssfti" { |
| 320 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 321 | ||
| 309 | 322 | try test__fixunssfti(0.0, 0); |
| 310 | 323 | |
| 311 | 324 | try test__fixunssfti(0.5, 0); |
| ... | ... | @@ -352,6 +365,8 @@ fn test__fixunsdfsi(a: f64, expected: u32) !void { |
| 352 | 365 | } |
| 353 | 366 | |
| 354 | 367 | test "fixdfsi" { |
| 368 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 369 | ||
| 355 | 370 | try test__fixdfsi(-math.floatMax(f64), math.minInt(i32)); |
| 356 | 371 | |
| 357 | 372 | try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32)); |
| ... | ... | @@ -413,6 +428,8 @@ test "fixdfsi" { |
| 413 | 428 | } |
| 414 | 429 | |
| 415 | 430 | test "fixunsdfsi" { |
| 431 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 432 | ||
| 416 | 433 | try test__fixunsdfsi(0.0, 0); |
| 417 | 434 | |
| 418 | 435 | try test__fixunsdfsi(0.5, 0); |
| ... | ... | @@ -455,6 +472,8 @@ fn test__fixunsdfdi(a: f64, expected: u64) !void { |
| 455 | 472 | } |
| 456 | 473 | |
| 457 | 474 | test "fixdfdi" { |
| 475 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 476 | ||
| 458 | 477 | try test__fixdfdi(-math.floatMax(f64), math.minInt(i64)); |
| 459 | 478 | |
| 460 | 479 | try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64)); |
| ... | ... | @@ -508,6 +527,8 @@ test "fixdfdi" { |
| 508 | 527 | } |
| 509 | 528 | |
| 510 | 529 | test "fixunsdfdi" { |
| 530 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 531 | ||
| 511 | 532 | try test__fixunsdfdi(0.0, 0); |
| 512 | 533 | try test__fixunsdfdi(0.5, 0); |
| 513 | 534 | try test__fixunsdfdi(0.99, 0); |
| ... | ... | @@ -550,6 +571,8 @@ fn test__fixunsdfti(a: f64, expected: u128) !void { |
| 550 | 571 | } |
| 551 | 572 | |
| 552 | 573 | test "fixdfti" { |
| 574 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 575 | ||
| 553 | 576 | try test__fixdfti(-math.floatMax(f64), math.minInt(i128)); |
| 554 | 577 | |
| 555 | 578 | try test__fixdfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128)); |
| ... | ... | @@ -603,6 +626,8 @@ test "fixdfti" { |
| 603 | 626 | } |
| 604 | 627 | |
| 605 | 628 | test "fixunsdfti" { |
| 629 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 630 | ||
| 606 | 631 | try test__fixunsdfti(0.0, 0); |
| 607 | 632 | |
| 608 | 633 | try test__fixunsdfti(0.5, 0); |
| ... | ... | @@ -652,6 +677,8 @@ fn test__fixunstfsi(a: f128, expected: u32) !void { |
| 652 | 677 | } |
| 653 | 678 | |
| 654 | 679 | test "fixtfsi" { |
| 680 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 681 | ||
| 655 | 682 | try test__fixtfsi(-math.floatMax(f128), math.minInt(i32)); |
| 656 | 683 | |
| 657 | 684 | try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32)); |
| ... | ... | @@ -715,6 +742,8 @@ test "fixtfsi" { |
| 715 | 742 | } |
| 716 | 743 | |
| 717 | 744 | test "fixunstfsi" { |
| 745 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 746 | ||
| 718 | 747 | try test__fixunstfsi(math.inf(f128), 0xffffffff); |
| 719 | 748 | try test__fixunstfsi(0, 0x0); |
| 720 | 749 | try test__fixunstfsi(0x1.23456789abcdefp+5, 0x24); |
| ... | ... | @@ -738,6 +767,8 @@ fn test__fixunstfdi(a: f128, expected: u64) !void { |
| 738 | 767 | } |
| 739 | 768 | |
| 740 | 769 | test "fixtfdi" { |
| 770 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 771 | ||
| 741 | 772 | try test__fixtfdi(-math.floatMax(f128), math.minInt(i64)); |
| 742 | 773 | |
| 743 | 774 | try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64)); |
| ... | ... | @@ -801,6 +832,8 @@ test "fixtfdi" { |
| 801 | 832 | } |
| 802 | 833 | |
| 803 | 834 | test "fixunstfdi" { |
| 835 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 836 | ||
| 804 | 837 | try test__fixunstfdi(0.0, 0); |
| 805 | 838 | |
| 806 | 839 | try test__fixunstfdi(0.5, 0); |
| ... | ... | @@ -853,6 +886,8 @@ fn test__fixunstfti(a: f128, expected: u128) !void { |
| 853 | 886 | } |
| 854 | 887 | |
| 855 | 888 | test "fixtfti" { |
| 889 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 890 | ||
| 856 | 891 | try test__fixtfti(-math.floatMax(f128), math.minInt(i128)); |
| 857 | 892 | |
| 858 | 893 | try test__fixtfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128)); |
| ... | ... | @@ -934,6 +969,8 @@ fn test__fixunshfti(a: f16, expected: u128) !void { |
| 934 | 969 | } |
| 935 | 970 | |
| 936 | 971 | test "fixunshfti for f16" { |
| 972 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 973 | ||
| 937 | 974 | try test__fixunshfti(math.inf(f16), math.maxInt(u128)); |
| 938 | 975 | try test__fixunshfti(math.floatMax(f16), 65504); |
| 939 | 976 | } |
lib/compiler_rt/negti2_test.zig+3-1| ... | ... | @@ -6,7 +6,9 @@ fn test__negti2(a: i128, expected: i128) !void { |
| 6 | 6 | try testing.expectEqual(expected, result); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | test "negdi2" { | |
| 9 | test "negti2" { | |
| 10 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 11 | ||
| 10 | 12 | // TODO ensuring that math.minInt(i128); returns error |
| 11 | 13 | |
| 12 | 14 | try test__negti2(-3, 3); |
lib/compiler_rt/powiXf2_test.zig+8-2| ... | ... | @@ -3,8 +3,10 @@ |
| 3 | 3 | // powihf2 adapted from powisf2 tests |
| 4 | 4 | |
| 5 | 5 | const powiXf2 = @import("powiXf2.zig"); |
| 6 | const testing = @import("std").testing; | |
| 7 | const math = @import("std").math; | |
| 6 | const std = @import("std"); | |
| 7 | const builtin = @import("builtin"); | |
| 8 | const testing = std.testing; | |
| 9 | const math = std.math; | |
| 8 | 10 | |
| 9 | 11 | fn test__powihf2(a: f16, b: i32, expected: f16) !void { |
| 10 | 12 | var result = powiXf2.__powihf2(a, b); |
| ... | ... | @@ -351,6 +353,8 @@ test "powidf2" { |
| 351 | 353 | } |
| 352 | 354 | |
| 353 | 355 | test "powitf2" { |
| 356 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 357 | ||
| 354 | 358 | const inf_f128 = math.inf(f128); |
| 355 | 359 | try test__powitf2(0, 0, 1); |
| 356 | 360 | try test__powitf2(1, 0, 1); |
| ... | ... | @@ -456,6 +460,8 @@ test "powitf2" { |
| 456 | 460 | } |
| 457 | 461 | |
| 458 | 462 | test "powixf2" { |
| 463 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 464 | ||
| 459 | 465 | const inf_f80 = math.inf(f80); |
| 460 | 466 | try test__powixf2(0, 0, 1); |
| 461 | 467 | try test__powixf2(1, 0, 1); |
lib/compiler_rt/sin.zig+2| ... | ... | @@ -140,6 +140,8 @@ pub fn sinl(x: c_longdouble) callconv(.C) c_longdouble { |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | test "sin32" { |
| 143 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 144 | ||
| 143 | 145 | const epsilon = 0.00001; |
| 144 | 146 | |
| 145 | 147 | try expect(math.approxEqAbs(f32, sinf(0.0), 0.0, epsilon)); |
lib/compiler_rt/suboti4_test.zig+2| ... | ... | @@ -27,6 +27,8 @@ pub fn simple_suboti4(a: i128, b: i128, overflow: *c_int) i128 { |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | test "suboti3" { |
| 30 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 31 | ||
| 30 | 32 | const min: i128 = math.minInt(i128); |
| 31 | 33 | const max: i128 = math.maxInt(i128); |
| 32 | 34 | var i: i128 = 1; |
lib/compiler_rt/tan.zig+4| ... | ... | @@ -131,6 +131,8 @@ test "tan" { |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | test "tan32" { |
| 134 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 135 | ||
| 134 | 136 | const epsilon = 0.00001; |
| 135 | 137 | |
| 136 | 138 | try expect(math.approxEqAbs(f32, tanf(0.0), 0.0, epsilon)); |
| ... | ... | @@ -142,6 +144,8 @@ test "tan32" { |
| 142 | 144 | } |
| 143 | 145 | |
| 144 | 146 | test "tan64" { |
| 147 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 148 | ||
| 145 | 149 | const epsilon = 0.000001; |
| 146 | 150 | |
| 147 | 151 | try expect(math.approxEqAbs(f64, tan(0.0), 0.0, epsilon)); |
lib/compiler_rt/udivmodei4.zig+4-1| ... | ... | @@ -129,7 +129,10 @@ pub fn __umodei4(r_p: [*]u32, u_p: [*]const u32, v_p: [*]const u32, bits: usize) |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | test "__udivei4/__umodei4" { |
| 132 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | |
| 132 | switch (builtin.zig_backend) { | |
| 133 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 134 | else => {}, | |
| 135 | } | |
| 133 | 136 | |
| 134 | 137 | const RndGen = std.rand.DefaultPrng; |
| 135 | 138 | var rnd = RndGen.init(42); |
lib/std/Build/Cache.zig+10| ... | ... | @@ -1007,6 +1007,8 @@ test "cache file and then recall it" { |
| 1007 | 1007 | return error.SkipZigTest; |
| 1008 | 1008 | } |
| 1009 | 1009 | |
| 1010 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1011 | ||
| 1010 | 1012 | var tmp = testing.tmpDir(.{}); |
| 1011 | 1013 | defer tmp.cleanup(); |
| 1012 | 1014 | |
| ... | ... | @@ -1072,6 +1074,9 @@ test "check that changing a file makes cache fail" { |
| 1072 | 1074 | // https://github.com/ziglang/zig/issues/5437 |
| 1073 | 1075 | return error.SkipZigTest; |
| 1074 | 1076 | } |
| 1077 | ||
| 1078 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1079 | ||
| 1075 | 1080 | var tmp = testing.tmpDir(.{}); |
| 1076 | 1081 | defer tmp.cleanup(); |
| 1077 | 1082 | |
| ... | ... | @@ -1146,6 +1151,8 @@ test "no file inputs" { |
| 1146 | 1151 | return error.SkipZigTest; |
| 1147 | 1152 | } |
| 1148 | 1153 | |
| 1154 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1155 | ||
| 1149 | 1156 | var tmp = testing.tmpDir(.{}); |
| 1150 | 1157 | defer tmp.cleanup(); |
| 1151 | 1158 | |
| ... | ... | @@ -1193,6 +1200,9 @@ test "Manifest with files added after initial hash work" { |
| 1193 | 1200 | // https://github.com/ziglang/zig/issues/5437 |
| 1194 | 1201 | return error.SkipZigTest; |
| 1195 | 1202 | } |
| 1203 | ||
| 1204 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1205 | ||
| 1196 | 1206 | var tmp = testing.tmpDir(.{}); |
| 1197 | 1207 | defer tmp.cleanup(); |
| 1198 | 1208 |
lib/std/Build/Step/Options.zig+2| ... | ... | @@ -296,6 +296,8 @@ const Arg = struct { |
| 296 | 296 | test Options { |
| 297 | 297 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 298 | 298 | |
| 299 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 300 | ||
| 299 | 301 | var arena = std.heap.ArenaAllocator.init(std.testing.allocator); |
| 300 | 302 | defer arena.deinit(); |
| 301 | 303 |
lib/std/atomic/Atomic.zig+2| ... | ... | @@ -374,6 +374,8 @@ const atomic_rmw_orderings = [_]Ordering{ |
| 374 | 374 | }; |
| 375 | 375 | |
| 376 | 376 | test "Atomic.swap" { |
| 377 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 378 | ||
| 377 | 379 | inline for (atomic_rmw_orderings) |ordering| { |
| 378 | 380 | var x = Atomic(usize).init(5); |
| 379 | 381 | try testing.expectEqual(x.swap(10, ordering), 5); |
lib/std/base64.zig+7| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | const std = @import("std.zig"); |
| 2 | 2 | const assert = std.debug.assert; |
| 3 | const builtin = @import("builtin"); | |
| 3 | 4 | const testing = std.testing; |
| 4 | 5 | const mem = std.mem; |
| 5 | 6 | |
| ... | ... | @@ -354,12 +355,16 @@ pub const Base64DecoderWithIgnore = struct { |
| 354 | 355 | }; |
| 355 | 356 | |
| 356 | 357 | test "base64" { |
| 358 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 359 | ||
| 357 | 360 | @setEvalBranchQuota(8000); |
| 358 | 361 | try testBase64(); |
| 359 | 362 | try comptime testAllApis(standard, "comptime", "Y29tcHRpbWU="); |
| 360 | 363 | } |
| 361 | 364 | |
| 362 | 365 | test "base64 padding dest overflow" { |
| 366 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 367 | ||
| 363 | 368 | const input = "foo"; |
| 364 | 369 | |
| 365 | 370 | var expect: [128]u8 = undefined; |
| ... | ... | @@ -374,6 +379,8 @@ test "base64 padding dest overflow" { |
| 374 | 379 | } |
| 375 | 380 | |
| 376 | 381 | test "base64 url_safe_no_pad" { |
| 382 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 383 | ||
| 377 | 384 | @setEvalBranchQuota(8000); |
| 378 | 385 | try testBase64UrlSafeNoPad(); |
| 379 | 386 | try comptime testAllApis(url_safe_no_pad, "comptime", "Y29tcHRpbWU"); |
lib/std/bit_set.zig+9-1| ... | ... | @@ -1636,7 +1636,10 @@ fn testStaticBitSet(comptime Set: type) !void { |
| 1636 | 1636 | } |
| 1637 | 1637 | |
| 1638 | 1638 | test "IntegerBitSet" { |
| 1639 | if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1639 | switch (@import("builtin").zig_backend) { | |
| 1640 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1641 | else => {}, | |
| 1642 | } | |
| 1640 | 1643 | |
| 1641 | 1644 | try testStaticBitSet(IntegerBitSet(0)); |
| 1642 | 1645 | try testStaticBitSet(IntegerBitSet(1)); |
| ... | ... | @@ -1649,6 +1652,11 @@ test "IntegerBitSet" { |
| 1649 | 1652 | } |
| 1650 | 1653 | |
| 1651 | 1654 | test "ArrayBitSet" { |
| 1655 | switch (@import("builtin").zig_backend) { | |
| 1656 | .stage2_x86_64 => return error.SkipZigTest, | |
| 1657 | else => {}, | |
| 1658 | } | |
| 1659 | ||
| 1652 | 1660 | inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| { |
| 1653 | 1661 | try testStaticBitSet(ArrayBitSet(u8, size)); |
| 1654 | 1662 | try testStaticBitSet(ArrayBitSet(u16, size)); |
lib/std/compress/lzma/test.zig+17| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("../../std.zig"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const lzma = @import("../lzma.zig"); |
| 3 | 4 | |
| 4 | 5 | fn testDecompress(compressed: []const u8) ![]u8 { |
| ... | ... | @@ -22,6 +23,8 @@ fn testDecompressError(expected: anyerror, compressed: []const u8) !void { |
| 22 | 23 | } |
| 23 | 24 | |
| 24 | 25 | test "LZMA: decompress empty world" { |
| 26 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 27 | ||
| 25 | 28 | try testDecompressEqual( |
| 26 | 29 | "", |
| 27 | 30 | &[_]u8{ |
| ... | ... | @@ -32,6 +35,8 @@ test "LZMA: decompress empty world" { |
| 32 | 35 | } |
| 33 | 36 | |
| 34 | 37 | test "LZMA: decompress hello world" { |
| 38 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 39 | ||
| 35 | 40 | try testDecompressEqual( |
| 36 | 41 | "Hello world\n", |
| 37 | 42 | &[_]u8{ |
| ... | ... | @@ -43,6 +48,8 @@ test "LZMA: decompress hello world" { |
| 43 | 48 | } |
| 44 | 49 | |
| 45 | 50 | test "LZMA: decompress huge dict" { |
| 51 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 52 | ||
| 46 | 53 | try testDecompressEqual( |
| 47 | 54 | "Hello world\n", |
| 48 | 55 | &[_]u8{ |
| ... | ... | @@ -54,6 +61,8 @@ test "LZMA: decompress huge dict" { |
| 54 | 61 | } |
| 55 | 62 | |
| 56 | 63 | test "LZMA: unknown size with end of payload marker" { |
| 64 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 65 | ||
| 57 | 66 | try testDecompressEqual( |
| 58 | 67 | "Hello\nWorld!\n", |
| 59 | 68 | @embedFile("testdata/good-unknown_size-with_eopm.lzma"), |
| ... | ... | @@ -61,6 +70,8 @@ test "LZMA: unknown size with end of payload marker" { |
| 61 | 70 | } |
| 62 | 71 | |
| 63 | 72 | test "LZMA: known size without end of payload marker" { |
| 73 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 74 | ||
| 64 | 75 | try testDecompressEqual( |
| 65 | 76 | "Hello\nWorld!\n", |
| 66 | 77 | @embedFile("testdata/good-known_size-without_eopm.lzma"), |
| ... | ... | @@ -68,6 +79,8 @@ test "LZMA: known size without end of payload marker" { |
| 68 | 79 | } |
| 69 | 80 | |
| 70 | 81 | test "LZMA: known size with end of payload marker" { |
| 82 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 83 | ||
| 71 | 84 | try testDecompressEqual( |
| 72 | 85 | "Hello\nWorld!\n", |
| 73 | 86 | @embedFile("testdata/good-known_size-with_eopm.lzma"), |
| ... | ... | @@ -75,6 +88,8 @@ test "LZMA: known size with end of payload marker" { |
| 75 | 88 | } |
| 76 | 89 | |
| 77 | 90 | test "LZMA: too big uncompressed size in header" { |
| 91 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 92 | ||
| 78 | 93 | try testDecompressError( |
| 79 | 94 | error.CorruptInput, |
| 80 | 95 | @embedFile("testdata/bad-too_big_size-with_eopm.lzma"), |
| ... | ... | @@ -82,6 +97,8 @@ test "LZMA: too big uncompressed size in header" { |
| 82 | 97 | } |
| 83 | 98 | |
| 84 | 99 | test "LZMA: too small uncompressed size in header" { |
| 100 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 101 | ||
| 85 | 102 | try testDecompressError( |
| 86 | 103 | error.CorruptInput, |
| 87 | 104 | @embedFile("testdata/bad-too_small_size-without_eopm-3.lzma"), |
lib/std/crypto.zig+2| ... | ... | @@ -314,6 +314,8 @@ test "CSPRNG" { |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | test "issue #4532: no index out of bounds" { |
| 317 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 318 | ||
| 317 | 319 | const types = [_]type{ |
| 318 | 320 | hash.Md5, |
| 319 | 321 | hash.Sha1, |
lib/std/crypto/25519/curve25519.zig+5| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const crypto = std.crypto; |
| 3 | 4 | |
| 4 | 5 | const IdentityElementError = crypto.errors.IdentityElementError; |
| ... | ... | @@ -111,6 +112,8 @@ pub const Curve25519 = struct { |
| 111 | 112 | }; |
| 112 | 113 | |
| 113 | 114 | test "curve25519" { |
| 115 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 116 | ||
| 114 | 117 | var s = [32]u8{ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8 }; |
| 115 | 118 | const p = try Curve25519.basePoint.clampedMul(s); |
| 116 | 119 | try p.rejectIdentity(); |
| ... | ... | @@ -125,6 +128,8 @@ test "curve25519" { |
| 125 | 128 | } |
| 126 | 129 | |
| 127 | 130 | test "curve25519 small order check" { |
| 131 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 132 | ||
| 128 | 133 | var s: [32]u8 = [_]u8{1} ++ [_]u8{0} ** 31; |
| 129 | 134 | const small_order_ss: [7][32]u8 = .{ |
| 130 | 135 | .{ |
lib/std/crypto/25519/ed25519.zig+15-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 3 | 3 | const crypto = std.crypto; |
| 4 | 4 | const debug = std.debug; |
| 5 | 5 | const fmt = std.fmt; |
| ... | ... | @@ -484,6 +484,8 @@ pub const Ed25519 = struct { |
| 484 | 484 | }; |
| 485 | 485 | |
| 486 | 486 | test "ed25519 key pair creation" { |
| 487 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 488 | ||
| 487 | 489 | var seed: [32]u8 = undefined; |
| 488 | 490 | _ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166"); |
| 489 | 491 | const key_pair = try Ed25519.KeyPair.create(seed); |
| ... | ... | @@ -493,6 +495,8 @@ test "ed25519 key pair creation" { |
| 493 | 495 | } |
| 494 | 496 | |
| 495 | 497 | test "ed25519 signature" { |
| 498 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 499 | ||
| 496 | 500 | var seed: [32]u8 = undefined; |
| 497 | 501 | _ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166"); |
| 498 | 502 | const key_pair = try Ed25519.KeyPair.create(seed); |
| ... | ... | @@ -505,6 +509,8 @@ test "ed25519 signature" { |
| 505 | 509 | } |
| 506 | 510 | |
| 507 | 511 | test "ed25519 batch verification" { |
| 512 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 513 | ||
| 508 | 514 | var i: usize = 0; |
| 509 | 515 | while (i < 100) : (i += 1) { |
| 510 | 516 | const key_pair = try Ed25519.KeyPair.create(null); |
| ... | ... | @@ -534,6 +540,8 @@ test "ed25519 batch verification" { |
| 534 | 540 | } |
| 535 | 541 | |
| 536 | 542 | test "ed25519 test vectors" { |
| 543 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 544 | ||
| 537 | 545 | const Vec = struct { |
| 538 | 546 | msg_hex: *const [64:0]u8, |
| 539 | 547 | public_key_hex: *const [64:0]u8, |
| ... | ... | @@ -636,6 +644,8 @@ test "ed25519 test vectors" { |
| 636 | 644 | } |
| 637 | 645 | |
| 638 | 646 | test "ed25519 with blind keys" { |
| 647 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 648 | ||
| 639 | 649 | const BlindKeyPair = Ed25519.key_blinding.BlindKeyPair; |
| 640 | 650 | |
| 641 | 651 | // Create a standard Ed25519 key pair |
| ... | ... | @@ -659,6 +669,8 @@ test "ed25519 with blind keys" { |
| 659 | 669 | } |
| 660 | 670 | |
| 661 | 671 | test "ed25519 signatures with streaming" { |
| 672 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 673 | ||
| 662 | 674 | const kp = try Ed25519.KeyPair.create(null); |
| 663 | 675 | |
| 664 | 676 | var signer = try kp.signer(null); |
| ... | ... | @@ -675,6 +687,8 @@ test "ed25519 signatures with streaming" { |
| 675 | 687 | } |
| 676 | 688 | |
| 677 | 689 | test "ed25519 key pair from secret key" { |
| 690 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 691 | ||
| 678 | 692 | const kp = try Ed25519.KeyPair.create(null); |
| 679 | 693 | const kp2 = try Ed25519.KeyPair.fromSecretKey(kp.secret_key); |
| 680 | 694 | try std.testing.expectEqualSlices(u8, &kp.secret_key.toBytes(), &kp2.secret_key.toBytes()); |
lib/std/crypto/25519/edwards25519.zig+11| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const crypto = std.crypto; |
| 3 | 4 | const debug = std.debug; |
| 4 | 5 | const fmt = std.fmt; |
| ... | ... | @@ -494,6 +495,8 @@ pub const Edwards25519 = struct { |
| 494 | 495 | const htest = @import("../test.zig"); |
| 495 | 496 | |
| 496 | 497 | test "edwards25519 packing/unpacking" { |
| 498 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 499 | ||
| 497 | 500 | const s = [_]u8{170} ++ [_]u8{0} ** 31; |
| 498 | 501 | var b = Edwards25519.basePoint; |
| 499 | 502 | const pk = try b.mul(s); |
| ... | ... | @@ -530,6 +533,8 @@ test "edwards25519 packing/unpacking" { |
| 530 | 533 | } |
| 531 | 534 | |
| 532 | 535 | test "edwards25519 point addition/subtraction" { |
| 536 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 537 | ||
| 533 | 538 | var s1: [32]u8 = undefined; |
| 534 | 539 | var s2: [32]u8 = undefined; |
| 535 | 540 | crypto.random.bytes(&s1); |
| ... | ... | @@ -544,6 +549,8 @@ test "edwards25519 point addition/subtraction" { |
| 544 | 549 | } |
| 545 | 550 | |
| 546 | 551 | test "edwards25519 uniform-to-point" { |
| 552 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 553 | ||
| 547 | 554 | var r = [32]u8{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; |
| 548 | 555 | var p = Edwards25519.fromUniform(r); |
| 549 | 556 | try htest.assertEqual("0691eee3cf70a0056df6bfa03120635636581b5c4ea571dfc680f78c7e0b4137", p.toBytes()[0..]); |
| ... | ... | @@ -555,6 +562,8 @@ test "edwards25519 uniform-to-point" { |
| 555 | 562 | |
| 556 | 563 | // Test vectors from draft-irtf-cfrg-hash-to-curve-12 |
| 557 | 564 | test "edwards25519 hash-to-curve operation" { |
| 565 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 566 | ||
| 558 | 567 | var p = Edwards25519.fromString(true, "QUUX-V01-CS02-with-edwards25519_XMD:SHA-512_ELL2_RO_", "abc"); |
| 559 | 568 | try htest.assertEqual("31558a26887f23fb8218f143e69d5f0af2e7831130bd5b432ef23883b895839a", p.toBytes()[0..]); |
| 560 | 569 | |
| ... | ... | @@ -563,6 +572,8 @@ test "edwards25519 hash-to-curve operation" { |
| 563 | 572 | } |
| 564 | 573 | |
| 565 | 574 | test "edwards25519 implicit reduction of invalid scalars" { |
| 575 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 576 | ||
| 566 | 577 | const s = [_]u8{0} ** 31 ++ [_]u8{255}; |
| 567 | 578 | const p1 = try Edwards25519.basePoint.mulPublic(s); |
| 568 | 579 | const p2 = try Edwards25519.basePoint.mul(s); |
lib/std/crypto/25519/ristretto255.zig+2| ... | ... | @@ -168,6 +168,8 @@ pub const Ristretto255 = struct { |
| 168 | 168 | }; |
| 169 | 169 | |
| 170 | 170 | test "ristretto255" { |
| 171 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 172 | ||
| 171 | 173 | const p = Ristretto255.basePoint; |
| 172 | 174 | var buf: [256]u8 = undefined; |
| 173 | 175 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{s}", .{std.fmt.fmtSliceHexUpper(&p.toBytes())}), "E2F2AE0A6ABC4E71A884A961C500515F58E30B6AA582DD8DB6A65945E08D2D76"); |
lib/std/crypto/25519/x25519.zig+15| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const crypto = std.crypto; |
| 3 | 4 | const mem = std.mem; |
| 4 | 5 | const fmt = std.fmt; |
| ... | ... | @@ -82,6 +83,8 @@ pub const X25519 = struct { |
| 82 | 83 | const htest = @import("../test.zig"); |
| 83 | 84 | |
| 84 | 85 | test "x25519 public key calculation from secret key" { |
| 86 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 87 | ||
| 85 | 88 | var sk: [32]u8 = undefined; |
| 86 | 89 | var pk_expected: [32]u8 = undefined; |
| 87 | 90 | _ = try fmt.hexToBytes(sk[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166"); |
| ... | ... | @@ -91,6 +94,8 @@ test "x25519 public key calculation from secret key" { |
| 91 | 94 | } |
| 92 | 95 | |
| 93 | 96 | test "x25519 rfc7748 vector1" { |
| 97 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 98 | ||
| 94 | 99 | const secret_key = [32]u8{ 0xa5, 0x46, 0xe3, 0x6b, 0xf0, 0x52, 0x7c, 0x9d, 0x3b, 0x16, 0x15, 0x4b, 0x82, 0x46, 0x5e, 0xdd, 0x62, 0x14, 0x4c, 0x0a, 0xc1, 0xfc, 0x5a, 0x18, 0x50, 0x6a, 0x22, 0x44, 0xba, 0x44, 0x9a, 0xc4 }; |
| 95 | 100 | const public_key = [32]u8{ 0xe6, 0xdb, 0x68, 0x67, 0x58, 0x30, 0x30, 0xdb, 0x35, 0x94, 0xc1, 0xa4, 0x24, 0xb1, 0x5f, 0x7c, 0x72, 0x66, 0x24, 0xec, 0x26, 0xb3, 0x35, 0x3b, 0x10, 0xa9, 0x03, 0xa6, 0xd0, 0xab, 0x1c, 0x4c }; |
| 96 | 101 | |
| ... | ... | @@ -101,6 +106,8 @@ test "x25519 rfc7748 vector1" { |
| 101 | 106 | } |
| 102 | 107 | |
| 103 | 108 | test "x25519 rfc7748 vector2" { |
| 109 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 110 | ||
| 104 | 111 | const secret_key = [32]u8{ 0x4b, 0x66, 0xe9, 0xd4, 0xd1, 0xb4, 0x67, 0x3c, 0x5a, 0xd2, 0x26, 0x91, 0x95, 0x7d, 0x6a, 0xf5, 0xc1, 0x1b, 0x64, 0x21, 0xe0, 0xea, 0x01, 0xd4, 0x2c, 0xa4, 0x16, 0x9e, 0x79, 0x18, 0xba, 0x0d }; |
| 105 | 112 | const public_key = [32]u8{ 0xe5, 0x21, 0x0f, 0x12, 0x78, 0x68, 0x11, 0xd3, 0xf4, 0xb7, 0x95, 0x9d, 0x05, 0x38, 0xae, 0x2c, 0x31, 0xdb, 0xe7, 0x10, 0x6f, 0xc0, 0x3c, 0x3e, 0xfc, 0x4c, 0xd5, 0x49, 0xc7, 0x15, 0xa4, 0x93 }; |
| 106 | 113 | |
| ... | ... | @@ -111,6 +118,8 @@ test "x25519 rfc7748 vector2" { |
| 111 | 118 | } |
| 112 | 119 | |
| 113 | 120 | test "x25519 rfc7748 one iteration" { |
| 121 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 122 | ||
| 114 | 123 | const initial_value = [32]u8{ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
| 115 | 124 | const expected_output = [32]u8{ 0x42, 0x2c, 0x8e, 0x7a, 0x62, 0x27, 0xd7, 0xbc, 0xa1, 0x35, 0x0b, 0x3e, 0x2b, 0xb7, 0x27, 0x9f, 0x78, 0x97, 0xb8, 0x7b, 0xb6, 0x85, 0x4b, 0x78, 0x3c, 0x60, 0xe8, 0x03, 0x11, 0xae, 0x30, 0x79 }; |
| 116 | 125 | |
| ... | ... | @@ -128,6 +137,8 @@ test "x25519 rfc7748 one iteration" { |
| 128 | 137 | } |
| 129 | 138 | |
| 130 | 139 | test "x25519 rfc7748 1,000 iterations" { |
| 140 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 141 | ||
| 131 | 142 | // These iteration tests are slow so we always skip them. Results have been verified. |
| 132 | 143 | if (true) { |
| 133 | 144 | return error.SkipZigTest; |
| ... | ... | @@ -150,6 +161,8 @@ test "x25519 rfc7748 1,000 iterations" { |
| 150 | 161 | } |
| 151 | 162 | |
| 152 | 163 | test "x25519 rfc7748 1,000,000 iterations" { |
| 164 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 165 | ||
| 153 | 166 | if (true) { |
| 154 | 167 | return error.SkipZigTest; |
| 155 | 168 | } |
| ... | ... | @@ -171,6 +184,8 @@ test "x25519 rfc7748 1,000,000 iterations" { |
| 171 | 184 | } |
| 172 | 185 | |
| 173 | 186 | test "edwards25519 -> curve25519 map" { |
| 187 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 188 | ||
| 174 | 189 | const ed_kp = try crypto.sign.Ed25519.KeyPair.create([_]u8{0x42} ** 32); |
| 175 | 190 | const mont_kp = try X25519.KeyPair.fromEd25519(ed_kp); |
| 176 | 191 | try htest.assertEqual("90e7595fc89e52fdfddce9c6a43d74dbf6047025ee0462d2d172e8b6a2841d6e", &mont_kp.secret_key); |
lib/std/crypto/Certificate.zig+6| ... | ... | @@ -624,6 +624,8 @@ pub fn parseTimeDigits(text: *const [2]u8, min: u8, max: u8) !u8 { |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | test parseTimeDigits { |
| 627 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 628 | ||
| 627 | 629 | const expectEqual = std.testing.expectEqual; |
| 628 | 630 | try expectEqual(@as(u8, 0), try parseTimeDigits("00", 0, 99)); |
| 629 | 631 | try expectEqual(@as(u8, 99), try parseTimeDigits("99", 0, 99)); |
| ... | ... | @@ -645,6 +647,8 @@ pub fn parseYear4(text: *const [4]u8) !u16 { |
| 645 | 647 | } |
| 646 | 648 | |
| 647 | 649 | test parseYear4 { |
| 650 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 651 | ||
| 648 | 652 | const expectEqual = std.testing.expectEqual; |
| 649 | 653 | try expectEqual(@as(u16, 0), try parseYear4("0000")); |
| 650 | 654 | try expectEqual(@as(u16, 9999), try parseYear4("9999")); |
| ... | ... | @@ -1119,3 +1123,5 @@ pub const rsa = struct { |
| 1119 | 1123 | return res; |
| 1120 | 1124 | } |
| 1121 | 1125 | }; |
| 1126 | ||
| 1127 | const builtin = @import("builtin"); |
lib/std/crypto/Certificate/Bundle.zig+2| ... | ... | @@ -318,6 +318,8 @@ const MapContext = struct { |
| 318 | 318 | test "scan for OS-provided certificates" { |
| 319 | 319 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 320 | 320 | |
| 321 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 322 | ||
| 321 | 323 | var bundle: Bundle = .{}; |
| 322 | 324 | defer bundle.deinit(std.testing.allocator); |
| 323 | 325 |
lib/std/crypto/aegis.zig+15| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | //! https://datatracker.ietf.org/doc/draft-irtf-cfrg-aegis-aead/ |
| 18 | 18 | |
| 19 | 19 | const std = @import("std"); |
| 20 | const builtin = @import("builtin"); | |
| 20 | 21 | const crypto = std.crypto; |
| 21 | 22 | const mem = std.mem; |
| 22 | 23 | const assert = std.debug.assert; |
| ... | ... | @@ -513,6 +514,8 @@ const htest = @import("test.zig"); |
| 513 | 514 | const testing = std.testing; |
| 514 | 515 | |
| 515 | 516 | test "Aegis128L test vector 1" { |
| 517 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 518 | ||
| 516 | 519 | const key: [Aegis128L.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 14; |
| 517 | 520 | const nonce: [Aegis128L.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 13; |
| 518 | 521 | const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }; |
| ... | ... | @@ -536,6 +539,8 @@ test "Aegis128L test vector 1" { |
| 536 | 539 | } |
| 537 | 540 | |
| 538 | 541 | test "Aegis128L test vector 2" { |
| 542 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 543 | ||
| 539 | 544 | const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16; |
| 540 | 545 | const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16; |
| 541 | 546 | const ad = [_]u8{}; |
| ... | ... | @@ -553,6 +558,8 @@ test "Aegis128L test vector 2" { |
| 553 | 558 | } |
| 554 | 559 | |
| 555 | 560 | test "Aegis128L test vector 3" { |
| 561 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 562 | ||
| 556 | 563 | const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16; |
| 557 | 564 | const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16; |
| 558 | 565 | const ad = [_]u8{}; |
| ... | ... | @@ -569,6 +576,8 @@ test "Aegis128L test vector 3" { |
| 569 | 576 | } |
| 570 | 577 | |
| 571 | 578 | test "Aegis256 test vector 1" { |
| 579 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 580 | ||
| 572 | 581 | const key: [Aegis256.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 30; |
| 573 | 582 | const nonce: [Aegis256.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 29; |
| 574 | 583 | const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }; |
| ... | ... | @@ -592,6 +601,8 @@ test "Aegis256 test vector 1" { |
| 592 | 601 | } |
| 593 | 602 | |
| 594 | 603 | test "Aegis256 test vector 2" { |
| 604 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 605 | ||
| 595 | 606 | const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32; |
| 596 | 607 | const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32; |
| 597 | 608 | const ad = [_]u8{}; |
| ... | ... | @@ -609,6 +620,8 @@ test "Aegis256 test vector 2" { |
| 609 | 620 | } |
| 610 | 621 | |
| 611 | 622 | test "Aegis256 test vector 3" { |
| 623 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 624 | ||
| 612 | 625 | const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32; |
| 613 | 626 | const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32; |
| 614 | 627 | const ad = [_]u8{}; |
| ... | ... | @@ -625,6 +638,8 @@ test "Aegis256 test vector 3" { |
| 625 | 638 | } |
| 626 | 639 | |
| 627 | 640 | test "Aegis MAC" { |
| 641 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 642 | ||
| 628 | 643 | const key = [_]u8{0x00} ** Aegis128LMac.key_length; |
| 629 | 644 | var msg: [64]u8 = undefined; |
| 630 | 645 | for (&msg, 0..) |*m, i| { |
lib/std/crypto/aes.zig+10| ... | ... | @@ -28,6 +28,8 @@ pub const Aes128 = impl.Aes128; |
| 28 | 28 | pub const Aes256 = impl.Aes256; |
| 29 | 29 | |
| 30 | 30 | test "ctr" { |
| 31 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 32 | ||
| 31 | 33 | // NIST SP 800-38A pp 55-58 |
| 32 | 34 | const ctr = @import("modes.zig").ctr; |
| 33 | 35 | |
| ... | ... | @@ -53,6 +55,8 @@ test "ctr" { |
| 53 | 55 | } |
| 54 | 56 | |
| 55 | 57 | test "encrypt" { |
| 58 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 59 | ||
| 56 | 60 | // Appendix B |
| 57 | 61 | { |
| 58 | 62 | const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; |
| ... | ... | @@ -82,6 +86,8 @@ test "encrypt" { |
| 82 | 86 | } |
| 83 | 87 | |
| 84 | 88 | test "decrypt" { |
| 89 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 90 | ||
| 85 | 91 | // Appendix B |
| 86 | 92 | { |
| 87 | 93 | const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; |
| ... | ... | @@ -111,6 +117,8 @@ test "decrypt" { |
| 111 | 117 | } |
| 112 | 118 | |
| 113 | 119 | test "expand 128-bit key" { |
| 120 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 121 | ||
| 114 | 122 | const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; |
| 115 | 123 | const exp_enc = [_]*const [32:0]u8{ |
| 116 | 124 | "2b7e151628aed2a6abf7158809cf4f3c", "a0fafe1788542cb123a339392a6c7605", "f2c295f27a96b9435935807a7359f67f", "3d80477d4716fe3e1e237e446d7a883b", "ef44a541a8525b7fb671253bdb0bad00", "d4d1c6f87c839d87caf2b8bc11f915bc", "6d88a37a110b3efddbf98641ca0093fd", "4e54f70e5f5fc9f384a64fb24ea6dc4f", "ead27321b58dbad2312bf5607f8d292f", "ac7766f319fadc2128d12941575c006e", "d014f9a8c9ee2589e13f0cc8b6630ca6", |
| ... | ... | @@ -133,6 +141,8 @@ test "expand 128-bit key" { |
| 133 | 141 | } |
| 134 | 142 | |
| 135 | 143 | test "expand 256-bit key" { |
| 144 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 145 | ||
| 136 | 146 | const key = [_]u8{ |
| 137 | 147 | 0x60, 0x3d, 0xeb, 0x10, |
| 138 | 148 | 0x15, 0xca, 0x71, 0xbe, |
lib/std/crypto/aes_gcm.zig+9| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const assert = std.debug.assert; |
| 3 | 4 | const crypto = std.crypto; |
| 4 | 5 | const debug = std.debug; |
| ... | ... | @@ -112,6 +113,8 @@ const htest = @import("test.zig"); |
| 112 | 113 | const testing = std.testing; |
| 113 | 114 | |
| 114 | 115 | test "Aes256Gcm - Empty message and no associated data" { |
| 116 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 117 | ||
| 115 | 118 | const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length; |
| 116 | 119 | const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length; |
| 117 | 120 | const ad = ""; |
| ... | ... | @@ -124,6 +127,8 @@ test "Aes256Gcm - Empty message and no associated data" { |
| 124 | 127 | } |
| 125 | 128 | |
| 126 | 129 | test "Aes256Gcm - Associated data only" { |
| 130 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 131 | ||
| 127 | 132 | const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length; |
| 128 | 133 | const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length; |
| 129 | 134 | const m = ""; |
| ... | ... | @@ -136,6 +141,8 @@ test "Aes256Gcm - Associated data only" { |
| 136 | 141 | } |
| 137 | 142 | |
| 138 | 143 | test "Aes256Gcm - Message only" { |
| 144 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 145 | ||
| 139 | 146 | const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length; |
| 140 | 147 | const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length; |
| 141 | 148 | const m = "Test with message only"; |
| ... | ... | @@ -153,6 +160,8 @@ test "Aes256Gcm - Message only" { |
| 153 | 160 | } |
| 154 | 161 | |
| 155 | 162 | test "Aes256Gcm - Message and associated data" { |
| 163 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 164 | ||
| 156 | 165 | const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length; |
| 157 | 166 | const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length; |
| 158 | 167 | const m = "Test with message"; |
lib/std/crypto/aes_ocb.zig+16-4| ... | ... | @@ -261,7 +261,10 @@ inline fn xorWith(x: *Block, y: Block) void { |
| 261 | 261 | const hexToBytes = std.fmt.hexToBytes; |
| 262 | 262 | |
| 263 | 263 | test "AesOcb test vector 1" { |
| 264 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 264 | switch (builtin.zig_backend) { | |
| 265 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 266 | else => {}, | |
| 267 | } | |
| 265 | 268 | |
| 266 | 269 | var k: [Aes128Ocb.key_length]u8 = undefined; |
| 267 | 270 | var nonce: [Aes128Ocb.nonce_length]u8 = undefined; |
| ... | ... | @@ -280,7 +283,10 @@ test "AesOcb test vector 1" { |
| 280 | 283 | } |
| 281 | 284 | |
| 282 | 285 | test "AesOcb test vector 2" { |
| 283 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 286 | switch (builtin.zig_backend) { | |
| 287 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 288 | else => {}, | |
| 289 | } | |
| 284 | 290 | |
| 285 | 291 | var k: [Aes128Ocb.key_length]u8 = undefined; |
| 286 | 292 | var nonce: [Aes128Ocb.nonce_length]u8 = undefined; |
| ... | ... | @@ -301,7 +307,10 @@ test "AesOcb test vector 2" { |
| 301 | 307 | } |
| 302 | 308 | |
| 303 | 309 | test "AesOcb test vector 3" { |
| 304 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 310 | switch (builtin.zig_backend) { | |
| 311 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 312 | else => {}, | |
| 313 | } | |
| 305 | 314 | |
| 306 | 315 | var k: [Aes128Ocb.key_length]u8 = undefined; |
| 307 | 316 | var nonce: [Aes128Ocb.nonce_length]u8 = undefined; |
| ... | ... | @@ -325,7 +334,10 @@ test "AesOcb test vector 3" { |
| 325 | 334 | } |
| 326 | 335 | |
| 327 | 336 | test "AesOcb test vector 4" { |
| 328 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 337 | switch (builtin.zig_backend) { | |
| 338 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 339 | else => {}, | |
| 340 | } | |
| 329 | 341 | |
| 330 | 342 | var k: [Aes128Ocb.key_length]u8 = undefined; |
| 331 | 343 | var nonce: [Aes128Ocb.nonce_length]u8 = undefined; |
lib/std/crypto/argon2.zig+14| ... | ... | @@ -622,6 +622,8 @@ pub fn strVerify( |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | test "argon2d" { |
| 625 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 626 | ||
| 625 | 627 | const password = [_]u8{0x01} ** 32; |
| 626 | 628 | const salt = [_]u8{0x02} ** 16; |
| 627 | 629 | const secret = [_]u8{0x03} ** 8; |
| ... | ... | @@ -647,6 +649,8 @@ test "argon2d" { |
| 647 | 649 | } |
| 648 | 650 | |
| 649 | 651 | test "argon2i" { |
| 652 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 653 | ||
| 650 | 654 | const password = [_]u8{0x01} ** 32; |
| 651 | 655 | const salt = [_]u8{0x02} ** 16; |
| 652 | 656 | const secret = [_]u8{0x03} ** 8; |
| ... | ... | @@ -672,6 +676,8 @@ test "argon2i" { |
| 672 | 676 | } |
| 673 | 677 | |
| 674 | 678 | test "argon2id" { |
| 679 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 680 | ||
| 675 | 681 | const password = [_]u8{0x01} ** 32; |
| 676 | 682 | const salt = [_]u8{0x02} ** 16; |
| 677 | 683 | const secret = [_]u8{0x03} ** 8; |
| ... | ... | @@ -697,6 +703,8 @@ test "argon2id" { |
| 697 | 703 | } |
| 698 | 704 | |
| 699 | 705 | test "kdf" { |
| 706 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 707 | ||
| 700 | 708 | const password = "password"; |
| 701 | 709 | const salt = "somesalt"; |
| 702 | 710 | |
| ... | ... | @@ -896,6 +904,8 @@ test "kdf" { |
| 896 | 904 | } |
| 897 | 905 | |
| 898 | 906 | test "phc format hasher" { |
| 907 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 908 | ||
| 899 | 909 | const allocator = std.testing.allocator; |
| 900 | 910 | const password = "testpass"; |
| 901 | 911 | |
| ... | ... | @@ -911,6 +921,8 @@ test "phc format hasher" { |
| 911 | 921 | } |
| 912 | 922 | |
| 913 | 923 | test "password hash and password verify" { |
| 924 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 925 | ||
| 914 | 926 | const allocator = std.testing.allocator; |
| 915 | 927 | const password = "testpass"; |
| 916 | 928 | |
| ... | ... | @@ -924,6 +936,8 @@ test "password hash and password verify" { |
| 924 | 936 | } |
| 925 | 937 | |
| 926 | 938 | test "kdf derived key length" { |
| 939 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 940 | ||
| 927 | 941 | const allocator = std.testing.allocator; |
| 928 | 942 | |
| 929 | 943 | const password = "testpass"; |
lib/std/crypto/bcrypt.zig+7| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const base64 = std.base64; |
| 3 | 4 | const crypto = std.crypto; |
| 4 | 5 | const debug = std.debug; |
| ... | ... | @@ -753,6 +754,8 @@ pub fn strVerify( |
| 753 | 754 | } |
| 754 | 755 | |
| 755 | 756 | test "bcrypt codec" { |
| 757 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 758 | ||
| 756 | 759 | var salt: [salt_length]u8 = undefined; |
| 757 | 760 | crypto.random.bytes(&salt); |
| 758 | 761 | var salt_str: [salt_str_length]u8 = undefined; |
| ... | ... | @@ -763,6 +766,8 @@ test "bcrypt codec" { |
| 763 | 766 | } |
| 764 | 767 | |
| 765 | 768 | test "bcrypt crypt format" { |
| 769 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 770 | ||
| 766 | 771 | var hash_options = HashOptions{ |
| 767 | 772 | .params = .{ .rounds_log = 5 }, |
| 768 | 773 | .encoding = .crypt, |
| ... | ... | @@ -803,6 +808,8 @@ test "bcrypt crypt format" { |
| 803 | 808 | } |
| 804 | 809 | |
| 805 | 810 | test "bcrypt phc format" { |
| 811 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 812 | ||
| 806 | 813 | var hash_options = HashOptions{ |
| 807 | 814 | .params = .{ .rounds_log = 5 }, |
| 808 | 815 | .encoding = .phc, |
lib/std/crypto/blake3.zig+3-1| ... | ... | @@ -200,7 +200,7 @@ const CompressGeneric = struct { |
| 200 | 200 | } |
| 201 | 201 | }; |
| 202 | 202 | |
| 203 | const compress = if (builtin.cpu.arch == .x86_64) | |
| 203 | const compress = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_x86_64) | |
| 204 | 204 | CompressVectorized.compress |
| 205 | 205 | else |
| 206 | 206 | CompressGeneric.compress; |
| ... | ... | @@ -682,6 +682,8 @@ fn testBlake3(hasher: *Blake3, input_len: usize, expected_hex: [262]u8) !void { |
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | test "BLAKE3 reference test cases" { |
| 685 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 686 | ||
| 685 | 687 | var hash_state = Blake3.init(.{}); |
| 686 | 688 | const hash = &hash_state; |
| 687 | 689 | var keyed_hash_state = Blake3.init(.{ .key = reference_test.key.* }); |
lib/std/crypto/chacha20.zig+22| ... | ... | @@ -499,6 +499,8 @@ fn ChaChaNonVecImpl(comptime rounds_nb: usize) type { |
| 499 | 499 | fn ChaChaImpl(comptime rounds_nb: usize) type { |
| 500 | 500 | switch (builtin.cpu.arch) { |
| 501 | 501 | .x86_64 => { |
| 502 | if (builtin.zig_backend == .stage2_x86_64) return ChaChaNonVecImpl(rounds_nb); | |
| 503 | ||
| 502 | 504 | const has_avx2 = std.Target.x86.featureSetHas(builtin.cpu.features, .avx2); |
| 503 | 505 | const has_avx512f = std.Target.x86.featureSetHas(builtin.cpu.features, .avx512f); |
| 504 | 506 | if (has_avx512f) return ChaChaVecImpl(rounds_nb, 4); |
| ... | ... | @@ -757,6 +759,8 @@ fn XChaChaPoly1305(comptime rounds_nb: usize) type { |
| 757 | 759 | } |
| 758 | 760 | |
| 759 | 761 | test "chacha20 AEAD API" { |
| 762 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 763 | ||
| 760 | 764 | const aeads = [_]type{ ChaCha20Poly1305, XChaCha20Poly1305 }; |
| 761 | 765 | const m = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."; |
| 762 | 766 | const ad = "Additional data"; |
| ... | ... | @@ -778,6 +782,8 @@ test "chacha20 AEAD API" { |
| 778 | 782 | |
| 779 | 783 | // https://tools.ietf.org/html/rfc7539#section-2.4.2 |
| 780 | 784 | test "crypto.chacha20 test vector sunscreen" { |
| 785 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 786 | ||
| 781 | 787 | const expected_result = [_]u8{ |
| 782 | 788 | 0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80, |
| 783 | 789 | 0x41, 0xba, 0x07, 0x28, 0xdd, 0x0d, 0x69, 0x81, |
| ... | ... | @@ -819,6 +825,8 @@ test "crypto.chacha20 test vector sunscreen" { |
| 819 | 825 | |
| 820 | 826 | // https://tools.ietf.org/html/draft-agl-tls-chacha20poly1305-04#section-7 |
| 821 | 827 | test "crypto.chacha20 test vector 1" { |
| 828 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 829 | ||
| 822 | 830 | const expected_result = [_]u8{ |
| 823 | 831 | 0x76, 0xb8, 0xe0, 0xad, 0xa0, 0xf1, 0x3d, 0x90, |
| 824 | 832 | 0x40, 0x5d, 0x6a, 0xe5, 0x53, 0x86, 0xbd, 0x28, |
| ... | ... | @@ -853,6 +861,8 @@ test "crypto.chacha20 test vector 1" { |
| 853 | 861 | } |
| 854 | 862 | |
| 855 | 863 | test "crypto.chacha20 test vector 2" { |
| 864 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 865 | ||
| 856 | 866 | const expected_result = [_]u8{ |
| 857 | 867 | 0x45, 0x40, 0xf0, 0x5a, 0x9f, 0x1f, 0xb2, 0x96, |
| 858 | 868 | 0xd7, 0x73, 0x6e, 0x7b, 0x20, 0x8e, 0x3c, 0x96, |
| ... | ... | @@ -887,6 +897,8 @@ test "crypto.chacha20 test vector 2" { |
| 887 | 897 | } |
| 888 | 898 | |
| 889 | 899 | test "crypto.chacha20 test vector 3" { |
| 900 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 901 | ||
| 890 | 902 | const expected_result = [_]u8{ |
| 891 | 903 | 0xde, 0x9c, 0xba, 0x7b, 0xf3, 0xd6, 0x9e, 0xf5, |
| 892 | 904 | 0xe7, 0x86, 0xdc, 0x63, 0x97, 0x3f, 0x65, 0x3a, |
| ... | ... | @@ -921,6 +933,8 @@ test "crypto.chacha20 test vector 3" { |
| 921 | 933 | } |
| 922 | 934 | |
| 923 | 935 | test "crypto.chacha20 test vector 4" { |
| 936 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 937 | ||
| 924 | 938 | const expected_result = [_]u8{ |
| 925 | 939 | 0xef, 0x3f, 0xdf, 0xd6, 0xc6, 0x15, 0x78, 0xfb, |
| 926 | 940 | 0xf5, 0xcf, 0x35, 0xbd, 0x3d, 0xd3, 0x3b, 0x80, |
| ... | ... | @@ -955,6 +969,8 @@ test "crypto.chacha20 test vector 4" { |
| 955 | 969 | } |
| 956 | 970 | |
| 957 | 971 | test "crypto.chacha20 test vector 5" { |
| 972 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 973 | ||
| 958 | 974 | const expected_result = [_]u8{ |
| 959 | 975 | 0xf7, 0x98, 0xa1, 0x89, 0xf1, 0x95, 0xe6, 0x69, |
| 960 | 976 | 0x82, 0x10, 0x5f, 0xfb, 0x64, 0x0b, 0xb7, 0x75, |
| ... | ... | @@ -1027,6 +1043,8 @@ test "crypto.chacha20 test vector 5" { |
| 1027 | 1043 | } |
| 1028 | 1044 | |
| 1029 | 1045 | test "seal" { |
| 1046 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1047 | ||
| 1030 | 1048 | { |
| 1031 | 1049 | const m = ""; |
| 1032 | 1050 | const ad = ""; |
| ... | ... | @@ -1077,6 +1095,8 @@ test "seal" { |
| 1077 | 1095 | } |
| 1078 | 1096 | |
| 1079 | 1097 | test "open" { |
| 1098 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1099 | ||
| 1080 | 1100 | { |
| 1081 | 1101 | const c = [_]u8{ 0xa0, 0x78, 0x4d, 0x7a, 0x47, 0x16, 0xf3, 0xfe, 0xb4, 0xf6, 0x4e, 0x7f, 0x4b, 0x39, 0xbf, 0x4 }; |
| 1082 | 1102 | const ad = ""; |
| ... | ... | @@ -1141,6 +1161,8 @@ test "open" { |
| 1141 | 1161 | } |
| 1142 | 1162 | |
| 1143 | 1163 | test "crypto.xchacha20" { |
| 1164 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1165 | ||
| 1144 | 1166 | const key = [_]u8{69} ** 32; |
| 1145 | 1167 | const nonce = [_]u8{42} ** 24; |
| 1146 | 1168 | const m = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."; |
lib/std/crypto/cmac.zig+9| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const crypto = std.crypto; |
| 3 | 4 | const mem = std.mem; |
| 4 | 5 | |
| ... | ... | @@ -93,6 +94,8 @@ pub fn Cmac(comptime BlockCipher: type) type { |
| 93 | 94 | const testing = std.testing; |
| 94 | 95 | |
| 95 | 96 | test "CmacAes128 - Example 1: len = 0" { |
| 97 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 98 | ||
| 96 | 99 | const key = [_]u8{ |
| 97 | 100 | 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c, |
| 98 | 101 | }; |
| ... | ... | @@ -106,6 +109,8 @@ test "CmacAes128 - Example 1: len = 0" { |
| 106 | 109 | } |
| 107 | 110 | |
| 108 | 111 | test "CmacAes128 - Example 2: len = 16" { |
| 112 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 113 | ||
| 109 | 114 | const key = [_]u8{ |
| 110 | 115 | 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c, |
| 111 | 116 | }; |
| ... | ... | @@ -121,6 +126,8 @@ test "CmacAes128 - Example 2: len = 16" { |
| 121 | 126 | } |
| 122 | 127 | |
| 123 | 128 | test "CmacAes128 - Example 3: len = 40" { |
| 129 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 130 | ||
| 124 | 131 | const key = [_]u8{ |
| 125 | 132 | 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c, |
| 126 | 133 | }; |
| ... | ... | @@ -138,6 +145,8 @@ test "CmacAes128 - Example 3: len = 40" { |
| 138 | 145 | } |
| 139 | 146 | |
| 140 | 147 | test "CmacAes128 - Example 4: len = 64" { |
| 148 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 149 | ||
| 141 | 150 | const key = [_]u8{ |
| 142 | 151 | 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c, |
| 143 | 152 | }; |
lib/std/crypto/ghash_polyval.zig+6| ... | ... | @@ -422,6 +422,8 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type { |
| 422 | 422 | const htest = @import("test.zig"); |
| 423 | 423 | |
| 424 | 424 | test "ghash" { |
| 425 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 426 | ||
| 425 | 427 | const key = [_]u8{0x42} ** 16; |
| 426 | 428 | const m = [_]u8{0x69} ** 256; |
| 427 | 429 | |
| ... | ... | @@ -439,6 +441,8 @@ test "ghash" { |
| 439 | 441 | } |
| 440 | 442 | |
| 441 | 443 | test "ghash2" { |
| 444 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 445 | ||
| 442 | 446 | var key: [16]u8 = undefined; |
| 443 | 447 | var i: usize = 0; |
| 444 | 448 | while (i < key.len) : (i += 1) { |
| ... | ... | @@ -472,6 +476,8 @@ test "ghash2" { |
| 472 | 476 | } |
| 473 | 477 | |
| 474 | 478 | test "polyval" { |
| 479 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 480 | ||
| 475 | 481 | const key = [_]u8{0x42} ** 16; |
| 476 | 482 | const m = [_]u8{0x69} ** 256; |
| 477 | 483 |
lib/std/crypto/hash_composition.zig+2| ... | ... | @@ -65,6 +65,8 @@ pub const Sha384oSha384 = Composition(sha2.Sha384, sha2.Sha384); |
| 65 | 65 | pub const Sha512oSha512 = Composition(sha2.Sha512, sha2.Sha512); |
| 66 | 66 | |
| 67 | 67 | test "Hash composition" { |
| 68 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 69 | ||
| 68 | 70 | const Sha256 = sha2.Sha256; |
| 69 | 71 | const msg = "test"; |
| 70 | 72 |
lib/std/crypto/hkdf.zig+2| ... | ... | @@ -72,6 +72,8 @@ pub fn Hkdf(comptime Hmac: type) type { |
| 72 | 72 | const htest = @import("test.zig"); |
| 73 | 73 | |
| 74 | 74 | test "Hkdf" { |
| 75 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 76 | ||
| 75 | 77 | const ikm = [_]u8{0x0b} ** 22; |
| 76 | 78 | const salt = [_]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c }; |
| 77 | 79 | const context = [_]u8{ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9 }; |
lib/std/crypto/kyber_d00.zig+28| ... | ... | @@ -553,6 +553,8 @@ const inv_ntt_reductions = [_]i16{ |
| 553 | 553 | }; |
| 554 | 554 | |
| 555 | 555 | test "invNTTReductions bounds" { |
| 556 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 557 | ||
| 556 | 558 | // Checks whether the reductions proposed by invNTTReductions |
| 557 | 559 | // don't overflow during invNTT(). |
| 558 | 560 | var xs = [_]i32{1} ** 256; // start at |x| ≤ q |
| ... | ... | @@ -656,6 +658,8 @@ fn montReduce(x: i32) i16 { |
| 656 | 658 | } |
| 657 | 659 | |
| 658 | 660 | test "Test montReduce" { |
| 661 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 662 | ||
| 659 | 663 | var rnd = RndGen.init(0); |
| 660 | 664 | for (0..1000) |_| { |
| 661 | 665 | const bound = comptime @as(i32, Q) * (1 << 15); |
| ... | ... | @@ -674,6 +678,8 @@ fn feToMont(x: i16) i16 { |
| 674 | 678 | } |
| 675 | 679 | |
| 676 | 680 | test "Test feToMont" { |
| 681 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 682 | ||
| 677 | 683 | var x: i32 = -(1 << 15); |
| 678 | 684 | while (x < 1 << 15) : (x += 1) { |
| 679 | 685 | const y = feToMont(@as(i16, @intCast(x))); |
| ... | ... | @@ -707,6 +713,8 @@ fn feBarrettReduce(x: i16) i16 { |
| 707 | 713 | } |
| 708 | 714 | |
| 709 | 715 | test "Test Barrett reduction" { |
| 716 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 717 | ||
| 710 | 718 | var x: i32 = -(1 << 15); |
| 711 | 719 | while (x < 1 << 15) : (x += 1) { |
| 712 | 720 | var y1 = feBarrettReduce(@as(i16, @intCast(x))); |
| ... | ... | @@ -727,6 +735,8 @@ fn csubq(x: i16) i16 { |
| 727 | 735 | } |
| 728 | 736 | |
| 729 | 737 | test "Test csubq" { |
| 738 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 739 | ||
| 730 | 740 | var x: i32 = -29439; |
| 731 | 741 | while (x < 1 << 15) : (x += 1) { |
| 732 | 742 | const y1 = csubq(@as(i16, @intCast(x))); |
| ... | ... | @@ -1466,6 +1476,8 @@ fn cmov(comptime len: usize, dst: *[len]u8, src: [len]u8, b: u1) void { |
| 1466 | 1476 | } |
| 1467 | 1477 | |
| 1468 | 1478 | test "MulHat" { |
| 1479 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1480 | ||
| 1469 | 1481 | var rnd = RndGen.init(0); |
| 1470 | 1482 | |
| 1471 | 1483 | for (0..100) |_| { |
| ... | ... | @@ -1497,6 +1509,8 @@ test "MulHat" { |
| 1497 | 1509 | } |
| 1498 | 1510 | |
| 1499 | 1511 | test "NTT" { |
| 1512 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1513 | ||
| 1500 | 1514 | var rnd = RndGen.init(0); |
| 1501 | 1515 | |
| 1502 | 1516 | for (0..1000) |_| { |
| ... | ... | @@ -1520,6 +1534,8 @@ test "NTT" { |
| 1520 | 1534 | } |
| 1521 | 1535 | |
| 1522 | 1536 | test "Compression" { |
| 1537 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1538 | ||
| 1523 | 1539 | var rnd = RndGen.init(0); |
| 1524 | 1540 | inline for (.{ 1, 4, 5, 10, 11 }) |d| { |
| 1525 | 1541 | for (0..1000) |_| { |
| ... | ... | @@ -1532,6 +1548,8 @@ test "Compression" { |
| 1532 | 1548 | } |
| 1533 | 1549 | |
| 1534 | 1550 | test "noise" { |
| 1551 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1552 | ||
| 1535 | 1553 | var seed: [32]u8 = undefined; |
| 1536 | 1554 | for (&seed, 0..) |*s, i| { |
| 1537 | 1555 | s.* = @as(u8, @intCast(i)); |
| ... | ... | @@ -1578,6 +1596,8 @@ test "noise" { |
| 1578 | 1596 | } |
| 1579 | 1597 | |
| 1580 | 1598 | test "uniform sampling" { |
| 1599 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1600 | ||
| 1581 | 1601 | var seed: [32]u8 = undefined; |
| 1582 | 1602 | for (&seed, 0..) |*s, i| { |
| 1583 | 1603 | s.* = @as(u8, @intCast(i)); |
| ... | ... | @@ -1611,6 +1631,8 @@ test "uniform sampling" { |
| 1611 | 1631 | } |
| 1612 | 1632 | |
| 1613 | 1633 | test "Polynomial packing" { |
| 1634 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1635 | ||
| 1614 | 1636 | var rnd = RndGen.init(0); |
| 1615 | 1637 | |
| 1616 | 1638 | for (0..1000) |_| { |
| ... | ... | @@ -1620,6 +1642,8 @@ test "Polynomial packing" { |
| 1620 | 1642 | } |
| 1621 | 1643 | |
| 1622 | 1644 | test "Test inner PKE" { |
| 1645 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1646 | ||
| 1623 | 1647 | var seed: [32]u8 = undefined; |
| 1624 | 1648 | var pt: [32]u8 = undefined; |
| 1625 | 1649 | for (&seed, &pt, 0..) |*s, *p, i| { |
| ... | ... | @@ -1641,6 +1665,8 @@ test "Test inner PKE" { |
| 1641 | 1665 | } |
| 1642 | 1666 | |
| 1643 | 1667 | test "Test happy flow" { |
| 1668 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1669 | ||
| 1644 | 1670 | var seed: [64]u8 = undefined; |
| 1645 | 1671 | for (&seed, 0..) |*s, i| { |
| 1646 | 1672 | s.* = @as(u8, @intCast(i)); |
| ... | ... | @@ -1667,6 +1693,8 @@ test "Test happy flow" { |
| 1667 | 1693 | const sha2 = crypto.hash.sha2; |
| 1668 | 1694 | |
| 1669 | 1695 | test "NIST KAT test" { |
| 1696 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1697 | ||
| 1670 | 1698 | inline for (.{ |
| 1671 | 1699 | .{ Kyber512, "e9c2bd37133fcb40772f81559f14b1f58dccd1c816701be9ba6214d43baf4547" }, |
| 1672 | 1700 | .{ Kyber1024, "89248f2f33f7f4f7051729111f3049c409a933ec904aedadf035f30fa5646cd5" }, |
lib/std/crypto/pbkdf2.zig+15| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const mem = std.mem; |
| 3 | 4 | const maxInt = std.math.maxInt; |
| 4 | 5 | const OutputTooLongError = std.crypto.errors.OutputTooLongError; |
| ... | ... | @@ -151,6 +152,8 @@ const HmacSha1 = std.crypto.auth.hmac.HmacSha1; |
| 151 | 152 | // RFC 6070 PBKDF2 HMAC-SHA1 Test Vectors |
| 152 | 153 | |
| 153 | 154 | test "RFC 6070 one iteration" { |
| 155 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 156 | ||
| 154 | 157 | const p = "password"; |
| 155 | 158 | const s = "salt"; |
| 156 | 159 | const c = 1; |
| ... | ... | @@ -166,6 +169,8 @@ test "RFC 6070 one iteration" { |
| 166 | 169 | } |
| 167 | 170 | |
| 168 | 171 | test "RFC 6070 two iterations" { |
| 172 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 173 | ||
| 169 | 174 | const p = "password"; |
| 170 | 175 | const s = "salt"; |
| 171 | 176 | const c = 2; |
| ... | ... | @@ -181,6 +186,8 @@ test "RFC 6070 two iterations" { |
| 181 | 186 | } |
| 182 | 187 | |
| 183 | 188 | test "RFC 6070 4096 iterations" { |
| 189 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 190 | ||
| 184 | 191 | const p = "password"; |
| 185 | 192 | const s = "salt"; |
| 186 | 193 | const c = 4096; |
| ... | ... | @@ -196,6 +203,8 @@ test "RFC 6070 4096 iterations" { |
| 196 | 203 | } |
| 197 | 204 | |
| 198 | 205 | test "RFC 6070 16,777,216 iterations" { |
| 206 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 207 | ||
| 199 | 208 | // These iteration tests are slow so we always skip them. Results have been verified. |
| 200 | 209 | if (true) { |
| 201 | 210 | return error.SkipZigTest; |
| ... | ... | @@ -216,6 +225,8 @@ test "RFC 6070 16,777,216 iterations" { |
| 216 | 225 | } |
| 217 | 226 | |
| 218 | 227 | test "RFC 6070 multi-block salt and password" { |
| 228 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 229 | ||
| 219 | 230 | const p = "passwordPASSWORDpassword"; |
| 220 | 231 | const s = "saltSALTsaltSALTsaltSALTsaltSALTsalt"; |
| 221 | 232 | const c = 4096; |
| ... | ... | @@ -231,6 +242,8 @@ test "RFC 6070 multi-block salt and password" { |
| 231 | 242 | } |
| 232 | 243 | |
| 233 | 244 | test "RFC 6070 embedded NUL" { |
| 245 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 246 | ||
| 234 | 247 | const p = "pass\x00word"; |
| 235 | 248 | const s = "sa\x00lt"; |
| 236 | 249 | const c = 4096; |
| ... | ... | @@ -246,6 +259,8 @@ test "RFC 6070 embedded NUL" { |
| 246 | 259 | } |
| 247 | 260 | |
| 248 | 261 | test "Very large dk_len" { |
| 262 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 263 | ||
| 249 | 264 | // This test allocates 8GB of memory and is expected to take several hours to run. |
| 250 | 265 | if (true) { |
| 251 | 266 | return error.SkipZigTest; |
lib/std/crypto/pcurves/p256.zig+2| ... | ... | @@ -478,5 +478,7 @@ pub const AffineCoordinates = struct { |
| 478 | 478 | }; |
| 479 | 479 | |
| 480 | 480 | test { |
| 481 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 482 | ||
| 481 | 483 | _ = @import("tests/p256.zig"); |
| 482 | 484 | } |
lib/std/crypto/phc_encoding.zig+9| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | // https://github.com/P-H-C/phc-string-format |
| 2 | 2 | |
| 3 | 3 | const std = @import("std"); |
| 4 | const builtin = @import("builtin"); | |
| 4 | 5 | const fmt = std.fmt; |
| 5 | 6 | const io = std.io; |
| 6 | 7 | const mem = std.mem; |
| ... | ... | @@ -263,6 +264,8 @@ fn kvSplit(str: []const u8) !struct { key: []const u8, value: []const u8 } { |
| 263 | 264 | } |
| 264 | 265 | |
| 265 | 266 | test "phc format - encoding/decoding" { |
| 267 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 268 | ||
| 266 | 269 | const Input = struct { |
| 267 | 270 | str: []const u8, |
| 268 | 271 | HashResult: type, |
| ... | ... | @@ -348,18 +351,24 @@ test "phc format - encoding/decoding" { |
| 348 | 351 | } |
| 349 | 352 | |
| 350 | 353 | test "phc format - empty input string" { |
| 354 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 355 | ||
| 351 | 356 | const s = ""; |
| 352 | 357 | const v = deserialize(struct { alg_id: []const u8 }, s); |
| 353 | 358 | try std.testing.expectError(Error.InvalidEncoding, v); |
| 354 | 359 | } |
| 355 | 360 | |
| 356 | 361 | test "phc format - hash without salt" { |
| 362 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 363 | ||
| 357 | 364 | const s = "$scrypt"; |
| 358 | 365 | const v = deserialize(struct { alg_id: []const u8, hash: BinValue(16) }, s); |
| 359 | 366 | try std.testing.expectError(Error.InvalidEncoding, v); |
| 360 | 367 | } |
| 361 | 368 | |
| 362 | 369 | test "phc format - calcSize" { |
| 370 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 371 | ||
| 363 | 372 | const s = "$scrypt$v=1$ln=15,r=8,p=1$c2FsdHNhbHQ$dGVzdHBhc3M"; |
| 364 | 373 | const v = try deserialize(struct { |
| 365 | 374 | alg_id: []const u8, |
lib/std/crypto/salsa20.zig+12| ... | ... | @@ -555,6 +555,8 @@ pub const SealedBox = struct { |
| 555 | 555 | const htest = @import("test.zig"); |
| 556 | 556 | |
| 557 | 557 | test "(x)salsa20" { |
| 558 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 559 | ||
| 558 | 560 | const key = [_]u8{0x69} ** 32; |
| 559 | 561 | const nonce = [_]u8{0x42} ** 8; |
| 560 | 562 | const msg = [_]u8{0} ** 20; |
| ... | ... | @@ -569,6 +571,8 @@ test "(x)salsa20" { |
| 569 | 571 | } |
| 570 | 572 | |
| 571 | 573 | test "xsalsa20poly1305" { |
| 574 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 575 | ||
| 572 | 576 | var msg: [100]u8 = undefined; |
| 573 | 577 | var msg2: [msg.len]u8 = undefined; |
| 574 | 578 | var c: [msg.len]u8 = undefined; |
| ... | ... | @@ -584,6 +588,8 @@ test "xsalsa20poly1305" { |
| 584 | 588 | } |
| 585 | 589 | |
| 586 | 590 | test "xsalsa20poly1305 secretbox" { |
| 591 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 592 | ||
| 587 | 593 | var msg: [100]u8 = undefined; |
| 588 | 594 | var msg2: [msg.len]u8 = undefined; |
| 589 | 595 | var key: [XSalsa20Poly1305.key_length]u8 = undefined; |
| ... | ... | @@ -598,6 +604,8 @@ test "xsalsa20poly1305 secretbox" { |
| 598 | 604 | } |
| 599 | 605 | |
| 600 | 606 | test "xsalsa20poly1305 box" { |
| 607 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 608 | ||
| 601 | 609 | var msg: [100]u8 = undefined; |
| 602 | 610 | var msg2: [msg.len]u8 = undefined; |
| 603 | 611 | var nonce: [Box.nonce_length]u8 = undefined; |
| ... | ... | @@ -612,6 +620,8 @@ test "xsalsa20poly1305 box" { |
| 612 | 620 | } |
| 613 | 621 | |
| 614 | 622 | test "xsalsa20poly1305 sealedbox" { |
| 623 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 624 | ||
| 615 | 625 | var msg: [100]u8 = undefined; |
| 616 | 626 | var msg2: [msg.len]u8 = undefined; |
| 617 | 627 | var boxed: [msg.len + SealedBox.seal_length]u8 = undefined; |
| ... | ... | @@ -623,6 +633,8 @@ test "xsalsa20poly1305 sealedbox" { |
| 623 | 633 | } |
| 624 | 634 | |
| 625 | 635 | test "secretbox twoblocks" { |
| 636 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 637 | ||
| 626 | 638 | const key = [_]u8{ 0xc9, 0xc9, 0x4d, 0xcf, 0x68, 0xbe, 0x00, 0xe4, 0x7f, 0xe6, 0x13, 0x26, 0xfc, 0xc4, 0x2f, 0xd0, 0xdb, 0x93, 0x91, 0x1c, 0x09, 0x94, 0x89, 0xe1, 0x1b, 0x88, 0x63, 0x18, 0x86, 0x64, 0x8b, 0x7b }; |
| 627 | 639 | const nonce = [_]u8{ 0xa4, 0x33, 0xe9, 0x0a, 0x07, 0x68, 0x6e, 0x9a, 0x2b, 0x6d, 0xd4, 0x59, 0x04, 0x72, 0x3e, 0xd3, 0x8a, 0x67, 0x55, 0xc7, 0x9e, 0x3e, 0x77, 0xdc }; |
| 628 | 640 | const msg = [_]u8{'a'} ** 97; |
lib/std/crypto/scrypt.zig+2| ... | ... | @@ -683,6 +683,8 @@ test "unix-scrypt" { |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | test "crypt format" { |
| 686 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 687 | ||
| 686 | 688 | const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D"; |
| 687 | 689 | const params = try crypt_format.deserialize(crypt_format.HashResult(32), str); |
| 688 | 690 | var buf: [str.len]u8 = undefined; |
lib/std/crypto/sha2.zig+11-1| ... | ... | @@ -238,7 +238,7 @@ fn Sha2x32(comptime params: Sha2Params32) type { |
| 238 | 238 | return; |
| 239 | 239 | }, |
| 240 | 240 | // C backend doesn't currently support passing vectors to inline asm. |
| 241 | .x86_64 => if (builtin.zig_backend != .stage2_c and comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .sha, .avx2 })) { | |
| 241 | .x86_64 => if (builtin.zig_backend != .stage2_c and builtin.zig_backend != .stage2_x86_64 and comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .sha, .avx2 })) { | |
| 242 | 242 | var x: v4u32 = [_]u32{ d.s[5], d.s[4], d.s[1], d.s[0] }; |
| 243 | 243 | var y: v4u32 = [_]u32{ d.s[7], d.s[6], d.s[3], d.s[2] }; |
| 244 | 244 | const s_v = @as(*[16]v4u32, @ptrCast(&s)); |
| ... | ... | @@ -406,12 +406,16 @@ fn Sha2x32(comptime params: Sha2Params32) type { |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | test "sha224 single" { |
| 409 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 410 | ||
| 409 | 411 | try htest.assertEqualHash(Sha224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", ""); |
| 410 | 412 | try htest.assertEqualHash(Sha224, "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc"); |
| 411 | 413 | try htest.assertEqualHash(Sha224, "c97ca9a559850ce97a04a96def6d99a9e0e0e2ab14e6b8df265fc0b3", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"); |
| 412 | 414 | } |
| 413 | 415 | |
| 414 | 416 | test "sha224 streaming" { |
| 417 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 418 | ||
| 415 | 419 | var h = Sha224.init(.{}); |
| 416 | 420 | var out: [28]u8 = undefined; |
| 417 | 421 | |
| ... | ... | @@ -432,12 +436,16 @@ test "sha224 streaming" { |
| 432 | 436 | } |
| 433 | 437 | |
| 434 | 438 | test "sha256 single" { |
| 439 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 440 | ||
| 435 | 441 | try htest.assertEqualHash(Sha256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", ""); |
| 436 | 442 | try htest.assertEqualHash(Sha256, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc"); |
| 437 | 443 | try htest.assertEqualHash(Sha256, "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"); |
| 438 | 444 | } |
| 439 | 445 | |
| 440 | 446 | test "sha256 streaming" { |
| 447 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 448 | ||
| 441 | 449 | var h = Sha256.init(.{}); |
| 442 | 450 | var out: [32]u8 = undefined; |
| 443 | 451 | |
| ... | ... | @@ -458,6 +466,8 @@ test "sha256 streaming" { |
| 458 | 466 | } |
| 459 | 467 | |
| 460 | 468 | test "sha256 aligned final" { |
| 469 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 470 | ||
| 461 | 471 | var block = [_]u8{0} ** Sha256.block_length; |
| 462 | 472 | var out: [Sha256.digest_length]u8 = undefined; |
| 463 | 473 |
lib/std/crypto/utils.zig+2| ... | ... | @@ -149,6 +149,8 @@ test "crypto.utils.timingSafeEql" { |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | test "crypto.utils.timingSafeEql (vectors)" { |
| 152 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 153 | ||
| 152 | 154 | var a: [100]u8 = undefined; |
| 153 | 155 | var b: [100]u8 = undefined; |
| 154 | 156 | random.bytes(a[0..]); |
lib/std/fmt.zig+8| ... | ... | @@ -2735,6 +2735,8 @@ test "formatType max_depth" { |
| 2735 | 2735 | } |
| 2736 | 2736 | |
| 2737 | 2737 | test "positional" { |
| 2738 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2739 | ||
| 2738 | 2740 | try expectFmt("2 1 0", "{2} {1} {0}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) }); |
| 2739 | 2741 | try expectFmt("2 1 0", "{2} {1} {}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) }); |
| 2740 | 2742 | try expectFmt("0 0", "{0} {0}", .{@as(usize, 0)}); |
| ... | ... | @@ -2743,14 +2745,20 @@ test "positional" { |
| 2743 | 2745 | } |
| 2744 | 2746 | |
| 2745 | 2747 | test "positional with specifier" { |
| 2748 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2749 | ||
| 2746 | 2750 | try expectFmt("10.0", "{0d:.1}", .{@as(f64, 9.999)}); |
| 2747 | 2751 | } |
| 2748 | 2752 | |
| 2749 | 2753 | test "positional/alignment/width/precision" { |
| 2754 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2755 | ||
| 2750 | 2756 | try expectFmt("10.0", "{0d: >3.1}", .{@as(f64, 9.999)}); |
| 2751 | 2757 | } |
| 2752 | 2758 | |
| 2753 | 2759 | test "vector" { |
| 2760 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2761 | ||
| 2754 | 2762 | if (builtin.target.cpu.arch == .riscv64) { |
| 2755 | 2763 | // https://github.com/ziglang/zig/issues/4486 |
| 2756 | 2764 | return error.SkipZigTest; |
lib/std/fmt/parse_float.zig+17-1| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | pub const parseFloat = @import("parse_float/parse_float.zig").parseFloat; |
| 2 | 2 | pub const ParseFloatError = @import("parse_float/parse_float.zig").ParseFloatError; |
| 3 | 3 | |
| 4 | const builtin = @import("builtin"); | |
| 5 | 4 | const std = @import("std"); |
| 5 | const builtin = @import("builtin"); | |
| 6 | 6 | const math = std.math; |
| 7 | 7 | const testing = std.testing; |
| 8 | 8 | const expect = testing.expect; |
| ... | ... | @@ -14,6 +14,8 @@ const epsilon = 1e-7; |
| 14 | 14 | // See https://github.com/tiehuis/parse-number-fxx-test-data for a wider-selection of test-data. |
| 15 | 15 | |
| 16 | 16 | test "fmt.parseFloat" { |
| 17 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 18 | ||
| 17 | 19 | inline for ([_]type{ f16, f32, f64, f128 }) |T| { |
| 18 | 20 | try testing.expectError(error.InvalidCharacter, parseFloat(T, "")); |
| 19 | 21 | try testing.expectError(error.InvalidCharacter, parseFloat(T, " 1")); |
| ... | ... | @@ -70,6 +72,8 @@ test "fmt.parseFloat" { |
| 70 | 72 | } |
| 71 | 73 | |
| 72 | 74 | test "fmt.parseFloat nan and inf" { |
| 75 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 76 | ||
| 73 | 77 | inline for ([_]type{ f16, f32, f64, f128 }) |T| { |
| 74 | 78 | const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits); |
| 75 | 79 | |
| ... | ... | @@ -80,16 +84,22 @@ test "fmt.parseFloat nan and inf" { |
| 80 | 84 | } |
| 81 | 85 | |
| 82 | 86 | test "fmt.parseFloat #11169" { |
| 87 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 88 | ||
| 83 | 89 | try expectEqual(try parseFloat(f128, "9007199254740993.0"), 9007199254740993.0); |
| 84 | 90 | } |
| 85 | 91 | |
| 86 | 92 | test "fmt.parseFloat hex.special" { |
| 93 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 94 | ||
| 87 | 95 | try testing.expect(math.isNan(try parseFloat(f32, "nAn"))); |
| 88 | 96 | try testing.expect(math.isPositiveInf(try parseFloat(f32, "iNf"))); |
| 89 | 97 | try testing.expect(math.isPositiveInf(try parseFloat(f32, "+Inf"))); |
| 90 | 98 | try testing.expect(math.isNegativeInf(try parseFloat(f32, "-iNf"))); |
| 91 | 99 | } |
| 92 | 100 | test "fmt.parseFloat hex.zero" { |
| 101 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 102 | ||
| 93 | 103 | try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0")); |
| 94 | 104 | try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "-0x0")); |
| 95 | 105 | try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0p42")); |
| ... | ... | @@ -98,6 +108,8 @@ test "fmt.parseFloat hex.zero" { |
| 98 | 108 | } |
| 99 | 109 | |
| 100 | 110 | test "fmt.parseFloat hex.f16" { |
| 111 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 112 | ||
| 101 | 113 | try testing.expectEqual(try parseFloat(f16, "0x1p0"), 1.0); |
| 102 | 114 | try testing.expectEqual(try parseFloat(f16, "-0x1p-1"), -0.5); |
| 103 | 115 | try testing.expectEqual(try parseFloat(f16, "0x10p+10"), 16384.0); |
| ... | ... | @@ -114,6 +126,8 @@ test "fmt.parseFloat hex.f16" { |
| 114 | 126 | } |
| 115 | 127 | |
| 116 | 128 | test "fmt.parseFloat hex.f32" { |
| 129 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 130 | ||
| 117 | 131 | try testing.expectError(error.InvalidCharacter, parseFloat(f32, "0x")); |
| 118 | 132 | try testing.expectEqual(try parseFloat(f32, "0x1p0"), 1.0); |
| 119 | 133 | try testing.expectEqual(try parseFloat(f32, "-0x1p-1"), -0.5); |
| ... | ... | @@ -148,6 +162,8 @@ test "fmt.parseFloat hex.f64" { |
| 148 | 162 | try testing.expectEqual(try parseFloat(f64, "-0x1p-1074"), -math.floatTrueMin(f64)); |
| 149 | 163 | } |
| 150 | 164 | test "fmt.parseFloat hex.f128" { |
| 165 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 166 | ||
| 151 | 167 | try testing.expectEqual(try parseFloat(f128, "0x1p0"), 1.0); |
| 152 | 168 | try testing.expectEqual(try parseFloat(f128, "-0x1p-1"), -0.5); |
| 153 | 169 | try testing.expectEqual(try parseFloat(f128, "0x10p+10"), 16384.0); |
lib/std/fs.zig+8-6| ... | ... | @@ -3167,13 +3167,15 @@ fn copy_file(fd_in: os.fd_t, fd_out: os.fd_t, maybe_size: ?u64) CopyFileRawError |
| 3167 | 3167 | } |
| 3168 | 3168 | |
| 3169 | 3169 | test { |
| 3170 | if (builtin.os.tag != .wasi) { | |
| 3171 | _ = &makeDirAbsolute; | |
| 3172 | _ = &makeDirAbsoluteZ; | |
| 3173 | _ = &copyFileAbsolute; | |
| 3174 | _ = &updateFileAbsolute; | |
| 3170 | if (builtin.zig_backend != .stage2_x86_64) { | |
| 3171 | if (builtin.os.tag != .wasi) { | |
| 3172 | _ = &makeDirAbsolute; | |
| 3173 | _ = &makeDirAbsoluteZ; | |
| 3174 | _ = &copyFileAbsolute; | |
| 3175 | _ = &updateFileAbsolute; | |
| 3176 | } | |
| 3177 | _ = &Dir.copyFile; | |
| 3175 | 3178 | } |
| 3176 | _ = &Dir.copyFile; | |
| 3177 | 3179 | _ = @import("fs/test.zig"); |
| 3178 | 3180 | _ = @import("fs/path.zig"); |
| 3179 | 3181 | _ = @import("fs/file.zig"); |
lib/std/fs/test.zig+104| ... | ... | @@ -124,6 +124,8 @@ fn testWithAllSupportedPathTypes(test_func: anytype) !void { |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | test "Dir.readLink" { |
| 127 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 128 | ||
| 127 | 129 | try testWithAllSupportedPathTypes(struct { |
| 128 | 130 | fn impl(ctx: *TestContext) !void { |
| 129 | 131 | // Create some targets |
| ... | ... | @@ -161,6 +163,8 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo |
| 161 | 163 | } |
| 162 | 164 | |
| 163 | 165 | test "relative symlink to parent directory" { |
| 166 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 167 | ||
| 164 | 168 | var tmp = tmpDir(.{}); |
| 165 | 169 | defer tmp.cleanup(); |
| 166 | 170 | |
| ... | ... | @@ -178,6 +182,8 @@ test "relative symlink to parent directory" { |
| 178 | 182 | } |
| 179 | 183 | |
| 180 | 184 | test "openDir" { |
| 185 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 186 | ||
| 181 | 187 | try testWithAllSupportedPathTypes(struct { |
| 182 | 188 | fn impl(ctx: *TestContext) !void { |
| 183 | 189 | const allocator = ctx.arena.allocator(); |
| ... | ... | @@ -196,6 +202,8 @@ test "openDir" { |
| 196 | 202 | test "accessAbsolute" { |
| 197 | 203 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 198 | 204 | |
| 205 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 206 | ||
| 199 | 207 | var tmp = tmpDir(.{}); |
| 200 | 208 | defer tmp.cleanup(); |
| 201 | 209 | |
| ... | ... | @@ -214,6 +222,8 @@ test "accessAbsolute" { |
| 214 | 222 | test "openDirAbsolute" { |
| 215 | 223 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 216 | 224 | |
| 225 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 226 | ||
| 217 | 227 | var tmp = tmpDir(.{}); |
| 218 | 228 | defer tmp.cleanup(); |
| 219 | 229 | |
| ... | ... | @@ -252,6 +262,8 @@ test "openDir non-cwd parent .." { |
| 252 | 262 | else => {}, |
| 253 | 263 | } |
| 254 | 264 | |
| 265 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 266 | ||
| 255 | 267 | var tmp = tmpDir(.{}); |
| 256 | 268 | defer tmp.cleanup(); |
| 257 | 269 | |
| ... | ... | @@ -273,6 +285,8 @@ test "openDir non-cwd parent .." { |
| 273 | 285 | test "readLinkAbsolute" { |
| 274 | 286 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 275 | 287 | |
| 288 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 289 | ||
| 276 | 290 | var tmp = tmpDir(.{}); |
| 277 | 291 | defer tmp.cleanup(); |
| 278 | 292 | |
| ... | ... | @@ -323,6 +337,8 @@ fn testReadLinkAbsolute(target_path: []const u8, symlink_path: []const u8) !void |
| 323 | 337 | } |
| 324 | 338 | |
| 325 | 339 | test "Dir.Iterator" { |
| 340 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 341 | ||
| 326 | 342 | var tmp_dir = tmpIterableDir(.{}); |
| 327 | 343 | defer tmp_dir.cleanup(); |
| 328 | 344 | |
| ... | ... | @@ -353,6 +369,8 @@ test "Dir.Iterator" { |
| 353 | 369 | } |
| 354 | 370 | |
| 355 | 371 | test "Dir.Iterator many entries" { |
| 372 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 373 | ||
| 356 | 374 | var tmp_dir = tmpIterableDir(.{}); |
| 357 | 375 | defer tmp_dir.cleanup(); |
| 358 | 376 | |
| ... | ... | @@ -388,6 +406,8 @@ test "Dir.Iterator many entries" { |
| 388 | 406 | } |
| 389 | 407 | |
| 390 | 408 | test "Dir.Iterator twice" { |
| 409 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 410 | ||
| 391 | 411 | var tmp_dir = tmpIterableDir(.{}); |
| 392 | 412 | defer tmp_dir.cleanup(); |
| 393 | 413 | |
| ... | ... | @@ -421,6 +441,8 @@ test "Dir.Iterator twice" { |
| 421 | 441 | } |
| 422 | 442 | |
| 423 | 443 | test "Dir.Iterator reset" { |
| 444 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 445 | ||
| 424 | 446 | var tmp_dir = tmpIterableDir(.{}); |
| 425 | 447 | defer tmp_dir.cleanup(); |
| 426 | 448 | |
| ... | ... | @@ -457,6 +479,8 @@ test "Dir.Iterator reset" { |
| 457 | 479 | } |
| 458 | 480 | |
| 459 | 481 | test "Dir.Iterator but dir is deleted during iteration" { |
| 482 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 483 | ||
| 460 | 484 | var tmp = std.testing.tmpDir(.{}); |
| 461 | 485 | defer tmp.cleanup(); |
| 462 | 486 | |
| ... | ... | @@ -499,6 +523,8 @@ fn contains(entries: *const std.ArrayList(IterableDir.Entry), el: IterableDir.En |
| 499 | 523 | test "Dir.realpath smoke test" { |
| 500 | 524 | if (!comptime std.os.isGetFdPathSupportedOnTarget(builtin.os)) return error.SkipZigTest; |
| 501 | 525 | |
| 526 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 527 | ||
| 502 | 528 | try testWithAllSupportedPathTypes(struct { |
| 503 | 529 | fn impl(ctx: *TestContext) !void { |
| 504 | 530 | const allocator = ctx.arena.allocator(); |
| ... | ... | @@ -549,6 +575,8 @@ test "Dir.realpath smoke test" { |
| 549 | 575 | } |
| 550 | 576 | |
| 551 | 577 | test "readAllAlloc" { |
| 578 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 579 | ||
| 552 | 580 | var tmp_dir = tmpDir(.{}); |
| 553 | 581 | defer tmp_dir.cleanup(); |
| 554 | 582 | |
| ... | ... | @@ -585,6 +613,8 @@ test "Dir.statFile" { |
| 585 | 613 | // TODO: Re-enable once https://github.com/ziglang/zig/issues/17034 is solved |
| 586 | 614 | if (builtin.os.tag == .linux and builtin.link_libc and builtin.abi == .gnu) return error.SkipZigTest; |
| 587 | 615 | |
| 616 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 617 | ||
| 588 | 618 | try testWithAllSupportedPathTypes(struct { |
| 589 | 619 | fn impl(ctx: *TestContext) !void { |
| 590 | 620 | const test_file_name = try ctx.transformPath("test_file"); |
| ... | ... | @@ -600,6 +630,8 @@ test "Dir.statFile" { |
| 600 | 630 | } |
| 601 | 631 | |
| 602 | 632 | test "directory operations on files" { |
| 633 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 634 | ||
| 603 | 635 | try testWithAllSupportedPathTypes(struct { |
| 604 | 636 | fn impl(ctx: *TestContext) !void { |
| 605 | 637 | const test_file_name = try ctx.transformPath("test_file"); |
| ... | ... | @@ -629,6 +661,8 @@ test "file operations on directories" { |
| 629 | 661 | // TODO: fix this test on FreeBSD. https://github.com/ziglang/zig/issues/1759 |
| 630 | 662 | if (builtin.os.tag == .freebsd) return error.SkipZigTest; |
| 631 | 663 | |
| 664 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 665 | ||
| 632 | 666 | try testWithAllSupportedPathTypes(struct { |
| 633 | 667 | fn impl(ctx: *TestContext) !void { |
| 634 | 668 | const test_dir_name = try ctx.transformPath("test_dir"); |
| ... | ... | @@ -664,6 +698,8 @@ test "file operations on directories" { |
| 664 | 698 | } |
| 665 | 699 | |
| 666 | 700 | test "deleteDir" { |
| 701 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 702 | ||
| 667 | 703 | try testWithAllSupportedPathTypes(struct { |
| 668 | 704 | fn impl(ctx: *TestContext) !void { |
| 669 | 705 | const test_dir_path = try ctx.transformPath("test_dir"); |
| ... | ... | @@ -685,6 +721,8 @@ test "deleteDir" { |
| 685 | 721 | } |
| 686 | 722 | |
| 687 | 723 | test "Dir.rename files" { |
| 724 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 725 | ||
| 688 | 726 | try testWithAllSupportedPathTypes(struct { |
| 689 | 727 | fn impl(ctx: *TestContext) !void { |
| 690 | 728 | // Rename on Windows can hit intermittent AccessDenied errors |
| ... | ... | @@ -727,6 +765,8 @@ test "Dir.rename files" { |
| 727 | 765 | } |
| 728 | 766 | |
| 729 | 767 | test "Dir.rename directories" { |
| 768 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 769 | ||
| 730 | 770 | try testWithAllSupportedPathTypes(struct { |
| 731 | 771 | fn impl(ctx: *TestContext) !void { |
| 732 | 772 | // Rename on Windows can hit intermittent AccessDenied errors |
| ... | ... | @@ -768,6 +808,8 @@ test "Dir.rename directory onto empty dir" { |
| 768 | 808 | // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364 |
| 769 | 809 | if (builtin.os.tag == .windows) return error.SkipZigTest; |
| 770 | 810 | |
| 811 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 812 | ||
| 771 | 813 | try testWithAllSupportedPathTypes(struct { |
| 772 | 814 | fn impl(ctx: *TestContext) !void { |
| 773 | 815 | const test_dir_path = try ctx.transformPath("test_dir"); |
| ... | ... | @@ -789,6 +831,8 @@ test "Dir.rename directory onto non-empty dir" { |
| 789 | 831 | // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364 |
| 790 | 832 | if (builtin.os.tag == .windows) return error.SkipZigTest; |
| 791 | 833 | |
| 834 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 835 | ||
| 792 | 836 | try testWithAllSupportedPathTypes(struct { |
| 793 | 837 | fn impl(ctx: *TestContext) !void { |
| 794 | 838 | const test_dir_path = try ctx.transformPath("test_dir"); |
| ... | ... | @@ -815,6 +859,8 @@ test "Dir.rename file <-> dir" { |
| 815 | 859 | // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364 |
| 816 | 860 | if (builtin.os.tag == .windows) return error.SkipZigTest; |
| 817 | 861 | |
| 862 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 863 | ||
| 818 | 864 | try testWithAllSupportedPathTypes(struct { |
| 819 | 865 | fn impl(ctx: *TestContext) !void { |
| 820 | 866 | const test_file_path = try ctx.transformPath("test_file"); |
| ... | ... | @@ -830,6 +876,8 @@ test "Dir.rename file <-> dir" { |
| 830 | 876 | } |
| 831 | 877 | |
| 832 | 878 | test "rename" { |
| 879 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 880 | ||
| 833 | 881 | var tmp_dir1 = tmpDir(.{}); |
| 834 | 882 | defer tmp_dir1.cleanup(); |
| 835 | 883 | |
| ... | ... | @@ -852,6 +900,8 @@ test "rename" { |
| 852 | 900 | test "renameAbsolute" { |
| 853 | 901 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 854 | 902 | |
| 903 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 904 | ||
| 855 | 905 | var tmp_dir = tmpDir(.{}); |
| 856 | 906 | defer tmp_dir.cleanup(); |
| 857 | 907 | |
| ... | ... | @@ -910,6 +960,8 @@ test "openSelfExe" { |
| 910 | 960 | } |
| 911 | 961 | |
| 912 | 962 | test "makePath, put some files in it, deleteTree" { |
| 963 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 964 | ||
| 913 | 965 | try testWithAllSupportedPathTypes(struct { |
| 914 | 966 | fn impl(ctx: *TestContext) !void { |
| 915 | 967 | const allocator = ctx.arena.allocator(); |
| ... | ... | @@ -926,6 +978,8 @@ test "makePath, put some files in it, deleteTree" { |
| 926 | 978 | } |
| 927 | 979 | |
| 928 | 980 | test "makePath, put some files in it, deleteTreeMinStackSize" { |
| 981 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 982 | ||
| 929 | 983 | try testWithAllSupportedPathTypes(struct { |
| 930 | 984 | fn impl(ctx: *TestContext) !void { |
| 931 | 985 | const allocator = ctx.arena.allocator(); |
| ... | ... | @@ -944,6 +998,8 @@ test "makePath, put some files in it, deleteTreeMinStackSize" { |
| 944 | 998 | test "makePath in a directory that no longer exists" { |
| 945 | 999 | if (builtin.os.tag == .windows) return error.SkipZigTest; // Windows returns FileBusy if attempting to remove an open dir |
| 946 | 1000 | |
| 1001 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1002 | ||
| 947 | 1003 | var tmp = tmpDir(.{}); |
| 948 | 1004 | defer tmp.cleanup(); |
| 949 | 1005 | try tmp.parent_dir.deleteTree(&tmp.sub_path); |
| ... | ... | @@ -975,6 +1031,8 @@ fn testFilenameLimits(iterable_dir: IterableDir, maxed_filename: []const u8) !vo |
| 975 | 1031 | } |
| 976 | 1032 | |
| 977 | 1033 | test "max file name component lengths" { |
| 1034 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1035 | ||
| 978 | 1036 | var tmp = tmpIterableDir(.{}); |
| 979 | 1037 | defer tmp.cleanup(); |
| 980 | 1038 | |
| ... | ... | @@ -996,6 +1054,8 @@ test "max file name component lengths" { |
| 996 | 1054 | } |
| 997 | 1055 | |
| 998 | 1056 | test "writev, readv" { |
| 1057 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1058 | ||
| 999 | 1059 | var tmp = tmpDir(.{}); |
| 1000 | 1060 | defer tmp.cleanup(); |
| 1001 | 1061 | |
| ... | ... | @@ -1038,6 +1098,8 @@ test "writev, readv" { |
| 1038 | 1098 | } |
| 1039 | 1099 | |
| 1040 | 1100 | test "pwritev, preadv" { |
| 1101 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1102 | ||
| 1041 | 1103 | var tmp = tmpDir(.{}); |
| 1042 | 1104 | defer tmp.cleanup(); |
| 1043 | 1105 | |
| ... | ... | @@ -1079,6 +1141,8 @@ test "pwritev, preadv" { |
| 1079 | 1141 | } |
| 1080 | 1142 | |
| 1081 | 1143 | test "access file" { |
| 1144 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1145 | ||
| 1082 | 1146 | try testWithAllSupportedPathTypes(struct { |
| 1083 | 1147 | fn impl(ctx: *TestContext) !void { |
| 1084 | 1148 | const dir_path = try ctx.transformPath("os_test_tmp"); |
| ... | ... | @@ -1095,6 +1159,8 @@ test "access file" { |
| 1095 | 1159 | } |
| 1096 | 1160 | |
| 1097 | 1161 | test "sendfile" { |
| 1162 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1163 | ||
| 1098 | 1164 | var tmp = tmpDir(.{}); |
| 1099 | 1165 | defer tmp.cleanup(); |
| 1100 | 1166 | |
| ... | ... | @@ -1160,6 +1226,8 @@ test "sendfile" { |
| 1160 | 1226 | } |
| 1161 | 1227 | |
| 1162 | 1228 | test "copyRangeAll" { |
| 1229 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1230 | ||
| 1163 | 1231 | var tmp = tmpDir(.{}); |
| 1164 | 1232 | defer tmp.cleanup(); |
| 1165 | 1233 | |
| ... | ... | @@ -1186,6 +1254,8 @@ test "copyRangeAll" { |
| 1186 | 1254 | } |
| 1187 | 1255 | |
| 1188 | 1256 | test "copyFile" { |
| 1257 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1258 | ||
| 1189 | 1259 | try testWithAllSupportedPathTypes(struct { |
| 1190 | 1260 | fn impl(ctx: *TestContext) !void { |
| 1191 | 1261 | const data = "u6wj+JmdF3qHsFPE BUlH2g4gJCmEz0PP"; |
| ... | ... | @@ -1216,6 +1286,8 @@ fn expectFileContents(dir: Dir, file_path: []const u8, data: []const u8) !void { |
| 1216 | 1286 | } |
| 1217 | 1287 | |
| 1218 | 1288 | test "AtomicFile" { |
| 1289 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1290 | ||
| 1219 | 1291 | try testWithAllSupportedPathTypes(struct { |
| 1220 | 1292 | fn impl(ctx: *TestContext) !void { |
| 1221 | 1293 | const allocator = ctx.arena.allocator(); |
| ... | ... | @@ -1242,6 +1314,8 @@ test "AtomicFile" { |
| 1242 | 1314 | test "open file with exclusive nonblocking lock twice" { |
| 1243 | 1315 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 1244 | 1316 | |
| 1317 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1318 | ||
| 1245 | 1319 | try testWithAllSupportedPathTypes(struct { |
| 1246 | 1320 | fn impl(ctx: *TestContext) !void { |
| 1247 | 1321 | const filename = try ctx.transformPath("file_nonblocking_lock_test.txt"); |
| ... | ... | @@ -1258,6 +1332,8 @@ test "open file with exclusive nonblocking lock twice" { |
| 1258 | 1332 | test "open file with shared and exclusive nonblocking lock" { |
| 1259 | 1333 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 1260 | 1334 | |
| 1335 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1336 | ||
| 1261 | 1337 | try testWithAllSupportedPathTypes(struct { |
| 1262 | 1338 | fn impl(ctx: *TestContext) !void { |
| 1263 | 1339 | const filename = try ctx.transformPath("file_nonblocking_lock_test.txt"); |
| ... | ... | @@ -1274,6 +1350,8 @@ test "open file with shared and exclusive nonblocking lock" { |
| 1274 | 1350 | test "open file with exclusive and shared nonblocking lock" { |
| 1275 | 1351 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 1276 | 1352 | |
| 1353 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1354 | ||
| 1277 | 1355 | try testWithAllSupportedPathTypes(struct { |
| 1278 | 1356 | fn impl(ctx: *TestContext) !void { |
| 1279 | 1357 | const filename = try ctx.transformPath("file_nonblocking_lock_test.txt"); |
| ... | ... | @@ -1288,6 +1366,8 @@ test "open file with exclusive and shared nonblocking lock" { |
| 1288 | 1366 | } |
| 1289 | 1367 | |
| 1290 | 1368 | test "open file with exclusive lock twice, make sure second lock waits" { |
| 1369 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1370 | ||
| 1291 | 1371 | if (builtin.single_threaded) return error.SkipZigTest; |
| 1292 | 1372 | |
| 1293 | 1373 | if (std.io.is_async) { |
| ... | ... | @@ -1338,6 +1418,8 @@ test "open file with exclusive lock twice, make sure second lock waits" { |
| 1338 | 1418 | test "open file with exclusive nonblocking lock twice (absolute paths)" { |
| 1339 | 1419 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 1340 | 1420 | |
| 1421 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1422 | ||
| 1341 | 1423 | var random_bytes: [12]u8 = undefined; |
| 1342 | 1424 | std.crypto.random.bytes(&random_bytes); |
| 1343 | 1425 | |
| ... | ... | @@ -1372,6 +1454,8 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" { |
| 1372 | 1454 | test "walker" { |
| 1373 | 1455 | if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest; |
| 1374 | 1456 | |
| 1457 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1458 | ||
| 1375 | 1459 | var tmp = tmpIterableDir(.{}); |
| 1376 | 1460 | defer tmp.cleanup(); |
| 1377 | 1461 | |
| ... | ... | @@ -1425,6 +1509,8 @@ test "walker" { |
| 1425 | 1509 | test "walker without fully iterating" { |
| 1426 | 1510 | if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest; |
| 1427 | 1511 | |
| 1512 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1513 | ||
| 1428 | 1514 | var tmp = tmpIterableDir(.{}); |
| 1429 | 1515 | defer tmp.cleanup(); |
| 1430 | 1516 | |
| ... | ... | @@ -1448,6 +1534,8 @@ test "walker without fully iterating" { |
| 1448 | 1534 | test ". and .. in fs.Dir functions" { |
| 1449 | 1535 | if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest; |
| 1450 | 1536 | |
| 1537 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1538 | ||
| 1451 | 1539 | if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64) { |
| 1452 | 1540 | // https://github.com/ziglang/zig/issues/17134 |
| 1453 | 1541 | return error.SkipZigTest; |
| ... | ... | @@ -1488,6 +1576,8 @@ test ". and .. in fs.Dir functions" { |
| 1488 | 1576 | test ". and .. in absolute functions" { |
| 1489 | 1577 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 1490 | 1578 | |
| 1579 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1580 | ||
| 1491 | 1581 | var tmp = tmpDir(.{}); |
| 1492 | 1582 | defer tmp.cleanup(); |
| 1493 | 1583 | |
| ... | ... | @@ -1533,6 +1623,8 @@ test "chmod" { |
| 1533 | 1623 | if (builtin.os.tag == .windows or builtin.os.tag == .wasi) |
| 1534 | 1624 | return error.SkipZigTest; |
| 1535 | 1625 | |
| 1626 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1627 | ||
| 1536 | 1628 | var tmp = tmpDir(.{}); |
| 1537 | 1629 | defer tmp.cleanup(); |
| 1538 | 1630 | |
| ... | ... | @@ -1555,6 +1647,8 @@ test "chown" { |
| 1555 | 1647 | if (builtin.os.tag == .windows or builtin.os.tag == .wasi) |
| 1556 | 1648 | return error.SkipZigTest; |
| 1557 | 1649 | |
| 1650 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1651 | ||
| 1558 | 1652 | var tmp = tmpDir(.{}); |
| 1559 | 1653 | defer tmp.cleanup(); |
| 1560 | 1654 | |
| ... | ... | @@ -1570,6 +1664,8 @@ test "chown" { |
| 1570 | 1664 | } |
| 1571 | 1665 | |
| 1572 | 1666 | test "File.Metadata" { |
| 1667 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1668 | ||
| 1573 | 1669 | var tmp = tmpDir(.{}); |
| 1574 | 1670 | defer tmp.cleanup(); |
| 1575 | 1671 | |
| ... | ... | @@ -1588,6 +1684,8 @@ test "File.Permissions" { |
| 1588 | 1684 | if (builtin.os.tag == .wasi) |
| 1589 | 1685 | return error.SkipZigTest; |
| 1590 | 1686 | |
| 1687 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1688 | ||
| 1591 | 1689 | var tmp = tmpDir(.{}); |
| 1592 | 1690 | defer tmp.cleanup(); |
| 1593 | 1691 | |
| ... | ... | @@ -1614,6 +1712,8 @@ test "File.PermissionsUnix" { |
| 1614 | 1712 | if (builtin.os.tag == .windows or builtin.os.tag == .wasi) |
| 1615 | 1713 | return error.SkipZigTest; |
| 1616 | 1714 | |
| 1715 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1716 | ||
| 1617 | 1717 | var tmp = tmpDir(.{}); |
| 1618 | 1718 | defer tmp.cleanup(); |
| 1619 | 1719 | |
| ... | ... | @@ -1649,6 +1749,8 @@ test "delete a read-only file on windows" { |
| 1649 | 1749 | if (builtin.os.tag != .windows) |
| 1650 | 1750 | return error.SkipZigTest; |
| 1651 | 1751 | |
| 1752 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1753 | ||
| 1652 | 1754 | var tmp = testing.tmpDir(.{}); |
| 1653 | 1755 | defer tmp.cleanup(); |
| 1654 | 1756 | |
| ... | ... | @@ -1679,6 +1781,8 @@ test "delete a read-only file on windows" { |
| 1679 | 1781 | test "delete a setAsCwd directory on Windows" { |
| 1680 | 1782 | if (builtin.os.tag != .windows) return error.SkipZigTest; |
| 1681 | 1783 | |
| 1784 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1785 | ||
| 1682 | 1786 | var tmp = tmpDir(.{}); |
| 1683 | 1787 | // Set tmp dir as current working directory. |
| 1684 | 1788 | try tmp.dir.setAsCwd(); |
lib/std/hash/xxhash.zig+18| ... | ... | @@ -803,6 +803,8 @@ fn testExpect(comptime H: type, seed: anytype, input: []const u8, expected: u64) |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | test "xxhash3" { |
| 806 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 807 | ||
| 806 | 808 | const H = XxHash3; |
| 807 | 809 | // Non-Seeded Tests |
| 808 | 810 | try testExpect(H, 0, "", 0x2d06800538d394c2); |
| ... | ... | @@ -834,6 +836,8 @@ test "xxhash3" { |
| 834 | 836 | } |
| 835 | 837 | |
| 836 | 838 | test "xxhash3 smhasher" { |
| 839 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 840 | ||
| 837 | 841 | const Test = struct { |
| 838 | 842 | fn do() !void { |
| 839 | 843 | try expectEqual(verify.smhasher(XxHash3.hash), 0x9a636405); |
| ... | ... | @@ -845,6 +849,8 @@ test "xxhash3 smhasher" { |
| 845 | 849 | } |
| 846 | 850 | |
| 847 | 851 | test "xxhash3 iterative api" { |
| 852 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 853 | ||
| 848 | 854 | const Test = struct { |
| 849 | 855 | fn do() !void { |
| 850 | 856 | try verify.iterativeApi(XxHash3); |
| ... | ... | @@ -856,6 +862,8 @@ test "xxhash3 iterative api" { |
| 856 | 862 | } |
| 857 | 863 | |
| 858 | 864 | test "xxhash64" { |
| 865 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 866 | ||
| 859 | 867 | const H = XxHash64; |
| 860 | 868 | try testExpect(H, 0, "", 0xef46db3751d8e999); |
| 861 | 869 | try testExpect(H, 0, "a", 0xd24ec4f1a98c6e5b); |
| ... | ... | @@ -867,6 +875,8 @@ test "xxhash64" { |
| 867 | 875 | } |
| 868 | 876 | |
| 869 | 877 | test "xxhash64 smhasher" { |
| 878 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 879 | ||
| 870 | 880 | const Test = struct { |
| 871 | 881 | fn do() !void { |
| 872 | 882 | try expectEqual(verify.smhasher(XxHash64.hash), 0x024B7CF4); |
| ... | ... | @@ -878,6 +888,8 @@ test "xxhash64 smhasher" { |
| 878 | 888 | } |
| 879 | 889 | |
| 880 | 890 | test "xxhash64 iterative api" { |
| 891 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 892 | ||
| 881 | 893 | const Test = struct { |
| 882 | 894 | fn do() !void { |
| 883 | 895 | try verify.iterativeApi(XxHash64); |
| ... | ... | @@ -889,6 +901,8 @@ test "xxhash64 iterative api" { |
| 889 | 901 | } |
| 890 | 902 | |
| 891 | 903 | test "xxhash32" { |
| 904 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 905 | ||
| 892 | 906 | const H = XxHash32; |
| 893 | 907 | |
| 894 | 908 | try testExpect(H, 0, "", 0x02cc5d05); |
| ... | ... | @@ -901,6 +915,8 @@ test "xxhash32" { |
| 901 | 915 | } |
| 902 | 916 | |
| 903 | 917 | test "xxhash32 smhasher" { |
| 918 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 919 | ||
| 904 | 920 | const Test = struct { |
| 905 | 921 | fn do() !void { |
| 906 | 922 | try expectEqual(verify.smhasher(XxHash32.hash), 0xBA88B743); |
| ... | ... | @@ -912,6 +928,8 @@ test "xxhash32 smhasher" { |
| 912 | 928 | } |
| 913 | 929 | |
| 914 | 930 | test "xxhash32 iterative api" { |
| 931 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 932 | ||
| 915 | 933 | const Test = struct { |
| 916 | 934 | fn do() !void { |
| 917 | 935 | try verify.iterativeApi(XxHash32); |
lib/std/http/Client.zig+6-2| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | //! Connecting and opening requests are threadsafe. Individual requests are not. |
| 2 | 2 | |
| 3 | 3 | const std = @import("../std.zig"); |
| 4 | const builtin = @import("builtin"); | |
| 4 | 5 | const testing = std.testing; |
| 5 | 6 | const http = std.http; |
| 6 | 7 | const mem = std.mem; |
| ... | ... | @@ -427,6 +428,8 @@ pub const Response = struct { |
| 427 | 428 | } |
| 428 | 429 | |
| 429 | 430 | test parseInt3 { |
| 431 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 432 | ||
| 430 | 433 | const expectEqual = testing.expectEqual; |
| 431 | 434 | try expectEqual(@as(u10, 0), parseInt3("000".*)); |
| 432 | 435 | try expectEqual(@as(u10, 418), parseInt3("418".*)); |
| ... | ... | @@ -585,7 +588,7 @@ pub const Request = struct { |
| 585 | 588 | |
| 586 | 589 | if (!req.headers.contains("user-agent")) { |
| 587 | 590 | try w.writeAll("User-Agent: zig/"); |
| 588 | try w.writeAll(@import("builtin").zig_version_string); | |
| 591 | try w.writeAll(builtin.zig_version_string); | |
| 589 | 592 | try w.writeAll(" (std.http)\r\n"); |
| 590 | 593 | } |
| 591 | 594 | |
| ... | ... | @@ -1249,7 +1252,6 @@ pub fn fetch(client: *Client, allocator: Allocator, options: FetchOptions) !Fetc |
| 1249 | 1252 | } |
| 1250 | 1253 | |
| 1251 | 1254 | test { |
| 1252 | const builtin = @import("builtin"); | |
| 1253 | 1255 | const native_endian = comptime builtin.cpu.arch.endian(); |
| 1254 | 1256 | if (builtin.zig_backend == .stage2_llvm and native_endian == .Big) { |
| 1255 | 1257 | // https://github.com/ziglang/zig/issues/13782 |
| ... | ... | @@ -1258,5 +1260,7 @@ test { |
| 1258 | 1260 | |
| 1259 | 1261 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 1260 | 1262 | |
| 1263 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1264 | ||
| 1261 | 1265 | std.testing.refAllDecls(@This()); |
| 1262 | 1266 | } |
lib/std/http/Server.zig+2| ... | ... | @@ -725,6 +725,8 @@ test "HTTP server handles a chunked transfer coding request" { |
| 725 | 725 | return error.SkipZigTest; |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 729 | ||
| 728 | 730 | const native_endian = comptime builtin.cpu.arch.endian(); |
| 729 | 731 | if (builtin.zig_backend == .stage2_llvm and native_endian == .Big) { |
| 730 | 732 | // https://github.com/ziglang/zig/issues/13782 |
lib/std/io/multi_writer.zig+1| ... | ... | @@ -36,6 +36,7 @@ pub fn multiWriter(streams: anytype) MultiWriter(@TypeOf(streams)) { |
| 36 | 36 | const testing = std.testing; |
| 37 | 37 | |
| 38 | 38 | test "MultiWriter" { |
| 39 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 39 | 40 | var tmp = testing.tmpDir(.{}); |
| 40 | 41 | defer tmp.cleanup(); |
| 41 | 42 | var f = try tmp.dir.createFile("t.txt", .{}); |
lib/std/io/test.zig+10| ... | ... | @@ -15,6 +15,8 @@ const native_endian = builtin.target.cpu.arch.endian(); |
| 15 | 15 | const tmpDir = std.testing.tmpDir; |
| 16 | 16 | |
| 17 | 17 | test "write a file, read it, then delete it" { |
| 18 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 19 | ||
| 18 | 20 | var tmp = tmpDir(.{}); |
| 19 | 21 | defer tmp.cleanup(); |
| 20 | 22 | |
| ... | ... | @@ -61,6 +63,8 @@ test "write a file, read it, then delete it" { |
| 61 | 63 | } |
| 62 | 64 | |
| 63 | 65 | test "BitStreams with File Stream" { |
| 66 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 67 | ||
| 64 | 68 | var tmp = tmpDir(.{}); |
| 65 | 69 | defer tmp.cleanup(); |
| 66 | 70 | |
| ... | ... | @@ -106,6 +110,8 @@ test "BitStreams with File Stream" { |
| 106 | 110 | } |
| 107 | 111 | |
| 108 | 112 | test "File seek ops" { |
| 113 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 114 | ||
| 109 | 115 | var tmp = tmpDir(.{}); |
| 110 | 116 | defer tmp.cleanup(); |
| 111 | 117 | |
| ... | ... | @@ -133,6 +139,8 @@ test "File seek ops" { |
| 133 | 139 | } |
| 134 | 140 | |
| 135 | 141 | test "setEndPos" { |
| 142 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 143 | ||
| 136 | 144 | var tmp = tmpDir(.{}); |
| 137 | 145 | defer tmp.cleanup(); |
| 138 | 146 | |
| ... | ... | @@ -159,6 +167,8 @@ test "setEndPos" { |
| 159 | 167 | } |
| 160 | 168 | |
| 161 | 169 | test "updateTimes" { |
| 170 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 171 | ||
| 162 | 172 | var tmp = tmpDir(.{}); |
| 163 | 173 | defer tmp.cleanup(); |
| 164 | 174 |
lib/std/json.zig+5| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | //! The low-level `writeStream` emits syntax-conformant JSON tokens to a `std.io.Writer`. |
| 10 | 10 | //! The high-level `stringify` serializes a Zig or `Value` type into JSON. |
| 11 | 11 | |
| 12 | const builtin = @import("builtin"); | |
| 12 | 13 | const testing = @import("std").testing; |
| 13 | 14 | const ArrayList = @import("std").ArrayList; |
| 14 | 15 | |
| ... | ... | @@ -23,6 +24,8 @@ test Scanner { |
| 23 | 24 | } |
| 24 | 25 | |
| 25 | 26 | test parseFromSlice { |
| 27 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 28 | ||
| 26 | 29 | var parsed_str = try parseFromSlice([]const u8, testing.allocator, "\"a\\u0020b\"", .{}); |
| 27 | 30 | defer parsed_str.deinit(); |
| 28 | 31 | try testing.expectEqualSlices(u8, "a b", parsed_str.value); |
| ... | ... | @@ -58,6 +61,8 @@ test writeStream { |
| 58 | 61 | } |
| 59 | 62 | |
| 60 | 63 | test stringify { |
| 64 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 65 | ||
| 61 | 66 | var out = ArrayList(u8).init(testing.allocator); |
| 62 | 67 | defer out.deinit(); |
| 63 | 68 |
lib/std/json/dynamic_test.zig+25| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const mem = std.mem; |
| 3 | 4 | const testing = std.testing; |
| 4 | 5 | const ArenaAllocator = std.heap.ArenaAllocator; |
| ... | ... | @@ -18,6 +19,8 @@ const jsonReader = @import("scanner.zig").reader; |
| 18 | 19 | const JsonReader = @import("scanner.zig").Reader; |
| 19 | 20 | |
| 20 | 21 | test "json.parser.dynamic" { |
| 22 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 23 | ||
| 21 | 24 | const s = |
| 22 | 25 | \\{ |
| 23 | 26 | \\ "Image": { |
| ... | ... | @@ -72,6 +75,8 @@ test "json.parser.dynamic" { |
| 72 | 75 | |
| 73 | 76 | const writeStream = @import("./stringify.zig").writeStream; |
| 74 | 77 | test "write json then parse it" { |
| 78 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 79 | ||
| 75 | 80 | var out_buffer: [1000]u8 = undefined; |
| 76 | 81 | |
| 77 | 82 | var fixed_buffer_stream = std.io.fixedBufferStream(&out_buffer); |
| ... | ... | @@ -120,12 +125,16 @@ fn testParse(allocator: std.mem.Allocator, json_str: []const u8) !Value { |
| 120 | 125 | } |
| 121 | 126 | |
| 122 | 127 | test "parsing empty string gives appropriate error" { |
| 128 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 129 | ||
| 123 | 130 | var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator); |
| 124 | 131 | defer arena_allocator.deinit(); |
| 125 | 132 | try testing.expectError(error.UnexpectedEndOfInput, testParse(arena_allocator.allocator(), "")); |
| 126 | 133 | } |
| 127 | 134 | |
| 128 | 135 | test "Value.array allocator should still be usable after parsing" { |
| 136 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 137 | ||
| 129 | 138 | var parsed = try parseFromSlice(Value, std.testing.allocator, "[]", .{}); |
| 130 | 139 | defer parsed.deinit(); |
| 131 | 140 | |
| ... | ... | @@ -138,6 +147,8 @@ test "Value.array allocator should still be usable after parsing" { |
| 138 | 147 | } |
| 139 | 148 | |
| 140 | 149 | test "integer after float has proper type" { |
| 150 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 151 | ||
| 141 | 152 | var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator); |
| 142 | 153 | defer arena_allocator.deinit(); |
| 143 | 154 | const parsed = try testParse(arena_allocator.allocator(), |
| ... | ... | @@ -150,6 +161,8 @@ test "integer after float has proper type" { |
| 150 | 161 | } |
| 151 | 162 | |
| 152 | 163 | test "escaped characters" { |
| 164 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 165 | ||
| 153 | 166 | var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator); |
| 154 | 167 | defer arena_allocator.deinit(); |
| 155 | 168 | const input = |
| ... | ... | @@ -182,6 +195,8 @@ test "escaped characters" { |
| 182 | 195 | } |
| 183 | 196 | |
| 184 | 197 | test "Value.jsonStringify" { |
| 198 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 199 | ||
| 185 | 200 | var vals = [_]Value{ |
| 186 | 201 | .{ .integer = 1 }, |
| 187 | 202 | .{ .integer = 2 }, |
| ... | ... | @@ -229,6 +244,8 @@ test "Value.jsonStringify" { |
| 229 | 244 | } |
| 230 | 245 | |
| 231 | 246 | test "parseFromValue(std.json.Value,...)" { |
| 247 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 248 | ||
| 232 | 249 | const str = |
| 233 | 250 | \\{ |
| 234 | 251 | \\ "int": 32, |
| ... | ... | @@ -246,6 +263,8 @@ test "parseFromValue(std.json.Value,...)" { |
| 246 | 263 | } |
| 247 | 264 | |
| 248 | 265 | test "polymorphic parsing" { |
| 266 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 267 | ||
| 249 | 268 | if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108 |
| 250 | 269 | const doc = |
| 251 | 270 | \\{ "type": "div", |
| ... | ... | @@ -291,6 +310,8 @@ test "polymorphic parsing" { |
| 291 | 310 | } |
| 292 | 311 | |
| 293 | 312 | test "long object value" { |
| 313 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 314 | ||
| 294 | 315 | const value = "01234567890123456789"; |
| 295 | 316 | const doc = "{\"key\":\"" ++ value ++ "\"}"; |
| 296 | 317 | var fbs = std.io.fixedBufferStream(doc); |
| ... | ... | @@ -303,6 +324,8 @@ test "long object value" { |
| 303 | 324 | } |
| 304 | 325 | |
| 305 | 326 | test "ParseOptions.max_value_len" { |
| 327 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 328 | ||
| 306 | 329 | var arena = ArenaAllocator.init(testing.allocator); |
| 307 | 330 | defer arena.deinit(); |
| 308 | 331 | |
| ... | ... | @@ -317,6 +340,8 @@ test "ParseOptions.max_value_len" { |
| 317 | 340 | } |
| 318 | 341 | |
| 319 | 342 | test "many object keys" { |
| 343 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 344 | ||
| 320 | 345 | const doc = |
| 321 | 346 | \\{ |
| 322 | 347 | \\ "k1": "v1", |
lib/std/json/hashmap_test.zig+13| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const testing = std.testing; |
| 3 | 4 | |
| 4 | 5 | const ArrayHashMap = @import("hashmap.zig").ArrayHashMap; |
| ... | ... | @@ -18,6 +19,8 @@ const T = struct { |
| 18 | 19 | }; |
| 19 | 20 | |
| 20 | 21 | test "parse json hashmap" { |
| 22 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 23 | ||
| 21 | 24 | const doc = |
| 22 | 25 | \\{ |
| 23 | 26 | \\ "abc": {"i": 0, "s": "d"}, |
| ... | ... | @@ -33,6 +36,8 @@ test "parse json hashmap" { |
| 33 | 36 | } |
| 34 | 37 | |
| 35 | 38 | test "parse json hashmap while streaming" { |
| 39 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 40 | ||
| 36 | 41 | const doc = |
| 37 | 42 | \\{ |
| 38 | 43 | \\ "abc": {"i": 0, "s": "d"}, |
| ... | ... | @@ -58,6 +63,8 @@ test "parse json hashmap while streaming" { |
| 58 | 63 | } |
| 59 | 64 | |
| 60 | 65 | test "parse json hashmap duplicate fields" { |
| 66 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 67 | ||
| 61 | 68 | var arena = std.heap.ArenaAllocator.init(std.testing.allocator); |
| 62 | 69 | defer arena.deinit(); |
| 63 | 70 | |
| ... | ... | @@ -86,6 +93,8 @@ test "parse json hashmap duplicate fields" { |
| 86 | 93 | } |
| 87 | 94 | |
| 88 | 95 | test "stringify json hashmap" { |
| 96 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 97 | ||
| 89 | 98 | var value = ArrayHashMap(T){}; |
| 90 | 99 | defer value.deinit(testing.allocator); |
| 91 | 100 | { |
| ... | ... | @@ -123,6 +132,8 @@ test "stringify json hashmap" { |
| 123 | 132 | } |
| 124 | 133 | |
| 125 | 134 | test "stringify json hashmap whitespace" { |
| 135 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 136 | ||
| 126 | 137 | var value = ArrayHashMap(T){}; |
| 127 | 138 | defer value.deinit(testing.allocator); |
| 128 | 139 | try value.map.put(testing.allocator, "abc", .{ .i = 0, .s = "d" }); |
| ... | ... | @@ -147,6 +158,8 @@ test "stringify json hashmap whitespace" { |
| 147 | 158 | } |
| 148 | 159 | |
| 149 | 160 | test "json parse from value hashmap" { |
| 161 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 162 | ||
| 150 | 163 | const doc = |
| 151 | 164 | \\{ |
| 152 | 165 | \\ "abc": {"i": 0, "s": "d"}, |
lib/std/json/static_test.zig+49| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const testing = std.testing; |
| 3 | 4 | const ArenaAllocator = std.heap.ArenaAllocator; |
| 4 | 5 | const Allocator = std.mem.Allocator; |
| ... | ... | @@ -371,6 +372,8 @@ test "test all types" { |
| 371 | 372 | } |
| 372 | 373 | |
| 373 | 374 | test "parse" { |
| 375 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 376 | ||
| 374 | 377 | try testing.expectEqual(false, try parseFromSliceLeaky(bool, testing.allocator, "false", .{})); |
| 375 | 378 | try testing.expectEqual(true, try parseFromSliceLeaky(bool, testing.allocator, "true", .{})); |
| 376 | 379 | try testing.expectEqual(@as(u1, 1), try parseFromSliceLeaky(u1, testing.allocator, "1", .{})); |
| ... | ... | @@ -389,6 +392,8 @@ test "parse" { |
| 389 | 392 | } |
| 390 | 393 | |
| 391 | 394 | test "parse into enum" { |
| 395 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 396 | ||
| 392 | 397 | const T = enum(u32) { |
| 393 | 398 | Foo = 42, |
| 394 | 399 | Bar, |
| ... | ... | @@ -402,6 +407,8 @@ test "parse into enum" { |
| 402 | 407 | } |
| 403 | 408 | |
| 404 | 409 | test "parse into that allocates a slice" { |
| 410 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 411 | ||
| 405 | 412 | { |
| 406 | 413 | // string as string |
| 407 | 414 | const parsed = try parseFromSlice([]u8, testing.allocator, "\"foo\"", .{}); |
| ... | ... | @@ -422,12 +429,16 @@ test "parse into that allocates a slice" { |
| 422 | 429 | } |
| 423 | 430 | |
| 424 | 431 | test "parse into sentinel slice" { |
| 432 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 433 | ||
| 425 | 434 | const parsed = try parseFromSlice([:0]const u8, testing.allocator, "\"\\n\"", .{}); |
| 426 | 435 | defer parsed.deinit(); |
| 427 | 436 | try testing.expect(std.mem.eql(u8, parsed.value, "\n")); |
| 428 | 437 | } |
| 429 | 438 | |
| 430 | 439 | test "parse into tagged union" { |
| 440 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 441 | ||
| 431 | 442 | const T = union(enum) { |
| 432 | 443 | nothing, |
| 433 | 444 | int: i32, |
| ... | ... | @@ -443,6 +454,8 @@ test "parse into tagged union" { |
| 443 | 454 | } |
| 444 | 455 | |
| 445 | 456 | test "parse into tagged union errors" { |
| 457 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 458 | ||
| 446 | 459 | const T = union(enum) { |
| 447 | 460 | nothing, |
| 448 | 461 | int: i32, |
| ... | ... | @@ -465,6 +478,8 @@ test "parse into tagged union errors" { |
| 465 | 478 | } |
| 466 | 479 | |
| 467 | 480 | test "parse into struct with no fields" { |
| 481 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 482 | ||
| 468 | 483 | const T = struct {}; |
| 469 | 484 | const parsed = try parseFromSlice(T, testing.allocator, "{}", .{}); |
| 470 | 485 | defer parsed.deinit(); |
| ... | ... | @@ -474,6 +489,8 @@ test "parse into struct with no fields" { |
| 474 | 489 | const test_const_value: usize = 123; |
| 475 | 490 | |
| 476 | 491 | test "parse into struct with default const pointer field" { |
| 492 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 493 | ||
| 477 | 494 | const T = struct { a: *const usize = &test_const_value }; |
| 478 | 495 | const parsed = try parseFromSlice(T, testing.allocator, "{}", .{}); |
| 479 | 496 | defer parsed.deinit(); |
| ... | ... | @@ -489,6 +506,8 @@ const test_default_str_slice: [2][]const u8 = [_][]const u8{ |
| 489 | 506 | }; |
| 490 | 507 | |
| 491 | 508 | test "freeing parsed structs with pointers to default values" { |
| 509 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 510 | ||
| 492 | 511 | const T = struct { |
| 493 | 512 | int: *const usize = &test_default_usize, |
| 494 | 513 | int_ptr: *allowzero align(1) const usize = test_default_usize_ptr, |
| ... | ... | @@ -502,11 +521,15 @@ test "freeing parsed structs with pointers to default values" { |
| 502 | 521 | } |
| 503 | 522 | |
| 504 | 523 | test "parse into struct where destination and source lengths mismatch" { |
| 524 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 525 | ||
| 505 | 526 | const T = struct { a: [2]u8 }; |
| 506 | 527 | try testing.expectError(error.LengthMismatch, parseFromSlice(T, testing.allocator, "{\"a\": \"bbb\"}", .{})); |
| 507 | 528 | } |
| 508 | 529 | |
| 509 | 530 | test "parse into struct with misc fields" { |
| 531 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 532 | ||
| 510 | 533 | const T = struct { |
| 511 | 534 | int: i64, |
| 512 | 535 | float: f64, |
| ... | ... | @@ -582,6 +605,8 @@ test "parse into struct with misc fields" { |
| 582 | 605 | } |
| 583 | 606 | |
| 584 | 607 | test "parse into struct with strings and arrays with sentinels" { |
| 608 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 609 | ||
| 585 | 610 | const T = struct { |
| 586 | 611 | language: [:0]const u8, |
| 587 | 612 | language_without_sentinel: []const u8, |
| ... | ... | @@ -610,6 +635,8 @@ test "parse into struct with strings and arrays with sentinels" { |
| 610 | 635 | } |
| 611 | 636 | |
| 612 | 637 | test "parse into struct with duplicate field" { |
| 638 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 639 | ||
| 613 | 640 | const options_first = ParseOptions{ .duplicate_field_behavior = .use_first }; |
| 614 | 641 | const options_last = ParseOptions{ .duplicate_field_behavior = .use_last }; |
| 615 | 642 | |
| ... | ... | @@ -629,6 +656,8 @@ test "parse into struct with duplicate field" { |
| 629 | 656 | } |
| 630 | 657 | |
| 631 | 658 | test "parse into struct ignoring unknown fields" { |
| 659 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 660 | ||
| 632 | 661 | const T = struct { |
| 633 | 662 | int: i64, |
| 634 | 663 | language: []const u8, |
| ... | ... | @@ -667,6 +696,8 @@ test "parse into struct ignoring unknown fields" { |
| 667 | 696 | } |
| 668 | 697 | |
| 669 | 698 | test "parse into tuple" { |
| 699 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 700 | ||
| 670 | 701 | const Union = union(enum) { |
| 671 | 702 | char: u8, |
| 672 | 703 | float: f64, |
| ... | ... | @@ -722,6 +753,8 @@ const ParseIntoRecursiveUnionDefinitionValue = union(enum) { |
| 722 | 753 | }; |
| 723 | 754 | |
| 724 | 755 | test "parse into recursive union definition" { |
| 756 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 757 | ||
| 725 | 758 | const T = struct { |
| 726 | 759 | values: ParseIntoRecursiveUnionDefinitionValue, |
| 727 | 760 | }; |
| ... | ... | @@ -743,6 +776,8 @@ const ParseIntoDoubleRecursiveUnionValueSecond = union(enum) { |
| 743 | 776 | }; |
| 744 | 777 | |
| 745 | 778 | test "parse into double recursive union definition" { |
| 779 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 780 | ||
| 746 | 781 | const T = struct { |
| 747 | 782 | values: ParseIntoDoubleRecursiveUnionValueFirst, |
| 748 | 783 | }; |
| ... | ... | @@ -754,6 +789,8 @@ test "parse into double recursive union definition" { |
| 754 | 789 | } |
| 755 | 790 | |
| 756 | 791 | test "parse exponential into int" { |
| 792 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 793 | ||
| 757 | 794 | const T = struct { int: i64 }; |
| 758 | 795 | const r = try parseFromSliceLeaky(T, testing.allocator, "{ \"int\": 4.2e2 }", .{}); |
| 759 | 796 | try testing.expectEqual(@as(i64, 420), r.int); |
| ... | ... | @@ -762,6 +799,8 @@ test "parse exponential into int" { |
| 762 | 799 | } |
| 763 | 800 | |
| 764 | 801 | test "parseFromTokenSource" { |
| 802 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 803 | ||
| 765 | 804 | { |
| 766 | 805 | var scanner = JsonScanner.initCompleteInput(testing.allocator, "123"); |
| 767 | 806 | defer scanner.deinit(); |
| ... | ... | @@ -781,10 +820,14 @@ test "parseFromTokenSource" { |
| 781 | 820 | } |
| 782 | 821 | |
| 783 | 822 | test "max_value_len" { |
| 823 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 824 | ||
| 784 | 825 | try testing.expectError(error.ValueTooLong, parseFromSlice([]u8, testing.allocator, "\"0123456789\"", .{ .max_value_len = 5 })); |
| 785 | 826 | } |
| 786 | 827 | |
| 787 | 828 | test "parse into vector" { |
| 829 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 830 | ||
| 788 | 831 | const T = struct { |
| 789 | 832 | vec_i32: @Vector(4, i32), |
| 790 | 833 | vec_f32: @Vector(2, f32), |
| ... | ... | @@ -817,6 +860,8 @@ fn assertKey( |
| 817 | 860 | } |
| 818 | 861 | } |
| 819 | 862 | test "json parse partial" { |
| 863 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 864 | ||
| 820 | 865 | const Inner = struct { |
| 821 | 866 | num: u32, |
| 822 | 867 | yes: bool, |
| ... | ... | @@ -872,6 +917,8 @@ test "json parse partial" { |
| 872 | 917 | } |
| 873 | 918 | |
| 874 | 919 | test "json parse allocate when streaming" { |
| 920 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 921 | ||
| 875 | 922 | const T = struct { |
| 876 | 923 | not_const: []u8, |
| 877 | 924 | is_const: []const u8, |
| ... | ... | @@ -902,6 +949,8 @@ test "json parse allocate when streaming" { |
| 902 | 949 | } |
| 903 | 950 | |
| 904 | 951 | test "parse at comptime" { |
| 952 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 953 | ||
| 905 | 954 | const doc = |
| 906 | 955 | \\{ |
| 907 | 956 | \\ "vals": { |
lib/std/json/stringify_test.zig+41| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const mem = std.mem; |
| 3 | 4 | const testing = std.testing; |
| 4 | 5 | |
| ... | ... | @@ -15,6 +16,8 @@ const writeStreamMaxDepth = @import("stringify.zig").writeStreamMaxDepth; |
| 15 | 16 | const writeStreamArbitraryDepth = @import("stringify.zig").writeStreamArbitraryDepth; |
| 16 | 17 | |
| 17 | 18 | test "json write stream" { |
| 19 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 20 | ||
| 18 | 21 | var out_buf: [1024]u8 = undefined; |
| 19 | 22 | var slice_stream = std.io.fixedBufferStream(&out_buf); |
| 20 | 23 | const out = slice_stream.writer(); |
| ... | ... | @@ -97,6 +100,8 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value { |
| 97 | 100 | } |
| 98 | 101 | |
| 99 | 102 | test "stringify null optional fields" { |
| 103 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 104 | ||
| 100 | 105 | const MyStruct = struct { |
| 101 | 106 | optional: ?[]const u8 = null, |
| 102 | 107 | required: []const u8 = "something", |
| ... | ... | @@ -118,6 +123,8 @@ test "stringify null optional fields" { |
| 118 | 123 | } |
| 119 | 124 | |
| 120 | 125 | test "stringify basic types" { |
| 126 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 127 | ||
| 121 | 128 | try testStringify("false", false, .{}); |
| 122 | 129 | try testStringify("true", true, .{}); |
| 123 | 130 | try testStringify("null", @as(?u8, null), .{}); |
| ... | ... | @@ -134,6 +141,8 @@ test "stringify basic types" { |
| 134 | 141 | } |
| 135 | 142 | |
| 136 | 143 | test "stringify string" { |
| 144 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 145 | ||
| 137 | 146 | try testStringify("\"hello\"", "hello", .{}); |
| 138 | 147 | try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{}); |
| 139 | 148 | try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true }); |
| ... | ... | @@ -158,12 +167,16 @@ test "stringify string" { |
| 158 | 167 | } |
| 159 | 168 | |
| 160 | 169 | test "stringify many-item sentinel-terminated string" { |
| 170 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 171 | ||
| 161 | 172 | try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{}); |
| 162 | 173 | try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true }); |
| 163 | 174 | try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true }); |
| 164 | 175 | } |
| 165 | 176 | |
| 166 | 177 | test "stringify enums" { |
| 178 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 179 | ||
| 167 | 180 | const E = enum { |
| 168 | 181 | foo, |
| 169 | 182 | bar, |
| ... | ... | @@ -173,11 +186,15 @@ test "stringify enums" { |
| 173 | 186 | } |
| 174 | 187 | |
| 175 | 188 | test "stringify enum literals" { |
| 189 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 190 | ||
| 176 | 191 | try testStringify("\"foo\"", .foo, .{}); |
| 177 | 192 | try testStringify("\"bar\"", .bar, .{}); |
| 178 | 193 | } |
| 179 | 194 | |
| 180 | 195 | test "stringify tagged unions" { |
| 196 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 197 | ||
| 181 | 198 | const T = union(enum) { |
| 182 | 199 | nothing, |
| 183 | 200 | foo: u32, |
| ... | ... | @@ -189,12 +206,16 @@ test "stringify tagged unions" { |
| 189 | 206 | } |
| 190 | 207 | |
| 191 | 208 | test "stringify struct" { |
| 209 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 210 | ||
| 192 | 211 | try testStringify("{\"foo\":42}", struct { |
| 193 | 212 | foo: u32, |
| 194 | 213 | }{ .foo = 42 }, .{}); |
| 195 | 214 | } |
| 196 | 215 | |
| 197 | 216 | test "emit_strings_as_arrays" { |
| 217 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 218 | ||
| 198 | 219 | // Should only affect string values, not object keys. |
| 199 | 220 | try testStringify("{\"foo\":\"bar\"}", .{ .foo = "bar" }, .{}); |
| 200 | 221 | try testStringify("{\"foo\":[98,97,114]}", .{ .foo = "bar" }, .{ .emit_strings_as_arrays = true }); |
| ... | ... | @@ -209,6 +230,8 @@ test "emit_strings_as_arrays" { |
| 209 | 230 | } |
| 210 | 231 | |
| 211 | 232 | test "stringify struct with indentation" { |
| 233 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 234 | ||
| 212 | 235 | try testStringify( |
| 213 | 236 | \\{ |
| 214 | 237 | \\ "foo": 42, |
| ... | ... | @@ -254,6 +277,8 @@ test "stringify struct with indentation" { |
| 254 | 277 | } |
| 255 | 278 | |
| 256 | 279 | test "stringify struct with void field" { |
| 280 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 281 | ||
| 257 | 282 | try testStringify("{\"foo\":42}", struct { |
| 258 | 283 | foo: u32, |
| 259 | 284 | bar: void = {}, |
| ... | ... | @@ -261,6 +286,8 @@ test "stringify struct with void field" { |
| 261 | 286 | } |
| 262 | 287 | |
| 263 | 288 | test "stringify array of structs" { |
| 289 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 290 | ||
| 264 | 291 | const MyStruct = struct { |
| 265 | 292 | foo: u32, |
| 266 | 293 | }; |
| ... | ... | @@ -272,6 +299,8 @@ test "stringify array of structs" { |
| 272 | 299 | } |
| 273 | 300 | |
| 274 | 301 | test "stringify struct with custom stringifier" { |
| 302 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 303 | ||
| 275 | 304 | try testStringify("[\"something special\",42]", struct { |
| 276 | 305 | foo: u32, |
| 277 | 306 | const Self = @This(); |
| ... | ... | @@ -286,12 +315,16 @@ test "stringify struct with custom stringifier" { |
| 286 | 315 | } |
| 287 | 316 | |
| 288 | 317 | test "stringify vector" { |
| 318 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 319 | ||
| 289 | 320 | try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{}); |
| 290 | 321 | try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{}); |
| 291 | 322 | try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true }); |
| 292 | 323 | } |
| 293 | 324 | |
| 294 | 325 | test "stringify tuple" { |
| 326 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 327 | ||
| 295 | 328 | try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{}); |
| 296 | 329 | } |
| 297 | 330 | |
| ... | ... | @@ -378,6 +411,8 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St |
| 378 | 411 | } |
| 379 | 412 | |
| 380 | 413 | test "stringify alloc" { |
| 414 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 415 | ||
| 381 | 416 | const allocator = std.testing.allocator; |
| 382 | 417 | const expected = |
| 383 | 418 | \\{"foo":"bar","answer":42,"my_friend":"sammy"} |
| ... | ... | @@ -389,6 +424,8 @@ test "stringify alloc" { |
| 389 | 424 | } |
| 390 | 425 | |
| 391 | 426 | test "comptime stringify" { |
| 427 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 428 | ||
| 392 | 429 | comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable; |
| 393 | 430 | comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable; |
| 394 | 431 | comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable; |
| ... | ... | @@ -409,6 +446,8 @@ test "comptime stringify" { |
| 409 | 446 | } |
| 410 | 447 | |
| 411 | 448 | test "print" { |
| 449 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 450 | ||
| 412 | 451 | var out_buf: [1024]u8 = undefined; |
| 413 | 452 | var slice_stream = std.io.fixedBufferStream(&out_buf); |
| 414 | 453 | const out = slice_stream.writer(); |
| ... | ... | @@ -440,6 +479,8 @@ test "print" { |
| 440 | 479 | } |
| 441 | 480 | |
| 442 | 481 | test "nonportable numbers" { |
| 482 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 483 | ||
| 443 | 484 | try testStringify("9999999999999999", 9999999999999999, .{}); |
| 444 | 485 | try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true }); |
| 445 | 486 | } |
lib/std/json/test.zig+2| ... | ... | @@ -34,6 +34,8 @@ fn testHighLevelDynamicParser(s: []const u8) !void { |
| 34 | 34 | |
| 35 | 35 | // Additional tests not part of test JSONTestSuite. |
| 36 | 36 | test "y_trailing_comma_after_empty" { |
| 37 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 38 | ||
| 37 | 39 | try roundTrip( |
| 38 | 40 | \\{"1":[],"2":{},"3":"4"} |
| 39 | 41 | ); |
lib/std/math.zig+26| ... | ... | @@ -492,10 +492,13 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T { |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | test "shl" { |
| 495 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 496 | ||
| 495 | 497 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { |
| 496 | 498 | // https://github.com/ziglang/zig/issues/12012 |
| 497 | 499 | return error.SkipZigTest; |
| 498 | 500 | } |
| 501 | ||
| 499 | 502 | try testing.expect(shl(u8, 0b11111111, @as(usize, 3)) == 0b11111000); |
| 500 | 503 | try testing.expect(shl(u8, 0b11111111, @as(usize, 8)) == 0); |
| 501 | 504 | try testing.expect(shl(u8, 0b11111111, @as(usize, 9)) == 0); |
| ... | ... | @@ -536,10 +539,13 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T { |
| 536 | 539 | } |
| 537 | 540 | |
| 538 | 541 | test "shr" { |
| 542 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 543 | ||
| 539 | 544 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { |
| 540 | 545 | // https://github.com/ziglang/zig/issues/12012 |
| 541 | 546 | return error.SkipZigTest; |
| 542 | 547 | } |
| 548 | ||
| 543 | 549 | try testing.expect(shr(u8, 0b11111111, @as(usize, 3)) == 0b00011111); |
| 544 | 550 | try testing.expect(shr(u8, 0b11111111, @as(usize, 8)) == 0); |
| 545 | 551 | try testing.expect(shr(u8, 0b11111111, @as(usize, 9)) == 0); |
| ... | ... | @@ -581,10 +587,13 @@ pub fn rotr(comptime T: type, x: T, r: anytype) T { |
| 581 | 587 | } |
| 582 | 588 | |
| 583 | 589 | test "rotr" { |
| 590 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 591 | ||
| 584 | 592 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { |
| 585 | 593 | // https://github.com/ziglang/zig/issues/12012 |
| 586 | 594 | return error.SkipZigTest; |
| 587 | 595 | } |
| 596 | ||
| 588 | 597 | try testing.expect(rotr(u0, 0b0, @as(usize, 3)) == 0b0); |
| 589 | 598 | try testing.expect(rotr(u5, 0b00001, @as(usize, 0)) == 0b00001); |
| 590 | 599 | try testing.expect(rotr(u6, 0b000001, @as(usize, 7)) == 0b100000); |
| ... | ... | @@ -625,10 +634,13 @@ pub fn rotl(comptime T: type, x: T, r: anytype) T { |
| 625 | 634 | } |
| 626 | 635 | |
| 627 | 636 | test "rotl" { |
| 637 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 638 | ||
| 628 | 639 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { |
| 629 | 640 | // https://github.com/ziglang/zig/issues/12012 |
| 630 | 641 | return error.SkipZigTest; |
| 631 | 642 | } |
| 643 | ||
| 632 | 644 | try testing.expect(rotl(u0, 0b0, @as(usize, 3)) == 0b0); |
| 633 | 645 | try testing.expect(rotl(u5, 0b00001, @as(usize, 0)) == 0b00001); |
| 634 | 646 | try testing.expect(rotl(u6, 0b000001, @as(usize, 7)) == 0b000010); |
| ... | ... | @@ -752,6 +764,8 @@ pub fn divTrunc(comptime T: type, numerator: T, denominator: T) !T { |
| 752 | 764 | } |
| 753 | 765 | |
| 754 | 766 | test "divTrunc" { |
| 767 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 768 | ||
| 755 | 769 | try testDivTrunc(); |
| 756 | 770 | try comptime testDivTrunc(); |
| 757 | 771 | } |
| ... | ... | @@ -776,6 +790,8 @@ pub fn divFloor(comptime T: type, numerator: T, denominator: T) !T { |
| 776 | 790 | } |
| 777 | 791 | |
| 778 | 792 | test "divFloor" { |
| 793 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 794 | ||
| 779 | 795 | try testDivFloor(); |
| 780 | 796 | try comptime testDivFloor(); |
| 781 | 797 | } |
| ... | ... | @@ -813,6 +829,8 @@ pub fn divCeil(comptime T: type, numerator: T, denominator: T) !T { |
| 813 | 829 | } |
| 814 | 830 | |
| 815 | 831 | test "divCeil" { |
| 832 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 833 | ||
| 816 | 834 | try testDivCeil(); |
| 817 | 835 | try comptime testDivCeil(); |
| 818 | 836 | } |
| ... | ... | @@ -857,6 +875,8 @@ pub fn divExact(comptime T: type, numerator: T, denominator: T) !T { |
| 857 | 875 | } |
| 858 | 876 | |
| 859 | 877 | test "divExact" { |
| 878 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 879 | ||
| 860 | 880 | try testDivExact(); |
| 861 | 881 | try comptime testDivExact(); |
| 862 | 882 | } |
| ... | ... | @@ -887,6 +907,8 @@ test "mod" { |
| 887 | 907 | try comptime testMod(); |
| 888 | 908 | } |
| 889 | 909 | fn testMod() !void { |
| 910 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 911 | ||
| 890 | 912 | try testing.expect((mod(i32, -5, 3) catch unreachable) == 1); |
| 891 | 913 | try testing.expect((mod(i32, 5, 3) catch unreachable) == 2); |
| 892 | 914 | try testing.expectError(error.NegativeDenominator, mod(i32, 10, -1)); |
| ... | ... | @@ -909,6 +931,8 @@ pub fn rem(comptime T: type, numerator: T, denominator: T) !T { |
| 909 | 931 | } |
| 910 | 932 | |
| 911 | 933 | test "rem" { |
| 934 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 935 | ||
| 912 | 936 | try testRem(); |
| 913 | 937 | try comptime testRem(); |
| 914 | 938 | } |
| ... | ... | @@ -1258,6 +1282,8 @@ pub fn lerp(a: anytype, b: anytype, t: anytype) @TypeOf(a, b, t) { |
| 1258 | 1282 | } |
| 1259 | 1283 | |
| 1260 | 1284 | test "lerp" { |
| 1285 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1286 | ||
| 1261 | 1287 | try testing.expectEqual(@as(f64, 75), lerp(50, 100, 0.5)); |
| 1262 | 1288 | try testing.expectEqual(@as(f32, 43.75), lerp(50, 25, 0.25)); |
| 1263 | 1289 | try testing.expectEqual(@as(f64, -31.25), lerp(-50, 25, 0.25)); |
lib/std/math/big/int_test.zig+36-5| ... | ... | @@ -915,7 +915,10 @@ test "big.int mul multi-single" { |
| 915 | 915 | } |
| 916 | 916 | |
| 917 | 917 | test "big.int mul multi-multi" { |
| 918 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 918 | switch (builtin.zig_backend) { | |
| 919 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 920 | else => {}, | |
| 921 | } | |
| 919 | 922 | |
| 920 | 923 | var op1: u256 = 0x998888efefefefefefefef; |
| 921 | 924 | var op2: u256 = 0x333000abababababababab; |
| ... | ... | @@ -1036,7 +1039,10 @@ test "big.int mulWrap single-single signed" { |
| 1036 | 1039 | } |
| 1037 | 1040 | |
| 1038 | 1041 | test "big.int mulWrap multi-multi unsigned" { |
| 1039 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1042 | switch (builtin.zig_backend) { | |
| 1043 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1044 | else => {}, | |
| 1045 | } | |
| 1040 | 1046 | |
| 1041 | 1047 | var op1: u256 = 0x998888efefefefefefefef; |
| 1042 | 1048 | var op2: u256 = 0x333000abababababababab; |
| ... | ... | @@ -1053,7 +1059,10 @@ test "big.int mulWrap multi-multi unsigned" { |
| 1053 | 1059 | } |
| 1054 | 1060 | |
| 1055 | 1061 | test "big.int mulWrap multi-multi signed" { |
| 1056 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1062 | switch (builtin.zig_backend) { | |
| 1063 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1064 | else => {}, | |
| 1065 | } | |
| 1057 | 1066 | |
| 1058 | 1067 | var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb) - 1); |
| 1059 | 1068 | defer a.deinit(); |
| ... | ... | @@ -1374,6 +1383,8 @@ test "big.int div trunc single-single -/-" { |
| 1374 | 1383 | } |
| 1375 | 1384 | |
| 1376 | 1385 | test "big.int divTrunc #15535" { |
| 1386 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1387 | ||
| 1377 | 1388 | var one = try Managed.initSet(testing.allocator, 1); |
| 1378 | 1389 | defer one.deinit(); |
| 1379 | 1390 | var x = try Managed.initSet(testing.allocator, std.math.pow(u128, 2, 64)); |
| ... | ... | @@ -1438,6 +1449,8 @@ test "big.int divFloor #11166" { |
| 1438 | 1449 | } |
| 1439 | 1450 | |
| 1440 | 1451 | test "big.int gcd #10932" { |
| 1452 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1453 | ||
| 1441 | 1454 | var a = try Managed.init(testing.allocator); |
| 1442 | 1455 | defer a.deinit(); |
| 1443 | 1456 | |
| ... | ... | @@ -1683,7 +1696,10 @@ test "big.int div multi-multi (2 branch)" { |
| 1683 | 1696 | } |
| 1684 | 1697 | |
| 1685 | 1698 | test "big.int div multi-multi (3.1/3.3 branch)" { |
| 1686 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1699 | switch (builtin.zig_backend) { | |
| 1700 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1701 | else => {}, | |
| 1702 | } | |
| 1687 | 1703 | |
| 1688 | 1704 | var a = try Managed.initSet(testing.allocator, 0x11111111111111111111111111111111111111111111111111111111111111); |
| 1689 | 1705 | defer a.deinit(); |
| ... | ... | @@ -2097,6 +2113,8 @@ test "big.int sat shift-left signed simple positive" { |
| 2097 | 2113 | } |
| 2098 | 2114 | |
| 2099 | 2115 | test "big.int sat shift-left signed multi positive" { |
| 2116 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2117 | ||
| 2100 | 2118 | var x: SignedDoubleLimb = 1; |
| 2101 | 2119 | const shift = @bitSizeOf(SignedDoubleLimb) - 1; |
| 2102 | 2120 | |
| ... | ... | @@ -2108,6 +2126,8 @@ test "big.int sat shift-left signed multi positive" { |
| 2108 | 2126 | } |
| 2109 | 2127 | |
| 2110 | 2128 | test "big.int sat shift-left signed multi negative" { |
| 2129 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2130 | ||
| 2111 | 2131 | var x: SignedDoubleLimb = -1; |
| 2112 | 2132 | const shift = @bitSizeOf(SignedDoubleLimb) - 1; |
| 2113 | 2133 | |
| ... | ... | @@ -2468,6 +2488,8 @@ test "big.int var args" { |
| 2468 | 2488 | } |
| 2469 | 2489 | |
| 2470 | 2490 | test "big.int gcd non-one small" { |
| 2491 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2492 | ||
| 2471 | 2493 | var a = try Managed.initSet(testing.allocator, 17); |
| 2472 | 2494 | defer a.deinit(); |
| 2473 | 2495 | var b = try Managed.initSet(testing.allocator, 97); |
| ... | ... | @@ -2481,6 +2503,8 @@ test "big.int gcd non-one small" { |
| 2481 | 2503 | } |
| 2482 | 2504 | |
| 2483 | 2505 | test "big.int gcd non-one medium" { |
| 2506 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2507 | ||
| 2484 | 2508 | var a = try Managed.initSet(testing.allocator, 4864); |
| 2485 | 2509 | defer a.deinit(); |
| 2486 | 2510 | var b = try Managed.initSet(testing.allocator, 3458); |
| ... | ... | @@ -2494,6 +2518,8 @@ test "big.int gcd non-one medium" { |
| 2494 | 2518 | } |
| 2495 | 2519 | |
| 2496 | 2520 | test "big.int gcd non-one large" { |
| 2521 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2522 | ||
| 2497 | 2523 | var a = try Managed.initSet(testing.allocator, 0xffffffffffffffff); |
| 2498 | 2524 | defer a.deinit(); |
| 2499 | 2525 | var b = try Managed.initSet(testing.allocator, 0xffffffffffffffff7777); |
| ... | ... | @@ -2507,7 +2533,10 @@ test "big.int gcd non-one large" { |
| 2507 | 2533 | } |
| 2508 | 2534 | |
| 2509 | 2535 | test "big.int gcd large multi-limb result" { |
| 2510 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 2536 | switch (builtin.zig_backend) { | |
| 2537 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 2538 | else => {}, | |
| 2539 | } | |
| 2511 | 2540 | |
| 2512 | 2541 | var a = try Managed.initSet(testing.allocator, 0x12345678123456781234567812345678123456781234567812345678); |
| 2513 | 2542 | defer a.deinit(); |
| ... | ... | @@ -2523,6 +2552,8 @@ test "big.int gcd large multi-limb result" { |
| 2523 | 2552 | } |
| 2524 | 2553 | |
| 2525 | 2554 | test "big.int gcd one large" { |
| 2555 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2556 | ||
| 2526 | 2557 | var a = try Managed.initSet(testing.allocator, 1897056385327307); |
| 2527 | 2558 | defer a.deinit(); |
| 2528 | 2559 | var b = try Managed.initSet(testing.allocator, 2251799813685248); |
lib/std/math/big/rational.zig+35| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("../../std.zig"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | const debug = std.debug; |
| 3 | 4 | const math = std.math; |
| 4 | 5 | const mem = std.mem; |
| ... | ... | @@ -493,6 +494,8 @@ fn extractLowBits(a: Int, comptime T: type) T { |
| 493 | 494 | } |
| 494 | 495 | |
| 495 | 496 | test "big.rational extractLowBits" { |
| 497 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 498 | ||
| 496 | 499 | var a = try Int.initSet(testing.allocator, 0x11112222333344441234567887654321); |
| 497 | 500 | defer a.deinit(); |
| 498 | 501 | |
| ... | ... | @@ -513,6 +516,8 @@ test "big.rational extractLowBits" { |
| 513 | 516 | } |
| 514 | 517 | |
| 515 | 518 | test "big.rational set" { |
| 519 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 520 | ||
| 516 | 521 | var a = try Rational.init(testing.allocator); |
| 517 | 522 | defer a.deinit(); |
| 518 | 523 | |
| ... | ... | @@ -542,6 +547,8 @@ test "big.rational set" { |
| 542 | 547 | } |
| 543 | 548 | |
| 544 | 549 | test "big.rational setFloat" { |
| 550 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 551 | ||
| 545 | 552 | var a = try Rational.init(testing.allocator); |
| 546 | 553 | defer a.deinit(); |
| 547 | 554 | |
| ... | ... | @@ -567,6 +574,8 @@ test "big.rational setFloat" { |
| 567 | 574 | } |
| 568 | 575 | |
| 569 | 576 | test "big.rational setFloatString" { |
| 577 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 578 | ||
| 570 | 579 | var a = try Rational.init(testing.allocator); |
| 571 | 580 | defer a.deinit(); |
| 572 | 581 | |
| ... | ... | @@ -578,6 +587,8 @@ test "big.rational setFloatString" { |
| 578 | 587 | } |
| 579 | 588 | |
| 580 | 589 | test "big.rational toFloat" { |
| 590 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 591 | ||
| 581 | 592 | var a = try Rational.init(testing.allocator); |
| 582 | 593 | defer a.deinit(); |
| 583 | 594 | |
| ... | ... | @@ -591,6 +602,8 @@ test "big.rational toFloat" { |
| 591 | 602 | } |
| 592 | 603 | |
| 593 | 604 | test "big.rational set/to Float round-trip" { |
| 605 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 606 | ||
| 594 | 607 | var a = try Rational.init(testing.allocator); |
| 595 | 608 | defer a.deinit(); |
| 596 | 609 | var prng = std.rand.DefaultPrng.init(0x5EED); |
| ... | ... | @@ -604,6 +617,8 @@ test "big.rational set/to Float round-trip" { |
| 604 | 617 | } |
| 605 | 618 | |
| 606 | 619 | test "big.rational copy" { |
| 620 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 621 | ||
| 607 | 622 | var a = try Rational.init(testing.allocator); |
| 608 | 623 | defer a.deinit(); |
| 609 | 624 | |
| ... | ... | @@ -634,6 +649,8 @@ test "big.rational copy" { |
| 634 | 649 | } |
| 635 | 650 | |
| 636 | 651 | test "big.rational negate" { |
| 652 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 653 | ||
| 637 | 654 | var a = try Rational.init(testing.allocator); |
| 638 | 655 | defer a.deinit(); |
| 639 | 656 | |
| ... | ... | @@ -651,6 +668,8 @@ test "big.rational negate" { |
| 651 | 668 | } |
| 652 | 669 | |
| 653 | 670 | test "big.rational abs" { |
| 671 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 672 | ||
| 654 | 673 | var a = try Rational.init(testing.allocator); |
| 655 | 674 | defer a.deinit(); |
| 656 | 675 | |
| ... | ... | @@ -668,6 +687,8 @@ test "big.rational abs" { |
| 668 | 687 | } |
| 669 | 688 | |
| 670 | 689 | test "big.rational swap" { |
| 690 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 691 | ||
| 671 | 692 | var a = try Rational.init(testing.allocator); |
| 672 | 693 | defer a.deinit(); |
| 673 | 694 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -692,6 +713,8 @@ test "big.rational swap" { |
| 692 | 713 | } |
| 693 | 714 | |
| 694 | 715 | test "big.rational order" { |
| 716 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 717 | ||
| 695 | 718 | var a = try Rational.init(testing.allocator); |
| 696 | 719 | defer a.deinit(); |
| 697 | 720 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -707,6 +730,8 @@ test "big.rational order" { |
| 707 | 730 | } |
| 708 | 731 | |
| 709 | 732 | test "big.rational order/orderAbs with negative" { |
| 733 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 734 | ||
| 710 | 735 | var a = try Rational.init(testing.allocator); |
| 711 | 736 | defer a.deinit(); |
| 712 | 737 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -719,6 +744,8 @@ test "big.rational order/orderAbs with negative" { |
| 719 | 744 | } |
| 720 | 745 | |
| 721 | 746 | test "big.rational add single-limb" { |
| 747 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 748 | ||
| 722 | 749 | var a = try Rational.init(testing.allocator); |
| 723 | 750 | defer a.deinit(); |
| 724 | 751 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -734,6 +761,8 @@ test "big.rational add single-limb" { |
| 734 | 761 | } |
| 735 | 762 | |
| 736 | 763 | test "big.rational add" { |
| 764 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 765 | ||
| 737 | 766 | var a = try Rational.init(testing.allocator); |
| 738 | 767 | defer a.deinit(); |
| 739 | 768 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -750,6 +779,8 @@ test "big.rational add" { |
| 750 | 779 | } |
| 751 | 780 | |
| 752 | 781 | test "big.rational sub" { |
| 782 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 783 | ||
| 753 | 784 | var a = try Rational.init(testing.allocator); |
| 754 | 785 | defer a.deinit(); |
| 755 | 786 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -766,6 +797,8 @@ test "big.rational sub" { |
| 766 | 797 | } |
| 767 | 798 | |
| 768 | 799 | test "big.rational mul" { |
| 800 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 801 | ||
| 769 | 802 | var a = try Rational.init(testing.allocator); |
| 770 | 803 | defer a.deinit(); |
| 771 | 804 | var b = try Rational.init(testing.allocator); |
| ... | ... | @@ -782,6 +815,8 @@ test "big.rational mul" { |
| 782 | 815 | } |
| 783 | 816 | |
| 784 | 817 | test "big.rational div" { |
| 818 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 819 | ||
| 785 | 820 | { |
| 786 | 821 | var a = try Rational.init(testing.allocator); |
| 787 | 822 | defer a.deinit(); |
lib/std/mem.zig+18-4| ... | ... | @@ -315,6 +315,8 @@ pub fn zeroes(comptime T: type) T { |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | test "zeroes" { |
| 318 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 319 | ||
| 318 | 320 | const C_struct = extern struct { |
| 319 | 321 | x: u32, |
| 320 | 322 | y: u32 align(128), |
| ... | ... | @@ -1737,6 +1739,8 @@ pub fn readIntSlice(comptime T: type, bytes: []const u8, endian: Endian) T { |
| 1737 | 1739 | } |
| 1738 | 1740 | |
| 1739 | 1741 | test "comptime read/write int" { |
| 1742 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1743 | ||
| 1740 | 1744 | comptime { |
| 1741 | 1745 | var bytes: [2]u8 = undefined; |
| 1742 | 1746 | writeIntLittle(u16, &bytes, 0x1234); |
| ... | ... | @@ -1752,7 +1756,10 @@ test "comptime read/write int" { |
| 1752 | 1756 | } |
| 1753 | 1757 | |
| 1754 | 1758 | test "readIntBig and readIntLittle" { |
| 1755 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 1759 | switch (builtin.zig_backend) { | |
| 1760 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 1761 | else => {}, | |
| 1762 | } | |
| 1756 | 1763 | |
| 1757 | 1764 | try testing.expect(readIntSliceBig(u0, &[_]u8{}) == 0x0); |
| 1758 | 1765 | try testing.expect(readIntSliceLittle(u0, &[_]u8{}) == 0x0); |
| ... | ... | @@ -2053,7 +2060,10 @@ pub fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value |
| 2053 | 2060 | } |
| 2054 | 2061 | |
| 2055 | 2062 | test "writeIntBig and writeIntLittle" { |
| 2056 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 2063 | switch (builtin.zig_backend) { | |
| 2064 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 2065 | else => {}, | |
| 2066 | } | |
| 2057 | 2067 | |
| 2058 | 2068 | var buf0: [0]u8 = undefined; |
| 2059 | 2069 | var buf1: [1]u8 = undefined; |
| ... | ... | @@ -3297,6 +3307,8 @@ test "testStringEquality" { |
| 3297 | 3307 | } |
| 3298 | 3308 | |
| 3299 | 3309 | test "testReadInt" { |
| 3310 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 3311 | ||
| 3300 | 3312 | try testReadIntImpl(); |
| 3301 | 3313 | try comptime testReadIntImpl(); |
| 3302 | 3314 | } |
| ... | ... | @@ -4650,8 +4662,10 @@ pub fn alignInSlice(slice: anytype, comptime new_alignment: usize) ?AlignedSlice |
| 4650 | 4662 | } |
| 4651 | 4663 | |
| 4652 | 4664 | test "read/write(Var)PackedInt" { |
| 4653 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 4654 | ||
| 4665 | switch (builtin.zig_backend) { | |
| 4666 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 4667 | else => {}, | |
| 4668 | } | |
| 4655 | 4669 | switch (builtin.cpu.arch) { |
| 4656 | 4670 | // This test generates too much code to execute on WASI. |
| 4657 | 4671 | // LLVM backend fails with "too many locals: locals exceed maximum" |
lib/std/multi_array_list.zig+16| ... | ... | @@ -583,6 +583,8 @@ pub fn MultiArrayList(comptime T: type) type { |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | test "basic usage" { |
| 586 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 587 | ||
| 586 | 588 | const ally = testing.allocator; |
| 587 | 589 | |
| 588 | 590 | const Foo = struct { |
| ... | ... | @@ -677,6 +679,8 @@ test "basic usage" { |
| 677 | 679 | // This was observed to fail on aarch64 with LLVM 11, when the capacityInBytes |
| 678 | 680 | // function used the @reduce code path. |
| 679 | 681 | test "regression test for @reduce bug" { |
| 682 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 683 | ||
| 680 | 684 | const ally = testing.allocator; |
| 681 | 685 | var list = MultiArrayList(struct { |
| 682 | 686 | tag: std.zig.Token.Tag, |
| ... | ... | @@ -754,6 +758,8 @@ test "regression test for @reduce bug" { |
| 754 | 758 | } |
| 755 | 759 | |
| 756 | 760 | test "ensure capacity on empty list" { |
| 761 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 762 | ||
| 757 | 763 | const ally = testing.allocator; |
| 758 | 764 | |
| 759 | 765 | const Foo = struct { |
| ... | ... | @@ -789,6 +795,8 @@ test "ensure capacity on empty list" { |
| 789 | 795 | } |
| 790 | 796 | |
| 791 | 797 | test "insert elements" { |
| 798 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 799 | ||
| 792 | 800 | const ally = testing.allocator; |
| 793 | 801 | |
| 794 | 802 | const Foo = struct { |
| ... | ... | @@ -808,6 +816,8 @@ test "insert elements" { |
| 808 | 816 | } |
| 809 | 817 | |
| 810 | 818 | test "union" { |
| 819 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 820 | ||
| 811 | 821 | const ally = testing.allocator; |
| 812 | 822 | |
| 813 | 823 | const Foo = union(enum) { |
| ... | ... | @@ -863,6 +873,8 @@ test "union" { |
| 863 | 873 | } |
| 864 | 874 | |
| 865 | 875 | test "sorting a span" { |
| 876 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 877 | ||
| 866 | 878 | var list: MultiArrayList(struct { score: u32, chr: u8 }) = .{}; |
| 867 | 879 | defer list.deinit(testing.allocator); |
| 868 | 880 | |
| ... | ... | @@ -903,6 +915,8 @@ test "sorting a span" { |
| 903 | 915 | } |
| 904 | 916 | |
| 905 | 917 | test "0 sized struct field" { |
| 918 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 919 | ||
| 906 | 920 | const ally = testing.allocator; |
| 907 | 921 | |
| 908 | 922 | const Foo = struct { |
| ... | ... | @@ -930,6 +944,8 @@ test "0 sized struct field" { |
| 930 | 944 | } |
| 931 | 945 | |
| 932 | 946 | test "0 sized struct" { |
| 947 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 948 | ||
| 933 | 949 | const ally = testing.allocator; |
| 934 | 950 | |
| 935 | 951 | const Foo = struct { |
lib/std/net/test.zig+4| ... | ... | @@ -109,6 +109,8 @@ test "parse and render UNIX addresses" { |
| 109 | 109 | test "resolve DNS" { |
| 110 | 110 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 111 | 111 | |
| 112 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 113 | ||
| 112 | 114 | if (builtin.os.tag == .windows) { |
| 113 | 115 | _ = try std.os.windows.WSAStartup(2, 2); |
| 114 | 116 | } |
| ... | ... | @@ -291,6 +293,8 @@ test "listen on a unix socket, send bytes, receive bytes" { |
| 291 | 293 | if (builtin.single_threaded) return error.SkipZigTest; |
| 292 | 294 | if (!net.has_unix_sockets) return error.SkipZigTest; |
| 293 | 295 | |
| 296 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 297 | ||
| 294 | 298 | if (builtin.os.tag == .windows) { |
| 295 | 299 | _ = try std.os.windows.WSAStartup(2, 2); |
| 296 | 300 | } |
lib/std/os/linux/io_uring.zig+26| ... | ... | @@ -1741,6 +1741,8 @@ test "readv" { |
| 1741 | 1741 | test "writev/fsync/readv" { |
| 1742 | 1742 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 1743 | 1743 | |
| 1744 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1745 | ||
| 1744 | 1746 | var ring = IO_Uring.init(4, 0) catch |err| switch (err) { |
| 1745 | 1747 | error.SystemOutdated => return error.SkipZigTest, |
| 1746 | 1748 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -1811,6 +1813,8 @@ test "writev/fsync/readv" { |
| 1811 | 1813 | test "write/read" { |
| 1812 | 1814 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 1813 | 1815 | |
| 1816 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1817 | ||
| 1814 | 1818 | var ring = IO_Uring.init(2, 0) catch |err| switch (err) { |
| 1815 | 1819 | error.SystemOutdated => return error.SkipZigTest, |
| 1816 | 1820 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -1929,6 +1933,8 @@ test "splice/read" { |
| 1929 | 1933 | test "write_fixed/read_fixed" { |
| 1930 | 1934 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 1931 | 1935 | |
| 1936 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1937 | ||
| 1932 | 1938 | var ring = IO_Uring.init(2, 0) catch |err| switch (err) { |
| 1933 | 1939 | error.SystemOutdated => return error.SkipZigTest, |
| 1934 | 1940 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -1994,6 +2000,8 @@ test "write_fixed/read_fixed" { |
| 1994 | 2000 | test "openat" { |
| 1995 | 2001 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 1996 | 2002 | |
| 2003 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2004 | ||
| 1997 | 2005 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 1998 | 2006 | error.SystemOutdated => return error.SkipZigTest, |
| 1999 | 2007 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2045,6 +2053,8 @@ test "openat" { |
| 2045 | 2053 | test "close" { |
| 2046 | 2054 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2047 | 2055 | |
| 2056 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2057 | ||
| 2048 | 2058 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2049 | 2059 | error.SystemOutdated => return error.SkipZigTest, |
| 2050 | 2060 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2204,6 +2214,8 @@ test "sendmsg/recvmsg" { |
| 2204 | 2214 | test "timeout (after a relative time)" { |
| 2205 | 2215 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2206 | 2216 | |
| 2217 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2218 | ||
| 2207 | 2219 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2208 | 2220 | error.SystemOutdated => return error.SkipZigTest, |
| 2209 | 2221 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2376,6 +2388,8 @@ test "accept/connect/recv/link_timeout" { |
| 2376 | 2388 | test "fallocate" { |
| 2377 | 2389 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2378 | 2390 | |
| 2391 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2392 | ||
| 2379 | 2393 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2380 | 2394 | error.SystemOutdated => return error.SkipZigTest, |
| 2381 | 2395 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2422,6 +2436,8 @@ test "fallocate" { |
| 2422 | 2436 | test "statx" { |
| 2423 | 2437 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2424 | 2438 | |
| 2439 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2440 | ||
| 2425 | 2441 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2426 | 2442 | error.SystemOutdated => return error.SkipZigTest, |
| 2427 | 2443 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2678,6 +2694,8 @@ test "shutdown" { |
| 2678 | 2694 | test "renameat" { |
| 2679 | 2695 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2680 | 2696 | |
| 2697 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2698 | ||
| 2681 | 2699 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2682 | 2700 | error.SystemOutdated => return error.SkipZigTest, |
| 2683 | 2701 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2747,6 +2765,8 @@ test "renameat" { |
| 2747 | 2765 | test "unlinkat" { |
| 2748 | 2766 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2749 | 2767 | |
| 2768 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2769 | ||
| 2750 | 2770 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2751 | 2771 | error.SystemOutdated => return error.SkipZigTest, |
| 2752 | 2772 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2799,6 +2819,8 @@ test "unlinkat" { |
| 2799 | 2819 | test "mkdirat" { |
| 2800 | 2820 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2801 | 2821 | |
| 2822 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2823 | ||
| 2802 | 2824 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2803 | 2825 | error.SystemOutdated => return error.SkipZigTest, |
| 2804 | 2826 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2843,6 +2865,8 @@ test "mkdirat" { |
| 2843 | 2865 | test "symlinkat" { |
| 2844 | 2866 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2845 | 2867 | |
| 2868 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2869 | ||
| 2846 | 2870 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2847 | 2871 | error.SystemOutdated => return error.SkipZigTest, |
| 2848 | 2872 | error.PermissionDenied => return error.SkipZigTest, |
| ... | ... | @@ -2891,6 +2915,8 @@ test "symlinkat" { |
| 2891 | 2915 | test "linkat" { |
| 2892 | 2916 | if (builtin.os.tag != .linux) return error.SkipZigTest; |
| 2893 | 2917 | |
| 2918 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2919 | ||
| 2894 | 2920 | var ring = IO_Uring.init(1, 0) catch |err| switch (err) { |
| 2895 | 2921 | error.SystemOutdated => return error.SkipZigTest, |
| 2896 | 2922 | error.PermissionDenied => return error.SkipZigTest, |
lib/std/os/linux/test.zig+6| ... | ... | @@ -8,6 +8,8 @@ const expectEqual = std.testing.expectEqual; |
| 8 | 8 | const fs = std.fs; |
| 9 | 9 | |
| 10 | 10 | test "fallocate" { |
| 11 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 12 | ||
| 11 | 13 | var tmp = std.testing.tmpDir(.{}); |
| 12 | 14 | defer tmp.cleanup(); |
| 13 | 15 | |
| ... | ... | @@ -69,6 +71,8 @@ test "timer" { |
| 69 | 71 | } |
| 70 | 72 | |
| 71 | 73 | test "statx" { |
| 74 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 75 | ||
| 72 | 76 | var tmp = std.testing.tmpDir(.{}); |
| 73 | 77 | defer tmp.cleanup(); |
| 74 | 78 | |
| ... | ... | @@ -107,6 +111,8 @@ test "user and group ids" { |
| 107 | 111 | } |
| 108 | 112 | |
| 109 | 113 | test "fadvise" { |
| 114 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 115 | ||
| 110 | 116 | var tmp = std.testing.tmpDir(.{}); |
| 111 | 117 | defer tmp.cleanup(); |
| 112 | 118 |
lib/std/os/test.zig+40| ... | ... | @@ -88,6 +88,8 @@ test "chdir smoke test" { |
| 88 | 88 | test "open smoke test" { |
| 89 | 89 | if (native_os == .wasi) return error.SkipZigTest; |
| 90 | 90 | |
| 91 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 92 | ||
| 91 | 93 | // TODO verify file attributes using `fstat` |
| 92 | 94 | |
| 93 | 95 | var tmp = tmpDir(.{}); |
| ... | ... | @@ -142,6 +144,8 @@ test "open smoke test" { |
| 142 | 144 | test "openat smoke test" { |
| 143 | 145 | if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest; |
| 144 | 146 | |
| 147 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 148 | ||
| 145 | 149 | // TODO verify file attributes using `fstatat` |
| 146 | 150 | |
| 147 | 151 | var tmp = tmpDir(.{}); |
| ... | ... | @@ -276,6 +280,8 @@ test "link with relative paths" { |
| 276 | 280 | test "linkat with different directories" { |
| 277 | 281 | if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest; |
| 278 | 282 | |
| 283 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 284 | ||
| 279 | 285 | switch (native_os) { |
| 280 | 286 | .wasi, .linux, .solaris, .illumos => {}, |
| 281 | 287 | else => return error.SkipZigTest, |
| ... | ... | @@ -321,6 +327,8 @@ test "fstatat" { |
| 321 | 327 | // enable when `fstat` and `fstatat` are implemented on Windows |
| 322 | 328 | if (native_os == .windows) return error.SkipZigTest; |
| 323 | 329 | |
| 330 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 331 | ||
| 324 | 332 | var tmp = tmpDir(.{}); |
| 325 | 333 | defer tmp.cleanup(); |
| 326 | 334 | |
| ... | ... | @@ -340,6 +348,8 @@ test "fstatat" { |
| 340 | 348 | } |
| 341 | 349 | |
| 342 | 350 | test "readlinkat" { |
| 351 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 352 | ||
| 343 | 353 | var tmp = tmpDir(.{}); |
| 344 | 354 | defer tmp.cleanup(); |
| 345 | 355 | |
| ... | ... | @@ -566,6 +576,8 @@ test "mmap" { |
| 566 | 576 | if (native_os == .windows or native_os == .wasi) |
| 567 | 577 | return error.SkipZigTest; |
| 568 | 578 | |
| 579 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 580 | ||
| 569 | 581 | var tmp = tmpDir(.{}); |
| 570 | 582 | defer tmp.cleanup(); |
| 571 | 583 | |
| ... | ... | @@ -676,6 +688,8 @@ test "fcntl" { |
| 676 | 688 | if (native_os == .windows or native_os == .wasi) |
| 677 | 689 | return error.SkipZigTest; |
| 678 | 690 | |
| 691 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 692 | ||
| 679 | 693 | var tmp = tmpDir(.{}); |
| 680 | 694 | defer tmp.cleanup(); |
| 681 | 695 | |
| ... | ... | @@ -716,6 +730,8 @@ test "sync" { |
| 716 | 730 | if (native_os != .linux) |
| 717 | 731 | return error.SkipZigTest; |
| 718 | 732 | |
| 733 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 734 | ||
| 719 | 735 | var tmp = tmpDir(.{}); |
| 720 | 736 | defer tmp.cleanup(); |
| 721 | 737 | |
| ... | ... | @@ -736,6 +752,8 @@ test "fsync" { |
| 736 | 752 | else => return error.SkipZigTest, |
| 737 | 753 | } |
| 738 | 754 | |
| 755 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 756 | ||
| 739 | 757 | var tmp = tmpDir(.{}); |
| 740 | 758 | defer tmp.cleanup(); |
| 741 | 759 | |
| ... | ... | @@ -874,6 +892,8 @@ test "dup & dup2" { |
| 874 | 892 | else => return error.SkipZigTest, |
| 875 | 893 | } |
| 876 | 894 | |
| 895 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 896 | ||
| 877 | 897 | var tmp = tmpDir(.{}); |
| 878 | 898 | defer tmp.cleanup(); |
| 879 | 899 | |
| ... | ... | @@ -903,6 +923,8 @@ test "dup & dup2" { |
| 903 | 923 | test "writev longer than IOV_MAX" { |
| 904 | 924 | if (native_os == .windows or native_os == .wasi) return error.SkipZigTest; |
| 905 | 925 | |
| 926 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 927 | ||
| 906 | 928 | var tmp = tmpDir(.{}); |
| 907 | 929 | defer tmp.cleanup(); |
| 908 | 930 | |
| ... | ... | @@ -920,6 +942,8 @@ test "POSIX file locking with fcntl" { |
| 920 | 942 | return error.SkipZigTest; |
| 921 | 943 | } |
| 922 | 944 | |
| 945 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 946 | ||
| 923 | 947 | if (true) { |
| 924 | 948 | // https://github.com/ziglang/zig/issues/11074 |
| 925 | 949 | return error.SkipZigTest; |
| ... | ... | @@ -982,6 +1006,8 @@ test "POSIX file locking with fcntl" { |
| 982 | 1006 | test "rename smoke test" { |
| 983 | 1007 | if (native_os == .wasi) return error.SkipZigTest; |
| 984 | 1008 | |
| 1009 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1010 | ||
| 985 | 1011 | var tmp = tmpDir(.{}); |
| 986 | 1012 | defer tmp.cleanup(); |
| 987 | 1013 | |
| ... | ... | @@ -1038,6 +1064,8 @@ test "rename smoke test" { |
| 1038 | 1064 | test "access smoke test" { |
| 1039 | 1065 | if (native_os == .wasi) return error.SkipZigTest; |
| 1040 | 1066 | |
| 1067 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1068 | ||
| 1041 | 1069 | var tmp = tmpDir(.{}); |
| 1042 | 1070 | defer tmp.cleanup(); |
| 1043 | 1071 | |
| ... | ... | @@ -1102,6 +1130,8 @@ test "timerfd" { |
| 1102 | 1130 | } |
| 1103 | 1131 | |
| 1104 | 1132 | test "isatty" { |
| 1133 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1134 | ||
| 1105 | 1135 | var tmp = tmpDir(.{}); |
| 1106 | 1136 | defer tmp.cleanup(); |
| 1107 | 1137 | |
| ... | ... | @@ -1114,6 +1144,8 @@ test "isatty" { |
| 1114 | 1144 | test "read with empty buffer" { |
| 1115 | 1145 | if (native_os == .wasi) return error.SkipZigTest; |
| 1116 | 1146 | |
| 1147 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1148 | ||
| 1117 | 1149 | var tmp = tmpDir(.{}); |
| 1118 | 1150 | defer tmp.cleanup(); |
| 1119 | 1151 | |
| ... | ... | @@ -1139,6 +1171,8 @@ test "read with empty buffer" { |
| 1139 | 1171 | test "pread with empty buffer" { |
| 1140 | 1172 | if (native_os == .wasi) return error.SkipZigTest; |
| 1141 | 1173 | |
| 1174 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1175 | ||
| 1142 | 1176 | var tmp = tmpDir(.{}); |
| 1143 | 1177 | defer tmp.cleanup(); |
| 1144 | 1178 | |
| ... | ... | @@ -1164,6 +1198,8 @@ test "pread with empty buffer" { |
| 1164 | 1198 | test "write with empty buffer" { |
| 1165 | 1199 | if (native_os == .wasi) return error.SkipZigTest; |
| 1166 | 1200 | |
| 1201 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1202 | ||
| 1167 | 1203 | var tmp = tmpDir(.{}); |
| 1168 | 1204 | defer tmp.cleanup(); |
| 1169 | 1205 | |
| ... | ... | @@ -1189,6 +1225,8 @@ test "write with empty buffer" { |
| 1189 | 1225 | test "pwrite with empty buffer" { |
| 1190 | 1226 | if (native_os == .wasi) return error.SkipZigTest; |
| 1191 | 1227 | |
| 1228 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1229 | ||
| 1192 | 1230 | var tmp = tmpDir(.{}); |
| 1193 | 1231 | defer tmp.cleanup(); |
| 1194 | 1232 | |
| ... | ... | @@ -1214,6 +1252,8 @@ test "pwrite with empty buffer" { |
| 1214 | 1252 | test "fchmodat smoke test" { |
| 1215 | 1253 | if (!std.fs.has_executable_bit) return error.SkipZigTest; |
| 1216 | 1254 | |
| 1255 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1256 | ||
| 1217 | 1257 | var tmp = tmpDir(.{}); |
| 1218 | 1258 | defer tmp.cleanup(); |
| 1219 | 1259 |
lib/std/rand/Xoshiro256.zig+4-1| ... | ... | @@ -90,7 +90,10 @@ pub fn fill(self: *Xoshiro256, buf: []u8) void { |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | test "xoroshiro sequence" { |
| 93 | if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest; | |
| 93 | switch (@import("builtin").zig_backend) { | |
| 94 | .stage2_c, .stage2_x86_64 => return error.SkipZigTest, | |
| 95 | else => {}, | |
| 96 | } | |
| 94 | 97 | |
| 95 | 98 | var r = Xoshiro256.init(0); |
| 96 | 99 |
lib/std/rand/test.zig+2| ... | ... | @@ -436,6 +436,8 @@ fn testRangeBias(r: Random, start: i8, end: i8, biased: bool) !void { |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | test "CSPRNG" { |
| 439 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 440 | ||
| 439 | 441 | var secret_seed: [DefaultCsprng.secret_seed_length]u8 = undefined; |
| 440 | 442 | std.crypto.random.bytes(&secret_seed); |
| 441 | 443 | var csprng = DefaultCsprng.init(secret_seed); |
lib/std/simd.zig+9| ... | ... | @@ -196,10 +196,13 @@ pub fn extract( |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | test "vector patterns" { |
| 199 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 200 | ||
| 199 | 201 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { |
| 200 | 202 | // https://github.com/ziglang/zig/issues/12012 |
| 201 | 203 | return error.SkipZigTest; |
| 202 | 204 | } |
| 205 | ||
| 203 | 206 | const base = @Vector(4, u32){ 10, 20, 30, 40 }; |
| 204 | 207 | const other_base = @Vector(4, u32){ 55, 66, 77, 88 }; |
| 205 | 208 | |
| ... | ... | @@ -269,6 +272,8 @@ pub fn reverseOrder(vec: anytype) @TypeOf(vec) { |
| 269 | 272 | } |
| 270 | 273 | |
| 271 | 274 | test "vector shifting" { |
| 275 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 276 | ||
| 272 | 277 | const base = @Vector(4, u32){ 10, 20, 30, 40 }; |
| 273 | 278 | |
| 274 | 279 | try std.testing.expectEqual([4]u32{ 30, 40, 999, 999 }, shiftElementsLeft(base, 2, 999)); |
| ... | ... | @@ -333,6 +338,8 @@ pub fn countElementsWithValue(vec: anytype, value: std.meta.Child(@TypeOf(vec))) |
| 333 | 338 | } |
| 334 | 339 | |
| 335 | 340 | test "vector searching" { |
| 341 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 342 | ||
| 336 | 343 | const base = @Vector(8, u32){ 6, 4, 7, 4, 4, 2, 3, 7 }; |
| 337 | 344 | |
| 338 | 345 | try std.testing.expectEqual(@as(?u3, 1), firstIndexOfValue(base, 4)); |
| ... | ... | @@ -424,6 +431,8 @@ pub fn prefixScan(comptime op: std.builtin.ReduceOp, comptime hop: isize, vec: a |
| 424 | 431 | } |
| 425 | 432 | |
| 426 | 433 | test "vector prefix scan" { |
| 434 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 435 | ||
| 427 | 436 | if (comptime builtin.cpu.arch.isMIPS()) { |
| 428 | 437 | return error.SkipZigTest; |
| 429 | 438 | } |
lib/std/time.zig+4| ... | ... | @@ -122,6 +122,8 @@ pub fn nanoTimestamp() i128 { |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | test "timestamp" { |
| 125 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 126 | ||
| 125 | 127 | const margin = ns_per_ms * 50; |
| 126 | 128 | |
| 127 | 129 | const time_0 = milliTimestamp(); |
| ... | ... | @@ -319,6 +321,8 @@ pub const Timer = struct { |
| 319 | 321 | }; |
| 320 | 322 | |
| 321 | 323 | test "Timer + Instant" { |
| 324 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 325 | ||
| 322 | 326 | const margin = ns_per_ms * 150; |
| 323 | 327 | |
| 324 | 328 | var timer = try Timer.start(); |
lib/std/unicode.zig+41| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | const std = @import("./std.zig"); |
| 2 | 2 | const assert = std.debug.assert; |
| 3 | const builtin = @import("builtin"); | |
| 3 | 4 | const testing = std.testing; |
| 4 | 5 | const mem = std.mem; |
| 5 | 6 | |
| ... | ... | @@ -499,11 +500,15 @@ fn testUtf16CountCodepoints() !void { |
| 499 | 500 | } |
| 500 | 501 | |
| 501 | 502 | test "utf16 count codepoints" { |
| 503 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 504 | ||
| 502 | 505 | try testUtf16CountCodepoints(); |
| 503 | 506 | try comptime testUtf16CountCodepoints(); |
| 504 | 507 | } |
| 505 | 508 | |
| 506 | 509 | test "utf8 encode" { |
| 510 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 511 | ||
| 507 | 512 | try comptime testUtf8Encode(); |
| 508 | 513 | try testUtf8Encode(); |
| 509 | 514 | } |
| ... | ... | @@ -530,6 +535,8 @@ fn testUtf8Encode() !void { |
| 530 | 535 | } |
| 531 | 536 | |
| 532 | 537 | test "utf8 encode error" { |
| 538 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 539 | ||
| 533 | 540 | try comptime testUtf8EncodeError(); |
| 534 | 541 | try testUtf8EncodeError(); |
| 535 | 542 | } |
| ... | ... | @@ -546,6 +553,8 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void { |
| 546 | 553 | } |
| 547 | 554 | |
| 548 | 555 | test "utf8 iterator on ascii" { |
| 556 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 557 | ||
| 549 | 558 | try comptime testUtf8IteratorOnAscii(); |
| 550 | 559 | try testUtf8IteratorOnAscii(); |
| 551 | 560 | } |
| ... | ... | @@ -566,6 +575,8 @@ fn testUtf8IteratorOnAscii() !void { |
| 566 | 575 | } |
| 567 | 576 | |
| 568 | 577 | test "utf8 view bad" { |
| 578 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 579 | ||
| 569 | 580 | try comptime testUtf8ViewBad(); |
| 570 | 581 | try testUtf8ViewBad(); |
| 571 | 582 | } |
| ... | ... | @@ -576,6 +587,8 @@ fn testUtf8ViewBad() !void { |
| 576 | 587 | } |
| 577 | 588 | |
| 578 | 589 | test "utf8 view ok" { |
| 590 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 591 | ||
| 579 | 592 | try comptime testUtf8ViewOk(); |
| 580 | 593 | try testUtf8ViewOk(); |
| 581 | 594 | } |
| ... | ... | @@ -596,6 +609,8 @@ fn testUtf8ViewOk() !void { |
| 596 | 609 | } |
| 597 | 610 | |
| 598 | 611 | test "validate slice" { |
| 612 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 613 | ||
| 599 | 614 | try comptime testValidateSlice(); |
| 600 | 615 | try testValidateSlice(); |
| 601 | 616 | |
| ... | ... | @@ -636,6 +651,8 @@ fn testValidateSlice() !void { |
| 636 | 651 | } |
| 637 | 652 | |
| 638 | 653 | test "valid utf8" { |
| 654 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 655 | ||
| 639 | 656 | try comptime testValidUtf8(); |
| 640 | 657 | try testValidUtf8(); |
| 641 | 658 | } |
| ... | ... | @@ -655,6 +672,8 @@ fn testValidUtf8() !void { |
| 655 | 672 | } |
| 656 | 673 | |
| 657 | 674 | test "invalid utf8 continuation bytes" { |
| 675 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 676 | ||
| 658 | 677 | try comptime testInvalidUtf8ContinuationBytes(); |
| 659 | 678 | try testInvalidUtf8ContinuationBytes(); |
| 660 | 679 | } |
| ... | ... | @@ -687,6 +706,8 @@ fn testInvalidUtf8ContinuationBytes() !void { |
| 687 | 706 | } |
| 688 | 707 | |
| 689 | 708 | test "overlong utf8 codepoint" { |
| 709 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 710 | ||
| 690 | 711 | try comptime testOverlongUtf8Codepoint(); |
| 691 | 712 | try testOverlongUtf8Codepoint(); |
| 692 | 713 | } |
| ... | ... | @@ -700,6 +721,8 @@ fn testOverlongUtf8Codepoint() !void { |
| 700 | 721 | } |
| 701 | 722 | |
| 702 | 723 | test "misc invalid utf8" { |
| 724 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 725 | ||
| 703 | 726 | try comptime testMiscInvalidUtf8(); |
| 704 | 727 | try testMiscInvalidUtf8(); |
| 705 | 728 | } |
| ... | ... | @@ -715,6 +738,8 @@ fn testMiscInvalidUtf8() !void { |
| 715 | 738 | } |
| 716 | 739 | |
| 717 | 740 | test "utf8 iterator peeking" { |
| 741 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 742 | ||
| 718 | 743 | try comptime testUtf8Peeking(); |
| 719 | 744 | try testUtf8Peeking(); |
| 720 | 745 | } |
| ... | ... | @@ -799,6 +824,8 @@ pub fn utf16leToUtf8(utf8: []u8, utf16le: []const u16) !usize { |
| 799 | 824 | } |
| 800 | 825 | |
| 801 | 826 | test "utf16leToUtf8" { |
| 827 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 828 | ||
| 802 | 829 | var utf16le: [2]u16 = undefined; |
| 803 | 830 | const utf16le_as_bytes = mem.sliceAsBytes(utf16le[0..]); |
| 804 | 831 | |
| ... | ... | @@ -911,6 +938,8 @@ pub fn utf8ToUtf16Le(utf16le: []u16, utf8: []const u8) !usize { |
| 911 | 938 | } |
| 912 | 939 | |
| 913 | 940 | test "utf8ToUtf16Le" { |
| 941 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 942 | ||
| 914 | 943 | var utf16le: [2]u16 = [_]u16{0} ** 2; |
| 915 | 944 | { |
| 916 | 945 | const length = try utf8ToUtf16Le(utf16le[0..], "𐐷"); |
| ... | ... | @@ -929,6 +958,8 @@ test "utf8ToUtf16Le" { |
| 929 | 958 | } |
| 930 | 959 | |
| 931 | 960 | test "utf8ToUtf16LeWithNull" { |
| 961 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 962 | ||
| 932 | 963 | { |
| 933 | 964 | const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "𐐷"); |
| 934 | 965 | defer testing.allocator.free(utf16); |
| ... | ... | @@ -987,6 +1018,8 @@ fn testCalcUtf16LeLen() !void { |
| 987 | 1018 | } |
| 988 | 1019 | |
| 989 | 1020 | test "calculate utf16 string length of given utf8 string in u16" { |
| 1021 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1022 | ||
| 990 | 1023 | try testCalcUtf16LeLen(); |
| 991 | 1024 | try comptime testCalcUtf16LeLen(); |
| 992 | 1025 | } |
| ... | ... | @@ -1020,6 +1053,8 @@ pub fn fmtUtf16le(utf16le: []const u16) std.fmt.Formatter(formatUtf16le) { |
| 1020 | 1053 | } |
| 1021 | 1054 | |
| 1022 | 1055 | test "fmtUtf16le" { |
| 1056 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1057 | ||
| 1023 | 1058 | const expectFmt = std.testing.expectFmt; |
| 1024 | 1059 | try expectFmt("", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral(""))}); |
| 1025 | 1060 | try expectFmt("foo", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral("foo"))}); |
| ... | ... | @@ -1033,6 +1068,8 @@ test "fmtUtf16le" { |
| 1033 | 1068 | } |
| 1034 | 1069 | |
| 1035 | 1070 | test "utf8ToUtf16LeStringLiteral" { |
| 1071 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1072 | ||
| 1036 | 1073 | { |
| 1037 | 1074 | const bytes = [_:0]u16{ |
| 1038 | 1075 | mem.nativeToLittle(u16, 0x41), |
| ... | ... | @@ -1093,6 +1130,8 @@ fn testUtf8CountCodepoints() !void { |
| 1093 | 1130 | } |
| 1094 | 1131 | |
| 1095 | 1132 | test "utf8 count codepoints" { |
| 1133 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1134 | ||
| 1096 | 1135 | try testUtf8CountCodepoints(); |
| 1097 | 1136 | try comptime testUtf8CountCodepoints(); |
| 1098 | 1137 | } |
| ... | ... | @@ -1109,6 +1148,8 @@ fn testUtf8ValidCodepoint() !void { |
| 1109 | 1148 | } |
| 1110 | 1149 | |
| 1111 | 1150 | test "utf8 valid codepoint" { |
| 1151 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1152 | ||
| 1112 | 1153 | try testUtf8ValidCodepoint(); |
| 1113 | 1154 | try comptime testUtf8ValidCodepoint(); |
| 1114 | 1155 | } |
lib/std/zig/CrossTarget.zig+2| ... | ... | @@ -785,6 +785,8 @@ fn parseOs(result: *CrossTarget, diags: *ParseOptions.Diagnostics, text: []const |
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | test "CrossTarget.parse" { |
| 788 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 789 | ||
| 788 | 790 | if (builtin.target.isGnuLibC()) { |
| 789 | 791 | var cross_target = try CrossTarget.parse(.{}); |
| 790 | 792 | cross_target.setGnuLibCVersion(2, 1, 1); |
lib/std/zig/tokenizer.zig+2| ... | ... | @@ -1478,6 +1478,8 @@ test "utf8" { |
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | 1480 | test "invalid utf8" { |
| 1481 | if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 1482 | ||
| 1481 | 1483 | try testTokenize("//\x80", &.{ |
| 1482 | 1484 | .invalid, |
| 1483 | 1485 | }); |
src/arch/x86_64/CodeGen.zig+67-42| ... | ... | @@ -2979,8 +2979,21 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void { |
| 2979 | 2979 | |
| 2980 | 2980 | const dst_mcv = if (src_mcv.isRegister() and self.reuseOperand(inst, ty_op.operand, 0, src_mcv)) |
| 2981 | 2981 | src_mcv |
| 2982 | else | |
| 2983 | try self.copyToRegisterWithInstTracking(inst, dst_ty, src_mcv); | |
| 2982 | else if (dst_abi_size <= 8) | |
| 2983 | try self.copyToRegisterWithInstTracking(inst, dst_ty, src_mcv) | |
| 2984 | else if (dst_abi_size <= 16) dst: { | |
| 2985 | const dst_regs = try self.register_manager.allocRegs( | |
| 2986 | 2, | |
| 2987 | .{ inst, inst }, | |
| 2988 | abi.RegisterClass.gp, | |
| 2989 | ); | |
| 2990 | const dst_mcv: MCValue = .{ .register_pair = dst_regs }; | |
| 2991 | const dst_locks = self.register_manager.lockRegsAssumeUnused(2, dst_regs); | |
| 2992 | defer for (dst_locks) |lock| self.register_manager.unlockReg(lock); | |
| 2993 | ||
| 2994 | try self.genCopy(dst_ty, dst_mcv, src_mcv); | |
| 2995 | break :dst dst_mcv; | |
| 2996 | } else return self.fail("TODO implement trunc from {} to {}", .{ src_ty.fmt(mod), dst_ty.fmt(mod) }); | |
| 2984 | 2997 | |
| 2985 | 2998 | if (dst_ty.zigTypeTag(mod) == .Vector) { |
| 2986 | 2999 | assert(src_ty.zigTypeTag(mod) == .Vector and dst_ty.vectorLen(mod) == src_ty.vectorLen(mod)); |
| ... | ... | @@ -3051,14 +3064,15 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void { |
| 3051 | 3064 | break :result dst_mcv; |
| 3052 | 3065 | } |
| 3053 | 3066 | |
| 3054 | if (dst_abi_size > 8) { | |
| 3055 | return self.fail("TODO implement trunc for abi sizes larger than 8", .{}); | |
| 3056 | } | |
| 3057 | ||
| 3058 | 3067 | // when truncating a `u16` to `u5`, for example, those top 3 bits in the result |
| 3059 | 3068 | // have to be removed. this only happens if the dst if not a power-of-two size. |
| 3060 | if (self.regExtraBits(dst_ty) > 0) | |
| 3061 | try self.truncateRegister(dst_ty, dst_mcv.register.to64()); | |
| 3069 | if (dst_abi_size <= 8) { | |
| 3070 | if (self.regExtraBits(dst_ty) > 0) try self.truncateRegister(dst_ty, dst_mcv.register.to64()); | |
| 3071 | } else if (dst_abi_size <= 16) { | |
| 3072 | const dst_info = dst_ty.intInfo(mod); | |
| 3073 | const high_ty = try mod.intType(dst_info.signedness, dst_info.bits - 64); | |
| 3074 | if (self.regExtraBits(high_ty) > 0) try self.truncateRegister(high_ty, dst_mcv.register_pair[1].to64()); | |
| 3075 | } | |
| 3062 | 3076 | |
| 3063 | 3077 | break :result dst_mcv; |
| 3064 | 3078 | }; |
| ... | ... | @@ -3381,7 +3395,7 @@ fn airMulSat(self: *Self, inst: Air.Inst.Index) !void { |
| 3381 | 3395 | const cc: Condition = if (ty.isSignedInt(mod)) cc: { |
| 3382 | 3396 | try self.genSetReg(limit_reg, ty, lhs_mcv); |
| 3383 | 3397 | try self.genBinOpMir(.{ ._, .xor }, ty, limit_mcv, rhs_mcv); |
| 3384 | try self.genShiftBinOpMir(.{ ._, .sa }, ty, limit_mcv, .{ .immediate = reg_bits - 1 }); | |
| 3398 | try self.genShiftBinOpMir(.{ ._r, .sa }, ty, limit_mcv, .{ .immediate = reg_bits - 1 }); | |
| 3385 | 3399 | try self.genBinOpMir(.{ ._, .xor }, ty, limit_mcv, .{ |
| 3386 | 3400 | .immediate = (@as(u64, 1) << @intCast(reg_bits - 1)) - 1, |
| 3387 | 3401 | }); |
| ... | ... | @@ -4949,7 +4963,7 @@ fn byteSwap(self: *Self, inst: Air.Inst.Index, src_ty: Type, src_mcv: MCValue, m |
| 4949 | 4963 | const mod = self.bin_file.options.module.?; |
| 4950 | 4964 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 4951 | 4965 | |
| 4952 | if (src_ty.zigTypeTag(mod) == .Vector or src_ty.abiSize(mod) > 8) return self.fail( | |
| 4966 | if (src_ty.zigTypeTag(mod) == .Vector) return self.fail( | |
| 4953 | 4967 | "TODO implement byteSwap for {}", |
| 4954 | 4968 | .{src_ty.fmt(mod)}, |
| 4955 | 4969 | ); |
| ... | ... | @@ -10493,39 +10507,44 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { |
| 10493 | 10507 | }, |
| 10494 | 10508 | else => return self.fail("invalid constraint: '{s}'", .{constraint}), |
| 10495 | 10509 | }; |
| 10496 | const arg_maybe_reg: ?Register = if (mem.eql(u8, constraint[1..], "r")) | |
| 10497 | self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse | |
| 10498 | return self.fail("ran out of registers lowering inline asm", .{}) | |
| 10499 | else if (mem.eql(u8, constraint[1..], "m")) | |
| 10500 | if (output != .none) null else return self.fail( | |
| 10501 | "memory constraint unsupported for asm result: '{s}'", | |
| 10502 | .{constraint}, | |
| 10503 | ) | |
| 10504 | else if (mem.eql(u8, constraint[1..], "g") or | |
| 10505 | mem.eql(u8, constraint[1..], "rm") or mem.eql(u8, constraint[1..], "mr") or | |
| 10506 | mem.eql(u8, constraint[1..], "r,m") or mem.eql(u8, constraint[1..], "m,r")) | |
| 10507 | self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse | |
| 10508 | if (output != .none) | |
| 10509 | null | |
| 10510 | else | |
| 10511 | return self.fail("ran out of registers lowering inline asm", .{}) | |
| 10512 | else if (mem.startsWith(u8, constraint[1..], "{") and mem.endsWith(u8, constraint[1..], "}")) | |
| 10513 | parseRegName(constraint[1 + "{".len .. constraint.len - "}".len]) orelse | |
| 10514 | return self.fail("invalid register constraint: '{s}'", .{constraint}) | |
| 10515 | else | |
| 10516 | return self.fail("invalid constraint: '{s}'", .{constraint}); | |
| 10517 | const arg_mcv: MCValue = if (arg_maybe_reg) |reg| .{ .register = reg } else arg: { | |
| 10518 | const ptr_mcv = try self.resolveInst(output); | |
| 10519 | switch (ptr_mcv) { | |
| 10520 | .immediate => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |_| | |
| 10521 | break :arg ptr_mcv.deref(), | |
| 10522 | .register, .register_offset, .lea_frame => break :arg ptr_mcv.deref(), | |
| 10523 | else => {}, | |
| 10524 | } | |
| 10525 | break :arg .{ .indirect = .{ .reg = try self.copyToTmpRegister(Type.usize, ptr_mcv) } }; | |
| 10510 | const arg_mcv: MCValue = arg_mcv: { | |
| 10511 | const arg_maybe_reg: ?Register = if (mem.eql(u8, constraint[1..], "r")) | |
| 10512 | self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse | |
| 10513 | return self.fail("ran out of registers lowering inline asm", .{}) | |
| 10514 | else if (mem.eql(u8, constraint[1..], "m")) | |
| 10515 | if (output != .none) null else return self.fail( | |
| 10516 | "memory constraint unsupported for asm result: '{s}'", | |
| 10517 | .{constraint}, | |
| 10518 | ) | |
| 10519 | else if (mem.eql(u8, constraint[1..], "g") or | |
| 10520 | mem.eql(u8, constraint[1..], "rm") or mem.eql(u8, constraint[1..], "mr") or | |
| 10521 | mem.eql(u8, constraint[1..], "r,m") or mem.eql(u8, constraint[1..], "m,r")) | |
| 10522 | self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse | |
| 10523 | if (output != .none) | |
| 10524 | null | |
| 10525 | else | |
| 10526 | return self.fail("ran out of registers lowering inline asm", .{}) | |
| 10527 | else if (mem.startsWith(u8, constraint[1..], "{") and mem.endsWith(u8, constraint[1..], "}")) | |
| 10528 | parseRegName(constraint[1 + "{".len .. constraint.len - "}".len]) orelse | |
| 10529 | return self.fail("invalid register constraint: '{s}'", .{constraint}) | |
| 10530 | else if (constraint.len == 2 and std.ascii.isDigit(constraint[1])) { | |
| 10531 | const index = std.fmt.charToDigit(constraint[0], 10) catch unreachable; | |
| 10532 | if (index >= args.items.len) return self.fail("constraint out of bounds: '{s}'", .{constraint}); | |
| 10533 | break :arg_mcv args.items[index]; | |
| 10534 | } else return self.fail("invalid constraint: '{s}'", .{constraint}); | |
| 10535 | break :arg_mcv if (arg_maybe_reg) |reg| .{ .register = reg } else arg: { | |
| 10536 | const ptr_mcv = try self.resolveInst(output); | |
| 10537 | switch (ptr_mcv) { | |
| 10538 | .immediate => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |_| | |
| 10539 | break :arg ptr_mcv.deref(), | |
| 10540 | .register, .register_offset, .lea_frame => break :arg ptr_mcv.deref(), | |
| 10541 | else => {}, | |
| 10542 | } | |
| 10543 | break :arg .{ .indirect = .{ .reg = try self.copyToTmpRegister(Type.usize, ptr_mcv) } }; | |
| 10544 | }; | |
| 10526 | 10545 | }; |
| 10527 | 10546 | if (arg_mcv.getReg()) |reg| if (RegisterManager.indexOfRegIntoTracked(reg)) |_| { |
| 10528 | _ = self.register_manager.lockRegAssumeUnused(reg); | |
| 10547 | _ = self.register_manager.lockReg(reg); | |
| 10529 | 10548 | }; |
| 10530 | 10549 | if (!mem.eql(u8, name, "_")) |
| 10531 | 10550 | arg_map.putAssumeCapacityNoClobber(name, @intCast(args.items.len)); |
| ... | ... | @@ -10587,6 +10606,10 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { |
| 10587 | 10606 | try self.register_manager.getReg(reg, null); |
| 10588 | 10607 | try self.genSetReg(reg, ty, input_mcv); |
| 10589 | 10608 | break :arg .{ .register = reg }; |
| 10609 | } else if (constraint.len == 1 and std.ascii.isDigit(constraint[0])) arg: { | |
| 10610 | const index = std.fmt.charToDigit(constraint[0], 10) catch unreachable; | |
| 10611 | if (index >= args.items.len) return self.fail("constraint out of bounds: '{s}'", .{constraint}); | |
| 10612 | break :arg args.items[index]; | |
| 10590 | 10613 | } else return self.fail("invalid constraint: '{s}'", .{constraint}); |
| 10591 | 10614 | if (arg_mcv.getReg()) |reg| if (RegisterManager.indexOfRegIntoTracked(reg)) |_| { |
| 10592 | 10615 | _ = self.register_manager.lockReg(reg); |
| ... | ... | @@ -10712,7 +10735,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { |
| 10712 | 10735 | mnem_name[mnem_prefix.len .. mnem_name.len - mnem_suffix.len], |
| 10713 | 10736 | ) orelse continue }; |
| 10714 | 10737 | } else { |
| 10715 | assert(prefix != .none); | |
| 10738 | assert(prefix != .none); // no combination of fixes produced a known mnemonic | |
| 10716 | 10739 | return self.fail("invalid prefix for mnemonic: '{s} {s}'", .{ |
| 10717 | 10740 | @tagName(prefix), mnem_str, |
| 10718 | 10741 | }); |
| ... | ... | @@ -10943,6 +10966,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { |
| 10943 | 10966 | |
| 10944 | 10967 | if (output == .none) continue; |
| 10945 | 10968 | if (arg_mcv != .register) continue; |
| 10969 | if (constraint.len == 2 and std.ascii.isDigit(constraint[1])) continue; | |
| 10946 | 10970 | try self.store(self.typeOf(output), .{ .air_ref = output }, arg_mcv); |
| 10947 | 10971 | } |
| 10948 | 10972 | |
| ... | ... | @@ -11036,6 +11060,7 @@ fn moveStrategy(self: *Self, ty: Type, aligned: bool) !MoveStrategy { |
| 11036 | 11060 | else => {}, |
| 11037 | 11061 | }, |
| 11038 | 11062 | .Vector => switch (ty.childType(mod).zigTypeTag(mod)) { |
| 11063 | .Bool => return .{ .move = .{ ._, .mov } }, | |
| 11039 | 11064 | .Int => switch (ty.childType(mod).intInfo(mod).bits) { |
| 11040 | 11065 | 8 => switch (ty.vectorLen(mod)) { |
| 11041 | 11066 | 1 => if (self.hasFeature(.avx)) return .{ .vex_insert_extract = .{ |
src/arch/x86_64/Encoding.zig+3-3| ... | ... | @@ -232,7 +232,7 @@ pub const Mnemonic = enum { |
| 232 | 232 | cmp, |
| 233 | 233 | cmps, cmpsb, cmpsd, cmpsq, cmpsw, |
| 234 | 234 | cmpxchg, cmpxchg8b, cmpxchg16b, |
| 235 | cqo, cwd, cwde, | |
| 235 | cpuid, cqo, cwd, cwde, | |
| 236 | 236 | div, |
| 237 | 237 | idiv, imul, int3, |
| 238 | 238 | ja, jae, jb, jbe, jc, jrcxz, je, jg, jge, jl, jle, jna, jnae, jnb, jnbe, |
| ... | ... | @@ -246,7 +246,7 @@ pub const Mnemonic = enum { |
| 246 | 246 | movsx, movsxd, movzx, mul, |
| 247 | 247 | neg, nop, not, |
| 248 | 248 | @"or", |
| 249 | pop, popcnt, push, | |
| 249 | pause, pop, popcnt, push, | |
| 250 | 250 | rcl, rcr, ret, rol, ror, |
| 251 | 251 | sal, sar, sbb, |
| 252 | 252 | scas, scasb, scasd, scasq, scasw, |
| ... | ... | @@ -258,7 +258,7 @@ pub const Mnemonic = enum { |
| 258 | 258 | stos, stosb, stosd, stosq, stosw, |
| 259 | 259 | @"test", tzcnt, |
| 260 | 260 | ud2, |
| 261 | xadd, xchg, xor, | |
| 261 | xadd, xchg, xgetbv, xor, | |
| 262 | 262 | // X87 |
| 263 | 263 | fabs, fchs, ffree, fisttp, fld, fst, fstp, |
| 264 | 264 | // MMX |
src/arch/x86_64/Mir.zig+6| ... | ... | @@ -327,6 +327,8 @@ pub const Inst = struct { |
| 327 | 327 | /// Compare and exchange |
| 328 | 328 | /// Compare and exchange bytes |
| 329 | 329 | cmpxchg, |
| 330 | /// CPU identification | |
| 331 | cpuid, | |
| 330 | 332 | /// Convert doubleword to quadword |
| 331 | 333 | cqo, |
| 332 | 334 | /// Convert word to doubleword |
| ... | ... | @@ -386,6 +388,8 @@ pub const Inst = struct { |
| 386 | 388 | /// Bitwise logical or of packed single-precision floating-point values |
| 387 | 389 | /// Bitwise logical or of packed double-precision floating-point values |
| 388 | 390 | @"or", |
| 391 | /// Spin loop hint | |
| 392 | pause, | |
| 389 | 393 | /// Pop |
| 390 | 394 | pop, |
| 391 | 395 | /// Return the count of number of bits set to 1 |
| ... | ... | @@ -437,6 +441,8 @@ pub const Inst = struct { |
| 437 | 441 | xadd, |
| 438 | 442 | /// Exchange register/memory with register |
| 439 | 443 | xchg, |
| 444 | /// Get value of extended control register | |
| 445 | xgetbv, | |
| 440 | 446 | /// Logical exclusive-or |
| 441 | 447 | /// Bitwise logical xor of packed single-precision floating-point values |
| 442 | 448 | /// Bitwise logical xor of packed double-precision floating-point values |
src/arch/x86_64/encodings.zig+6| ... | ... | @@ -266,6 +266,8 @@ pub const table = [_]Entry{ |
| 266 | 266 | .{ .cmpxchg8b, .m, &.{ .m64 }, &.{ 0x0f, 0xc7 }, 1, .none, .none }, |
| 267 | 267 | .{ .cmpxchg16b, .m, &.{ .m128 }, &.{ 0x0f, 0xc7 }, 1, .long, .none }, |
| 268 | 268 | |
| 269 | .{ .cpuid, .np, &.{}, &.{ 0x0f, 0xa2 }, 0, .none, .none }, | |
| 270 | ||
| 269 | 271 | .{ .div, .m, &.{ .rm8 }, &.{ 0xf6 }, 6, .none, .none }, |
| 270 | 272 | .{ .div, .m, &.{ .rm8 }, &.{ 0xf6 }, 6, .rex, .none }, |
| 271 | 273 | .{ .div, .m, &.{ .rm16 }, &.{ 0xf7 }, 6, .short, .none }, |
| ... | ... | @@ -469,6 +471,8 @@ pub const table = [_]Entry{ |
| 469 | 471 | .{ .@"or", .rm, &.{ .r32, .rm32 }, &.{ 0x0b }, 0, .none, .none }, |
| 470 | 472 | .{ .@"or", .rm, &.{ .r64, .rm64 }, &.{ 0x0b }, 0, .long, .none }, |
| 471 | 473 | |
| 474 | .{ .pause, .np, &.{}, &.{ 0xf3, 0x90 }, 0, .none, .none }, | |
| 475 | ||
| 472 | 476 | .{ .pop, .o, &.{ .r16 }, &.{ 0x58 }, 0, .short, .none }, |
| 473 | 477 | .{ .pop, .o, &.{ .r64 }, &.{ 0x58 }, 0, .none, .none }, |
| 474 | 478 | .{ .pop, .m, &.{ .rm16 }, &.{ 0x8f }, 0, .short, .none }, |
| ... | ... | @@ -805,6 +809,8 @@ pub const table = [_]Entry{ |
| 805 | 809 | .{ .xchg, .rm, &.{ .r32, .rm32 }, &.{ 0x87 }, 0, .none, .none }, |
| 806 | 810 | .{ .xchg, .rm, &.{ .r64, .rm64 }, &.{ 0x87 }, 0, .long, .none }, |
| 807 | 811 | |
| 812 | .{ .xgetbv, .np, &.{}, &.{ 0x0f, 0x01 }, 0, .none, .none }, | |
| 813 | ||
| 808 | 814 | .{ .xor, .zi, &.{ .al, .imm8 }, &.{ 0x34 }, 0, .none, .none }, |
| 809 | 815 | .{ .xor, .zi, &.{ .ax, .imm16 }, &.{ 0x35 }, 0, .short, .none }, |
| 810 | 816 | .{ .xor, .zi, &.{ .eax, .imm32 }, &.{ 0x35 }, 0, .none, .none }, |
test/behavior/bitcast.zig+2-1| ... | ... | @@ -411,8 +411,9 @@ test "bitcast nan float does not modify signaling bit" { |
| 411 | 411 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 412 | 412 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 413 | 413 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 414 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 415 | 414 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 415 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; | |
| 416 | ||
| 416 | 417 | // TODO: https://github.com/ziglang/zig/issues/14366 |
| 417 | 418 | if (builtin.zig_backend == .stage2_llvm and comptime builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest; |
| 418 | 419 |
test/behavior/bugs/920.zig+1-1| ... | ... | @@ -57,11 +57,11 @@ const NormalDist = blk: { |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | 59 | test "bug 920 fixed" { |
| 60 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 61 | 60 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 62 | 61 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 63 | 62 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 64 | 63 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 64 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; | |
| 65 | 65 | |
| 66 | 66 | const NormalDist1 = blk: { |
| 67 | 67 | break :blk ZigTableGen(true, norm_r, norm_v, norm_f, norm_f_inv, norm_zero_case); |
test/behavior/cast.zig+3-3| ... | ... | @@ -1606,8 +1606,8 @@ test "peer type resolution: const sentinel slice and mutable non-sentinel slice" |
| 1606 | 1606 | test "peer type resolution: float and comptime-known fixed-width integer" { |
| 1607 | 1607 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1608 | 1608 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1609 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1610 | 1609 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1610 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; | |
| 1611 | 1611 | |
| 1612 | 1612 | const i: u8 = 100; |
| 1613 | 1613 | var f: f32 = 1.234; |
| ... | ... | @@ -2372,7 +2372,7 @@ test "@intFromBool on vector" { |
| 2372 | 2372 | } |
| 2373 | 2373 | |
| 2374 | 2374 | test "numeric coercions with undefined" { |
| 2375 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 2375 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; | |
| 2376 | 2376 | |
| 2377 | 2377 | const from: i32 = undefined; |
| 2378 | 2378 | var to: f32 = from; |
| ... | ... | @@ -2390,11 +2390,11 @@ test "15-bit int to float" { |
| 2390 | 2390 | } |
| 2391 | 2391 | |
| 2392 | 2392 | test "@as does not corrupt values with incompatible representations" { |
| 2393 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 2394 | 2393 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 2395 | 2394 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 2396 | 2395 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 2397 | 2396 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 2397 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; | |
| 2398 | 2398 | |
| 2399 | 2399 | const x: f32 = @as(f16, blk: { |
| 2400 | 2400 | if (false) { |
test/behavior/cast_int.zig-1| ... | ... | @@ -199,7 +199,6 @@ test "load non byte-sized value in union" { |
| 199 | 199 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 200 | 200 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; |
| 201 | 201 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 202 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 203 | 202 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 204 | 203 | |
| 205 | 204 | // note: this bug is triggered by the == operator, expectEqual will hide it |
test/behavior/int128.zig-1| ... | ... | @@ -66,7 +66,6 @@ test "int128" { |
| 66 | 66 | |
| 67 | 67 | test "truncate int128" { |
| 68 | 68 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 69 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 70 | 69 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 71 | 70 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 72 | 71 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
test/behavior/packed-struct.zig+2-2| ... | ... | @@ -659,12 +659,12 @@ test "optional pointer in packed struct" { |
| 659 | 659 | test "nested packed struct field access test" { |
| 660 | 660 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 661 | 661 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO packed structs larger than 64 bits |
| 662 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 663 | 662 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 664 | 663 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 665 | 664 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 666 | 665 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 667 | // | |
| 666 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; | |
| 667 | ||
| 668 | 668 | const Vec2 = packed struct { |
| 669 | 669 | x: f32, |
| 670 | 670 | y: f32, |
test/behavior/translate_c_macros.zig+1-1| ... | ... | @@ -151,11 +151,11 @@ test "string and char literals that are not UTF-8 encoded. Issue #12784" { |
| 151 | 151 | |
| 152 | 152 | test "Macro that uses division operator. Issue #13162" { |
| 153 | 153 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 154 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 155 | 154 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 156 | 155 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 157 | 156 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 158 | 157 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 158 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; | |
| 159 | 159 | |
| 160 | 160 | try expectEqual(@as(c_int, 42), h.DIVIDE_CONSTANT(@as(c_int, 42_000))); |
| 161 | 161 | try expectEqual(@as(c_uint, 42), h.DIVIDE_CONSTANT(@as(c_uint, 42_000))); |
test/behavior/tuple.zig+1-1| ... | ... | @@ -370,8 +370,8 @@ test "tuple initialized with a runtime known value" { |
| 370 | 370 | test "tuple of struct concatenation and coercion to array" { |
| 371 | 371 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 372 | 372 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 373 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 374 | 373 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 374 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; | |
| 375 | 375 | |
| 376 | 376 | const StructWithDefault = struct { value: f32 = 42 }; |
| 377 | 377 | const SomeStruct = struct { array: [4]StructWithDefault }; |
test/behavior/vector.zig+1-1| ... | ... | @@ -1329,8 +1329,8 @@ test "store to vector in slice" { |
| 1329 | 1329 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1330 | 1330 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1331 | 1331 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1332 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 1333 | 1332 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1333 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; | |
| 1334 | 1334 | |
| 1335 | 1335 | var v = [_]@Vector(3, f32){ |
| 1336 | 1336 | .{ 1, 1, 1 }, |
tools/lldb_pretty_printers.py+19-8| ... | ... | @@ -355,17 +355,28 @@ class Module_Decl__Module_Decl_Index_SynthProvider: |
| 355 | 355 | def __init__(self, value, _=None): self.value = value |
| 356 | 356 | def update(self): |
| 357 | 357 | try: |
| 358 | for frame in self.value.thread: | |
| 359 | mod = frame.FindVariable('mod') or frame.FindVariable('module') | |
| 360 | if mod: break | |
| 361 | else: return | |
| 362 | self.ptr = mod.GetChildMemberWithName('allocated_decls').GetChildAtIndex(self.value.unsigned).address_of.Clone('decl') | |
| 358 | ip = InternPool_Find(self.value.thread) | |
| 359 | if not ip: return | |
| 360 | self.ptr = ip.GetChildMemberWithName('allocated_decls').GetChildAtIndex(self.value.unsigned).address_of.Clone('decl') | |
| 363 | 361 | except: pass |
| 364 | 362 | def has_children(self): return True |
| 365 | 363 | def num_children(self): return 1 |
| 366 | 364 | def get_child_index(self, name): return 0 if name == 'decl' else -1 |
| 367 | 365 | def get_child_at_index(self, index): return self.ptr if index == 0 else None |
| 368 | 366 | |
| 367 | class Module_Namespace__Module_Namespace_Index_SynthProvider: | |
| 368 | def __init__(self, value, _=None): self.value = value | |
| 369 | def update(self): | |
| 370 | try: | |
| 371 | ip = InternPool_Find(self.value.thread) | |
| 372 | if not ip: return | |
| 373 | self.ptr = ip.GetChildMemberWithName('allocated_namespaces').GetChildAtIndex(self.value.unsigned).address_of.Clone('namespace') | |
| 374 | except: pass | |
| 375 | def has_children(self): return True | |
| 376 | def num_children(self): return 1 | |
| 377 | def get_child_index(self, name): return 0 if name == 'namespace' else -1 | |
| 378 | def get_child_at_index(self, index): return self.ptr if index == 0 else None | |
| 379 | ||
| 369 | 380 | class TagOrPayloadPtr_SynthProvider: |
| 370 | 381 | def __init__(self, value, _=None): self.value = value |
| 371 | 382 | def update(self): |
| ... | ... | @@ -440,10 +451,9 @@ class InternPool_Index_SynthProvider: |
| 440 | 451 | for encoding_field in encoding_type.fields: |
| 441 | 452 | if encoding_field.name == 'data': |
| 442 | 453 | if encoding_field.type.IsPointerType(): |
| 443 | data_type = encoding_field.type.GetPointeeType() | |
| 444 | 454 | extra_index = data.unsigned |
| 445 | self.data = extra.GetChildAtIndex(extra_index).Cast(data_type).Clone('data') | |
| 446 | extra_index += data_type.num_fields | |
| 455 | self.data = extra.GetChildAtIndex(extra_index).address_of.Cast(encoding_field.type).deref.Clone('data') | |
| 456 | extra_index += encoding_field.type.GetPointeeType().num_fields | |
| 447 | 457 | else: |
| 448 | 458 | self.data = data.Cast(encoding_field.type).Clone('data') |
| 449 | 459 | elif encoding_field.name == 'trailing': |
| ... | ... | @@ -700,6 +710,7 @@ def __lldb_init_module(debugger, _=None): |
| 700 | 710 | add(debugger, category='zig.stage2', regex=True, type=MultiArrayList_Entry('Air\\.Inst'), identifier='TagAndPayload', synth=True, inline_children=True, summary=True) |
| 701 | 711 | add(debugger, category='zig.stage2', regex=True, type='^Air\\.Inst\\.Data\\.Data__struct_[1-9][0-9]*$', inline_children=True, summary=True) |
| 702 | 712 | add(debugger, category='zig.stage2', type='Module.Decl::Module.Decl.Index', synth=True) |
| 713 | add(debugger, category='zig.stage2', type='Module.Namespace::Module.Namespace.Index', synth=True) | |
| 703 | 714 | add(debugger, category='zig.stage2', type='Module.LazySrcLoc', identifier='zig_TaggedUnion', synth=True) |
| 704 | 715 | add(debugger, category='zig.stage2', type='InternPool.Index', synth=True) |
| 705 | 716 | add(debugger, category='zig.stage2', type='InternPool.NullTerminatedString', summary=True) |