authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-22 15:46:33-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-22 15:46:43-04:00
log27fe945a00956c8e727ca4c5409c6b716bc09a6d
treec9427aa9886e8d7f84c50f2ef12407cc80fa61d1
parent6f0198cadbe29294f2bf3153a27beebd64377566

Revert "Revert "Merge pull request #17637 from jacobly0/x86_64-test-std""

This reverts commit 6f0198cadbe29294f2bf3153a27beebd64377566.

150 files changed, 1691 insertions(+), 180 deletions(-)

lib/compiler_rt/addf3_test.zig+8
......@@ -4,6 +4,7 @@
44// https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/test/builtins/Unit/subtf3_test.c
55
66const std = @import("std");
7const builtin = @import("builtin");
78const math = std.math;
89const qnan128: f128 = @bitCast(@as(u128, 0x7fff800000000000) << 64);
910
......@@ -34,6 +35,8 @@ fn test__addtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {
3435}
3536
3637test "addtf3" {
38 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
39
3740 try test__addtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
3841
3942 // NaN + any = NaN
......@@ -73,6 +76,9 @@ fn test__subtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {
7376}
7477
7578test "subtf3" {
79 if (builtin.zig_backend == .stage2_x86_64 and
80 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
81
7682 // qNaN - any = qNaN
7783 try test__subtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
7884
......@@ -103,6 +109,8 @@ fn test__addxf3(a: f80, b: f80, expected: u80) !void {
103109}
104110
105111test "addxf3" {
112 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
113
106114 // NaN + any = NaN
107115 try test__addxf3(qnan80, 0x1.23456789abcdefp+5, @as(u80, @bitCast(qnan80)));
108116 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 {
2323}
2424
2525test "addoti4" {
26 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
27
2628 const min: i128 = math.minInt(i128);
2729 const max: i128 = math.maxInt(i128);
2830 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 {
9898}
9999
100100test "cmp_f80" {
101 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
102
101103 inline for (.{ LE, GE }) |RT| {
102104 try std.testing.expect(cmp_f80(RT, 1.0, 1.0) == RT.Equal);
103105 try std.testing.expect(cmp_f80(RT, 0.0, -0.0) == RT.Equal);
lib/compiler_rt/cos.zig+2-2
......@@ -1,6 +1,4 @@
11const std = @import("std");
2const builtin = @import("builtin");
3const arch = builtin.cpu.arch;
42const math = std.math;
53const expect = std.testing.expect;
64const common = @import("common.zig");
......@@ -136,6 +134,8 @@ pub fn cosl(x: c_longdouble) callconv(.C) c_longdouble {
136134}
137135
138136test "cos32" {
137 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
138
139139 const epsilon = 0.00001;
140140
141141 try expect(math.approxEqAbs(f32, cosf(0.0), 1.0, epsilon));
lib/compiler_rt/divtf3_test.zig+4
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const math = std.math;
34const testing = std.testing;
45
......@@ -30,6 +31,9 @@ fn test__divtf3(a: f128, b: f128, expectedHi: u64, expectedLo: u64) !void {
3031}
3132
3233test "divtf3" {
34 if (builtin.zig_backend == .stage2_x86_64 and
35 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
36
3337 // NaN / any = NaN
3438 try test__divtf3(math.nan(f128), 0x1.23456789abcdefp+5, 0x7fff800000000000, 0);
3539 // inf / any(except inf and nan) = inf
lib/compiler_rt/divxf3_test.zig+2
......@@ -39,6 +39,8 @@ fn test__divxf3(a: f80, b: f80) !void {
3939}
4040
4141test "divxf3" {
42 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
43
4244 // NaN / any = NaN
4345 try expect__divxf3_result(math.nan(f80), 0x1.23456789abcdefp+5, 0x7fffC000000000000000);
4446 // inf / any(except inf and nan) = inf
lib/compiler_rt/float_from_int_test.zig+22
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const testing = std.testing;
34const math = std.math;
45
......@@ -125,6 +126,9 @@ fn test__floatuntisf(a: u128, expected: f32) !void {
125126}
126127
127128test "floattisf" {
129 if (builtin.zig_backend == .stage2_x86_64 and
130 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
131
128132 try test__floattisf(0, 0.0);
129133
130134 try test__floattisf(1, 1.0);
......@@ -171,6 +175,9 @@ test "floattisf" {
171175}
172176
173177test "floatuntisf" {
178 if (builtin.zig_backend == .stage2_x86_64 and
179 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
180
174181 try test__floatuntisf(0, 0.0);
175182
176183 try test__floatuntisf(1, 1.0);
......@@ -367,6 +374,9 @@ fn test__floatuntidf(a: u128, expected: f64) !void {
367374}
368375
369376test "floattidf" {
377 if (builtin.zig_backend == .stage2_x86_64 and
378 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
379
370380 try test__floattidf(0, 0.0);
371381
372382 try test__floattidf(1, 1.0);
......@@ -437,6 +447,9 @@ test "floattidf" {
437447}
438448
439449test "floatuntidf" {
450 if (builtin.zig_backend == .stage2_x86_64 and
451 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
452
440453 try test__floatuntidf(0, 0.0);
441454
442455 try test__floatuntidf(1, 1.0);
......@@ -582,6 +595,9 @@ test "floatditf" {
582595}
583596
584597test "floatunditf" {
598 if (builtin.zig_backend == .stage2_x86_64 and
599 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
600
585601 try test__floatunditf(0xffffffffffffffff, 0x403effffffffffff, 0xfffe000000000000);
586602 try test__floatunditf(0xfffffffffffffffe, 0x403effffffffffff, 0xfffc000000000000);
587603 try test__floatunditf(0x8000000000000000, 0x403e000000000000, 0x0);
......@@ -603,6 +619,9 @@ fn test__floatuntitf(a: u128, expected: f128) !void {
603619}
604620
605621test "floattitf" {
622 if (builtin.zig_backend == .stage2_x86_64 and
623 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
624
606625 try test__floattitf(0, 0.0);
607626
608627 try test__floattitf(1, 1.0);
......@@ -685,6 +704,9 @@ test "floattitf" {
685704}
686705
687706test "floatuntitf" {
707 if (builtin.zig_backend == .stage2_x86_64 and
708 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
709
688710 try test__floatuntitf(0, 0.0);
689711
690712 try test__floatuntitf(1, 1.0);
lib/compiler_rt/fma.zig+3
......@@ -343,6 +343,9 @@ test "64" {
343343}
344344
345345test "128" {
346 if (builtin.zig_backend == .stage2_x86_64 and
347 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
348
346349 const epsilon = 0.000001;
347350
348351 try expect(math.approxEqAbs(f128, fmaq(0.0, 5.0, 9.124), 9.124, epsilon));
lib/compiler_rt/fmodx_test.zig+4
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const fmod = @import("fmod.zig");
34const testing = std.testing;
45
......@@ -22,6 +23,9 @@ fn test_fmodx_infs() !void {
2223}
2324
2425test "fmodx" {
26 if (builtin.zig_backend == .stage2_x86_64 and
27 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
28
2529 try test_fmodx(6.4, 4.0, 2.4);
2630 try test_fmodx(6.4, -4.0, 2.4);
2731 try test_fmodx(-6.4, 4.0, -2.4);
lib/compiler_rt/int.zig+2
......@@ -42,6 +42,8 @@ pub fn __divmodti4(a: i128, b: i128, rem: *i128) callconv(.C) i128 {
4242}
4343
4444test "test_divmodti4" {
45 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
46
4547 const cases = [_][4]i128{
4648 [_]i128{ 0, 1, 0, 0 },
4749 [_]i128{ 0, -1, 0, 0 },
lib/compiler_rt/int_from_float_test.zig+37
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const testing = std.testing;
34const math = std.math;
45
......@@ -40,6 +41,8 @@ fn test__fixunssfsi(a: f32, expected: u32) !void {
4041}
4142
4243test "fixsfsi" {
44 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
45
4346 try test__fixsfsi(-math.floatMax(f32), math.minInt(i32));
4447
4548 try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
......@@ -103,6 +106,8 @@ test "fixsfsi" {
103106}
104107
105108test "fixunssfsi" {
109 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
110
106111 try test__fixunssfsi(0.0, 0);
107112
108113 try test__fixunssfsi(0.5, 0);
......@@ -142,6 +147,8 @@ fn test__fixunssfdi(a: f32, expected: u64) !void {
142147}
143148
144149test "fixsfdi" {
150 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
151
145152 try test__fixsfdi(-math.floatMax(f32), math.minInt(i64));
146153
147154 try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
......@@ -197,6 +204,8 @@ test "fixsfdi" {
197204}
198205
199206test "fixunssfdi" {
207 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
208
200209 try test__fixunssfdi(0.0, 0);
201210
202211 try test__fixunssfdi(0.5, 0);
......@@ -235,6 +244,8 @@ fn test__fixunssfti(a: f32, expected: u128) !void {
235244}
236245
237246test "fixsfti" {
247 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
248
238249 try test__fixsfti(-math.floatMax(f32), math.minInt(i128));
239250
240251 try test__fixsfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
......@@ -306,6 +317,8 @@ test "fixsfti" {
306317}
307318
308319test "fixunssfti" {
320 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
321
309322 try test__fixunssfti(0.0, 0);
310323
311324 try test__fixunssfti(0.5, 0);
......@@ -352,6 +365,8 @@ fn test__fixunsdfsi(a: f64, expected: u32) !void {
352365}
353366
354367test "fixdfsi" {
368 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
369
355370 try test__fixdfsi(-math.floatMax(f64), math.minInt(i32));
356371
357372 try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
......@@ -413,6 +428,8 @@ test "fixdfsi" {
413428}
414429
415430test "fixunsdfsi" {
431 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
432
416433 try test__fixunsdfsi(0.0, 0);
417434
418435 try test__fixunsdfsi(0.5, 0);
......@@ -455,6 +472,8 @@ fn test__fixunsdfdi(a: f64, expected: u64) !void {
455472}
456473
457474test "fixdfdi" {
475 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
476
458477 try test__fixdfdi(-math.floatMax(f64), math.minInt(i64));
459478
460479 try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
......@@ -508,6 +527,8 @@ test "fixdfdi" {
508527}
509528
510529test "fixunsdfdi" {
530 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
531
511532 try test__fixunsdfdi(0.0, 0);
512533 try test__fixunsdfdi(0.5, 0);
513534 try test__fixunsdfdi(0.99, 0);
......@@ -550,6 +571,8 @@ fn test__fixunsdfti(a: f64, expected: u128) !void {
550571}
551572
552573test "fixdfti" {
574 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
575
553576 try test__fixdfti(-math.floatMax(f64), math.minInt(i128));
554577
555578 try test__fixdfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
......@@ -603,6 +626,8 @@ test "fixdfti" {
603626}
604627
605628test "fixunsdfti" {
629 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
630
606631 try test__fixunsdfti(0.0, 0);
607632
608633 try test__fixunsdfti(0.5, 0);
......@@ -652,6 +677,8 @@ fn test__fixunstfsi(a: f128, expected: u32) !void {
652677}
653678
654679test "fixtfsi" {
680 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
681
655682 try test__fixtfsi(-math.floatMax(f128), math.minInt(i32));
656683
657684 try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
......@@ -715,6 +742,8 @@ test "fixtfsi" {
715742}
716743
717744test "fixunstfsi" {
745 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
746
718747 try test__fixunstfsi(math.inf(f128), 0xffffffff);
719748 try test__fixunstfsi(0, 0x0);
720749 try test__fixunstfsi(0x1.23456789abcdefp+5, 0x24);
......@@ -738,6 +767,8 @@ fn test__fixunstfdi(a: f128, expected: u64) !void {
738767}
739768
740769test "fixtfdi" {
770 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
771
741772 try test__fixtfdi(-math.floatMax(f128), math.minInt(i64));
742773
743774 try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
......@@ -801,6 +832,8 @@ test "fixtfdi" {
801832}
802833
803834test "fixunstfdi" {
835 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
836
804837 try test__fixunstfdi(0.0, 0);
805838
806839 try test__fixunstfdi(0.5, 0);
......@@ -853,6 +886,8 @@ fn test__fixunstfti(a: f128, expected: u128) !void {
853886}
854887
855888test "fixtfti" {
889 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
890
856891 try test__fixtfti(-math.floatMax(f128), math.minInt(i128));
857892
858893 try test__fixtfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
......@@ -934,6 +969,8 @@ fn test__fixunshfti(a: f16, expected: u128) !void {
934969}
935970
936971test "fixunshfti for f16" {
972 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
973
937974 try test__fixunshfti(math.inf(f16), math.maxInt(u128));
938975 try test__fixunshfti(math.floatMax(f16), 65504);
939976}
lib/compiler_rt/mulf3_test.zig+4
......@@ -3,6 +3,7 @@
33// https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/test/builtins/Unit/multf3_test.c
44
55const std = @import("std");
6const builtin = @import("builtin");
67const math = std.math;
78const qnan128: f128 = @bitCast(@as(u128, 0x7fff800000000000) << 64);
89const inf128: f128 = @bitCast(@as(u128, 0x7fff000000000000) << 64);
......@@ -48,6 +49,9 @@ fn makeNaN128(rand: u64) f128 {
4849 return @bitCast(int_result);
4950}
5051test "multf3" {
52 if (builtin.zig_backend == .stage2_x86_64 and
53 !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
54
5155 // qNaN * any = qNaN
5256 try test__multf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
5357
lib/compiler_rt/negti2_test.zig+3-1
......@@ -6,7 +6,9 @@ fn test__negti2(a: i128, expected: i128) !void {
66 try testing.expectEqual(expected, result);
77}
88
9test "negdi2" {
9test "negti2" {
10 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
11
1012 // TODO ensuring that math.minInt(i128); returns error
1113
1214 try test__negti2(-3, 3);
lib/compiler_rt/powiXf2_test.zig+11-2
......@@ -3,8 +3,10 @@
33// powihf2 adapted from powisf2 tests
44
55const powiXf2 = @import("powiXf2.zig");
6const testing = @import("std").testing;
7const math = @import("std").math;
6const std = @import("std");
7const builtin = @import("builtin");
8const testing = std.testing;
9const math = std.math;
810
911fn test__powihf2(a: f16, b: i32, expected: f16) !void {
1012 var result = powiXf2.__powihf2(a, b);
......@@ -32,6 +34,9 @@ fn test__powixf2(a: f80, b: i32, expected: f80) !void {
3234}
3335
3436test "powihf2" {
37 if (builtin.zig_backend == .stage2_x86_64 and
38 !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .f16c)) return error.SkipZigTest;
39
3540 const inf_f16 = math.inf(f16);
3641 try test__powisf2(0, 0, 1);
3742 try test__powihf2(1, 0, 1);
......@@ -351,6 +356,8 @@ test "powidf2" {
351356}
352357
353358test "powitf2" {
359 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
360
354361 const inf_f128 = math.inf(f128);
355362 try test__powitf2(0, 0, 1);
356363 try test__powitf2(1, 0, 1);
......@@ -456,6 +463,8 @@ test "powitf2" {
456463}
457464
458465test "powixf2" {
466 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
467
459468 const inf_f80 = math.inf(f80);
460469 try test__powixf2(0, 0, 1);
461470 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 {
140140}
141141
142142test "sin32" {
143 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
144
143145 const epsilon = 0.00001;
144146
145147 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 {
2727}
2828
2929test "suboti3" {
30 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
31
3032 const min: i128 = math.minInt(i128);
3133 const max: i128 = math.maxInt(i128);
3234 var i: i128 = 1;
lib/compiler_rt/tan.zig+4
......@@ -131,6 +131,8 @@ test "tan" {
131131}
132132
133133test "tan32" {
134 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
135
134136 const epsilon = 0.00001;
135137
136138 try expect(math.approxEqAbs(f32, tanf(0.0), 0.0, epsilon));
......@@ -142,6 +144,8 @@ test "tan32" {
142144}
143145
144146test "tan64" {
147 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
148
145149 const epsilon = 0.000001;
146150
147151 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)
129129}
130130
131131test "__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 }
133136
134137 const RndGen = std.rand.DefaultPrng;
135138 var rnd = RndGen.init(42);
lib/std/Build/Cache.zig+10
......@@ -1007,6 +1007,8 @@ test "cache file and then recall it" {
10071007 return error.SkipZigTest;
10081008 }
10091009
1010 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1011
10101012 var tmp = testing.tmpDir(.{});
10111013 defer tmp.cleanup();
10121014
......@@ -1072,6 +1074,9 @@ test "check that changing a file makes cache fail" {
10721074 // https://github.com/ziglang/zig/issues/5437
10731075 return error.SkipZigTest;
10741076 }
1077
1078 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1079
10751080 var tmp = testing.tmpDir(.{});
10761081 defer tmp.cleanup();
10771082
......@@ -1146,6 +1151,8 @@ test "no file inputs" {
11461151 return error.SkipZigTest;
11471152 }
11481153
1154 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1155
11491156 var tmp = testing.tmpDir(.{});
11501157 defer tmp.cleanup();
11511158
......@@ -1193,6 +1200,9 @@ test "Manifest with files added after initial hash work" {
11931200 // https://github.com/ziglang/zig/issues/5437
11941201 return error.SkipZigTest;
11951202 }
1203
1204 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1205
11961206 var tmp = testing.tmpDir(.{});
11971207 defer tmp.cleanup();
11981208
lib/std/Build/Step/Options.zig+2
......@@ -296,6 +296,8 @@ const Arg = struct {
296296test Options {
297297 if (builtin.os.tag == .wasi) return error.SkipZigTest;
298298
299 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
300
299301 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
300302 defer arena.deinit();
301303
lib/std/Thread/Condition.zig+6
......@@ -369,6 +369,8 @@ test "Condition - signal" {
369369 return error.SkipZigTest;
370370 }
371371
372 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
373
372374 const num_threads = 4;
373375
374376 const SignalTest = struct {
......@@ -498,6 +500,8 @@ test "Condition - broadcasting" {
498500 return error.SkipZigTest;
499501 }
500502
503 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
504
501505 const num_threads = 10;
502506
503507 const BroadcastTest = struct {
......@@ -565,6 +569,8 @@ test "Condition - broadcasting - wake all threads" {
565569 return error.SkipZigTest;
566570 }
567571
572 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
573
568574 var num_runs: usize = 1;
569575 const num_threads = 10;
570576
lib/std/Thread/Mutex.zig+2
......@@ -289,6 +289,8 @@ test "Mutex - many contended" {
289289 return error.SkipZigTest;
290290 }
291291
292 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
293
292294 const num_threads = 4;
293295 const num_increments = 1000;
294296
lib/std/Thread/RwLock.zig+2
......@@ -297,6 +297,8 @@ test "RwLock - concurrent access" {
297297 if (builtin.single_threaded)
298298 return;
299299
300 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
301
300302 const num_writers: usize = 2;
301303 const num_readers: usize = 4;
302304 const num_writes: usize = 10000;
lib/std/Uri.zig+2
......@@ -685,6 +685,8 @@ test "Special test" {
685685}
686686
687687test "URI escaping" {
688 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
689
688690 const input = "\\ö/ äöß ~~.adas-https://canvas:123/#ads&&sad";
689691 const expected = "%5C%C3%B6%2F%20%C3%A4%C3%B6%C3%9F%20~~.adas-https%3A%2F%2Fcanvas%3A123%2F%23ads%26%26sad";
690692
lib/std/array_hash_map.zig+15
......@@ -1,4 +1,5 @@
11const std = @import("std.zig");
2const builtin = @import("builtin");
23const debug = std.debug;
34const assert = debug.assert;
45const testing = std.testing;
......@@ -2137,6 +2138,8 @@ test "ensure capacity leak" {
21372138}
21382139
21392140test "big map" {
2141 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2142
21402143 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
21412144 defer map.deinit();
21422145
......@@ -2190,6 +2193,8 @@ test "big map" {
21902193}
21912194
21922195test "clone" {
2196 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2197
21932198 var original = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
21942199 defer original.deinit();
21952200
......@@ -2216,6 +2221,8 @@ test "clone" {
22162221}
22172222
22182223test "shrink" {
2224 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2225
22192226 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
22202227 defer map.deinit();
22212228
......@@ -2256,6 +2263,8 @@ test "shrink" {
22562263}
22572264
22582265test "pop" {
2266 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2267
22592268 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
22602269 defer map.deinit();
22612270
......@@ -2274,6 +2283,8 @@ test "pop" {
22742283}
22752284
22762285test "popOrNull" {
2286 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2287
22772288 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
22782289 defer map.deinit();
22792290
......@@ -2294,6 +2305,8 @@ test "popOrNull" {
22942305}
22952306
22962307test "reIndex" {
2308 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2309
22972310 var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);
22982311 defer map.deinit();
22992312
......@@ -2338,6 +2351,8 @@ test "auto store_hash" {
23382351}
23392352
23402353test "sort" {
2354 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2355
23412356 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
23422357 defer map.deinit();
23432358
lib/std/array_list.zig+11
......@@ -1,4 +1,5 @@
11const std = @import("std.zig");
2const builtin = @import("builtin");
23const debug = std.debug;
34const assert = debug.assert;
45const testing = std.testing;
......@@ -1183,6 +1184,8 @@ test "std.ArrayList/ArrayListUnmanaged.initCapacity" {
11831184}
11841185
11851186test "std.ArrayList/ArrayListUnmanaged.clone" {
1187 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1188
11861189 const a = testing.allocator;
11871190 {
11881191 var array = ArrayList(i32).init(a);
......@@ -1224,6 +1227,8 @@ test "std.ArrayList/ArrayListUnmanaged.clone" {
12241227}
12251228
12261229test "std.ArrayList/ArrayListUnmanaged.basic" {
1230 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1231
12271232 const a = testing.allocator;
12281233 {
12291234 var list = ArrayList(i32).init(a);
......@@ -1508,6 +1513,8 @@ test "std.ArrayList/ArrayListUnmanaged.insert" {
15081513}
15091514
15101515test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
1516 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1517
15111518 const a = testing.allocator;
15121519 {
15131520 var list = ArrayList(i32).init(a);
......@@ -1554,6 +1561,8 @@ test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
15541561}
15551562
15561563test "std.ArrayList/ArrayListUnmanaged.replaceRange" {
1564 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1565
15571566 var arena = std.heap.ArenaAllocator.init(testing.allocator);
15581567 defer arena.deinit();
15591568 const a = arena.allocator();
......@@ -1725,6 +1734,8 @@ test "shrink still sets length when resizing is disabled" {
17251734}
17261735
17271736test "shrinkAndFree with a copy" {
1737 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1738
17281739 var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 });
17291740 const a = failing_allocator.allocator();
17301741
lib/std/atomic/Atomic.zig+4
......@@ -374,6 +374,8 @@ const atomic_rmw_orderings = [_]Ordering{
374374};
375375
376376test "Atomic.swap" {
377 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
378
377379 inline for (atomic_rmw_orderings) |ordering| {
378380 var x = Atomic(usize).init(5);
379381 try testing.expectEqual(x.swap(10, ordering), 5);
......@@ -467,6 +469,8 @@ test "Atomic.fetchSub" {
467469}
468470
469471test "Atomic.fetchMin" {
472 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
473
470474 inline for (atomicIntTypes()) |Int| {
471475 inline for (atomic_rmw_orderings) |ordering| {
472476 var x = Atomic(Int).init(5);
lib/std/atomic/queue.zig+2
......@@ -175,6 +175,8 @@ const puts_per_thread = 500;
175175const put_thread_count = 3;
176176
177177test "std.atomic.Queue" {
178 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
179
178180 var plenty_of_memory = try std.heap.page_allocator.alloc(u8, 300 * 1024);
179181 defer std.heap.page_allocator.free(plenty_of_memory);
180182
lib/std/base64.zig+7
......@@ -1,5 +1,6 @@
11const std = @import("std.zig");
22const assert = std.debug.assert;
3const builtin = @import("builtin");
34const testing = std.testing;
45const mem = std.mem;
56
......@@ -354,12 +355,16 @@ pub const Base64DecoderWithIgnore = struct {
354355};
355356
356357test "base64" {
358 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
359
357360 @setEvalBranchQuota(8000);
358361 try testBase64();
359362 try comptime testAllApis(standard, "comptime", "Y29tcHRpbWU=");
360363}
361364
362365test "base64 padding dest overflow" {
366 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
367
363368 const input = "foo";
364369
365370 var expect: [128]u8 = undefined;
......@@ -374,6 +379,8 @@ test "base64 padding dest overflow" {
374379}
375380
376381test "base64 url_safe_no_pad" {
382 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
383
377384 @setEvalBranchQuota(8000);
378385 try testBase64UrlSafeNoPad();
379386 try comptime testAllApis(url_safe_no_pad, "comptime", "Y29tcHRpbWU");
lib/std/bit_set.zig+14-1
......@@ -33,6 +33,7 @@
3333const std = @import("std.zig");
3434const assert = std.debug.assert;
3535const Allocator = std.mem.Allocator;
36const builtin = @import("builtin");
3637
3738/// Returns the optimal static bit set type for the specified number
3839/// of elements: either `IntegerBitSet` or `ArrayBitSet`,
......@@ -1636,7 +1637,10 @@ fn testStaticBitSet(comptime Set: type) !void {
16361637}
16371638
16381639test "IntegerBitSet" {
1639 if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
1640 switch (builtin.zig_backend) {
1641 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1642 else => {},
1643 }
16401644
16411645 try testStaticBitSet(IntegerBitSet(0));
16421646 try testStaticBitSet(IntegerBitSet(1));
......@@ -1649,6 +1653,11 @@ test "IntegerBitSet" {
16491653}
16501654
16511655test "ArrayBitSet" {
1656 switch (builtin.zig_backend) {
1657 .stage2_x86_64 => return error.SkipZigTest,
1658 else => {},
1659 }
1660
16521661 inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| {
16531662 try testStaticBitSet(ArrayBitSet(u8, size));
16541663 try testStaticBitSet(ArrayBitSet(u16, size));
......@@ -1659,6 +1668,8 @@ test "ArrayBitSet" {
16591668}
16601669
16611670test "DynamicBitSetUnmanaged" {
1671 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1672
16621673 const allocator = std.testing.allocator;
16631674 var a = try DynamicBitSetUnmanaged.initEmpty(allocator, 300);
16641675 try testing.expectEqual(@as(usize, 0), a.count());
......@@ -1712,6 +1723,8 @@ test "DynamicBitSetUnmanaged" {
17121723}
17131724
17141725test "DynamicBitSet" {
1726 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1727
17151728 const allocator = std.testing.allocator;
17161729 var a = try DynamicBitSet.initEmpty(allocator, 300);
17171730 try testing.expectEqual(@as(usize, 0), a.count());
lib/std/compress/deflate/compressor.zig+2
......@@ -1069,6 +1069,8 @@ var deflate_tests = [_]DeflateTest{
10691069};
10701070
10711071test "deflate" {
1072 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1073
10721074 for (deflate_tests) |dt| {
10731075 var output = ArrayList(u8).init(testing.allocator);
10741076 defer output.deinit();
lib/std/compress/deflate/compressor_test.zig+18
......@@ -154,6 +154,8 @@ fn testToFromWithLimit(input: []const u8, limit: [11]u32) !void {
154154}
155155
156156test "deflate/inflate" {
157 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
158
157159 var limits = [_]u32{0} ** 11;
158160
159161 var test0 = [_]u8{};
......@@ -178,6 +180,8 @@ test "deflate/inflate" {
178180}
179181
180182test "very long sparse chunk" {
183 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
184
181185 // A SparseReader returns a stream consisting of 0s ending with 65,536 (1<<16) 1s.
182186 // This tests missing hash references in a very large input.
183187 const SparseReader = struct {
......@@ -239,6 +243,8 @@ test "very long sparse chunk" {
239243}
240244
241245test "compressor reset" {
246 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
247
242248 for (std.enums.values(deflate.Compression)) |c| {
243249 try testWriterReset(c, null);
244250 try testWriterReset(c, "dict");
......@@ -289,6 +295,8 @@ fn testWriterReset(level: deflate.Compression, dict: ?[]const u8) !void {
289295}
290296
291297test "decompressor dictionary" {
298 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
299
292300 const dict = "hello world"; // dictionary
293301 const text = "hello again world";
294302
......@@ -329,6 +337,8 @@ test "decompressor dictionary" {
329337}
330338
331339test "compressor dictionary" {
340 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
341
332342 const dict = "hello world";
333343 const text = "hello again world";
334344
......@@ -375,6 +385,8 @@ test "compressor dictionary" {
375385// Update the hash for best_speed only if d.index < d.maxInsertIndex
376386// See https://golang.org/issue/2508
377387test "Go non-regression test for 2508" {
388 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
389
378390 var comp = try compressor(
379391 testing.allocator,
380392 io.null_writer,
......@@ -392,6 +404,8 @@ test "Go non-regression test for 2508" {
392404}
393405
394406test "deflate/inflate string" {
407 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
408
395409 const StringTest = struct {
396410 filename: []const u8,
397411 limit: [11]u32,
......@@ -439,6 +453,8 @@ test "deflate/inflate string" {
439453}
440454
441455test "inflate reset" {
456 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
457
442458 const strings = [_][]const u8{
443459 "lorem ipsum izzle fo rizzle",
444460 "the quick brown fox jumped over",
......@@ -485,6 +501,8 @@ test "inflate reset" {
485501}
486502
487503test "inflate reset dictionary" {
504 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
505
488506 const dict = "the lorem fox";
489507 const strings = [_][]const u8{
490508 "lorem ipsum izzle fo rizzle",
lib/std/compress/deflate/deflate_fast.zig+2
......@@ -649,6 +649,8 @@ test "best speed shift offsets" {
649649}
650650
651651test "best speed reset" {
652 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
652654 // test that encoding is consistent across a warparound of the table offset.
653655 // See https://github.com/golang/go/issues/34121
654656 const fmt = std.fmt;
lib/std/compress/deflate/deflate_fast_test.zig+5
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const expect = std.testing.expect;
34const io = std.io;
45const mem = std.mem;
......@@ -11,6 +12,8 @@ const inflate = @import("decompressor.zig");
1112const deflate_const = @import("deflate_const.zig");
1213
1314test "best speed" {
15 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
16
1417 // Tests that round-tripping through deflate and then inflate recovers the original input.
1518 // The Write sizes are near the thresholds in the compressor.encSpeed method (0, 16, 128), as well
1619 // as near `deflate_const.max_store_block_size` (65535).
......@@ -93,6 +96,8 @@ test "best speed" {
9396}
9497
9598test "best speed max match offset" {
99 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
100
96101 const abc = "abcdefgh";
97102 const xyz = "stuvwxyz";
98103 const input_margin = 16 - 1;
lib/std/compress/deflate/huffman_bit_writer.zig+6
......@@ -845,6 +845,8 @@ const testing = std.testing;
845845const ArrayList = std.ArrayList;
846846
847847test "writeBlockHuff" {
848 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
849
848850 // Tests huffman encoding against reference files to detect possible regressions.
849851 // If encoding/bit allocation changes you can regenerate these files
850852
......@@ -1569,6 +1571,8 @@ const TestType = enum {
15691571};
15701572
15711573test "writeBlock" {
1574 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1575
15721576 // tests if the writeBlock encoding has changed.
15731577
15741578 const ttype: TestType = .write_block;
......@@ -1584,6 +1588,8 @@ test "writeBlock" {
15841588}
15851589
15861590test "writeBlockDynamic" {
1591 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1592
15871593 // tests if the writeBlockDynamic encoding has changed.
15881594
15891595 const ttype: TestType = .write_dyn_block;
lib/std/compress/deflate/huffman_code.zig+2
......@@ -360,6 +360,8 @@ fn byFreq(context: void, a: LiteralNode, b: LiteralNode) bool {
360360}
361361
362362test "generate a Huffman code from an array of frequencies" {
363 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
364
363365 var freqs: [19]u16 = [_]u16{
364366 8, // 0
365367 1, // 1
lib/std/compress/gzip.zig+2
......@@ -174,6 +174,8 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
174174// https://tools.ietf.org/rfc/rfc1952.txt length=25037 bytes
175175// SHA256=164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67
176176test "compressed data" {
177 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
178
177179 try testReader(
178180 @embedFile("testdata/rfc1952.txt.gz"),
179181 @embedFile("testdata/rfc1952.txt"),
lib/std/compress/lzma/test.zig+17
......@@ -1,4 +1,5 @@
11const std = @import("../../std.zig");
2const builtin = @import("builtin");
23const lzma = @import("../lzma.zig");
34
45fn testDecompress(compressed: []const u8) ![]u8 {
......@@ -22,6 +23,8 @@ fn testDecompressError(expected: anyerror, compressed: []const u8) !void {
2223}
2324
2425test "LZMA: decompress empty world" {
26 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
27
2528 try testDecompressEqual(
2629 "",
2730 &[_]u8{
......@@ -32,6 +35,8 @@ test "LZMA: decompress empty world" {
3235}
3336
3437test "LZMA: decompress hello world" {
38 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
39
3540 try testDecompressEqual(
3641 "Hello world\n",
3742 &[_]u8{
......@@ -43,6 +48,8 @@ test "LZMA: decompress hello world" {
4348}
4449
4550test "LZMA: decompress huge dict" {
51 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
52
4653 try testDecompressEqual(
4754 "Hello world\n",
4855 &[_]u8{
......@@ -54,6 +61,8 @@ test "LZMA: decompress huge dict" {
5461}
5562
5663test "LZMA: unknown size with end of payload marker" {
64 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
65
5766 try testDecompressEqual(
5867 "Hello\nWorld!\n",
5968 @embedFile("testdata/good-unknown_size-with_eopm.lzma"),
......@@ -61,6 +70,8 @@ test "LZMA: unknown size with end of payload marker" {
6170}
6271
6372test "LZMA: known size without end of payload marker" {
73 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
74
6475 try testDecompressEqual(
6576 "Hello\nWorld!\n",
6677 @embedFile("testdata/good-known_size-without_eopm.lzma"),
......@@ -68,6 +79,8 @@ test "LZMA: known size without end of payload marker" {
6879}
6980
7081test "LZMA: known size with end of payload marker" {
82 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
83
7184 try testDecompressEqual(
7285 "Hello\nWorld!\n",
7386 @embedFile("testdata/good-known_size-with_eopm.lzma"),
......@@ -75,6 +88,8 @@ test "LZMA: known size with end of payload marker" {
7588}
7689
7790test "LZMA: too big uncompressed size in header" {
91 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
92
7893 try testDecompressError(
7994 error.CorruptInput,
8095 @embedFile("testdata/bad-too_big_size-with_eopm.lzma"),
......@@ -82,6 +97,8 @@ test "LZMA: too big uncompressed size in header" {
8297}
8398
8499test "LZMA: too small uncompressed size in header" {
100 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
101
85102 try testDecompressError(
86103 error.CorruptInput,
87104 @embedFile("testdata/bad-too_small_size-without_eopm-3.lzma"),
lib/std/compress/lzma/vec2d.zig+2
......@@ -50,6 +50,8 @@ const expectEqualSlices = std.testing.expectEqualSlices;
5050const expectError = std.testing.expectError;
5151
5252test "Vec2D.init" {
53 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
54
5355 const allocator = testing.allocator;
5456 var vec2d = try Vec2D(i32).init(allocator, 1, .{ 2, 3 });
5557 defer vec2d.deinit(allocator);
lib/std/compress/xz/test.zig+2
......@@ -19,6 +19,8 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
1919}
2020
2121test "compressed data" {
22 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
23
2224 try testReader(@embedFile("testdata/good-0-empty.xz"), "");
2325
2426 inline for ([_][]const u8{
lib/std/compress/zlib.zig+4
......@@ -199,6 +199,8 @@ fn testDecompress(data: []const u8, expected: []const u8) !void {
199199// https://tools.ietf.org/rfc/rfc1951.txt length=36944 bytes
200200// SHA256=5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009
201201test "compressed data" {
202 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
203
202204 const rfc1951_txt = @embedFile("testdata/rfc1951.txt");
203205
204206 // Compressed with compression level = 0
......@@ -264,6 +266,8 @@ test "sanity checks" {
264266}
265267
266268test "compress data" {
269 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
270
267271 const allocator = testing.allocator;
268272 const rfc1951_txt = @embedFile("testdata/rfc1951.txt");
269273
lib/std/compress/zstandard.zig+2
......@@ -264,6 +264,8 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
264264}
265265
266266test "zstandard decompression" {
267 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
268
267269 const uncompressed = @embedFile("testdata/rfc8478.txt");
268270 const compressed3 = @embedFile("testdata/rfc8478.txt.zst.3");
269271 const compressed19 = @embedFile("testdata/rfc8478.txt.zst.19");
lib/std/crypto.zig+2
......@@ -314,6 +314,8 @@ test "CSPRNG" {
314314}
315315
316316test "issue #4532: no index out of bounds" {
317 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
318
317319 const types = [_]type{
318320 hash.Md5,
319321 hash.Sha1,
lib/std/crypto/25519/curve25519.zig+5
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const crypto = std.crypto;
34
45const IdentityElementError = crypto.errors.IdentityElementError;
......@@ -111,6 +112,8 @@ pub const Curve25519 = struct {
111112};
112113
113114test "curve25519" {
115 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
116
114117 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 };
115118 const p = try Curve25519.basePoint.clampedMul(s);
116119 try p.rejectIdentity();
......@@ -125,6 +128,8 @@ test "curve25519" {
125128}
126129
127130test "curve25519 small order check" {
131 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
132
128133 var s: [32]u8 = [_]u8{1} ++ [_]u8{0} ** 31;
129134 const small_order_ss: [7][32]u8 = .{
130135 .{
lib/std/crypto/25519/ed25519.zig+15-1
......@@ -1,5 +1,5 @@
1const builtin = @import("builtin");
21const std = @import("std");
2const builtin = @import("builtin");
33const crypto = std.crypto;
44const debug = std.debug;
55const fmt = std.fmt;
......@@ -484,6 +484,8 @@ pub const Ed25519 = struct {
484484};
485485
486486test "ed25519 key pair creation" {
487 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
488
487489 var seed: [32]u8 = undefined;
488490 _ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");
489491 const key_pair = try Ed25519.KeyPair.create(seed);
......@@ -493,6 +495,8 @@ test "ed25519 key pair creation" {
493495}
494496
495497test "ed25519 signature" {
498 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
499
496500 var seed: [32]u8 = undefined;
497501 _ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");
498502 const key_pair = try Ed25519.KeyPair.create(seed);
......@@ -505,6 +509,8 @@ test "ed25519 signature" {
505509}
506510
507511test "ed25519 batch verification" {
512 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
513
508514 var i: usize = 0;
509515 while (i < 100) : (i += 1) {
510516 const key_pair = try Ed25519.KeyPair.create(null);
......@@ -534,6 +540,8 @@ test "ed25519 batch verification" {
534540}
535541
536542test "ed25519 test vectors" {
543 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
544
537545 const Vec = struct {
538546 msg_hex: *const [64:0]u8,
539547 public_key_hex: *const [64:0]u8,
......@@ -636,6 +644,8 @@ test "ed25519 test vectors" {
636644}
637645
638646test "ed25519 with blind keys" {
647 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
648
639649 const BlindKeyPair = Ed25519.key_blinding.BlindKeyPair;
640650
641651 // Create a standard Ed25519 key pair
......@@ -659,6 +669,8 @@ test "ed25519 with blind keys" {
659669}
660670
661671test "ed25519 signatures with streaming" {
672 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
673
662674 const kp = try Ed25519.KeyPair.create(null);
663675
664676 var signer = try kp.signer(null);
......@@ -675,6 +687,8 @@ test "ed25519 signatures with streaming" {
675687}
676688
677689test "ed25519 key pair from secret key" {
690 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
691
678692 const kp = try Ed25519.KeyPair.create(null);
679693 const kp2 = try Ed25519.KeyPair.fromSecretKey(kp.secret_key);
680694 try std.testing.expectEqualSlices(u8, &kp.secret_key.toBytes(), &kp2.secret_key.toBytes());
lib/std/crypto/25519/edwards25519.zig+11
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const crypto = std.crypto;
34const debug = std.debug;
45const fmt = std.fmt;
......@@ -494,6 +495,8 @@ pub const Edwards25519 = struct {
494495const htest = @import("../test.zig");
495496
496497test "edwards25519 packing/unpacking" {
498 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
499
497500 const s = [_]u8{170} ++ [_]u8{0} ** 31;
498501 var b = Edwards25519.basePoint;
499502 const pk = try b.mul(s);
......@@ -530,6 +533,8 @@ test "edwards25519 packing/unpacking" {
530533}
531534
532535test "edwards25519 point addition/subtraction" {
536 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
537
533538 var s1: [32]u8 = undefined;
534539 var s2: [32]u8 = undefined;
535540 crypto.random.bytes(&s1);
......@@ -544,6 +549,8 @@ test "edwards25519 point addition/subtraction" {
544549}
545550
546551test "edwards25519 uniform-to-point" {
552 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
553
547554 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 };
548555 var p = Edwards25519.fromUniform(r);
549556 try htest.assertEqual("0691eee3cf70a0056df6bfa03120635636581b5c4ea571dfc680f78c7e0b4137", p.toBytes()[0..]);
......@@ -555,6 +562,8 @@ test "edwards25519 uniform-to-point" {
555562
556563// Test vectors from draft-irtf-cfrg-hash-to-curve-12
557564test "edwards25519 hash-to-curve operation" {
565 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
566
558567 var p = Edwards25519.fromString(true, "QUUX-V01-CS02-with-edwards25519_XMD:SHA-512_ELL2_RO_", "abc");
559568 try htest.assertEqual("31558a26887f23fb8218f143e69d5f0af2e7831130bd5b432ef23883b895839a", p.toBytes()[0..]);
560569
......@@ -563,6 +572,8 @@ test "edwards25519 hash-to-curve operation" {
563572}
564573
565574test "edwards25519 implicit reduction of invalid scalars" {
575 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
576
566577 const s = [_]u8{0} ** 31 ++ [_]u8{255};
567578 const p1 = try Edwards25519.basePoint.mulPublic(s);
568579 const p2 = try Edwards25519.basePoint.mul(s);
lib/std/crypto/25519/ristretto255.zig+2
......@@ -168,6 +168,8 @@ pub const Ristretto255 = struct {
168168};
169169
170170test "ristretto255" {
171 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
172
171173 const p = Ristretto255.basePoint;
172174 var buf: [256]u8 = undefined;
173175 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 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const crypto = std.crypto;
34const mem = std.mem;
45const fmt = std.fmt;
......@@ -82,6 +83,8 @@ pub const X25519 = struct {
8283const htest = @import("../test.zig");
8384
8485test "x25519 public key calculation from secret key" {
86 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
87
8588 var sk: [32]u8 = undefined;
8689 var pk_expected: [32]u8 = undefined;
8790 _ = try fmt.hexToBytes(sk[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");
......@@ -91,6 +94,8 @@ test "x25519 public key calculation from secret key" {
9194}
9295
9396test "x25519 rfc7748 vector1" {
97 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
98
9499 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 };
95100 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 };
96101
......@@ -101,6 +106,8 @@ test "x25519 rfc7748 vector1" {
101106}
102107
103108test "x25519 rfc7748 vector2" {
109 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
110
104111 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 };
105112 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 };
106113
......@@ -111,6 +118,8 @@ test "x25519 rfc7748 vector2" {
111118}
112119
113120test "x25519 rfc7748 one iteration" {
121 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
122
114123 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 };
115124 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 };
116125
......@@ -128,6 +137,8 @@ test "x25519 rfc7748 one iteration" {
128137}
129138
130139test "x25519 rfc7748 1,000 iterations" {
140 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
141
131142 // These iteration tests are slow so we always skip them. Results have been verified.
132143 if (true) {
133144 return error.SkipZigTest;
......@@ -150,6 +161,8 @@ test "x25519 rfc7748 1,000 iterations" {
150161}
151162
152163test "x25519 rfc7748 1,000,000 iterations" {
164 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
165
153166 if (true) {
154167 return error.SkipZigTest;
155168 }
......@@ -171,6 +184,8 @@ test "x25519 rfc7748 1,000,000 iterations" {
171184}
172185
173186test "edwards25519 -> curve25519 map" {
187 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
188
174189 const ed_kp = try crypto.sign.Ed25519.KeyPair.create([_]u8{0x42} ** 32);
175190 const mont_kp = try X25519.KeyPair.fromEd25519(ed_kp);
176191 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 {
624624}
625625
626626test parseTimeDigits {
627 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
628
627629 const expectEqual = std.testing.expectEqual;
628630 try expectEqual(@as(u8, 0), try parseTimeDigits("00", 0, 99));
629631 try expectEqual(@as(u8, 99), try parseTimeDigits("99", 0, 99));
......@@ -645,6 +647,8 @@ pub fn parseYear4(text: *const [4]u8) !u16 {
645647}
646648
647649test parseYear4 {
650 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
651
648652 const expectEqual = std.testing.expectEqual;
649653 try expectEqual(@as(u16, 0), try parseYear4("0000"));
650654 try expectEqual(@as(u16, 9999), try parseYear4("9999"));
......@@ -1119,3 +1123,5 @@ pub const rsa = struct {
11191123 return res;
11201124 }
11211125};
1126
1127const builtin = @import("builtin");
lib/std/crypto/Certificate/Bundle.zig+2
......@@ -318,6 +318,8 @@ const MapContext = struct {
318318test "scan for OS-provided certificates" {
319319 if (builtin.os.tag == .wasi) return error.SkipZigTest;
320320
321 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
322
321323 var bundle: Bundle = .{};
322324 defer bundle.deinit(std.testing.allocator);
323325
lib/std/crypto/aegis.zig+15
......@@ -17,6 +17,7 @@
1717//! https://datatracker.ietf.org/doc/draft-irtf-cfrg-aegis-aead/
1818
1919const std = @import("std");
20const builtin = @import("builtin");
2021const crypto = std.crypto;
2122const mem = std.mem;
2223const assert = std.debug.assert;
......@@ -513,6 +514,8 @@ const htest = @import("test.zig");
513514const testing = std.testing;
514515
515516test "Aegis128L test vector 1" {
517 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
518
516519 const key: [Aegis128L.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 14;
517520 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 13;
518521 const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
......@@ -536,6 +539,8 @@ test "Aegis128L test vector 1" {
536539}
537540
538541test "Aegis128L test vector 2" {
542 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
543
539544 const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;
540545 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;
541546 const ad = [_]u8{};
......@@ -553,6 +558,8 @@ test "Aegis128L test vector 2" {
553558}
554559
555560test "Aegis128L test vector 3" {
561 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
562
556563 const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;
557564 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;
558565 const ad = [_]u8{};
......@@ -569,6 +576,8 @@ test "Aegis128L test vector 3" {
569576}
570577
571578test "Aegis256 test vector 1" {
579 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
580
572581 const key: [Aegis256.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 30;
573582 const nonce: [Aegis256.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 29;
574583 const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
......@@ -592,6 +601,8 @@ test "Aegis256 test vector 1" {
592601}
593602
594603test "Aegis256 test vector 2" {
604 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
605
595606 const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;
596607 const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;
597608 const ad = [_]u8{};
......@@ -609,6 +620,8 @@ test "Aegis256 test vector 2" {
609620}
610621
611622test "Aegis256 test vector 3" {
623 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
624
612625 const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;
613626 const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;
614627 const ad = [_]u8{};
......@@ -625,6 +638,8 @@ test "Aegis256 test vector 3" {
625638}
626639
627640test "Aegis MAC" {
641 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
642
628643 const key = [_]u8{0x00} ** Aegis128LMac.key_length;
629644 var msg: [64]u8 = undefined;
630645 for (&msg, 0..) |*m, i| {
lib/std/crypto/aes.zig+10
......@@ -28,6 +28,8 @@ pub const Aes128 = impl.Aes128;
2828pub const Aes256 = impl.Aes256;
2929
3030test "ctr" {
31 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
32
3133 // NIST SP 800-38A pp 55-58
3234 const ctr = @import("modes.zig").ctr;
3335
......@@ -53,6 +55,8 @@ test "ctr" {
5355}
5456
5557test "encrypt" {
58 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
59
5660 // Appendix B
5761 {
5862 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" {
8286}
8387
8488test "decrypt" {
89 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
90
8591 // Appendix B
8692 {
8793 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" {
111117}
112118
113119test "expand 128-bit key" {
120 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
121
114122 const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
115123 const exp_enc = [_]*const [32:0]u8{
116124 "2b7e151628aed2a6abf7158809cf4f3c", "a0fafe1788542cb123a339392a6c7605", "f2c295f27a96b9435935807a7359f67f", "3d80477d4716fe3e1e237e446d7a883b", "ef44a541a8525b7fb671253bdb0bad00", "d4d1c6f87c839d87caf2b8bc11f915bc", "6d88a37a110b3efddbf98641ca0093fd", "4e54f70e5f5fc9f384a64fb24ea6dc4f", "ead27321b58dbad2312bf5607f8d292f", "ac7766f319fadc2128d12941575c006e", "d014f9a8c9ee2589e13f0cc8b6630ca6",
......@@ -133,6 +141,8 @@ test "expand 128-bit key" {
133141}
134142
135143test "expand 256-bit key" {
144 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
145
136146 const key = [_]u8{
137147 0x60, 0x3d, 0xeb, 0x10,
138148 0x15, 0xca, 0x71, 0xbe,
lib/std/crypto/aes_gcm.zig+9
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const assert = std.debug.assert;
34const crypto = std.crypto;
45const debug = std.debug;
......@@ -112,6 +113,8 @@ const htest = @import("test.zig");
112113const testing = std.testing;
113114
114115test "Aes256Gcm - Empty message and no associated data" {
116 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
117
115118 const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
116119 const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
117120 const ad = "";
......@@ -124,6 +127,8 @@ test "Aes256Gcm - Empty message and no associated data" {
124127}
125128
126129test "Aes256Gcm - Associated data only" {
130 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
131
127132 const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
128133 const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
129134 const m = "";
......@@ -136,6 +141,8 @@ test "Aes256Gcm - Associated data only" {
136141}
137142
138143test "Aes256Gcm - Message only" {
144 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
145
139146 const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
140147 const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
141148 const m = "Test with message only";
......@@ -153,6 +160,8 @@ test "Aes256Gcm - Message only" {
153160}
154161
155162test "Aes256Gcm - Message and associated data" {
163 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
164
156165 const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
157166 const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
158167 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 {
261261const hexToBytes = std.fmt.hexToBytes;
262262
263263test "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 }
265268
266269 var k: [Aes128Ocb.key_length]u8 = undefined;
267270 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
......@@ -280,7 +283,10 @@ test "AesOcb test vector 1" {
280283}
281284
282285test "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 }
284290
285291 var k: [Aes128Ocb.key_length]u8 = undefined;
286292 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
......@@ -301,7 +307,10 @@ test "AesOcb test vector 2" {
301307}
302308
303309test "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 }
305314
306315 var k: [Aes128Ocb.key_length]u8 = undefined;
307316 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
......@@ -325,7 +334,10 @@ test "AesOcb test vector 3" {
325334}
326335
327336test "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 }
329341
330342 var k: [Aes128Ocb.key_length]u8 = undefined;
331343 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
lib/std/crypto/argon2.zig+14
......@@ -622,6 +622,8 @@ pub fn strVerify(
622622}
623623
624624test "argon2d" {
625 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
626
625627 const password = [_]u8{0x01} ** 32;
626628 const salt = [_]u8{0x02} ** 16;
627629 const secret = [_]u8{0x03} ** 8;
......@@ -647,6 +649,8 @@ test "argon2d" {
647649}
648650
649651test "argon2i" {
652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
650654 const password = [_]u8{0x01} ** 32;
651655 const salt = [_]u8{0x02} ** 16;
652656 const secret = [_]u8{0x03} ** 8;
......@@ -672,6 +676,8 @@ test "argon2i" {
672676}
673677
674678test "argon2id" {
679 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
680
675681 const password = [_]u8{0x01} ** 32;
676682 const salt = [_]u8{0x02} ** 16;
677683 const secret = [_]u8{0x03} ** 8;
......@@ -697,6 +703,8 @@ test "argon2id" {
697703}
698704
699705test "kdf" {
706 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
707
700708 const password = "password";
701709 const salt = "somesalt";
702710
......@@ -896,6 +904,8 @@ test "kdf" {
896904}
897905
898906test "phc format hasher" {
907 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
908
899909 const allocator = std.testing.allocator;
900910 const password = "testpass";
901911
......@@ -911,6 +921,8 @@ test "phc format hasher" {
911921}
912922
913923test "password hash and password verify" {
924 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
925
914926 const allocator = std.testing.allocator;
915927 const password = "testpass";
916928
......@@ -924,6 +936,8 @@ test "password hash and password verify" {
924936}
925937
926938test "kdf derived key length" {
939 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
940
927941 const allocator = std.testing.allocator;
928942
929943 const password = "testpass";
lib/std/crypto/bcrypt.zig+7
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const base64 = std.base64;
34const crypto = std.crypto;
45const debug = std.debug;
......@@ -753,6 +754,8 @@ pub fn strVerify(
753754}
754755
755756test "bcrypt codec" {
757 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
758
756759 var salt: [salt_length]u8 = undefined;
757760 crypto.random.bytes(&salt);
758761 var salt_str: [salt_str_length]u8 = undefined;
......@@ -763,6 +766,8 @@ test "bcrypt codec" {
763766}
764767
765768test "bcrypt crypt format" {
769 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
770
766771 var hash_options = HashOptions{
767772 .params = .{ .rounds_log = 5 },
768773 .encoding = .crypt,
......@@ -803,6 +808,8 @@ test "bcrypt crypt format" {
803808}
804809
805810test "bcrypt phc format" {
811 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
812
806813 var hash_options = HashOptions{
807814 .params = .{ .rounds_log = 5 },
808815 .encoding = .phc,
lib/std/crypto/blake3.zig+3-1
......@@ -200,7 +200,7 @@ const CompressGeneric = struct {
200200 }
201201};
202202
203const compress = if (builtin.cpu.arch == .x86_64)
203const compress = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_x86_64)
204204 CompressVectorized.compress
205205else
206206 CompressGeneric.compress;
......@@ -682,6 +682,8 @@ fn testBlake3(hasher: *Blake3, input_len: usize, expected_hex: [262]u8) !void {
682682}
683683
684684test "BLAKE3 reference test cases" {
685 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
686
685687 var hash_state = Blake3.init(.{});
686688 const hash = &hash_state;
687689 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 {
499499fn ChaChaImpl(comptime rounds_nb: usize) type {
500500 switch (builtin.cpu.arch) {
501501 .x86_64 => {
502 if (builtin.zig_backend == .stage2_x86_64) return ChaChaNonVecImpl(rounds_nb);
503
502504 const has_avx2 = std.Target.x86.featureSetHas(builtin.cpu.features, .avx2);
503505 const has_avx512f = std.Target.x86.featureSetHas(builtin.cpu.features, .avx512f);
504506 if (has_avx512f) return ChaChaVecImpl(rounds_nb, 4);
......@@ -757,6 +759,8 @@ fn XChaChaPoly1305(comptime rounds_nb: usize) type {
757759}
758760
759761test "chacha20 AEAD API" {
762 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
763
760764 const aeads = [_]type{ ChaCha20Poly1305, XChaCha20Poly1305 };
761765 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.";
762766 const ad = "Additional data";
......@@ -778,6 +782,8 @@ test "chacha20 AEAD API" {
778782
779783// https://tools.ietf.org/html/rfc7539#section-2.4.2
780784test "crypto.chacha20 test vector sunscreen" {
785 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
786
781787 const expected_result = [_]u8{
782788 0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80,
783789 0x41, 0xba, 0x07, 0x28, 0xdd, 0x0d, 0x69, 0x81,
......@@ -819,6 +825,8 @@ test "crypto.chacha20 test vector sunscreen" {
819825
820826// https://tools.ietf.org/html/draft-agl-tls-chacha20poly1305-04#section-7
821827test "crypto.chacha20 test vector 1" {
828 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
829
822830 const expected_result = [_]u8{
823831 0x76, 0xb8, 0xe0, 0xad, 0xa0, 0xf1, 0x3d, 0x90,
824832 0x40, 0x5d, 0x6a, 0xe5, 0x53, 0x86, 0xbd, 0x28,
......@@ -853,6 +861,8 @@ test "crypto.chacha20 test vector 1" {
853861}
854862
855863test "crypto.chacha20 test vector 2" {
864 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
865
856866 const expected_result = [_]u8{
857867 0x45, 0x40, 0xf0, 0x5a, 0x9f, 0x1f, 0xb2, 0x96,
858868 0xd7, 0x73, 0x6e, 0x7b, 0x20, 0x8e, 0x3c, 0x96,
......@@ -887,6 +897,8 @@ test "crypto.chacha20 test vector 2" {
887897}
888898
889899test "crypto.chacha20 test vector 3" {
900 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
901
890902 const expected_result = [_]u8{
891903 0xde, 0x9c, 0xba, 0x7b, 0xf3, 0xd6, 0x9e, 0xf5,
892904 0xe7, 0x86, 0xdc, 0x63, 0x97, 0x3f, 0x65, 0x3a,
......@@ -921,6 +933,8 @@ test "crypto.chacha20 test vector 3" {
921933}
922934
923935test "crypto.chacha20 test vector 4" {
936 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
937
924938 const expected_result = [_]u8{
925939 0xef, 0x3f, 0xdf, 0xd6, 0xc6, 0x15, 0x78, 0xfb,
926940 0xf5, 0xcf, 0x35, 0xbd, 0x3d, 0xd3, 0x3b, 0x80,
......@@ -955,6 +969,8 @@ test "crypto.chacha20 test vector 4" {
955969}
956970
957971test "crypto.chacha20 test vector 5" {
972 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
973
958974 const expected_result = [_]u8{
959975 0xf7, 0x98, 0xa1, 0x89, 0xf1, 0x95, 0xe6, 0x69,
960976 0x82, 0x10, 0x5f, 0xfb, 0x64, 0x0b, 0xb7, 0x75,
......@@ -1027,6 +1043,8 @@ test "crypto.chacha20 test vector 5" {
10271043}
10281044
10291045test "seal" {
1046 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1047
10301048 {
10311049 const m = "";
10321050 const ad = "";
......@@ -1077,6 +1095,8 @@ test "seal" {
10771095}
10781096
10791097test "open" {
1098 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1099
10801100 {
10811101 const c = [_]u8{ 0xa0, 0x78, 0x4d, 0x7a, 0x47, 0x16, 0xf3, 0xfe, 0xb4, 0xf6, 0x4e, 0x7f, 0x4b, 0x39, 0xbf, 0x4 };
10821102 const ad = "";
......@@ -1141,6 +1161,8 @@ test "open" {
11411161}
11421162
11431163test "crypto.xchacha20" {
1164 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1165
11441166 const key = [_]u8{69} ** 32;
11451167 const nonce = [_]u8{42} ** 24;
11461168 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 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const crypto = std.crypto;
34const mem = std.mem;
45
......@@ -93,6 +94,8 @@ pub fn Cmac(comptime BlockCipher: type) type {
9394const testing = std.testing;
9495
9596test "CmacAes128 - Example 1: len = 0" {
97 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
98
9699 const key = [_]u8{
97100 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
98101 };
......@@ -106,6 +109,8 @@ test "CmacAes128 - Example 1: len = 0" {
106109}
107110
108111test "CmacAes128 - Example 2: len = 16" {
112 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
113
109114 const key = [_]u8{
110115 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
111116 };
......@@ -121,6 +126,8 @@ test "CmacAes128 - Example 2: len = 16" {
121126}
122127
123128test "CmacAes128 - Example 3: len = 40" {
129 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
130
124131 const key = [_]u8{
125132 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
126133 };
......@@ -138,6 +145,8 @@ test "CmacAes128 - Example 3: len = 40" {
138145}
139146
140147test "CmacAes128 - Example 4: len = 64" {
148 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
149
141150 const key = [_]u8{
142151 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
143152 };
lib/std/crypto/ecdsa.zig+24-6
......@@ -372,7 +372,10 @@ pub fn Ecdsa(comptime Curve: type, comptime Hash: type) type {
372372}
373373
374374test "ECDSA - Basic operations over EcdsaP384Sha384" {
375 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
375 switch (builtin.zig_backend) {
376 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
377 else => {},
378 }
376379
377380 const Scheme = EcdsaP384Sha384;
378381 const kp = try Scheme.KeyPair.create(null);
......@@ -388,7 +391,10 @@ test "ECDSA - Basic operations over EcdsaP384Sha384" {
388391}
389392
390393test "ECDSA - Basic operations over Secp256k1" {
391 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
394 switch (builtin.zig_backend) {
395 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
396 else => {},
397 }
392398
393399 const Scheme = EcdsaSecp256k1Sha256oSha256;
394400 const kp = try Scheme.KeyPair.create(null);
......@@ -404,7 +410,10 @@ test "ECDSA - Basic operations over Secp256k1" {
404410}
405411
406412test "ECDSA - Basic operations over EcdsaP384Sha256" {
407 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
413 switch (builtin.zig_backend) {
414 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
415 else => {},
416 }
408417
409418 const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);
410419 const kp = try Scheme.KeyPair.create(null);
......@@ -420,7 +429,10 @@ test "ECDSA - Basic operations over EcdsaP384Sha256" {
420429}
421430
422431test "ECDSA - Verifying a existing signature with EcdsaP384Sha256" {
423 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
432 switch (builtin.zig_backend) {
433 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
434 else => {},
435 }
424436
425437 const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);
426438 // zig fmt: off
......@@ -464,7 +476,10 @@ const TestVector = struct {
464476};
465477
466478test "ECDSA - Test vectors from Project Wycheproof" {
467 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
479 switch (builtin.zig_backend) {
480 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
481 else => {},
482 }
468483
469484 const vectors = [_]TestVector{
470485 .{ .key = "042927b10512bae3eddcfe467828128bad2903269919f7086069c8c4df6c732838c7787964eaac00e5921fb1498a60f4606766b3d9685001558d1a974e7341513e", .msg = "313233343030", .sig = "304402202ba3a8be6b94d5ec80a6d9d1190a436effe50d85a1eee859b8cc6af9bd5c2e1802204cd60b855d442f5b3c7b11eb6c4e0ae7525fe710fab9aa7c77a67f79e6fadd76", .result = .valid },
......@@ -878,7 +893,10 @@ fn tvTry(vector: TestVector) !void {
878893}
879894
880895test "ECDSA - Sec1 encoding/decoding" {
881 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
896 switch (builtin.zig_backend) {
897 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
898 else => {},
899 }
882900
883901 const Scheme = EcdsaP384Sha384;
884902 const kp = try Scheme.KeyPair.create(null);
lib/std/crypto/ff.zig+4-1
......@@ -912,7 +912,10 @@ const ct_unprotected = struct {
912912};
913913
914914test {
915 if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
915 switch (@import("builtin").zig_backend) {
916 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
917 else => {},
918 }
916919
917920 const M = Modulus(256);
918921 const m = try M.fromPrimitive(u256, 3429938563481314093726330772853735541133072814650493833233);
lib/std/crypto/ghash_polyval.zig+6
......@@ -422,6 +422,8 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
422422const htest = @import("test.zig");
423423
424424test "ghash" {
425 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
426
425427 const key = [_]u8{0x42} ** 16;
426428 const m = [_]u8{0x69} ** 256;
427429
......@@ -439,6 +441,8 @@ test "ghash" {
439441}
440442
441443test "ghash2" {
444 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
445
442446 var key: [16]u8 = undefined;
443447 var i: usize = 0;
444448 while (i < key.len) : (i += 1) {
......@@ -472,6 +476,8 @@ test "ghash2" {
472476}
473477
474478test "polyval" {
479 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
480
475481 const key = [_]u8{0x42} ** 16;
476482 const m = [_]u8{0x69} ** 256;
477483
lib/std/crypto/hash_composition.zig+2
......@@ -65,6 +65,8 @@ pub const Sha384oSha384 = Composition(sha2.Sha384, sha2.Sha384);
6565pub const Sha512oSha512 = Composition(sha2.Sha512, sha2.Sha512);
6666
6767test "Hash composition" {
68 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
69
6870 const Sha256 = sha2.Sha256;
6971 const msg = "test";
7072
lib/std/crypto/hkdf.zig+2
......@@ -72,6 +72,8 @@ pub fn Hkdf(comptime Hmac: type) type {
7272const htest = @import("test.zig");
7373
7474test "Hkdf" {
75 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
76
7577 const ikm = [_]u8{0x0b} ** 22;
7678 const salt = [_]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c };
7779 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{
553553};
554554
555555test "invNTTReductions bounds" {
556 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
557
556558 // Checks whether the reductions proposed by invNTTReductions
557559 // don't overflow during invNTT().
558560 var xs = [_]i32{1} ** 256; // start at |x| ≤ q
......@@ -656,6 +658,8 @@ fn montReduce(x: i32) i16 {
656658}
657659
658660test "Test montReduce" {
661 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
662
659663 var rnd = RndGen.init(0);
660664 for (0..1000) |_| {
661665 const bound = comptime @as(i32, Q) * (1 << 15);
......@@ -674,6 +678,8 @@ fn feToMont(x: i16) i16 {
674678}
675679
676680test "Test feToMont" {
681 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
682
677683 var x: i32 = -(1 << 15);
678684 while (x < 1 << 15) : (x += 1) {
679685 const y = feToMont(@as(i16, @intCast(x)));
......@@ -707,6 +713,8 @@ fn feBarrettReduce(x: i16) i16 {
707713}
708714
709715test "Test Barrett reduction" {
716 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
717
710718 var x: i32 = -(1 << 15);
711719 while (x < 1 << 15) : (x += 1) {
712720 var y1 = feBarrettReduce(@as(i16, @intCast(x)));
......@@ -727,6 +735,8 @@ fn csubq(x: i16) i16 {
727735}
728736
729737test "Test csubq" {
738 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
739
730740 var x: i32 = -29439;
731741 while (x < 1 << 15) : (x += 1) {
732742 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 {
14661476}
14671477
14681478test "MulHat" {
1479 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1480
14691481 var rnd = RndGen.init(0);
14701482
14711483 for (0..100) |_| {
......@@ -1497,6 +1509,8 @@ test "MulHat" {
14971509}
14981510
14991511test "NTT" {
1512 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1513
15001514 var rnd = RndGen.init(0);
15011515
15021516 for (0..1000) |_| {
......@@ -1520,6 +1534,8 @@ test "NTT" {
15201534}
15211535
15221536test "Compression" {
1537 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1538
15231539 var rnd = RndGen.init(0);
15241540 inline for (.{ 1, 4, 5, 10, 11 }) |d| {
15251541 for (0..1000) |_| {
......@@ -1532,6 +1548,8 @@ test "Compression" {
15321548}
15331549
15341550test "noise" {
1551 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1552
15351553 var seed: [32]u8 = undefined;
15361554 for (&seed, 0..) |*s, i| {
15371555 s.* = @as(u8, @intCast(i));
......@@ -1578,6 +1596,8 @@ test "noise" {
15781596}
15791597
15801598test "uniform sampling" {
1599 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1600
15811601 var seed: [32]u8 = undefined;
15821602 for (&seed, 0..) |*s, i| {
15831603 s.* = @as(u8, @intCast(i));
......@@ -1611,6 +1631,8 @@ test "uniform sampling" {
16111631}
16121632
16131633test "Polynomial packing" {
1634 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1635
16141636 var rnd = RndGen.init(0);
16151637
16161638 for (0..1000) |_| {
......@@ -1620,6 +1642,8 @@ test "Polynomial packing" {
16201642}
16211643
16221644test "Test inner PKE" {
1645 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1646
16231647 var seed: [32]u8 = undefined;
16241648 var pt: [32]u8 = undefined;
16251649 for (&seed, &pt, 0..) |*s, *p, i| {
......@@ -1641,6 +1665,8 @@ test "Test inner PKE" {
16411665}
16421666
16431667test "Test happy flow" {
1668 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1669
16441670 var seed: [64]u8 = undefined;
16451671 for (&seed, 0..) |*s, i| {
16461672 s.* = @as(u8, @intCast(i));
......@@ -1667,6 +1693,8 @@ test "Test happy flow" {
16671693const sha2 = crypto.hash.sha2;
16681694
16691695test "NIST KAT test" {
1696 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1697
16701698 inline for (.{
16711699 .{ Kyber512, "e9c2bd37133fcb40772f81559f14b1f58dccd1c816701be9ba6214d43baf4547" },
16721700 .{ Kyber1024, "89248f2f33f7f4f7051729111f3049c409a933ec904aedadf035f30fa5646cd5" },
lib/std/crypto/pbkdf2.zig+15
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const mem = std.mem;
34const maxInt = std.math.maxInt;
45const OutputTooLongError = std.crypto.errors.OutputTooLongError;
......@@ -151,6 +152,8 @@ const HmacSha1 = std.crypto.auth.hmac.HmacSha1;
151152// RFC 6070 PBKDF2 HMAC-SHA1 Test Vectors
152153
153154test "RFC 6070 one iteration" {
155 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
156
154157 const p = "password";
155158 const s = "salt";
156159 const c = 1;
......@@ -166,6 +169,8 @@ test "RFC 6070 one iteration" {
166169}
167170
168171test "RFC 6070 two iterations" {
172 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
173
169174 const p = "password";
170175 const s = "salt";
171176 const c = 2;
......@@ -181,6 +186,8 @@ test "RFC 6070 two iterations" {
181186}
182187
183188test "RFC 6070 4096 iterations" {
189 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
190
184191 const p = "password";
185192 const s = "salt";
186193 const c = 4096;
......@@ -196,6 +203,8 @@ test "RFC 6070 4096 iterations" {
196203}
197204
198205test "RFC 6070 16,777,216 iterations" {
206 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
207
199208 // These iteration tests are slow so we always skip them. Results have been verified.
200209 if (true) {
201210 return error.SkipZigTest;
......@@ -216,6 +225,8 @@ test "RFC 6070 16,777,216 iterations" {
216225}
217226
218227test "RFC 6070 multi-block salt and password" {
228 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
229
219230 const p = "passwordPASSWORDpassword";
220231 const s = "saltSALTsaltSALTsaltSALTsaltSALTsalt";
221232 const c = 4096;
......@@ -231,6 +242,8 @@ test "RFC 6070 multi-block salt and password" {
231242}
232243
233244test "RFC 6070 embedded NUL" {
245 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
246
234247 const p = "pass\x00word";
235248 const s = "sa\x00lt";
236249 const c = 4096;
......@@ -246,6 +259,8 @@ test "RFC 6070 embedded NUL" {
246259}
247260
248261test "Very large dk_len" {
262 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
263
249264 // This test allocates 8GB of memory and is expected to take several hours to run.
250265 if (true) {
251266 return error.SkipZigTest;
lib/std/crypto/pcurves/p256.zig+2
......@@ -478,5 +478,7 @@ pub const AffineCoordinates = struct {
478478};
479479
480480test {
481 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
482
481483 _ = @import("tests/p256.zig");
482484}
lib/std/crypto/pcurves/p384.zig+4-1
......@@ -478,7 +478,10 @@ pub const AffineCoordinates = struct {
478478};
479479
480480test {
481 if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
481 switch (@import("builtin").zig_backend) {
482 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
483 else => {},
484 }
482485
483486 _ = @import("tests/p384.zig");
484487}
lib/std/crypto/pcurves/secp256k1.zig+4-1
......@@ -556,7 +556,10 @@ pub const AffineCoordinates = struct {
556556};
557557
558558test {
559 if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
559 switch (@import("builtin").zig_backend) {
560 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
561 else => {},
562 }
560563
561564 _ = @import("tests/secp256k1.zig");
562565}
lib/std/crypto/phc_encoding.zig+9
......@@ -1,6 +1,7 @@
11// https://github.com/P-H-C/phc-string-format
22
33const std = @import("std");
4const builtin = @import("builtin");
45const fmt = std.fmt;
56const io = std.io;
67const mem = std.mem;
......@@ -263,6 +264,8 @@ fn kvSplit(str: []const u8) !struct { key: []const u8, value: []const u8 } {
263264}
264265
265266test "phc format - encoding/decoding" {
267 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
268
266269 const Input = struct {
267270 str: []const u8,
268271 HashResult: type,
......@@ -348,18 +351,24 @@ test "phc format - encoding/decoding" {
348351}
349352
350353test "phc format - empty input string" {
354 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
355
351356 const s = "";
352357 const v = deserialize(struct { alg_id: []const u8 }, s);
353358 try std.testing.expectError(Error.InvalidEncoding, v);
354359}
355360
356361test "phc format - hash without salt" {
362 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
363
357364 const s = "$scrypt";
358365 const v = deserialize(struct { alg_id: []const u8, hash: BinValue(16) }, s);
359366 try std.testing.expectError(Error.InvalidEncoding, v);
360367}
361368
362369test "phc format - calcSize" {
370 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
371
363372 const s = "$scrypt$v=1$ln=15,r=8,p=1$c2FsdHNhbHQ$dGVzdHBhc3M";
364373 const v = try deserialize(struct {
365374 alg_id: []const u8,
lib/std/crypto/poly1305.zig+2
......@@ -196,6 +196,8 @@ pub const Poly1305 = struct {
196196};
197197
198198test "poly1305 rfc7439 vector1" {
199 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
200
199201 const expected_mac = "\xa8\x06\x1d\xc1\x30\x51\x36\xc6\xc2\x2b\x8b\xaf\x0c\x01\x27\xa9";
200202
201203 const msg = "Cryptographic Forum Research Group";
lib/std/crypto/salsa20.zig+12
......@@ -555,6 +555,8 @@ pub const SealedBox = struct {
555555const htest = @import("test.zig");
556556
557557test "(x)salsa20" {
558 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
559
558560 const key = [_]u8{0x69} ** 32;
559561 const nonce = [_]u8{0x42} ** 8;
560562 const msg = [_]u8{0} ** 20;
......@@ -569,6 +571,8 @@ test "(x)salsa20" {
569571}
570572
571573test "xsalsa20poly1305" {
574 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
575
572576 var msg: [100]u8 = undefined;
573577 var msg2: [msg.len]u8 = undefined;
574578 var c: [msg.len]u8 = undefined;
......@@ -584,6 +588,8 @@ test "xsalsa20poly1305" {
584588}
585589
586590test "xsalsa20poly1305 secretbox" {
591 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
592
587593 var msg: [100]u8 = undefined;
588594 var msg2: [msg.len]u8 = undefined;
589595 var key: [XSalsa20Poly1305.key_length]u8 = undefined;
......@@ -598,6 +604,8 @@ test "xsalsa20poly1305 secretbox" {
598604}
599605
600606test "xsalsa20poly1305 box" {
607 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
608
601609 var msg: [100]u8 = undefined;
602610 var msg2: [msg.len]u8 = undefined;
603611 var nonce: [Box.nonce_length]u8 = undefined;
......@@ -612,6 +620,8 @@ test "xsalsa20poly1305 box" {
612620}
613621
614622test "xsalsa20poly1305 sealedbox" {
623 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
624
615625 var msg: [100]u8 = undefined;
616626 var msg2: [msg.len]u8 = undefined;
617627 var boxed: [msg.len + SealedBox.seal_length]u8 = undefined;
......@@ -623,6 +633,8 @@ test "xsalsa20poly1305 sealedbox" {
623633}
624634
625635test "secretbox twoblocks" {
636 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
637
626638 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 };
627639 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 };
628640 const msg = [_]u8{'a'} ** 97;
lib/std/crypto/scrypt.zig+5
......@@ -3,6 +3,7 @@
33// https://github.com/Tarsnap/scrypt
44
55const std = @import("std");
6const builtin = @import("builtin");
67const crypto = std.crypto;
78const fmt = std.fmt;
89const io = std.io;
......@@ -683,6 +684,8 @@ test "unix-scrypt" {
683684}
684685
685686test "crypt format" {
687 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
688
686689 const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D";
687690 const params = try crypt_format.deserialize(crypt_format.HashResult(32), str);
688691 var buf: [str.len]u8 = undefined;
......@@ -691,6 +694,8 @@ test "crypt format" {
691694}
692695
693696test "kdf fast" {
697 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
698
694699 const TestVector = struct {
695700 password: []const u8,
696701 salt: []const u8,
lib/std/crypto/sha2.zig+11-1
......@@ -238,7 +238,7 @@ fn Sha2x32(comptime params: Sha2Params32) type {
238238 return;
239239 },
240240 // 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 })) {
242242 var x: v4u32 = [_]u32{ d.s[5], d.s[4], d.s[1], d.s[0] };
243243 var y: v4u32 = [_]u32{ d.s[7], d.s[6], d.s[3], d.s[2] };
244244 const s_v = @as(*[16]v4u32, @ptrCast(&s));
......@@ -406,12 +406,16 @@ fn Sha2x32(comptime params: Sha2Params32) type {
406406}
407407
408408test "sha224 single" {
409 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
410
409411 try htest.assertEqualHash(Sha224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", "");
410412 try htest.assertEqualHash(Sha224, "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc");
411413 try htest.assertEqualHash(Sha224, "c97ca9a559850ce97a04a96def6d99a9e0e0e2ab14e6b8df265fc0b3", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
412414}
413415
414416test "sha224 streaming" {
417 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
418
415419 var h = Sha224.init(.{});
416420 var out: [28]u8 = undefined;
417421
......@@ -432,12 +436,16 @@ test "sha224 streaming" {
432436}
433437
434438test "sha256 single" {
439 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
440
435441 try htest.assertEqualHash(Sha256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "");
436442 try htest.assertEqualHash(Sha256, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc");
437443 try htest.assertEqualHash(Sha256, "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
438444}
439445
440446test "sha256 streaming" {
447 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
448
441449 var h = Sha256.init(.{});
442450 var out: [32]u8 = undefined;
443451
......@@ -458,6 +466,8 @@ test "sha256 streaming" {
458466}
459467
460468test "sha256 aligned final" {
469 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
470
461471 var block = [_]u8{0} ** Sha256.block_length;
462472 var out: [Sha256.digest_length]u8 = undefined;
463473
lib/std/crypto/utils.zig+2
......@@ -149,6 +149,8 @@ test "crypto.utils.timingSafeEql" {
149149}
150150
151151test "crypto.utils.timingSafeEql (vectors)" {
152 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
153
152154 var a: [100]u8 = undefined;
153155 var b: [100]u8 = undefined;
154156 random.bytes(a[0..]);
lib/std/debug.zig+2
......@@ -2513,6 +2513,8 @@ pub fn dumpStackPointerAddr(prefix: []const u8) void {
25132513}
25142514
25152515test "manage resources correctly" {
2516 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2517
25162518 if (builtin.os.tag == .wasi) return error.SkipZigTest;
25172519
25182520 if (builtin.os.tag == .windows) {
lib/std/dwarf/expressions.zig+2
......@@ -1054,6 +1054,8 @@ fn isOpcodeRegisterLocation(opcode: u8) bool {
10541054
10551055const testing = std.testing;
10561056test "DWARF expressions" {
1057 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1058
10571059 const allocator = std.testing.allocator;
10581060
10591061 const options = ExpressionOptions{};
lib/std/fifo.zig+2
......@@ -505,6 +505,8 @@ test "LinearFifo(u8, .Dynamic)" {
505505}
506506
507507test "LinearFifo" {
508 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
509
508510 inline for ([_]type{ u1, u8, u16, u64 }) |T| {
509511 inline for ([_]LinearFifoBufferType{ LinearFifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| {
510512 const FifoType = LinearFifo(T, bt);
lib/std/fmt.zig+24
......@@ -2129,6 +2129,8 @@ test "int.small" {
21292129}
21302130
21312131test "int.specifier" {
2132 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2133
21322134 {
21332135 const value: u8 = 'a';
21342136 try expectFmt("u8: a\n", "u8: {c}\n", .{value});
......@@ -2179,6 +2181,8 @@ test "int.padded" {
21792181}
21802182
21812183test "buffer" {
2184 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2185
21822186 {
21832187 var buf1: [32]u8 = undefined;
21842188 var fbs = std.io.fixedBufferStream(&buf1);
......@@ -2375,6 +2379,8 @@ test "float.scientific" {
23752379}
23762380
23772381test "float.scientific.precision" {
2382 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2383
23782384 try expectFmt("f64: 1.40971e-42", "f64: {e:.5}", .{@as(f64, 1.409706e-42)});
23792385 try expectFmt("f64: 1.00000e-09", "f64: {e:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 814313563))))});
23802386 try expectFmt("f64: 7.81250e-03", "f64: {e:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 1006632960))))});
......@@ -2435,6 +2441,8 @@ test "float.hexadecimal" {
24352441}
24362442
24372443test "float.hexadecimal.precision" {
2444 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2445
24382446 try expectFmt("f16: 0x1.5p-2", "f16: {x:.1}", .{@as(f16, 1.0 / 3.0)});
24392447 try expectFmt("f32: 0x1.555p-2", "f32: {x:.3}", .{@as(f32, 1.0 / 3.0)});
24402448 try expectFmt("f64: 0x1.55555p-2", "f64: {x:.5}", .{@as(f64, 1.0 / 3.0)});
......@@ -2449,6 +2457,8 @@ test "float.hexadecimal.precision" {
24492457}
24502458
24512459test "float.decimal" {
2460 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2461
24522462 try expectFmt("f64: 152314000000000000000000000000", "f64: {d}", .{@as(f64, 1.52314e+29)});
24532463 try expectFmt("f32: 0", "f32: {d}", .{@as(f32, 0.0)});
24542464 try expectFmt("f32: 0", "f32: {d:.0}", .{@as(f32, 0.0)});
......@@ -2472,6 +2482,8 @@ test "float.decimal" {
24722482}
24732483
24742484test "float.libc.sanity" {
2485 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2486
24752487 try expectFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 916964781))))});
24762488 try expectFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 925353389))))});
24772489 try expectFmt("f64: 0.10000", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 1036831278))))});
......@@ -2491,6 +2503,8 @@ test "float.libc.sanity" {
24912503}
24922504
24932505test "custom" {
2506 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2507
24942508 const Vec2 = struct {
24952509 const SelfType = @This();
24962510 x: f32,
......@@ -2669,6 +2683,8 @@ test "formatFloatValue with comptime_float" {
26692683}
26702684
26712685test "formatType max_depth" {
2686 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2687
26722688 const Vec2 = struct {
26732689 const SelfType = @This();
26742690 x: f32,
......@@ -2735,6 +2751,8 @@ test "formatType max_depth" {
27352751}
27362752
27372753test "positional" {
2754 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2755
27382756 try expectFmt("2 1 0", "{2} {1} {0}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
27392757 try expectFmt("2 1 0", "{2} {1} {}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
27402758 try expectFmt("0 0", "{0} {0}", .{@as(usize, 0)});
......@@ -2743,14 +2761,20 @@ test "positional" {
27432761}
27442762
27452763test "positional with specifier" {
2764 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2765
27462766 try expectFmt("10.0", "{0d:.1}", .{@as(f64, 9.999)});
27472767}
27482768
27492769test "positional/alignment/width/precision" {
2770 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2771
27502772 try expectFmt("10.0", "{0d: >3.1}", .{@as(f64, 9.999)});
27512773}
27522774
27532775test "vector" {
2776 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2777
27542778 if (builtin.target.cpu.arch == .riscv64) {
27552779 // https://github.com/ziglang/zig/issues/4486
27562780 return error.SkipZigTest;
lib/std/fmt/parse_float.zig+17-1
......@@ -1,8 +1,8 @@
11pub const parseFloat = @import("parse_float/parse_float.zig").parseFloat;
22pub const ParseFloatError = @import("parse_float/parse_float.zig").ParseFloatError;
33
4const builtin = @import("builtin");
54const std = @import("std");
5const builtin = @import("builtin");
66const math = std.math;
77const testing = std.testing;
88const expect = testing.expect;
......@@ -14,6 +14,8 @@ const epsilon = 1e-7;
1414// See https://github.com/tiehuis/parse-number-fxx-test-data for a wider-selection of test-data.
1515
1616test "fmt.parseFloat" {
17 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
18
1719 inline for ([_]type{ f16, f32, f64, f128 }) |T| {
1820 try testing.expectError(error.InvalidCharacter, parseFloat(T, ""));
1921 try testing.expectError(error.InvalidCharacter, parseFloat(T, " 1"));
......@@ -70,6 +72,8 @@ test "fmt.parseFloat" {
7072}
7173
7274test "fmt.parseFloat nan and inf" {
75 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
76
7377 inline for ([_]type{ f16, f32, f64, f128 }) |T| {
7478 const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
7579
......@@ -80,16 +84,22 @@ test "fmt.parseFloat nan and inf" {
8084}
8185
8286test "fmt.parseFloat #11169" {
87 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
88
8389 try expectEqual(try parseFloat(f128, "9007199254740993.0"), 9007199254740993.0);
8490}
8591
8692test "fmt.parseFloat hex.special" {
93 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
94
8795 try testing.expect(math.isNan(try parseFloat(f32, "nAn")));
8896 try testing.expect(math.isPositiveInf(try parseFloat(f32, "iNf")));
8997 try testing.expect(math.isPositiveInf(try parseFloat(f32, "+Inf")));
9098 try testing.expect(math.isNegativeInf(try parseFloat(f32, "-iNf")));
9199}
92100test "fmt.parseFloat hex.zero" {
101 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
102
93103 try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0"));
94104 try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "-0x0"));
95105 try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0p42"));
......@@ -98,6 +108,8 @@ test "fmt.parseFloat hex.zero" {
98108}
99109
100110test "fmt.parseFloat hex.f16" {
111 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
112
101113 try testing.expectEqual(try parseFloat(f16, "0x1p0"), 1.0);
102114 try testing.expectEqual(try parseFloat(f16, "-0x1p-1"), -0.5);
103115 try testing.expectEqual(try parseFloat(f16, "0x10p+10"), 16384.0);
......@@ -114,6 +126,8 @@ test "fmt.parseFloat hex.f16" {
114126}
115127
116128test "fmt.parseFloat hex.f32" {
129 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
130
117131 try testing.expectError(error.InvalidCharacter, parseFloat(f32, "0x"));
118132 try testing.expectEqual(try parseFloat(f32, "0x1p0"), 1.0);
119133 try testing.expectEqual(try parseFloat(f32, "-0x1p-1"), -0.5);
......@@ -148,6 +162,8 @@ test "fmt.parseFloat hex.f64" {
148162 try testing.expectEqual(try parseFloat(f64, "-0x1p-1074"), -math.floatTrueMin(f64));
149163}
150164test "fmt.parseFloat hex.f128" {
165 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
166
151167 try testing.expectEqual(try parseFloat(f128, "0x1p0"), 1.0);
152168 try testing.expectEqual(try parseFloat(f128, "-0x1p-1"), -0.5);
153169 try testing.expectEqual(try parseFloat(f128, "0x10p+10"), 16384.0);
lib/std/fs.zig+8-6
......@@ -3244,13 +3244,15 @@ fn copy_file(fd_in: os.fd_t, fd_out: os.fd_t, maybe_size: ?u64) CopyFileRawError
32443244}
32453245
32463246test {
3247 if (builtin.os.tag != .wasi) {
3248 _ = &makeDirAbsolute;
3249 _ = &makeDirAbsoluteZ;
3250 _ = &copyFileAbsolute;
3251 _ = &updateFileAbsolute;
3247 if (builtin.zig_backend != .stage2_x86_64) {
3248 if (builtin.os.tag != .wasi) {
3249 _ = &makeDirAbsolute;
3250 _ = &makeDirAbsoluteZ;
3251 _ = &copyFileAbsolute;
3252 _ = &updateFileAbsolute;
3253 }
3254 _ = &Dir.copyFile;
32523255 }
3253 _ = &Dir.copyFile;
32543256 _ = @import("fs/test.zig");
32553257 _ = @import("fs/path.zig");
32563258 _ = @import("fs/file.zig");
lib/std/fs/test.zig+104
......@@ -124,6 +124,8 @@ fn testWithAllSupportedPathTypes(test_func: anytype) !void {
124124}
125125
126126test "Dir.readLink" {
127 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
128
127129 try testWithAllSupportedPathTypes(struct {
128130 fn impl(ctx: *TestContext) !void {
129131 // Create some targets
......@@ -161,6 +163,8 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo
161163}
162164
163165test "relative symlink to parent directory" {
166 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
167
164168 var tmp = tmpDir(.{});
165169 defer tmp.cleanup();
166170
......@@ -178,6 +182,8 @@ test "relative symlink to parent directory" {
178182}
179183
180184test "openDir" {
185 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
186
181187 try testWithAllSupportedPathTypes(struct {
182188 fn impl(ctx: *TestContext) !void {
183189 const allocator = ctx.arena.allocator();
......@@ -196,6 +202,8 @@ test "openDir" {
196202test "accessAbsolute" {
197203 if (builtin.os.tag == .wasi) return error.SkipZigTest;
198204
205 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
206
199207 var tmp = tmpDir(.{});
200208 defer tmp.cleanup();
201209
......@@ -214,6 +222,8 @@ test "accessAbsolute" {
214222test "openDirAbsolute" {
215223 if (builtin.os.tag == .wasi) return error.SkipZigTest;
216224
225 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
226
217227 var tmp = tmpDir(.{});
218228 defer tmp.cleanup();
219229
......@@ -252,6 +262,8 @@ test "openDir non-cwd parent .." {
252262 else => {},
253263 }
254264
265 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
266
255267 var tmp = tmpDir(.{});
256268 defer tmp.cleanup();
257269
......@@ -273,6 +285,8 @@ test "openDir non-cwd parent .." {
273285test "readLinkAbsolute" {
274286 if (builtin.os.tag == .wasi) return error.SkipZigTest;
275287
288 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
289
276290 var tmp = tmpDir(.{});
277291 defer tmp.cleanup();
278292
......@@ -323,6 +337,8 @@ fn testReadLinkAbsolute(target_path: []const u8, symlink_path: []const u8) !void
323337}
324338
325339test "Dir.Iterator" {
340 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
341
326342 var tmp_dir = tmpIterableDir(.{});
327343 defer tmp_dir.cleanup();
328344
......@@ -353,6 +369,8 @@ test "Dir.Iterator" {
353369}
354370
355371test "Dir.Iterator many entries" {
372 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
373
356374 var tmp_dir = tmpIterableDir(.{});
357375 defer tmp_dir.cleanup();
358376
......@@ -388,6 +406,8 @@ test "Dir.Iterator many entries" {
388406}
389407
390408test "Dir.Iterator twice" {
409 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
410
391411 var tmp_dir = tmpIterableDir(.{});
392412 defer tmp_dir.cleanup();
393413
......@@ -421,6 +441,8 @@ test "Dir.Iterator twice" {
421441}
422442
423443test "Dir.Iterator reset" {
444 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
445
424446 var tmp_dir = tmpIterableDir(.{});
425447 defer tmp_dir.cleanup();
426448
......@@ -457,6 +479,8 @@ test "Dir.Iterator reset" {
457479}
458480
459481test "Dir.Iterator but dir is deleted during iteration" {
482 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
483
460484 var tmp = std.testing.tmpDir(.{});
461485 defer tmp.cleanup();
462486
......@@ -499,6 +523,8 @@ fn contains(entries: *const std.ArrayList(IterableDir.Entry), el: IterableDir.En
499523test "Dir.realpath smoke test" {
500524 if (!comptime std.os.isGetFdPathSupportedOnTarget(builtin.os)) return error.SkipZigTest;
501525
526 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
527
502528 try testWithAllSupportedPathTypes(struct {
503529 fn impl(ctx: *TestContext) !void {
504530 const allocator = ctx.arena.allocator();
......@@ -549,6 +575,8 @@ test "Dir.realpath smoke test" {
549575}
550576
551577test "readAllAlloc" {
578 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
579
552580 var tmp_dir = tmpDir(.{});
553581 defer tmp_dir.cleanup();
554582
......@@ -585,6 +613,8 @@ test "Dir.statFile" {
585613 // TODO: Re-enable once https://github.com/ziglang/zig/issues/17034 is solved
586614 if (builtin.os.tag == .linux and builtin.link_libc and builtin.abi == .gnu) return error.SkipZigTest;
587615
616 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
617
588618 try testWithAllSupportedPathTypes(struct {
589619 fn impl(ctx: *TestContext) !void {
590620 const test_file_name = try ctx.transformPath("test_file");
......@@ -600,6 +630,8 @@ test "Dir.statFile" {
600630}
601631
602632test "directory operations on files" {
633 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
634
603635 try testWithAllSupportedPathTypes(struct {
604636 fn impl(ctx: *TestContext) !void {
605637 const test_file_name = try ctx.transformPath("test_file");
......@@ -629,6 +661,8 @@ test "file operations on directories" {
629661 // TODO: fix this test on FreeBSD. https://github.com/ziglang/zig/issues/1759
630662 if (builtin.os.tag == .freebsd) return error.SkipZigTest;
631663
664 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
665
632666 try testWithAllSupportedPathTypes(struct {
633667 fn impl(ctx: *TestContext) !void {
634668 const test_dir_name = try ctx.transformPath("test_dir");
......@@ -676,6 +710,8 @@ test "makeOpenPath parent dirs do not exist" {
676710}
677711
678712test "deleteDir" {
713 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
714
679715 try testWithAllSupportedPathTypes(struct {
680716 fn impl(ctx: *TestContext) !void {
681717 const test_dir_path = try ctx.transformPath("test_dir");
......@@ -697,6 +733,8 @@ test "deleteDir" {
697733}
698734
699735test "Dir.rename files" {
736 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
737
700738 try testWithAllSupportedPathTypes(struct {
701739 fn impl(ctx: *TestContext) !void {
702740 // Rename on Windows can hit intermittent AccessDenied errors
......@@ -739,6 +777,8 @@ test "Dir.rename files" {
739777}
740778
741779test "Dir.rename directories" {
780 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
781
742782 try testWithAllSupportedPathTypes(struct {
743783 fn impl(ctx: *TestContext) !void {
744784 // Rename on Windows can hit intermittent AccessDenied errors
......@@ -780,6 +820,8 @@ test "Dir.rename directory onto empty dir" {
780820 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
781821 if (builtin.os.tag == .windows) return error.SkipZigTest;
782822
823 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
824
783825 try testWithAllSupportedPathTypes(struct {
784826 fn impl(ctx: *TestContext) !void {
785827 const test_dir_path = try ctx.transformPath("test_dir");
......@@ -801,6 +843,8 @@ test "Dir.rename directory onto non-empty dir" {
801843 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
802844 if (builtin.os.tag == .windows) return error.SkipZigTest;
803845
846 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
847
804848 try testWithAllSupportedPathTypes(struct {
805849 fn impl(ctx: *TestContext) !void {
806850 const test_dir_path = try ctx.transformPath("test_dir");
......@@ -827,6 +871,8 @@ test "Dir.rename file <-> dir" {
827871 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
828872 if (builtin.os.tag == .windows) return error.SkipZigTest;
829873
874 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
875
830876 try testWithAllSupportedPathTypes(struct {
831877 fn impl(ctx: *TestContext) !void {
832878 const test_file_path = try ctx.transformPath("test_file");
......@@ -842,6 +888,8 @@ test "Dir.rename file <-> dir" {
842888}
843889
844890test "rename" {
891 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
892
845893 var tmp_dir1 = tmpDir(.{});
846894 defer tmp_dir1.cleanup();
847895
......@@ -864,6 +912,8 @@ test "rename" {
864912test "renameAbsolute" {
865913 if (builtin.os.tag == .wasi) return error.SkipZigTest;
866914
915 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
916
867917 var tmp_dir = tmpDir(.{});
868918 defer tmp_dir.cleanup();
869919
......@@ -922,6 +972,8 @@ test "openSelfExe" {
922972}
923973
924974test "makePath, put some files in it, deleteTree" {
975 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
976
925977 try testWithAllSupportedPathTypes(struct {
926978 fn impl(ctx: *TestContext) !void {
927979 const allocator = ctx.arena.allocator();
......@@ -938,6 +990,8 @@ test "makePath, put some files in it, deleteTree" {
938990}
939991
940992test "makePath, put some files in it, deleteTreeMinStackSize" {
993 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
994
941995 try testWithAllSupportedPathTypes(struct {
942996 fn impl(ctx: *TestContext) !void {
943997 const allocator = ctx.arena.allocator();
......@@ -956,6 +1010,8 @@ test "makePath, put some files in it, deleteTreeMinStackSize" {
9561010test "makePath in a directory that no longer exists" {
9571011 if (builtin.os.tag == .windows) return error.SkipZigTest; // Windows returns FileBusy if attempting to remove an open dir
9581012
1013 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1014
9591015 var tmp = tmpDir(.{});
9601016 defer tmp.cleanup();
9611017 try tmp.parent_dir.deleteTree(&tmp.sub_path);
......@@ -987,6 +1043,8 @@ fn testFilenameLimits(iterable_dir: IterableDir, maxed_filename: []const u8) !vo
9871043}
9881044
9891045test "max file name component lengths" {
1046 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1047
9901048 var tmp = tmpIterableDir(.{});
9911049 defer tmp.cleanup();
9921050
......@@ -1008,6 +1066,8 @@ test "max file name component lengths" {
10081066}
10091067
10101068test "writev, readv" {
1069 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1070
10111071 var tmp = tmpDir(.{});
10121072 defer tmp.cleanup();
10131073
......@@ -1050,6 +1110,8 @@ test "writev, readv" {
10501110}
10511111
10521112test "pwritev, preadv" {
1113 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1114
10531115 var tmp = tmpDir(.{});
10541116 defer tmp.cleanup();
10551117
......@@ -1091,6 +1153,8 @@ test "pwritev, preadv" {
10911153}
10921154
10931155test "access file" {
1156 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1157
10941158 try testWithAllSupportedPathTypes(struct {
10951159 fn impl(ctx: *TestContext) !void {
10961160 const dir_path = try ctx.transformPath("os_test_tmp");
......@@ -1107,6 +1171,8 @@ test "access file" {
11071171}
11081172
11091173test "sendfile" {
1174 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1175
11101176 var tmp = tmpDir(.{});
11111177 defer tmp.cleanup();
11121178
......@@ -1172,6 +1238,8 @@ test "sendfile" {
11721238}
11731239
11741240test "copyRangeAll" {
1241 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1242
11751243 var tmp = tmpDir(.{});
11761244 defer tmp.cleanup();
11771245
......@@ -1198,6 +1266,8 @@ test "copyRangeAll" {
11981266}
11991267
12001268test "copyFile" {
1269 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1270
12011271 try testWithAllSupportedPathTypes(struct {
12021272 fn impl(ctx: *TestContext) !void {
12031273 const data = "u6wj+JmdF3qHsFPE BUlH2g4gJCmEz0PP";
......@@ -1228,6 +1298,8 @@ fn expectFileContents(dir: Dir, file_path: []const u8, data: []const u8) !void {
12281298}
12291299
12301300test "AtomicFile" {
1301 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1302
12311303 try testWithAllSupportedPathTypes(struct {
12321304 fn impl(ctx: *TestContext) !void {
12331305 const allocator = ctx.arena.allocator();
......@@ -1254,6 +1326,8 @@ test "AtomicFile" {
12541326test "open file with exclusive nonblocking lock twice" {
12551327 if (builtin.os.tag == .wasi) return error.SkipZigTest;
12561328
1329 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1330
12571331 try testWithAllSupportedPathTypes(struct {
12581332 fn impl(ctx: *TestContext) !void {
12591333 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
......@@ -1270,6 +1344,8 @@ test "open file with exclusive nonblocking lock twice" {
12701344test "open file with shared and exclusive nonblocking lock" {
12711345 if (builtin.os.tag == .wasi) return error.SkipZigTest;
12721346
1347 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1348
12731349 try testWithAllSupportedPathTypes(struct {
12741350 fn impl(ctx: *TestContext) !void {
12751351 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
......@@ -1286,6 +1362,8 @@ test "open file with shared and exclusive nonblocking lock" {
12861362test "open file with exclusive and shared nonblocking lock" {
12871363 if (builtin.os.tag == .wasi) return error.SkipZigTest;
12881364
1365 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1366
12891367 try testWithAllSupportedPathTypes(struct {
12901368 fn impl(ctx: *TestContext) !void {
12911369 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
......@@ -1300,6 +1378,8 @@ test "open file with exclusive and shared nonblocking lock" {
13001378}
13011379
13021380test "open file with exclusive lock twice, make sure second lock waits" {
1381 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1382
13031383 if (builtin.single_threaded) return error.SkipZigTest;
13041384
13051385 if (std.io.is_async) {
......@@ -1350,6 +1430,8 @@ test "open file with exclusive lock twice, make sure second lock waits" {
13501430test "open file with exclusive nonblocking lock twice (absolute paths)" {
13511431 if (builtin.os.tag == .wasi) return error.SkipZigTest;
13521432
1433 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1434
13531435 var random_bytes: [12]u8 = undefined;
13541436 std.crypto.random.bytes(&random_bytes);
13551437
......@@ -1384,6 +1466,8 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" {
13841466test "walker" {
13851467 if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;
13861468
1469 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1470
13871471 var tmp = tmpIterableDir(.{});
13881472 defer tmp.cleanup();
13891473
......@@ -1437,6 +1521,8 @@ test "walker" {
14371521test "walker without fully iterating" {
14381522 if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;
14391523
1524 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1525
14401526 var tmp = tmpIterableDir(.{});
14411527 defer tmp.cleanup();
14421528
......@@ -1460,6 +1546,8 @@ test "walker without fully iterating" {
14601546test ". and .. in fs.Dir functions" {
14611547 if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;
14621548
1549 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1550
14631551 if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64) {
14641552 // https://github.com/ziglang/zig/issues/17134
14651553 return error.SkipZigTest;
......@@ -1500,6 +1588,8 @@ test ". and .. in fs.Dir functions" {
15001588test ". and .. in absolute functions" {
15011589 if (builtin.os.tag == .wasi) return error.SkipZigTest;
15021590
1591 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1592
15031593 var tmp = tmpDir(.{});
15041594 defer tmp.cleanup();
15051595
......@@ -1545,6 +1635,8 @@ test "chmod" {
15451635 if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
15461636 return error.SkipZigTest;
15471637
1638 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1639
15481640 var tmp = tmpDir(.{});
15491641 defer tmp.cleanup();
15501642
......@@ -1567,6 +1659,8 @@ test "chown" {
15671659 if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
15681660 return error.SkipZigTest;
15691661
1662 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1663
15701664 var tmp = tmpDir(.{});
15711665 defer tmp.cleanup();
15721666
......@@ -1582,6 +1676,8 @@ test "chown" {
15821676}
15831677
15841678test "File.Metadata" {
1679 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1680
15851681 var tmp = tmpDir(.{});
15861682 defer tmp.cleanup();
15871683
......@@ -1600,6 +1696,8 @@ test "File.Permissions" {
16001696 if (builtin.os.tag == .wasi)
16011697 return error.SkipZigTest;
16021698
1699 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1700
16031701 var tmp = tmpDir(.{});
16041702 defer tmp.cleanup();
16051703
......@@ -1626,6 +1724,8 @@ test "File.PermissionsUnix" {
16261724 if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
16271725 return error.SkipZigTest;
16281726
1727 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1728
16291729 var tmp = tmpDir(.{});
16301730 defer tmp.cleanup();
16311731
......@@ -1661,6 +1761,8 @@ test "delete a read-only file on windows" {
16611761 if (builtin.os.tag != .windows)
16621762 return error.SkipZigTest;
16631763
1764 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1765
16641766 var tmp = testing.tmpDir(.{});
16651767 defer tmp.cleanup();
16661768
......@@ -1691,6 +1793,8 @@ test "delete a read-only file on windows" {
16911793test "delete a setAsCwd directory on Windows" {
16921794 if (builtin.os.tag != .windows) return error.SkipZigTest;
16931795
1796 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1797
16941798 var tmp = tmpDir(.{});
16951799 // Set tmp dir as current working directory.
16961800 try tmp.dir.setAsCwd();
lib/std/hash/auto_hash.zig+21
......@@ -1,5 +1,6 @@
11const std = @import("std");
22const assert = std.debug.assert;
3const builtin = @import("builtin");
34const mem = std.mem;
45const meta = std.meta;
56
......@@ -252,6 +253,8 @@ test "typeContainsSlice" {
252253}
253254
254255test "hash pointer" {
256 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
257
255258 const array = [_]u32{ 123, 123, 123 };
256259 const a = &array[0];
257260 const b = &array[1];
......@@ -272,6 +275,8 @@ test "hash pointer" {
272275}
273276
274277test "hash slice shallow" {
278 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
279
275280 // Allocate one array dynamically so that we're assured it is not merged
276281 // with the other by the optimization passes.
277282 const array1 = try std.testing.allocator.create([6]u32);
......@@ -290,6 +295,8 @@ test "hash slice shallow" {
290295}
291296
292297test "hash slice deep" {
298 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
299
293300 // Allocate one array dynamically so that we're assured it is not merged
294301 // with the other by the optimization passes.
295302 const array1 = try std.testing.allocator.create([6]u32);
......@@ -306,6 +313,8 @@ test "hash slice deep" {
306313}
307314
308315test "hash struct deep" {
316 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
317
309318 const Foo = struct {
310319 a: u32,
311320 b: u16,
......@@ -345,6 +354,8 @@ test "hash struct deep" {
345354}
346355
347356test "testHash optional" {
357 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
358
348359 const a: ?u32 = 123;
349360 const b: ?u32 = null;
350361 try testing.expectEqual(testHash(a), testHash(@as(u32, 123)));
......@@ -353,6 +364,8 @@ test "testHash optional" {
353364}
354365
355366test "testHash array" {
367 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
368
356369 const a = [_]u32{ 1, 2, 3 };
357370 const h = testHash(a);
358371 var hasher = Wyhash.init(0);
......@@ -369,6 +382,8 @@ test "testHash multi-dimensional array" {
369382}
370383
371384test "testHash struct" {
385 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
386
372387 const Foo = struct {
373388 a: u32 = 1,
374389 b: u32 = 2,
......@@ -384,6 +399,8 @@ test "testHash struct" {
384399}
385400
386401test "testHash union" {
402 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
403
387404 const Foo = union(enum) {
388405 A: u32,
389406 B: bool,
......@@ -408,6 +425,8 @@ test "testHash union" {
408425}
409426
410427test "testHash vector" {
428 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
429
411430 const a: @Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };
412431 const b: @Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };
413432 try testing.expect(testHash(a) == testHash(a));
......@@ -420,6 +439,8 @@ test "testHash vector" {
420439}
421440
422441test "testHash error union" {
442 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
443
423444 const Errors = error{Test};
424445 const Foo = struct {
425446 a: u32 = 1,
lib/std/hash/wyhash.zig+2
......@@ -242,6 +242,8 @@ test "smhasher" {
242242}
243243
244244test "iterative api" {
245 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
246
245247 const Test = struct {
246248 fn do() !void {
247249 try verify.iterativeApi(Wyhash);
lib/std/hash/xxhash.zig+18
......@@ -803,6 +803,8 @@ fn testExpect(comptime H: type, seed: anytype, input: []const u8, expected: u64)
803803}
804804
805805test "xxhash3" {
806 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
807
806808 const H = XxHash3;
807809 // Non-Seeded Tests
808810 try testExpect(H, 0, "", 0x2d06800538d394c2);
......@@ -834,6 +836,8 @@ test "xxhash3" {
834836}
835837
836838test "xxhash3 smhasher" {
839 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
840
837841 const Test = struct {
838842 fn do() !void {
839843 try expectEqual(verify.smhasher(XxHash3.hash), 0x9a636405);
......@@ -845,6 +849,8 @@ test "xxhash3 smhasher" {
845849}
846850
847851test "xxhash3 iterative api" {
852 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
853
848854 const Test = struct {
849855 fn do() !void {
850856 try verify.iterativeApi(XxHash3);
......@@ -856,6 +862,8 @@ test "xxhash3 iterative api" {
856862}
857863
858864test "xxhash64" {
865 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
866
859867 const H = XxHash64;
860868 try testExpect(H, 0, "", 0xef46db3751d8e999);
861869 try testExpect(H, 0, "a", 0xd24ec4f1a98c6e5b);
......@@ -867,6 +875,8 @@ test "xxhash64" {
867875}
868876
869877test "xxhash64 smhasher" {
878 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
879
870880 const Test = struct {
871881 fn do() !void {
872882 try expectEqual(verify.smhasher(XxHash64.hash), 0x024B7CF4);
......@@ -878,6 +888,8 @@ test "xxhash64 smhasher" {
878888}
879889
880890test "xxhash64 iterative api" {
891 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
892
881893 const Test = struct {
882894 fn do() !void {
883895 try verify.iterativeApi(XxHash64);
......@@ -889,6 +901,8 @@ test "xxhash64 iterative api" {
889901}
890902
891903test "xxhash32" {
904 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
905
892906 const H = XxHash32;
893907
894908 try testExpect(H, 0, "", 0x02cc5d05);
......@@ -901,6 +915,8 @@ test "xxhash32" {
901915}
902916
903917test "xxhash32 smhasher" {
918 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
919
904920 const Test = struct {
905921 fn do() !void {
906922 try expectEqual(verify.smhasher(XxHash32.hash), 0xBA88B743);
......@@ -912,6 +928,8 @@ test "xxhash32 smhasher" {
912928}
913929
914930test "xxhash32 iterative api" {
931 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
932
915933 const Test = struct {
916934 fn do() !void {
917935 try verify.iterativeApi(XxHash32);
lib/std/hash_map.zig+2
......@@ -1873,6 +1873,8 @@ test "std.hash_map multiple removes on same metadata" {
18731873}
18741874
18751875test "std.hash_map put and remove loop in random order" {
1876 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1877
18761878 var map = AutoHashMap(u32, u32).init(std.testing.allocator);
18771879 defer map.deinit();
18781880
lib/std/heap/general_purpose_allocator.zig+4
......@@ -1042,6 +1042,8 @@ const TraceKind = enum {
10421042const test_config = Config{};
10431043
10441044test "small allocations - free in same order" {
1045 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1046
10451047 var gpa = GeneralPurposeAllocator(test_config){};
10461048 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
10471049 const allocator = gpa.allocator();
......@@ -1061,6 +1063,8 @@ test "small allocations - free in same order" {
10611063}
10621064
10631065test "small allocations - free in reverse order" {
1066 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1067
10641068 var gpa = GeneralPurposeAllocator(test_config){};
10651069 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
10661070 const allocator = gpa.allocator();
lib/std/http/Client.zig+6-2
......@@ -1,6 +1,7 @@
11//! Connecting and opening requests are threadsafe. Individual requests are not.
22
33const std = @import("../std.zig");
4const builtin = @import("builtin");
45const testing = std.testing;
56const http = std.http;
67const mem = std.mem;
......@@ -427,6 +428,8 @@ pub const Response = struct {
427428 }
428429
429430 test parseInt3 {
431 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
432
430433 const expectEqual = testing.expectEqual;
431434 try expectEqual(@as(u10, 0), parseInt3("000".*));
432435 try expectEqual(@as(u10, 418), parseInt3("418".*));
......@@ -585,7 +588,7 @@ pub const Request = struct {
585588
586589 if (!req.headers.contains("user-agent")) {
587590 try w.writeAll("User-Agent: zig/");
588 try w.writeAll(@import("builtin").zig_version_string);
591 try w.writeAll(builtin.zig_version_string);
589592 try w.writeAll(" (std.http)\r\n");
590593 }
591594
......@@ -1249,7 +1252,6 @@ pub fn fetch(client: *Client, allocator: Allocator, options: FetchOptions) !Fetc
12491252}
12501253
12511254test {
1252 const builtin = @import("builtin");
12531255 const native_endian = comptime builtin.cpu.arch.endian();
12541256 if (builtin.zig_backend == .stage2_llvm and native_endian == .Big) {
12551257 // https://github.com/ziglang/zig/issues/13782
......@@ -1258,5 +1260,7 @@ test {
12581260
12591261 if (builtin.os.tag == .wasi) return error.SkipZigTest;
12601262
1263 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1264
12611265 std.testing.refAllDecls(@This());
12621266}
lib/std/http/Server.zig+2
......@@ -725,6 +725,8 @@ test "HTTP server handles a chunked transfer coding request" {
725725 return error.SkipZigTest;
726726 }
727727
728 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
729
728730 const native_endian = comptime builtin.cpu.arch.endian();
729731 if (builtin.zig_backend == .stage2_llvm and native_endian == .Big) {
730732 // https://github.com/ziglang/zig/issues/13782
lib/std/io/bit_reader.zig+2
......@@ -164,6 +164,8 @@ pub fn bitReader(
164164}
165165
166166test "api coverage" {
167 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
168
167169 const mem_be = [_]u8{ 0b11001101, 0b00001011 };
168170 const mem_le = [_]u8{ 0b00011101, 0b10010101 };
169171
lib/std/io/multi_writer.zig+1
......@@ -36,6 +36,7 @@ pub fn multiWriter(streams: anytype) MultiWriter(@TypeOf(streams)) {
3636const testing = std.testing;
3737
3838test "MultiWriter" {
39 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3940 var tmp = testing.tmpDir(.{});
4041 defer tmp.cleanup();
4142 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();
1515const tmpDir = std.testing.tmpDir;
1616
1717test "write a file, read it, then delete it" {
18 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
19
1820 var tmp = tmpDir(.{});
1921 defer tmp.cleanup();
2022
......@@ -61,6 +63,8 @@ test "write a file, read it, then delete it" {
6163}
6264
6365test "BitStreams with File Stream" {
66 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
67
6468 var tmp = tmpDir(.{});
6569 defer tmp.cleanup();
6670
......@@ -106,6 +110,8 @@ test "BitStreams with File Stream" {
106110}
107111
108112test "File seek ops" {
113 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
114
109115 var tmp = tmpDir(.{});
110116 defer tmp.cleanup();
111117
......@@ -133,6 +139,8 @@ test "File seek ops" {
133139}
134140
135141test "setEndPos" {
142 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
143
136144 var tmp = tmpDir(.{});
137145 defer tmp.cleanup();
138146
......@@ -159,6 +167,8 @@ test "setEndPos" {
159167}
160168
161169test "updateTimes" {
170 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
171
162172 var tmp = tmpDir(.{});
163173 defer tmp.cleanup();
164174
lib/std/json.zig+9
......@@ -9,6 +9,7 @@
99//! The low-level `writeStream` emits syntax-conformant JSON tokens to a `std.io.Writer`.
1010//! The high-level `stringify` serializes a Zig or `Value` type into JSON.
1111
12const builtin = @import("builtin");
1213const testing = @import("std").testing;
1314const ArrayList = @import("std").ArrayList;
1415
......@@ -23,6 +24,8 @@ test Scanner {
2324}
2425
2526test parseFromSlice {
27 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
28
2629 var parsed_str = try parseFromSlice([]const u8, testing.allocator, "\"a\\u0020b\"", .{});
2730 defer parsed_str.deinit();
2831 try testing.expectEqualSlices(u8, "a b", parsed_str.value);
......@@ -35,12 +38,16 @@ test parseFromSlice {
3538}
3639
3740test Value {
41 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
42
3843 var parsed = try parseFromSlice(Value, testing.allocator, "{\"anything\": \"goes\"}", .{});
3944 defer parsed.deinit();
4045 try testing.expectEqualSlices(u8, "goes", parsed.value.object.get("anything").?.string);
4146}
4247
4348test writeStream {
49 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
50
4451 var out = ArrayList(u8).init(testing.allocator);
4552 defer out.deinit();
4653 var write_stream = writeStream(out.writer(), .{ .whitespace = .indent_2 });
......@@ -58,6 +65,8 @@ test writeStream {
5865}
5966
6067test stringify {
68 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
69
6170 var out = ArrayList(u8).init(testing.allocator);
6271 defer out.deinit();
6372
lib/std/json/JSONTestSuite_test.zig+72
......@@ -104,6 +104,8 @@ test "i_string_utf16LE_no_BOM.json" {
104104 try any("[\x00\"\x00\xe9\x00\"\x00]\x00");
105105}
106106test "i_structure_500_nested_arrays.json" {
107 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
108
107109 try any("[" ** 500 ++ "]" ** 500);
108110}
109111test "i_structure_UTF-8_BOM_empty_object.json" {
......@@ -359,15 +361,21 @@ test "n_object_bracket_key.json" {
359361 try err("{[: \"x\"}\n");
360362}
361363test "n_object_comma_instead_of_colon.json" {
364 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
365
362366 try err("{\"x\", null}");
363367}
364368test "n_object_double_colon.json" {
369 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
370
365371 try err("{\"x\"::\"b\"}");
366372}
367373test "n_object_emoji.json" {
368374 try err("{\xf0\x9f\x87\xa8\xf0\x9f\x87\xad}");
369375}
370376test "n_object_garbage_at_end.json" {
377 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
378
371379 try err("{\"a\":\"a\" 123}");
372380}
373381test "n_object_key_with_single_quotes.json" {
......@@ -377,18 +385,26 @@ test "n_object_lone_continuation_byte_in_key_and_trailing_comma.json" {
377385 try err("{\"\xb9\":\"0\",}");
378386}
379387test "n_object_missing_colon.json" {
388 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
389
380390 try err("{\"a\" b}");
381391}
382392test "n_object_missing_key.json" {
383393 try err("{:\"b\"}");
384394}
385395test "n_object_missing_semicolon.json" {
396 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
397
386398 try err("{\"a\" \"b\"}");
387399}
388400test "n_object_missing_value.json" {
401 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
402
389403 try err("{\"a\":");
390404}
391405test "n_object_no-colon.json" {
406 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
407
392408 try err("{\"a\"");
393409}
394410test "n_object_non_string_key.json" {
......@@ -401,39 +417,59 @@ test "n_object_repeated_null_null.json" {
401417 try err("{null:null,null:null}");
402418}
403419test "n_object_several_trailing_commas.json" {
420 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
421
404422 try err("{\"id\":0,,,,,}");
405423}
406424test "n_object_single_quote.json" {
407425 try err("{'a':0}");
408426}
409427test "n_object_trailing_comma.json" {
428 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
429
410430 try err("{\"id\":0,}");
411431}
412432test "n_object_trailing_comment.json" {
433 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
434
413435 try err("{\"a\":\"b\"}/**/");
414436}
415437test "n_object_trailing_comment_open.json" {
438 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
439
416440 try err("{\"a\":\"b\"}/**//");
417441}
418442test "n_object_trailing_comment_slash_open.json" {
443 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
444
419445 try err("{\"a\":\"b\"}//");
420446}
421447test "n_object_trailing_comment_slash_open_incomplete.json" {
448 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
449
422450 try err("{\"a\":\"b\"}/");
423451}
424452test "n_object_two_commas_in_a_row.json" {
453 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
454
425455 try err("{\"a\":\"b\",,\"c\":\"d\"}");
426456}
427457test "n_object_unquoted_key.json" {
428458 try err("{a: \"b\"}");
429459}
430460test "n_object_unterminated-value.json" {
461 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
462
431463 try err("{\"a\":\"a");
432464}
433465test "n_object_with_single_string.json" {
466 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
467
434468 try err("{ \"foo\" : \"bar\", \"a\" }");
435469}
436470test "n_object_with_trailing_garbage.json" {
471 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
472
437473 try err("{\"a\":\"b\"}#");
438474}
439475test "n_single_space.json" {
......@@ -560,6 +596,8 @@ test "n_structure_close_unopened_array.json" {
560596 try err("1]");
561597}
562598test "n_structure_comma_instead_of_closing_brace.json" {
599 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
600
563601 try err("{\"x\": true,");
564602}
565603test "n_structure_double_array.json" {
......@@ -590,12 +628,18 @@ test "n_structure_object_followed_by_closing_object.json" {
590628 try err("{}}");
591629}
592630test "n_structure_object_unclosed_no_value.json" {
631 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
632
593633 try err("{\"\":");
594634}
595635test "n_structure_object_with_comment.json" {
636 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
637
596638 try err("{\"a\":/*comment*/\"b\"}");
597639}
598640test "n_structure_object_with_trailing_garbage.json" {
641 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
642
599643 try err("{\"a\": true} \"x\"");
600644}
601645test "n_structure_open_array_apostrophe.json" {
......@@ -605,6 +649,8 @@ test "n_structure_open_array_comma.json" {
605649 try err("[,");
606650}
607651test "n_structure_open_array_object.json" {
652 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
608654 try err("[{\"\":" ** 50000 ++ "\n");
609655}
610656test "n_structure_open_array_open_object.json" {
......@@ -644,6 +690,8 @@ test "n_structure_single_star.json" {
644690 try err("*");
645691}
646692test "n_structure_trailing_#.json" {
693 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
694
647695 try err("{\"a\":\"b\"}#{}");
648696}
649697test "n_structure_uescaped_LF_before_string.json" {
......@@ -662,6 +710,8 @@ test "n_structure_unclosed_array_unfinished_true.json" {
662710 try err("[ false, tru");
663711}
664712test "n_structure_unclosed_object.json" {
713 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
714
665715 try err("{\"asd\":\"asd\"");
666716}
667717test "n_structure_unicode-identifier.json" {
......@@ -764,39 +814,61 @@ test "y_number_simple_real.json" {
764814 try ok("[123.456789]");
765815}
766816test "y_object.json" {
817 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
818
767819 try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");
768820}
769821test "y_object_basic.json" {
822 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
823
770824 try ok("{\"asd\":\"sdf\"}");
771825}
772826test "y_object_duplicated_key.json" {
827 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
828
773829 try ok("{\"a\":\"b\",\"a\":\"c\"}");
774830}
775831test "y_object_duplicated_key_and_value.json" {
832 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
833
776834 try ok("{\"a\":\"b\",\"a\":\"b\"}");
777835}
778836test "y_object_empty.json" {
779837 try ok("{}");
780838}
781839test "y_object_empty_key.json" {
840 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
841
782842 try ok("{\"\":0}");
783843}
784844test "y_object_escaped_null_in_key.json" {
845 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
846
785847 try ok("{\"foo\\u0000bar\": 42}");
786848}
787849test "y_object_extreme_numbers.json" {
850 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
851
788852 try ok("{ \"min\": -1.0e+28, \"max\": 1.0e+28 }");
789853}
790854test "y_object_long_strings.json" {
855 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
856
791857 try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");
792858}
793859test "y_object_simple.json" {
860 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
861
794862 try ok("{\"a\":[]}");
795863}
796864test "y_object_string_unicode.json" {
865 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
866
797867 try ok("{\"title\":\"\\u041f\\u043e\\u043b\\u0442\\u043e\\u0440\\u0430 \\u0417\\u0435\\u043c\\u043b\\u0435\\u043a\\u043e\\u043f\\u0430\" }");
798868}
799869test "y_object_with_newlines.json" {
870 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
871
800872 try ok("{\n\"a\": \"b\"\n}");
801873}
802874test "y_string_1_2_3_bytes_UTF-8_sequences.json" {
lib/std/json/dynamic_test.zig+25
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const mem = std.mem;
34const testing = std.testing;
45const ArenaAllocator = std.heap.ArenaAllocator;
......@@ -18,6 +19,8 @@ const jsonReader = @import("scanner.zig").reader;
1819const JsonReader = @import("scanner.zig").Reader;
1920
2021test "json.parser.dynamic" {
22 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
23
2124 const s =
2225 \\{
2326 \\ "Image": {
......@@ -72,6 +75,8 @@ test "json.parser.dynamic" {
7275
7376const writeStream = @import("./stringify.zig").writeStream;
7477test "write json then parse it" {
78 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
79
7580 var out_buffer: [1000]u8 = undefined;
7681
7782 var fixed_buffer_stream = std.io.fixedBufferStream(&out_buffer);
......@@ -120,12 +125,16 @@ fn testParse(allocator: std.mem.Allocator, json_str: []const u8) !Value {
120125}
121126
122127test "parsing empty string gives appropriate error" {
128 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
129
123130 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
124131 defer arena_allocator.deinit();
125132 try testing.expectError(error.UnexpectedEndOfInput, testParse(arena_allocator.allocator(), ""));
126133}
127134
128135test "Value.array allocator should still be usable after parsing" {
136 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
137
129138 var parsed = try parseFromSlice(Value, std.testing.allocator, "[]", .{});
130139 defer parsed.deinit();
131140
......@@ -138,6 +147,8 @@ test "Value.array allocator should still be usable after parsing" {
138147}
139148
140149test "integer after float has proper type" {
150 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
151
141152 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
142153 defer arena_allocator.deinit();
143154 const parsed = try testParse(arena_allocator.allocator(),
......@@ -150,6 +161,8 @@ test "integer after float has proper type" {
150161}
151162
152163test "escaped characters" {
164 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
165
153166 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
154167 defer arena_allocator.deinit();
155168 const input =
......@@ -182,6 +195,8 @@ test "escaped characters" {
182195}
183196
184197test "Value.jsonStringify" {
198 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
199
185200 var vals = [_]Value{
186201 .{ .integer = 1 },
187202 .{ .integer = 2 },
......@@ -229,6 +244,8 @@ test "Value.jsonStringify" {
229244}
230245
231246test "parseFromValue(std.json.Value,...)" {
247 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
248
232249 const str =
233250 \\{
234251 \\ "int": 32,
......@@ -246,6 +263,8 @@ test "parseFromValue(std.json.Value,...)" {
246263}
247264
248265test "polymorphic parsing" {
266 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
267
249268 if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108
250269 const doc =
251270 \\{ "type": "div",
......@@ -291,6 +310,8 @@ test "polymorphic parsing" {
291310}
292311
293312test "long object value" {
313 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
314
294315 const value = "01234567890123456789";
295316 const doc = "{\"key\":\"" ++ value ++ "\"}";
296317 var fbs = std.io.fixedBufferStream(doc);
......@@ -303,6 +324,8 @@ test "long object value" {
303324}
304325
305326test "ParseOptions.max_value_len" {
327 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
328
306329 var arena = ArenaAllocator.init(testing.allocator);
307330 defer arena.deinit();
308331
......@@ -317,6 +340,8 @@ test "ParseOptions.max_value_len" {
317340}
318341
319342test "many object keys" {
343 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
344
320345 const doc =
321346 \\{
322347 \\ "k1": "v1",
lib/std/json/hashmap_test.zig+13
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const testing = std.testing;
34
45const ArrayHashMap = @import("hashmap.zig").ArrayHashMap;
......@@ -18,6 +19,8 @@ const T = struct {
1819};
1920
2021test "parse json hashmap" {
22 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
23
2124 const doc =
2225 \\{
2326 \\ "abc": {"i": 0, "s": "d"},
......@@ -33,6 +36,8 @@ test "parse json hashmap" {
3336}
3437
3538test "parse json hashmap while streaming" {
39 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
40
3641 const doc =
3742 \\{
3843 \\ "abc": {"i": 0, "s": "d"},
......@@ -58,6 +63,8 @@ test "parse json hashmap while streaming" {
5863}
5964
6065test "parse json hashmap duplicate fields" {
66 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
67
6168 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
6269 defer arena.deinit();
6370
......@@ -86,6 +93,8 @@ test "parse json hashmap duplicate fields" {
8693}
8794
8895test "stringify json hashmap" {
96 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
97
8998 var value = ArrayHashMap(T){};
9099 defer value.deinit(testing.allocator);
91100 {
......@@ -123,6 +132,8 @@ test "stringify json hashmap" {
123132}
124133
125134test "stringify json hashmap whitespace" {
135 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
136
126137 var value = ArrayHashMap(T){};
127138 defer value.deinit(testing.allocator);
128139 try value.map.put(testing.allocator, "abc", .{ .i = 0, .s = "d" });
......@@ -147,6 +158,8 @@ test "stringify json hashmap whitespace" {
147158}
148159
149160test "json parse from value hashmap" {
161 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
162
150163 const doc =
151164 \\{
152165 \\ "abc": {"i": 0, "s": "d"},
lib/std/json/static_test.zig+49
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const testing = std.testing;
34const ArenaAllocator = std.heap.ArenaAllocator;
45const Allocator = std.mem.Allocator;
......@@ -371,6 +372,8 @@ test "test all types" {
371372}
372373
373374test "parse" {
375 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
376
374377 try testing.expectEqual(false, try parseFromSliceLeaky(bool, testing.allocator, "false", .{}));
375378 try testing.expectEqual(true, try parseFromSliceLeaky(bool, testing.allocator, "true", .{}));
376379 try testing.expectEqual(@as(u1, 1), try parseFromSliceLeaky(u1, testing.allocator, "1", .{}));
......@@ -389,6 +392,8 @@ test "parse" {
389392}
390393
391394test "parse into enum" {
395 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
396
392397 const T = enum(u32) {
393398 Foo = 42,
394399 Bar,
......@@ -402,6 +407,8 @@ test "parse into enum" {
402407}
403408
404409test "parse into that allocates a slice" {
410 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
411
405412 {
406413 // string as string
407414 const parsed = try parseFromSlice([]u8, testing.allocator, "\"foo\"", .{});
......@@ -422,12 +429,16 @@ test "parse into that allocates a slice" {
422429}
423430
424431test "parse into sentinel slice" {
432 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
433
425434 const parsed = try parseFromSlice([:0]const u8, testing.allocator, "\"\\n\"", .{});
426435 defer parsed.deinit();
427436 try testing.expect(std.mem.eql(u8, parsed.value, "\n"));
428437}
429438
430439test "parse into tagged union" {
440 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
441
431442 const T = union(enum) {
432443 nothing,
433444 int: i32,
......@@ -443,6 +454,8 @@ test "parse into tagged union" {
443454}
444455
445456test "parse into tagged union errors" {
457 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
458
446459 const T = union(enum) {
447460 nothing,
448461 int: i32,
......@@ -465,6 +478,8 @@ test "parse into tagged union errors" {
465478}
466479
467480test "parse into struct with no fields" {
481 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
482
468483 const T = struct {};
469484 const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});
470485 defer parsed.deinit();
......@@ -474,6 +489,8 @@ test "parse into struct with no fields" {
474489const test_const_value: usize = 123;
475490
476491test "parse into struct with default const pointer field" {
492 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
493
477494 const T = struct { a: *const usize = &test_const_value };
478495 const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});
479496 defer parsed.deinit();
......@@ -489,6 +506,8 @@ const test_default_str_slice: [2][]const u8 = [_][]const u8{
489506};
490507
491508test "freeing parsed structs with pointers to default values" {
509 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
510
492511 const T = struct {
493512 int: *const usize = &test_default_usize,
494513 int_ptr: *allowzero align(1) const usize = test_default_usize_ptr,
......@@ -502,11 +521,15 @@ test "freeing parsed structs with pointers to default values" {
502521}
503522
504523test "parse into struct where destination and source lengths mismatch" {
524 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
525
505526 const T = struct { a: [2]u8 };
506527 try testing.expectError(error.LengthMismatch, parseFromSlice(T, testing.allocator, "{\"a\": \"bbb\"}", .{}));
507528}
508529
509530test "parse into struct with misc fields" {
531 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
532
510533 const T = struct {
511534 int: i64,
512535 float: f64,
......@@ -582,6 +605,8 @@ test "parse into struct with misc fields" {
582605}
583606
584607test "parse into struct with strings and arrays with sentinels" {
608 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
609
585610 const T = struct {
586611 language: [:0]const u8,
587612 language_without_sentinel: []const u8,
......@@ -610,6 +635,8 @@ test "parse into struct with strings and arrays with sentinels" {
610635}
611636
612637test "parse into struct with duplicate field" {
638 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
639
613640 const options_first = ParseOptions{ .duplicate_field_behavior = .use_first };
614641 const options_last = ParseOptions{ .duplicate_field_behavior = .use_last };
615642
......@@ -629,6 +656,8 @@ test "parse into struct with duplicate field" {
629656}
630657
631658test "parse into struct ignoring unknown fields" {
659 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
660
632661 const T = struct {
633662 int: i64,
634663 language: []const u8,
......@@ -667,6 +696,8 @@ test "parse into struct ignoring unknown fields" {
667696}
668697
669698test "parse into tuple" {
699 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
700
670701 const Union = union(enum) {
671702 char: u8,
672703 float: f64,
......@@ -722,6 +753,8 @@ const ParseIntoRecursiveUnionDefinitionValue = union(enum) {
722753};
723754
724755test "parse into recursive union definition" {
756 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
757
725758 const T = struct {
726759 values: ParseIntoRecursiveUnionDefinitionValue,
727760 };
......@@ -743,6 +776,8 @@ const ParseIntoDoubleRecursiveUnionValueSecond = union(enum) {
743776};
744777
745778test "parse into double recursive union definition" {
779 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
780
746781 const T = struct {
747782 values: ParseIntoDoubleRecursiveUnionValueFirst,
748783 };
......@@ -754,6 +789,8 @@ test "parse into double recursive union definition" {
754789}
755790
756791test "parse exponential into int" {
792 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
793
757794 const T = struct { int: i64 };
758795 const r = try parseFromSliceLeaky(T, testing.allocator, "{ \"int\": 4.2e2 }", .{});
759796 try testing.expectEqual(@as(i64, 420), r.int);
......@@ -762,6 +799,8 @@ test "parse exponential into int" {
762799}
763800
764801test "parseFromTokenSource" {
802 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
803
765804 {
766805 var scanner = JsonScanner.initCompleteInput(testing.allocator, "123");
767806 defer scanner.deinit();
......@@ -781,10 +820,14 @@ test "parseFromTokenSource" {
781820}
782821
783822test "max_value_len" {
823 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
824
784825 try testing.expectError(error.ValueTooLong, parseFromSlice([]u8, testing.allocator, "\"0123456789\"", .{ .max_value_len = 5 }));
785826}
786827
787828test "parse into vector" {
829 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
830
788831 const T = struct {
789832 vec_i32: @Vector(4, i32),
790833 vec_f32: @Vector(2, f32),
......@@ -817,6 +860,8 @@ fn assertKey(
817860 }
818861}
819862test "json parse partial" {
863 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
864
820865 const Inner = struct {
821866 num: u32,
822867 yes: bool,
......@@ -872,6 +917,8 @@ test "json parse partial" {
872917}
873918
874919test "json parse allocate when streaming" {
920 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
921
875922 const T = struct {
876923 not_const: []u8,
877924 is_const: []const u8,
......@@ -902,6 +949,8 @@ test "json parse allocate when streaming" {
902949}
903950
904951test "parse at comptime" {
952 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
953
905954 const doc =
906955 \\{
907956 \\ "vals": {
lib/std/json/stringify_test.zig+41
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const mem = std.mem;
34const testing = std.testing;
45
......@@ -15,6 +16,8 @@ const writeStreamMaxDepth = @import("stringify.zig").writeStreamMaxDepth;
1516const writeStreamArbitraryDepth = @import("stringify.zig").writeStreamArbitraryDepth;
1617
1718test "json write stream" {
19 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
20
1821 var out_buf: [1024]u8 = undefined;
1922 var slice_stream = std.io.fixedBufferStream(&out_buf);
2023 const out = slice_stream.writer();
......@@ -97,6 +100,8 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value {
97100}
98101
99102test "stringify null optional fields" {
103 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
104
100105 const MyStruct = struct {
101106 optional: ?[]const u8 = null,
102107 required: []const u8 = "something",
......@@ -118,6 +123,8 @@ test "stringify null optional fields" {
118123}
119124
120125test "stringify basic types" {
126 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
127
121128 try testStringify("false", false, .{});
122129 try testStringify("true", true, .{});
123130 try testStringify("null", @as(?u8, null), .{});
......@@ -134,6 +141,8 @@ test "stringify basic types" {
134141}
135142
136143test "stringify string" {
144 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
145
137146 try testStringify("\"hello\"", "hello", .{});
138147 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{});
139148 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true });
......@@ -158,12 +167,16 @@ test "stringify string" {
158167}
159168
160169test "stringify many-item sentinel-terminated string" {
170 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
171
161172 try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{});
162173 try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true });
163174 try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true });
164175}
165176
166177test "stringify enums" {
178 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
179
167180 const E = enum {
168181 foo,
169182 bar,
......@@ -173,11 +186,15 @@ test "stringify enums" {
173186}
174187
175188test "stringify enum literals" {
189 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
190
176191 try testStringify("\"foo\"", .foo, .{});
177192 try testStringify("\"bar\"", .bar, .{});
178193}
179194
180195test "stringify tagged unions" {
196 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
197
181198 const T = union(enum) {
182199 nothing,
183200 foo: u32,
......@@ -189,12 +206,16 @@ test "stringify tagged unions" {
189206}
190207
191208test "stringify struct" {
209 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
210
192211 try testStringify("{\"foo\":42}", struct {
193212 foo: u32,
194213 }{ .foo = 42 }, .{});
195214}
196215
197216test "emit_strings_as_arrays" {
217 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
218
198219 // Should only affect string values, not object keys.
199220 try testStringify("{\"foo\":\"bar\"}", .{ .foo = "bar" }, .{});
200221 try testStringify("{\"foo\":[98,97,114]}", .{ .foo = "bar" }, .{ .emit_strings_as_arrays = true });
......@@ -209,6 +230,8 @@ test "emit_strings_as_arrays" {
209230}
210231
211232test "stringify struct with indentation" {
233 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
234
212235 try testStringify(
213236 \\{
214237 \\ "foo": 42,
......@@ -254,6 +277,8 @@ test "stringify struct with indentation" {
254277}
255278
256279test "stringify struct with void field" {
280 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
281
257282 try testStringify("{\"foo\":42}", struct {
258283 foo: u32,
259284 bar: void = {},
......@@ -261,6 +286,8 @@ test "stringify struct with void field" {
261286}
262287
263288test "stringify array of structs" {
289 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
290
264291 const MyStruct = struct {
265292 foo: u32,
266293 };
......@@ -272,6 +299,8 @@ test "stringify array of structs" {
272299}
273300
274301test "stringify struct with custom stringifier" {
302 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
303
275304 try testStringify("[\"something special\",42]", struct {
276305 foo: u32,
277306 const Self = @This();
......@@ -286,12 +315,16 @@ test "stringify struct with custom stringifier" {
286315}
287316
288317test "stringify vector" {
318 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
319
289320 try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{});
290321 try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{});
291322 try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true });
292323}
293324
294325test "stringify tuple" {
326 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
327
295328 try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{});
296329}
297330
......@@ -378,6 +411,8 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St
378411}
379412
380413test "stringify alloc" {
414 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
415
381416 const allocator = std.testing.allocator;
382417 const expected =
383418 \\{"foo":"bar","answer":42,"my_friend":"sammy"}
......@@ -389,6 +424,8 @@ test "stringify alloc" {
389424}
390425
391426test "comptime stringify" {
427 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
428
392429 comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable;
393430 comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable;
394431 comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable;
......@@ -409,6 +446,8 @@ test "comptime stringify" {
409446}
410447
411448test "print" {
449 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
450
412451 var out_buf: [1024]u8 = undefined;
413452 var slice_stream = std.io.fixedBufferStream(&out_buf);
414453 const out = slice_stream.writer();
......@@ -440,6 +479,8 @@ test "print" {
440479}
441480
442481test "nonportable numbers" {
482 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
483
443484 try testStringify("9999999999999999", 9999999999999999, .{});
444485 try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true });
445486}
lib/std/json/test.zig+5
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const testing = std.testing;
34const parseFromSlice = @import("./static.zig").parseFromSlice;
45const validate = @import("./scanner.zig").validate;
......@@ -34,11 +35,15 @@ fn testHighLevelDynamicParser(s: []const u8) !void {
3435
3536// Additional tests not part of test JSONTestSuite.
3637test "y_trailing_comma_after_empty" {
38 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
39
3740 try roundTrip(
3841 \\{"1":[],"2":{},"3":"4"}
3942 );
4043}
4144test "n_object_closed_missing_value" {
45 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
46
4247 try err(
4348 \\{"a":}
4449 );
lib/std/leb128.zig+4
......@@ -215,6 +215,8 @@ fn test_read_uleb128_seq(comptime T: type, comptime N: usize, encoded: []const u
215215}
216216
217217test "deserialize signed LEB128" {
218 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
219
218220 // Truncated
219221 try testing.expectError(error.EndOfStream, test_read_stream_ileb128(i64, "\x80"));
220222
......@@ -361,6 +363,8 @@ test "serialize unsigned LEB128" {
361363}
362364
363365test "serialize signed LEB128" {
366 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
367
364368 // explicitly test i0 because starting `t` at 0
365369 // will break the while loop
366370 try test_write_leb128(@as(i0, 0));
lib/std/math.zig+26
......@@ -492,10 +492,13 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T {
492492}
493493
494494test "shl" {
495 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
496
495497 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
496498 // https://github.com/ziglang/zig/issues/12012
497499 return error.SkipZigTest;
498500 }
501
499502 try testing.expect(shl(u8, 0b11111111, @as(usize, 3)) == 0b11111000);
500503 try testing.expect(shl(u8, 0b11111111, @as(usize, 8)) == 0);
501504 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 {
536539}
537540
538541test "shr" {
542 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
543
539544 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
540545 // https://github.com/ziglang/zig/issues/12012
541546 return error.SkipZigTest;
542547 }
548
543549 try testing.expect(shr(u8, 0b11111111, @as(usize, 3)) == 0b00011111);
544550 try testing.expect(shr(u8, 0b11111111, @as(usize, 8)) == 0);
545551 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 {
581587}
582588
583589test "rotr" {
590 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
591
584592 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
585593 // https://github.com/ziglang/zig/issues/12012
586594 return error.SkipZigTest;
587595 }
596
588597 try testing.expect(rotr(u0, 0b0, @as(usize, 3)) == 0b0);
589598 try testing.expect(rotr(u5, 0b00001, @as(usize, 0)) == 0b00001);
590599 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 {
625634}
626635
627636test "rotl" {
637 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
638
628639 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
629640 // https://github.com/ziglang/zig/issues/12012
630641 return error.SkipZigTest;
631642 }
643
632644 try testing.expect(rotl(u0, 0b0, @as(usize, 3)) == 0b0);
633645 try testing.expect(rotl(u5, 0b00001, @as(usize, 0)) == 0b00001);
634646 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 {
752764}
753765
754766test "divTrunc" {
767 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
768
755769 try testDivTrunc();
756770 try comptime testDivTrunc();
757771}
......@@ -776,6 +790,8 @@ pub fn divFloor(comptime T: type, numerator: T, denominator: T) !T {
776790}
777791
778792test "divFloor" {
793 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
794
779795 try testDivFloor();
780796 try comptime testDivFloor();
781797}
......@@ -813,6 +829,8 @@ pub fn divCeil(comptime T: type, numerator: T, denominator: T) !T {
813829}
814830
815831test "divCeil" {
832 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
833
816834 try testDivCeil();
817835 try comptime testDivCeil();
818836}
......@@ -857,6 +875,8 @@ pub fn divExact(comptime T: type, numerator: T, denominator: T) !T {
857875}
858876
859877test "divExact" {
878 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
879
860880 try testDivExact();
861881 try comptime testDivExact();
862882}
......@@ -887,6 +907,8 @@ test "mod" {
887907 try comptime testMod();
888908}
889909fn testMod() !void {
910 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
911
890912 try testing.expect((mod(i32, -5, 3) catch unreachable) == 1);
891913 try testing.expect((mod(i32, 5, 3) catch unreachable) == 2);
892914 try testing.expectError(error.NegativeDenominator, mod(i32, 10, -1));
......@@ -909,6 +931,8 @@ pub fn rem(comptime T: type, numerator: T, denominator: T) !T {
909931}
910932
911933test "rem" {
934 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
935
912936 try testRem();
913937 try comptime testRem();
914938}
......@@ -1261,6 +1285,8 @@ pub fn lerp(a: anytype, b: anytype, t: anytype) @TypeOf(a, b, t) {
12611285}
12621286
12631287test "lerp" {
1288 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1289
12641290 try testing.expectEqual(@as(f64, 75), lerp(50, 100, 0.5));
12651291 try testing.expectEqual(@as(f32, 43.75), lerp(50, 25, 0.25));
12661292 try testing.expectEqual(@as(f64, -31.25), lerp(-50, 25, 0.25));
lib/std/math/big/int_test.zig+160-13
......@@ -71,6 +71,8 @@ test "big.int set negative minimum" {
7171}
7272
7373test "big.int set double-width maximum then zero" {
74 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
75
7476 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));
7577 defer a.deinit();
7678 try a.set(@as(DoubleLimb, 0));
......@@ -244,6 +246,8 @@ test "big.int fits" {
244246}
245247
246248test "big.int string set" {
249 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
250
247251 var a = try Managed.init(testing.allocator);
248252 defer a.deinit();
249253
......@@ -260,6 +264,8 @@ test "big.int string negative" {
260264}
261265
262266test "big.int string set number with underscores" {
267 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
268
263269 var a = try Managed.init(testing.allocator);
264270 defer a.deinit();
265271
......@@ -268,6 +274,8 @@ test "big.int string set number with underscores" {
268274}
269275
270276test "big.int string set case insensitive number" {
277 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
278
271279 var a = try Managed.init(testing.allocator);
272280 defer a.deinit();
273281
......@@ -318,6 +326,8 @@ test "big.int twos complement limit set" {
318326}
319327
320328test "big.int string to" {
329 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
330
321331 var a = try Managed.initSet(testing.allocator, 120317241209124781241290847124);
322332 defer a.deinit();
323333
......@@ -358,6 +368,8 @@ test "big.int string to base 16" {
358368}
359369
360370test "big.int neg string to" {
371 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
372
361373 var a = try Managed.initSet(testing.allocator, -123907434);
362374 defer a.deinit();
363375
......@@ -380,6 +392,8 @@ test "big.int zero string to" {
380392}
381393
382394test "big.int clone" {
395 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
396
383397 var a = try Managed.initSet(testing.allocator, 1234);
384398 defer a.deinit();
385399 var b = try a.clone();
......@@ -517,6 +531,8 @@ test "big.int add multi-single" {
517531}
518532
519533test "big.int add multi-multi" {
534 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
535
520536 var op1: u128 = 0xefefefef7f7f7f7f;
521537 var op2: u128 = 0xfefefefe9f9f9f9f;
522538 var a = try Managed.initSet(testing.allocator, op1);
......@@ -618,6 +634,8 @@ test "big.int addWrap single-single, unsigned" {
618634}
619635
620636test "big.int subWrap single-single, unsigned" {
637 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
638
621639 var a = try Managed.initSet(testing.allocator, 0);
622640 defer a.deinit();
623641
......@@ -631,6 +649,8 @@ test "big.int subWrap single-single, unsigned" {
631649}
632650
633651test "big.int addWrap multi-multi, unsigned, limb aligned" {
652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
634654 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));
635655 defer a.deinit();
636656
......@@ -683,6 +703,8 @@ test "big.int subWrap single-single, signed" {
683703}
684704
685705test "big.int addWrap multi-multi, signed, limb aligned" {
706 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
707
686708 var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb));
687709 defer a.deinit();
688710
......@@ -733,6 +755,8 @@ test "big.int subSat single-single, unsigned" {
733755}
734756
735757test "big.int addSat multi-multi, unsigned, limb aligned" {
758 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
759
736760 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));
737761 defer a.deinit();
738762
......@@ -818,6 +842,8 @@ test "big.int sub single-single" {
818842}
819843
820844test "big.int sub multi-single" {
845 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
846
821847 var a = try Managed.initSet(testing.allocator, maxInt(Limb) + 1);
822848 defer a.deinit();
823849 var b = try Managed.initSet(testing.allocator, 1);
......@@ -831,6 +857,8 @@ test "big.int sub multi-single" {
831857}
832858
833859test "big.int sub multi-multi" {
860 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
861
834862 var op1: u128 = 0xefefefefefefefefefefefef;
835863 var op2: u128 = 0xabababababababababababab;
836864
......@@ -915,7 +943,10 @@ test "big.int mul multi-single" {
915943}
916944
917945test "big.int mul multi-multi" {
918 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
946 switch (builtin.zig_backend) {
947 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
948 else => {},
949 }
919950
920951 var op1: u256 = 0x998888efefefefefefefef;
921952 var op2: u256 = 0x333000abababababababab;
......@@ -932,6 +963,8 @@ test "big.int mul multi-multi" {
932963}
933964
934965test "big.int mul alias r with a" {
966 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
967
935968 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
936969 defer a.deinit();
937970 var b = try Managed.initSet(testing.allocator, 2);
......@@ -943,6 +976,8 @@ test "big.int mul alias r with a" {
943976}
944977
945978test "big.int mul alias r with b" {
979 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
980
946981 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
947982 defer a.deinit();
948983 var b = try Managed.initSet(testing.allocator, 2);
......@@ -954,6 +989,8 @@ test "big.int mul alias r with b" {
954989}
955990
956991test "big.int mul alias r with a and b" {
992 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
993
957994 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
958995 defer a.deinit();
959996
......@@ -989,6 +1026,8 @@ test "big.int mul 0*0" {
9891026}
9901027
9911028test "big.int mul large" {
1029 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1030
9921031 var a = try Managed.initCapacity(testing.allocator, 50);
9931032 defer a.deinit();
9941033 var b = try Managed.initCapacity(testing.allocator, 100);
......@@ -1036,7 +1075,10 @@ test "big.int mulWrap single-single signed" {
10361075}
10371076
10381077test "big.int mulWrap multi-multi unsigned" {
1039 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1078 switch (builtin.zig_backend) {
1079 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1080 else => {},
1081 }
10401082
10411083 var op1: u256 = 0x998888efefefefefefefef;
10421084 var op2: u256 = 0x333000abababababababab;
......@@ -1053,7 +1095,10 @@ test "big.int mulWrap multi-multi unsigned" {
10531095}
10541096
10551097test "big.int mulWrap multi-multi signed" {
1056 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1098 switch (builtin.zig_backend) {
1099 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1100 else => {},
1101 }
10571102
10581103 var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb) - 1);
10591104 defer a.deinit();
......@@ -1068,6 +1113,8 @@ test "big.int mulWrap multi-multi signed" {
10681113}
10691114
10701115test "big.int mulWrap large" {
1116 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1117
10711118 var a = try Managed.initCapacity(testing.allocator, 50);
10721119 defer a.deinit();
10731120 var b = try Managed.initCapacity(testing.allocator, 100);
......@@ -1124,6 +1171,8 @@ test "big.int div single-half with rem" {
11241171}
11251172
11261173test "big.int div single-single no rem" {
1174 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1175
11271176 // assumes usize is <= 64 bits.
11281177 var a = try Managed.initSet(testing.allocator, 1 << 52);
11291178 defer a.deinit();
......@@ -1141,6 +1190,8 @@ test "big.int div single-single no rem" {
11411190}
11421191
11431192test "big.int div single-single with rem" {
1193 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1194
11441195 var a = try Managed.initSet(testing.allocator, (1 << 52) | (1 << 33));
11451196 defer a.deinit();
11461197 var b = try Managed.initSet(testing.allocator, (1 << 35));
......@@ -1157,6 +1208,8 @@ test "big.int div single-single with rem" {
11571208}
11581209
11591210test "big.int div multi-single no rem" {
1211 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1212
11601213 var op1: u128 = 0xffffeeeeddddcccc;
11611214 var op2: u128 = 34;
11621215
......@@ -1176,6 +1229,8 @@ test "big.int div multi-single no rem" {
11761229}
11771230
11781231test "big.int div multi-single with rem" {
1232 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1233
11791234 var op1: u128 = 0xffffeeeeddddcccf;
11801235 var op2: u128 = 34;
11811236
......@@ -1195,6 +1250,8 @@ test "big.int div multi-single with rem" {
11951250}
11961251
11971252test "big.int div multi>2-single" {
1253 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1254
11981255 var op1: u128 = 0xfefefefefefefefefefefefefefefefe;
11991256 var op2: u128 = 0xefab8;
12001257
......@@ -1214,6 +1271,8 @@ test "big.int div multi>2-single" {
12141271}
12151272
12161273test "big.int div single-single q < r" {
1274 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1275
12171276 var a = try Managed.initSet(testing.allocator, 0x0078f432);
12181277 defer a.deinit();
12191278 var b = try Managed.initSet(testing.allocator, 0x01000000);
......@@ -1258,7 +1317,10 @@ test "big.int div q=0 alias" {
12581317}
12591318
12601319test "big.int div multi-multi q < r" {
1261 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1320 switch (builtin.zig_backend) {
1321 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1322 else => {},
1323 }
12621324
12631325 const op1 = 0x1ffffffff0078f432;
12641326 const op2 = 0x1ffffffff01000000;
......@@ -1374,6 +1436,8 @@ test "big.int div trunc single-single -/-" {
13741436}
13751437
13761438test "big.int divTrunc #15535" {
1439 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1440
13771441 var one = try Managed.initSet(testing.allocator, 1);
13781442 defer one.deinit();
13791443 var x = try Managed.initSet(testing.allocator, std.math.pow(u128, 2, 64));
......@@ -1387,6 +1451,8 @@ test "big.int divTrunc #15535" {
13871451}
13881452
13891453test "big.int divFloor #10932" {
1454 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1455
13901456 var a = try Managed.init(testing.allocator);
13911457 defer a.deinit();
13921458
......@@ -1411,6 +1477,8 @@ test "big.int divFloor #10932" {
14111477}
14121478
14131479test "big.int divFloor #11166" {
1480 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1481
14141482 var a = try Managed.init(testing.allocator);
14151483 defer a.deinit();
14161484
......@@ -1438,6 +1506,8 @@ test "big.int divFloor #11166" {
14381506}
14391507
14401508test "big.int gcd #10932" {
1509 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1510
14411511 var a = try Managed.init(testing.allocator);
14421512 defer a.deinit();
14431513
......@@ -1572,6 +1642,8 @@ test "big.int div floor single-single -/-" {
15721642}
15731643
15741644test "big.int div floor no remainder negative quotient" {
1645 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1646
15751647 const u: i32 = -0x80000000;
15761648 const v: i32 = 1;
15771649
......@@ -1629,7 +1701,10 @@ test "big.int div floor positive close to zero" {
16291701}
16301702
16311703test "big.int div multi-multi with rem" {
1632 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1704 switch (builtin.zig_backend) {
1705 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1706 else => {},
1707 }
16331708
16341709 var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeeddddccccbbbbaaaa9999);
16351710 defer a.deinit();
......@@ -1647,7 +1722,10 @@ test "big.int div multi-multi with rem" {
16471722}
16481723
16491724test "big.int div multi-multi no rem" {
1650 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1725 switch (builtin.zig_backend) {
1726 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1727 else => {},
1728 }
16511729
16521730 var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeedb4fec200ee3a4286361);
16531731 defer a.deinit();
......@@ -1665,7 +1743,10 @@ test "big.int div multi-multi no rem" {
16651743}
16661744
16671745test "big.int div multi-multi (2 branch)" {
1668 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1746 switch (builtin.zig_backend) {
1747 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1748 else => {},
1749 }
16691750
16701751 var a = try Managed.initSet(testing.allocator, 0x866666665555555588888887777777761111111111111111);
16711752 defer a.deinit();
......@@ -1683,7 +1764,10 @@ test "big.int div multi-multi (2 branch)" {
16831764}
16841765
16851766test "big.int div multi-multi (3.1/3.3 branch)" {
1686 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1767 switch (builtin.zig_backend) {
1768 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1769 else => {},
1770 }
16871771
16881772 var a = try Managed.initSet(testing.allocator, 0x11111111111111111111111111111111111111111111111111111111111111);
16891773 defer a.deinit();
......@@ -1701,7 +1785,10 @@ test "big.int div multi-multi (3.1/3.3 branch)" {
17011785}
17021786
17031787test "big.int div multi-single zero-limb trailing" {
1704 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1788 switch (builtin.zig_backend) {
1789 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1790 else => {},
1791 }
17051792
17061793 var a = try Managed.initSet(testing.allocator, 0x60000000000000000000000000000000000000000000000000000000000000000);
17071794 defer a.deinit();
......@@ -1721,7 +1808,10 @@ test "big.int div multi-single zero-limb trailing" {
17211808}
17221809
17231810test "big.int div multi-multi zero-limb trailing (with rem)" {
1724 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1811 switch (builtin.zig_backend) {
1812 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1813 else => {},
1814 }
17251815
17261816 var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);
17271817 defer a.deinit();
......@@ -1742,7 +1832,10 @@ test "big.int div multi-multi zero-limb trailing (with rem)" {
17421832}
17431833
17441834test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count > divisor zero-limb count" {
1745 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1835 switch (builtin.zig_backend) {
1836 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1837 else => {},
1838 }
17461839
17471840 var a = try Managed.initSet(testing.allocator, 0x8666666655555555888888877777777611111111111111110000000000000000);
17481841 defer a.deinit();
......@@ -1763,7 +1856,10 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li
17631856}
17641857
17651858test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count < divisor zero-limb count" {
1766 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1859 switch (builtin.zig_backend) {
1860 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1861 else => {},
1862 }
17671863
17681864 var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);
17691865 defer a.deinit();
......@@ -1786,6 +1882,8 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li
17861882}
17871883
17881884test "big.int div multi-multi fuzz case #1" {
1885 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1886
17891887 var a = try Managed.init(testing.allocator);
17901888 defer a.deinit();
17911889 var b = try Managed.init(testing.allocator);
......@@ -1810,6 +1908,8 @@ test "big.int div multi-multi fuzz case #1" {
18101908}
18111909
18121910test "big.int div multi-multi fuzz case #2" {
1911 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1912
18131913 var a = try Managed.init(testing.allocator);
18141914 defer a.deinit();
18151915 var b = try Managed.init(testing.allocator);
......@@ -1882,6 +1982,8 @@ test "big.int truncate multi to multi unsigned" {
18821982}
18831983
18841984test "big.int truncate multi to multi signed" {
1985 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1986
18851987 var a = try Managed.initSet(testing.allocator, 3 << @bitSizeOf(Limb));
18861988 defer a.deinit();
18871989
......@@ -1891,6 +1993,8 @@ test "big.int truncate multi to multi signed" {
18911993}
18921994
18931995test "big.int truncate negative multi to single" {
1996 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1997
18941998 var a = try Managed.initSet(testing.allocator, -@as(SignedDoubleLimb, maxInt(Limb) + 1));
18951999 defer a.deinit();
18962000
......@@ -1997,6 +2101,8 @@ test "big.int shift-right multi" {
19972101}
19982102
19992103test "big.int shift-left single" {
2104 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2105
20002106 var a = try Managed.initSet(testing.allocator, 0xffff);
20012107 defer a.deinit();
20022108 try a.shiftLeft(&a, 16);
......@@ -2041,6 +2147,8 @@ test "big.int sat shift-left simple unsigned" {
20412147}
20422148
20432149test "big.int sat shift-left simple unsigned no sat" {
2150 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2151
20442152 var a = try Managed.initSet(testing.allocator, 1);
20452153 defer a.deinit();
20462154 try a.shiftLeftSat(&a, 16, .unsigned, 21);
......@@ -2097,6 +2205,8 @@ test "big.int sat shift-left signed simple positive" {
20972205}
20982206
20992207test "big.int sat shift-left signed multi positive" {
2208 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2209
21002210 var x: SignedDoubleLimb = 1;
21012211 const shift = @bitSizeOf(SignedDoubleLimb) - 1;
21022212
......@@ -2108,6 +2218,8 @@ test "big.int sat shift-left signed multi positive" {
21082218}
21092219
21102220test "big.int sat shift-left signed multi negative" {
2221 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2222
21112223 var x: SignedDoubleLimb = -1;
21122224 const shift = @bitSizeOf(SignedDoubleLimb) - 1;
21132225
......@@ -2294,6 +2406,8 @@ test "big.int bitwise xor simple" {
22942406}
22952407
22962408test "big.int bitwise xor multi-limb" {
2409 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2410
22972411 var x: DoubleLimb = maxInt(Limb) + 1;
22982412 var y: DoubleLimb = maxInt(Limb);
22992413 var a = try Managed.initSet(testing.allocator, x);
......@@ -2468,6 +2582,8 @@ test "big.int var args" {
24682582}
24692583
24702584test "big.int gcd non-one small" {
2585 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2586
24712587 var a = try Managed.initSet(testing.allocator, 17);
24722588 defer a.deinit();
24732589 var b = try Managed.initSet(testing.allocator, 97);
......@@ -2481,6 +2597,8 @@ test "big.int gcd non-one small" {
24812597}
24822598
24832599test "big.int gcd non-one medium" {
2600 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2601
24842602 var a = try Managed.initSet(testing.allocator, 4864);
24852603 defer a.deinit();
24862604 var b = try Managed.initSet(testing.allocator, 3458);
......@@ -2494,6 +2612,8 @@ test "big.int gcd non-one medium" {
24942612}
24952613
24962614test "big.int gcd non-one large" {
2615 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2616
24972617 var a = try Managed.initSet(testing.allocator, 0xffffffffffffffff);
24982618 defer a.deinit();
24992619 var b = try Managed.initSet(testing.allocator, 0xffffffffffffffff7777);
......@@ -2507,7 +2627,10 @@ test "big.int gcd non-one large" {
25072627}
25082628
25092629test "big.int gcd large multi-limb result" {
2510 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
2630 switch (builtin.zig_backend) {
2631 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
2632 else => {},
2633 }
25112634
25122635 var a = try Managed.initSet(testing.allocator, 0x12345678123456781234567812345678123456781234567812345678);
25132636 defer a.deinit();
......@@ -2523,6 +2646,8 @@ test "big.int gcd large multi-limb result" {
25232646}
25242647
25252648test "big.int gcd one large" {
2649 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2650
25262651 var a = try Managed.initSet(testing.allocator, 1897056385327307);
25272652 defer a.deinit();
25282653 var b = try Managed.initSet(testing.allocator, 2251799813685248);
......@@ -2547,6 +2672,8 @@ test "big.int mutable to managed" {
25472672}
25482673
25492674test "big.int const to managed" {
2675 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2676
25502677 var a = try Managed.initSet(testing.allocator, 123423453456);
25512678 defer a.deinit();
25522679
......@@ -2557,6 +2684,8 @@ test "big.int const to managed" {
25572684}
25582685
25592686test "big.int pow" {
2687 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2688
25602689 {
25612690 var a = try Managed.initSet(testing.allocator, -3);
25622691 defer a.deinit();
......@@ -2612,6 +2741,8 @@ test "big.int pow" {
26122741}
26132742
26142743test "big.int sqrt" {
2744 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2745
26152746 var r = try Managed.init(testing.allocator);
26162747 defer r.deinit();
26172748 var a = try Managed.init(testing.allocator);
......@@ -2642,6 +2773,8 @@ test "big.int sqrt" {
26422773}
26432774
26442775test "big.int regression test for 1 limb overflow with alias" {
2776 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2777
26452778 // Note these happen to be two consecutive Fibonacci sequence numbers, the
26462779 // first two whose sum exceeds 2**64.
26472780 var a = try Managed.initSet(testing.allocator, 7540113804746346429);
......@@ -2656,6 +2789,8 @@ test "big.int regression test for 1 limb overflow with alias" {
26562789}
26572790
26582791test "big.int regression test for realloc with alias" {
2792 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2793
26592794 // Note these happen to be two consecutive Fibonacci sequence numbers, the
26602795 // second of which is the first such number to exceed 2**192.
26612796 var a = try Managed.initSet(testing.allocator, 5611500259351924431073312796924978741056961814867751431689);
......@@ -2670,6 +2805,8 @@ test "big.int regression test for realloc with alias" {
26702805}
26712806
26722807test "big int popcount" {
2808 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2809
26732810 var a = try Managed.init(testing.allocator);
26742811 defer a.deinit();
26752812
......@@ -2750,6 +2887,8 @@ fn popCountTest(val: *const Managed, bit_count: usize, expected: usize) !void {
27502887}
27512888
27522889test "big int conversion read/write twos complement" {
2890 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2891
27532892 var a = try Managed.initSet(testing.allocator, (1 << 493) - 1);
27542893 defer a.deinit();
27552894 var b = try Managed.initSet(testing.allocator, (1 << 493) - 1);
......@@ -2848,6 +2987,8 @@ test "big int write twos complement +/- zero" {
28482987}
28492988
28502989test "big int conversion write twos complement with padding" {
2990 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2991
28512992 var a = try Managed.initSet(testing.allocator, 0x01_ffffffff_ffffffff_ffffffff);
28522993 defer a.deinit();
28532994
......@@ -3031,6 +3172,8 @@ fn byteSwapTest(comptime T: type, comptime input: comptime_int, comptime expecte
30313172}
30323173
30333174test "big int byte swap" {
3175 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
3176
30343177 var a = try Managed.initSet(testing.allocator, 0x01_ffffffff_ffffffff_ffffffff);
30353178 defer a.deinit();
30363179
......@@ -3075,6 +3218,8 @@ test "big int byte swap" {
30753218}
30763219
30773220test "big.int mul multi-multi alias r with a and b" {
3221 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
3222
30783223 var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb));
30793224 defer a.deinit();
30803225
......@@ -3091,6 +3236,8 @@ test "big.int mul multi-multi alias r with a and b" {
30913236}
30923237
30933238test "big.int sqr multi alias r with a" {
3239 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
3240
30943241 var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb));
30953242 defer a.deinit();
30963243
lib/std/math/big/rational.zig+35
......@@ -1,4 +1,5 @@
11const std = @import("../../std.zig");
2const builtin = @import("builtin");
23const debug = std.debug;
34const math = std.math;
45const mem = std.mem;
......@@ -493,6 +494,8 @@ fn extractLowBits(a: Int, comptime T: type) T {
493494}
494495
495496test "big.rational extractLowBits" {
497 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
498
496499 var a = try Int.initSet(testing.allocator, 0x11112222333344441234567887654321);
497500 defer a.deinit();
498501
......@@ -513,6 +516,8 @@ test "big.rational extractLowBits" {
513516}
514517
515518test "big.rational set" {
519 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
520
516521 var a = try Rational.init(testing.allocator);
517522 defer a.deinit();
518523
......@@ -542,6 +547,8 @@ test "big.rational set" {
542547}
543548
544549test "big.rational setFloat" {
550 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
551
545552 var a = try Rational.init(testing.allocator);
546553 defer a.deinit();
547554
......@@ -567,6 +574,8 @@ test "big.rational setFloat" {
567574}
568575
569576test "big.rational setFloatString" {
577 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
578
570579 var a = try Rational.init(testing.allocator);
571580 defer a.deinit();
572581
......@@ -578,6 +587,8 @@ test "big.rational setFloatString" {
578587}
579588
580589test "big.rational toFloat" {
590 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
591
581592 var a = try Rational.init(testing.allocator);
582593 defer a.deinit();
583594
......@@ -591,6 +602,8 @@ test "big.rational toFloat" {
591602}
592603
593604test "big.rational set/to Float round-trip" {
605 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
606
594607 var a = try Rational.init(testing.allocator);
595608 defer a.deinit();
596609 var prng = std.rand.DefaultPrng.init(0x5EED);
......@@ -604,6 +617,8 @@ test "big.rational set/to Float round-trip" {
604617}
605618
606619test "big.rational copy" {
620 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
621
607622 var a = try Rational.init(testing.allocator);
608623 defer a.deinit();
609624
......@@ -634,6 +649,8 @@ test "big.rational copy" {
634649}
635650
636651test "big.rational negate" {
652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
637654 var a = try Rational.init(testing.allocator);
638655 defer a.deinit();
639656
......@@ -651,6 +668,8 @@ test "big.rational negate" {
651668}
652669
653670test "big.rational abs" {
671 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
672
654673 var a = try Rational.init(testing.allocator);
655674 defer a.deinit();
656675
......@@ -668,6 +687,8 @@ test "big.rational abs" {
668687}
669688
670689test "big.rational swap" {
690 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
691
671692 var a = try Rational.init(testing.allocator);
672693 defer a.deinit();
673694 var b = try Rational.init(testing.allocator);
......@@ -692,6 +713,8 @@ test "big.rational swap" {
692713}
693714
694715test "big.rational order" {
716 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
717
695718 var a = try Rational.init(testing.allocator);
696719 defer a.deinit();
697720 var b = try Rational.init(testing.allocator);
......@@ -707,6 +730,8 @@ test "big.rational order" {
707730}
708731
709732test "big.rational order/orderAbs with negative" {
733 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
734
710735 var a = try Rational.init(testing.allocator);
711736 defer a.deinit();
712737 var b = try Rational.init(testing.allocator);
......@@ -719,6 +744,8 @@ test "big.rational order/orderAbs with negative" {
719744}
720745
721746test "big.rational add single-limb" {
747 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
748
722749 var a = try Rational.init(testing.allocator);
723750 defer a.deinit();
724751 var b = try Rational.init(testing.allocator);
......@@ -734,6 +761,8 @@ test "big.rational add single-limb" {
734761}
735762
736763test "big.rational add" {
764 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
765
737766 var a = try Rational.init(testing.allocator);
738767 defer a.deinit();
739768 var b = try Rational.init(testing.allocator);
......@@ -750,6 +779,8 @@ test "big.rational add" {
750779}
751780
752781test "big.rational sub" {
782 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
783
753784 var a = try Rational.init(testing.allocator);
754785 defer a.deinit();
755786 var b = try Rational.init(testing.allocator);
......@@ -766,6 +797,8 @@ test "big.rational sub" {
766797}
767798
768799test "big.rational mul" {
800 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
801
769802 var a = try Rational.init(testing.allocator);
770803 defer a.deinit();
771804 var b = try Rational.init(testing.allocator);
......@@ -782,6 +815,8 @@ test "big.rational mul" {
782815}
783816
784817test "big.rational div" {
818 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
819
785820 {
786821 var a = try Rational.init(testing.allocator);
787822 defer a.deinit();
lib/std/math/ilogb.zig+9
......@@ -6,6 +6,7 @@
66// https://git.musl-libc.org/cgit/musl/tree/src/math/ilogb.c
77
88const std = @import("../std.zig");
9const builtin = @import("builtin");
910const math = std.math;
1011const expect = std.testing.expect;
1112const maxInt = std.math.maxInt;
......@@ -108,6 +109,8 @@ test "64" {
108109}
109110
110111test "80" {
112 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
113
111114 try expect(ilogbX(f80, 0.0) == fp_ilogb0);
112115 try expect(ilogbX(f80, 0.5) == -1);
113116 try expect(ilogbX(f80, 0.8923) == -1);
......@@ -122,6 +125,8 @@ test "80" {
122125}
123126
124127test "128" {
128 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
129
125130 try expect(ilogbX(f128, 0.0) == fp_ilogb0);
126131 try expect(ilogbX(f128, 0.5) == -1);
127132 try expect(ilogbX(f128, 0.8923) == -1);
......@@ -157,6 +162,8 @@ test "64 special" {
157162}
158163
159164test "80 special" {
165 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
166
160167 try expect(ilogbX(f80, math.inf(f80)) == maxInt(i32));
161168 try expect(ilogbX(f80, -math.inf(f80)) == maxInt(i32));
162169 try expect(ilogbX(f80, 0.0) == minInt(i32));
......@@ -164,6 +171,8 @@ test "80 special" {
164171}
165172
166173test "128 special" {
174 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
175
167176 try expect(ilogbX(f128, math.inf(f128)) == maxInt(i32));
168177 try expect(ilogbX(f128, -math.inf(f128)) == maxInt(i32));
169178 try expect(ilogbX(f128, 0.0) == minInt(i32));
lib/std/math/ldexp.zig+1
......@@ -67,6 +67,7 @@ pub fn ldexp(x: anytype, n: i32) @TypeOf(x) {
6767}
6868
6969test "math.ldexp" {
70 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
7071
7172 // subnormals
7273 try expect(ldexp(@as(f16, 0x1.1FFp14), -14 - 9 - 15) == math.floatTrueMin(f16));
lib/std/math/log10.zig+1-1
......@@ -170,11 +170,11 @@ test "log10_int vs old implementation" {
170170test "log10_int close to powers of 10" {
171171 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
172172 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
173 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
174173 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
175174 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
176175 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
177176 if (builtin.zig_backend == .stage2_llvm and comptime builtin.target.isWasm()) return error.SkipZigTest; // TODO
177 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
178178
179179 const int_types = .{ u8, u16, u32, u64, u128, u256, u512 };
180180 const max_log_values: [7]usize = .{ 2, 4, 9, 19, 38, 77, 154 };
lib/std/math/log_int.zig+2
......@@ -56,6 +56,8 @@ pub fn log_int(comptime T: type, base: T, x: T) Log2Int(T) {
5656}
5757
5858test "math.log_int" {
59 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
60
5961 // Test all unsigned integers with 2, 3, ..., 64 bits.
6062 // We cannot test 0 or 1 bits since base must be > 1.
6163 inline for (2..64 + 1) |bits| {
lib/std/math/nextafter.zig+2
......@@ -103,6 +103,8 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T {
103103}
104104
105105test "math.nextAfter.int" {
106 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
107
106108 try expect(nextAfter(i0, 0, 0) == 0);
107109 try expect(nextAfter(u0, 0, 0) == 0);
108110 try expect(nextAfter(i1, 0, 0) == 0);
lib/std/math/scalbn.zig+2
......@@ -7,6 +7,8 @@ const expect = std.testing.expect;
77pub const scalbn = @import("ldexp.zig").ldexp;
88
99test "math.scalbn" {
10 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
11
1012 // Verify we are using base 2.
1113 try expect(scalbn(@as(f16, 1.5), 4) == 24.0);
1214 try expect(scalbn(@as(f32, 1.5), 4) == 24.0);
lib/std/mem.zig+20-4
......@@ -315,6 +315,8 @@ pub fn zeroes(comptime T: type) T {
315315}
316316
317317test "zeroes" {
318 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
319
318320 const C_struct = extern struct {
319321 x: u32,
320322 y: u32 align(128),
......@@ -1023,6 +1025,8 @@ pub fn indexOfSentinel(comptime T: type, comptime sentinel: T, p: [*:sentinel]co
10231025}
10241026
10251027test "indexOfSentinel vector paths" {
1028 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1029
10261030 const Types = [_]type{ u8, u16, u32, u64 };
10271031 const allocator = std.testing.allocator;
10281032
......@@ -1737,6 +1741,8 @@ pub fn readIntSlice(comptime T: type, bytes: []const u8, endian: Endian) T {
17371741}
17381742
17391743test "comptime read/write int" {
1744 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1745
17401746 comptime {
17411747 var bytes: [2]u8 = undefined;
17421748 writeIntLittle(u16, &bytes, 0x1234);
......@@ -1752,7 +1758,10 @@ test "comptime read/write int" {
17521758}
17531759
17541760test "readIntBig and readIntLittle" {
1755 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1761 switch (builtin.zig_backend) {
1762 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
1763 else => {},
1764 }
17561765
17571766 try testing.expect(readIntSliceBig(u0, &[_]u8{}) == 0x0);
17581767 try testing.expect(readIntSliceLittle(u0, &[_]u8{}) == 0x0);
......@@ -2053,7 +2062,10 @@ pub fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value
20532062}
20542063
20552064test "writeIntBig and writeIntLittle" {
2056 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
2065 switch (builtin.zig_backend) {
2066 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
2067 else => {},
2068 }
20572069
20582070 var buf0: [0]u8 = undefined;
20592071 var buf1: [1]u8 = undefined;
......@@ -3297,6 +3309,8 @@ test "testStringEquality" {
32973309}
32983310
32993311test "testReadInt" {
3312 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3313
33003314 try testReadIntImpl();
33013315 try comptime testReadIntImpl();
33023316}
......@@ -4650,8 +4664,10 @@ pub fn alignInSlice(slice: anytype, comptime new_alignment: usize) ?AlignedSlice
46504664}
46514665
46524666test "read/write(Var)PackedInt" {
4653 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
4654
4667 switch (builtin.zig_backend) {
4668 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
4669 else => {},
4670 }
46554671 switch (builtin.cpu.arch) {
46564672 // This test generates too much code to execute on WASI.
46574673 // 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 {
583583}
584584
585585test "basic usage" {
586 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
587
586588 const ally = testing.allocator;
587589
588590 const Foo = struct {
......@@ -677,6 +679,8 @@ test "basic usage" {
677679// This was observed to fail on aarch64 with LLVM 11, when the capacityInBytes
678680// function used the @reduce code path.
679681test "regression test for @reduce bug" {
682 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
683
680684 const ally = testing.allocator;
681685 var list = MultiArrayList(struct {
682686 tag: std.zig.Token.Tag,
......@@ -754,6 +758,8 @@ test "regression test for @reduce bug" {
754758}
755759
756760test "ensure capacity on empty list" {
761 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
762
757763 const ally = testing.allocator;
758764
759765 const Foo = struct {
......@@ -789,6 +795,8 @@ test "ensure capacity on empty list" {
789795}
790796
791797test "insert elements" {
798 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
799
792800 const ally = testing.allocator;
793801
794802 const Foo = struct {
......@@ -808,6 +816,8 @@ test "insert elements" {
808816}
809817
810818test "union" {
819 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
820
811821 const ally = testing.allocator;
812822
813823 const Foo = union(enum) {
......@@ -863,6 +873,8 @@ test "union" {
863873}
864874
865875test "sorting a span" {
876 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
877
866878 var list: MultiArrayList(struct { score: u32, chr: u8 }) = .{};
867879 defer list.deinit(testing.allocator);
868880
......@@ -903,6 +915,8 @@ test "sorting a span" {
903915}
904916
905917test "0 sized struct field" {
918 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
919
906920 const ally = testing.allocator;
907921
908922 const Foo = struct {
......@@ -930,6 +944,8 @@ test "0 sized struct field" {
930944}
931945
932946test "0 sized struct" {
947 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
948
933949 const ally = testing.allocator;
934950
935951 const Foo = struct {
lib/std/net/test.zig+6
......@@ -5,6 +5,7 @@ const mem = std.mem;
55const testing = std.testing;
66
77test "parse and render IPv6 addresses" {
8 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
89 if (builtin.os.tag == .wasi) return error.SkipZigTest;
910
1011 var buffer: [100]u8 = undefined;
......@@ -70,6 +71,7 @@ test "invalid but parseable IPv6 scope ids" {
7071}
7172
7273test "parse and render IPv4 addresses" {
74 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
7375 if (builtin.os.tag == .wasi) return error.SkipZigTest;
7476
7577 var buffer: [18]u8 = undefined;
......@@ -109,6 +111,8 @@ test "parse and render UNIX addresses" {
109111test "resolve DNS" {
110112 if (builtin.os.tag == .wasi) return error.SkipZigTest;
111113
114 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
115
112116 if (builtin.os.tag == .windows) {
113117 _ = try std.os.windows.WSAStartup(2, 2);
114118 }
......@@ -291,6 +295,8 @@ test "listen on a unix socket, send bytes, receive bytes" {
291295 if (builtin.single_threaded) return error.SkipZigTest;
292296 if (!net.has_unix_sockets) return error.SkipZigTest;
293297
298 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
299
294300 if (builtin.os.tag == .windows) {
295301 _ = try std.os.windows.WSAStartup(2, 2);
296302 }
lib/std/once.zig+2
......@@ -46,6 +46,8 @@ fn incr() void {
4646}
4747
4848test "Once executes its function just once" {
49 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
50
4951 if (builtin.single_threaded) {
5052 global_once.call();
5153 global_once.call();
lib/std/os/linux/io_uring.zig+30
......@@ -1741,6 +1741,8 @@ test "readv" {
17411741test "writev/fsync/readv" {
17421742 if (builtin.os.tag != .linux) return error.SkipZigTest;
17431743
1744 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1745
17441746 var ring = IO_Uring.init(4, 0) catch |err| switch (err) {
17451747 error.SystemOutdated => return error.SkipZigTest,
17461748 error.PermissionDenied => return error.SkipZigTest,
......@@ -1811,6 +1813,8 @@ test "writev/fsync/readv" {
18111813test "write/read" {
18121814 if (builtin.os.tag != .linux) return error.SkipZigTest;
18131815
1816 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1817
18141818 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
18151819 error.SystemOutdated => return error.SkipZigTest,
18161820 error.PermissionDenied => return error.SkipZigTest,
......@@ -1858,6 +1862,8 @@ test "write/read" {
18581862test "splice/read" {
18591863 if (builtin.os.tag != .linux) return error.SkipZigTest;
18601864
1865 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1866
18611867 var ring = IO_Uring.init(4, 0) catch |err| switch (err) {
18621868 error.SystemOutdated => return error.SkipZigTest,
18631869 error.PermissionDenied => return error.SkipZigTest,
......@@ -1929,6 +1935,8 @@ test "splice/read" {
19291935test "write_fixed/read_fixed" {
19301936 if (builtin.os.tag != .linux) return error.SkipZigTest;
19311937
1938 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1939
19321940 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
19331941 error.SystemOutdated => return error.SkipZigTest,
19341942 error.PermissionDenied => return error.SkipZigTest,
......@@ -1994,6 +2002,8 @@ test "write_fixed/read_fixed" {
19942002test "openat" {
19952003 if (builtin.os.tag != .linux) return error.SkipZigTest;
19962004
2005 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2006
19972007 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
19982008 error.SystemOutdated => return error.SkipZigTest,
19992009 error.PermissionDenied => return error.SkipZigTest,
......@@ -2045,6 +2055,8 @@ test "openat" {
20452055test "close" {
20462056 if (builtin.os.tag != .linux) return error.SkipZigTest;
20472057
2058 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2059
20482060 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
20492061 error.SystemOutdated => return error.SkipZigTest,
20502062 error.PermissionDenied => return error.SkipZigTest,
......@@ -2204,6 +2216,8 @@ test "sendmsg/recvmsg" {
22042216test "timeout (after a relative time)" {
22052217 if (builtin.os.tag != .linux) return error.SkipZigTest;
22062218
2219 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2220
22072221 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
22082222 error.SystemOutdated => return error.SkipZigTest,
22092223 error.PermissionDenied => return error.SkipZigTest,
......@@ -2268,6 +2282,8 @@ test "timeout (after a number of completions)" {
22682282test "timeout_remove" {
22692283 if (builtin.os.tag != .linux) return error.SkipZigTest;
22702284
2285 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2286
22712287 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
22722288 error.SystemOutdated => return error.SkipZigTest,
22732289 error.PermissionDenied => return error.SkipZigTest,
......@@ -2376,6 +2392,8 @@ test "accept/connect/recv/link_timeout" {
23762392test "fallocate" {
23772393 if (builtin.os.tag != .linux) return error.SkipZigTest;
23782394
2395 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2396
23792397 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
23802398 error.SystemOutdated => return error.SkipZigTest,
23812399 error.PermissionDenied => return error.SkipZigTest,
......@@ -2422,6 +2440,8 @@ test "fallocate" {
24222440test "statx" {
24232441 if (builtin.os.tag != .linux) return error.SkipZigTest;
24242442
2443 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2444
24252445 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
24262446 error.SystemOutdated => return error.SkipZigTest,
24272447 error.PermissionDenied => return error.SkipZigTest,
......@@ -2678,6 +2698,8 @@ test "shutdown" {
26782698test "renameat" {
26792699 if (builtin.os.tag != .linux) return error.SkipZigTest;
26802700
2701 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2702
26812703 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
26822704 error.SystemOutdated => return error.SkipZigTest,
26832705 error.PermissionDenied => return error.SkipZigTest,
......@@ -2747,6 +2769,8 @@ test "renameat" {
27472769test "unlinkat" {
27482770 if (builtin.os.tag != .linux) return error.SkipZigTest;
27492771
2772 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2773
27502774 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
27512775 error.SystemOutdated => return error.SkipZigTest,
27522776 error.PermissionDenied => return error.SkipZigTest,
......@@ -2799,6 +2823,8 @@ test "unlinkat" {
27992823test "mkdirat" {
28002824 if (builtin.os.tag != .linux) return error.SkipZigTest;
28012825
2826 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2827
28022828 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
28032829 error.SystemOutdated => return error.SkipZigTest,
28042830 error.PermissionDenied => return error.SkipZigTest,
......@@ -2843,6 +2869,8 @@ test "mkdirat" {
28432869test "symlinkat" {
28442870 if (builtin.os.tag != .linux) return error.SkipZigTest;
28452871
2872 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2873
28462874 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
28472875 error.SystemOutdated => return error.SkipZigTest,
28482876 error.PermissionDenied => return error.SkipZigTest,
......@@ -2891,6 +2919,8 @@ test "symlinkat" {
28912919test "linkat" {
28922920 if (builtin.os.tag != .linux) return error.SkipZigTest;
28932921
2922 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2923
28942924 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
28952925 error.SystemOutdated => return error.SkipZigTest,
28962926 error.PermissionDenied => return error.SkipZigTest,
lib/std/os/linux/test.zig+6
......@@ -8,6 +8,8 @@ const expectEqual = std.testing.expectEqual;
88const fs = std.fs;
99
1010test "fallocate" {
11 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
12
1113 var tmp = std.testing.tmpDir(.{});
1214 defer tmp.cleanup();
1315
......@@ -69,6 +71,8 @@ test "timer" {
6971}
7072
7173test "statx" {
74 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
75
7276 var tmp = std.testing.tmpDir(.{});
7377 defer tmp.cleanup();
7478
......@@ -107,6 +111,8 @@ test "user and group ids" {
107111}
108112
109113test "fadvise" {
114 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
115
110116 var tmp = std.testing.tmpDir(.{});
111117 defer tmp.cleanup();
112118
lib/std/os/test.zig+51
......@@ -88,6 +88,8 @@ test "chdir smoke test" {
8888test "open smoke test" {
8989 if (native_os == .wasi) return error.SkipZigTest;
9090
91 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
92
9193 // TODO verify file attributes using `fstat`
9294
9395 var tmp = tmpDir(.{});
......@@ -142,6 +144,8 @@ test "open smoke test" {
142144test "openat smoke test" {
143145 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
144146
147 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
148
145149 // TODO verify file attributes using `fstatat`
146150
147151 var tmp = tmpDir(.{});
......@@ -276,6 +280,8 @@ test "link with relative paths" {
276280test "linkat with different directories" {
277281 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
278282
283 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
284
279285 switch (native_os) {
280286 .wasi, .linux, .solaris, .illumos => {},
281287 else => return error.SkipZigTest,
......@@ -321,6 +327,8 @@ test "fstatat" {
321327 // enable when `fstat` and `fstatat` are implemented on Windows
322328 if (native_os == .windows) return error.SkipZigTest;
323329
330 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
331
324332 var tmp = tmpDir(.{});
325333 defer tmp.cleanup();
326334
......@@ -340,6 +348,8 @@ test "fstatat" {
340348}
341349
342350test "readlinkat" {
351 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
352
343353 var tmp = tmpDir(.{});
344354 defer tmp.cleanup();
345355
......@@ -375,6 +385,8 @@ fn testThreadIdFn(thread_id: *Thread.Id) void {
375385test "std.Thread.getCurrentId" {
376386 if (builtin.single_threaded) return error.SkipZigTest;
377387
388 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
389
378390 var thread_current_id: Thread.Id = undefined;
379391 const thread = try Thread.spawn(.{}, testThreadIdFn, .{&thread_current_id});
380392 thread.join();
......@@ -417,6 +429,9 @@ test "cpu count" {
417429
418430test "thread local storage" {
419431 if (builtin.single_threaded) return error.SkipZigTest;
432
433 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
434
420435 const thread1 = try Thread.spawn(.{}, testTls, .{});
421436 const thread2 = try Thread.spawn(.{}, testTls, .{});
422437 try testTls();
......@@ -504,6 +519,8 @@ fn iter_fn(info: *dl_phdr_info, size: usize, counter: *usize) IterFnError!void {
504519test "dl_iterate_phdr" {
505520 if (builtin.object_format != .elf) return error.SkipZigTest;
506521
522 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
523
507524 var counter: usize = 0;
508525 try os.dl_iterate_phdr(&counter, IterFnError, iter_fn);
509526 try expect(counter != 0);
......@@ -566,6 +583,8 @@ test "mmap" {
566583 if (native_os == .windows or native_os == .wasi)
567584 return error.SkipZigTest;
568585
586 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
587
569588 var tmp = tmpDir(.{});
570589 defer tmp.cleanup();
571590
......@@ -676,6 +695,8 @@ test "fcntl" {
676695 if (native_os == .windows or native_os == .wasi)
677696 return error.SkipZigTest;
678697
698 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
699
679700 var tmp = tmpDir(.{});
680701 defer tmp.cleanup();
681702
......@@ -716,6 +737,8 @@ test "sync" {
716737 if (native_os != .linux)
717738 return error.SkipZigTest;
718739
740 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
741
719742 var tmp = tmpDir(.{});
720743 defer tmp.cleanup();
721744
......@@ -736,6 +759,8 @@ test "fsync" {
736759 else => return error.SkipZigTest,
737760 }
738761
762 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
763
739764 var tmp = tmpDir(.{});
740765 defer tmp.cleanup();
741766
......@@ -755,6 +780,8 @@ test "getrlimit and setrlimit" {
755780 return error.SkipZigTest;
756781 }
757782
783 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
784
758785 inline for (std.meta.fields(os.rlimit_resource)) |field| {
759786 const resource = @as(os.rlimit_resource, @enumFromInt(field.value));
760787 const limit = try os.getrlimit(resource);
......@@ -797,6 +824,8 @@ test "sigaction" {
797824 if (native_os == .wasi or native_os == .windows)
798825 return error.SkipZigTest;
799826
827 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
828
800829 // https://github.com/ziglang/zig/issues/7427
801830 if (native_os == .linux and builtin.target.cpu.arch == .x86)
802831 return error.SkipZigTest;
......@@ -874,6 +903,8 @@ test "dup & dup2" {
874903 else => return error.SkipZigTest,
875904 }
876905
906 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
907
877908 var tmp = tmpDir(.{});
878909 defer tmp.cleanup();
879910
......@@ -903,6 +934,8 @@ test "dup & dup2" {
903934test "writev longer than IOV_MAX" {
904935 if (native_os == .windows or native_os == .wasi) return error.SkipZigTest;
905936
937 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
938
906939 var tmp = tmpDir(.{});
907940 defer tmp.cleanup();
908941
......@@ -920,6 +953,8 @@ test "POSIX file locking with fcntl" {
920953 return error.SkipZigTest;
921954 }
922955
956 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
957
923958 if (true) {
924959 // https://github.com/ziglang/zig/issues/11074
925960 return error.SkipZigTest;
......@@ -982,6 +1017,8 @@ test "POSIX file locking with fcntl" {
9821017test "rename smoke test" {
9831018 if (native_os == .wasi) return error.SkipZigTest;
9841019
1020 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1021
9851022 var tmp = tmpDir(.{});
9861023 defer tmp.cleanup();
9871024
......@@ -1038,6 +1075,8 @@ test "rename smoke test" {
10381075test "access smoke test" {
10391076 if (native_os == .wasi) return error.SkipZigTest;
10401077
1078 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1079
10411080 var tmp = tmpDir(.{});
10421081 defer tmp.cleanup();
10431082
......@@ -1102,6 +1141,8 @@ test "timerfd" {
11021141}
11031142
11041143test "isatty" {
1144 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1145
11051146 var tmp = tmpDir(.{});
11061147 defer tmp.cleanup();
11071148
......@@ -1114,6 +1155,8 @@ test "isatty" {
11141155test "read with empty buffer" {
11151156 if (native_os == .wasi) return error.SkipZigTest;
11161157
1158 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1159
11171160 var tmp = tmpDir(.{});
11181161 defer tmp.cleanup();
11191162
......@@ -1139,6 +1182,8 @@ test "read with empty buffer" {
11391182test "pread with empty buffer" {
11401183 if (native_os == .wasi) return error.SkipZigTest;
11411184
1185 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1186
11421187 var tmp = tmpDir(.{});
11431188 defer tmp.cleanup();
11441189
......@@ -1164,6 +1209,8 @@ test "pread with empty buffer" {
11641209test "write with empty buffer" {
11651210 if (native_os == .wasi) return error.SkipZigTest;
11661211
1212 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1213
11671214 var tmp = tmpDir(.{});
11681215 defer tmp.cleanup();
11691216
......@@ -1189,6 +1236,8 @@ test "write with empty buffer" {
11891236test "pwrite with empty buffer" {
11901237 if (native_os == .wasi) return error.SkipZigTest;
11911238
1239 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1240
11921241 var tmp = tmpDir(.{});
11931242 defer tmp.cleanup();
11941243
......@@ -1214,6 +1263,8 @@ test "pwrite with empty buffer" {
12141263test "fchmodat smoke test" {
12151264 if (!std.fs.has_executable_bit) return error.SkipZigTest;
12161265
1266 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1267
12171268 var tmp = tmpDir(.{});
12181269 defer tmp.cleanup();
12191270
lib/std/os/windows.zig+2
......@@ -2491,6 +2491,8 @@ pub fn ntToWin32Namespace(path: []const u16) !PathSpace {
24912491}
24922492
24932493test "ntToWin32Namespace" {
2494 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2495
24942496 const L = std.unicode.utf8ToUtf16LeStringLiteral;
24952497
24962498 try testNtToWin32Namespace(L("UNC"), L("\\??\\UNC"));
lib/std/priority_dequeue.zig+2
......@@ -705,6 +705,8 @@ test "std.PriorityDequeue: fromOwnedSlice trivial case 1" {
705705}
706706
707707test "std.PriorityDequeue: fromOwnedSlice" {
708 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
709
708710 const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 };
709711 const queue_items = try testing.allocator.dupe(u32, items[0..]);
710712 var queue = PDQ.fromOwnedSlice(testing.allocator, queue_items[0..], {});
lib/std/priority_queue.zig+2
......@@ -385,6 +385,8 @@ test "std.PriorityQueue: fromOwnedSlice trivial case 1" {
385385}
386386
387387test "std.PriorityQueue: fromOwnedSlice" {
388 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
389
388390 const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 };
389391 const heap_items = try testing.allocator.dupe(u32, items[0..]);
390392 var queue = PQlt.fromOwnedSlice(testing.allocator, heap_items[0..], {});
lib/std/rand/Xoshiro256.zig+4-1
......@@ -90,7 +90,10 @@ pub fn fill(self: *Xoshiro256, buf: []u8) void {
9090}
9191
9292test "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 }
9497
9598 var r = Xoshiro256.init(0);
9699
lib/std/rand/test.zig+11
......@@ -1,4 +1,5 @@
11const std = @import("../std.zig");
2const builtin = @import("builtin");
23const math = std.math;
34const DefaultPrng = std.rand.DefaultPrng;
45const Random = std.rand.Random;
......@@ -157,6 +158,8 @@ fn testRandomEnumValue() !void {
157158}
158159
159160test "Random intLessThan" {
161 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
162
160163 @setEvalBranchQuota(10000);
161164 try testRandomIntLessThan();
162165 try comptime testRandomIntLessThan();
......@@ -199,6 +202,8 @@ fn testRandomIntLessThan() !void {
199202}
200203
201204test "Random intAtMost" {
205 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
206
202207 @setEvalBranchQuota(10000);
203208 try testRandomIntAtMost();
204209 try comptime testRandomIntAtMost();
......@@ -239,6 +244,8 @@ fn testRandomIntAtMost() !void {
239244}
240245
241246test "Random Biased" {
247 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
248
242249 var prng = DefaultPrng.init(0);
243250 const random = prng.random();
244251 // Not thoroughly checking the logic here.
......@@ -436,6 +443,8 @@ fn testRangeBias(r: Random, start: i8, end: i8, biased: bool) !void {
436443}
437444
438445test "CSPRNG" {
446 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
447
439448 var secret_seed: [DefaultCsprng.secret_seed_length]u8 = undefined;
440449 std.crypto.random.bytes(&secret_seed);
441450 var csprng = DefaultCsprng.init(secret_seed);
......@@ -447,6 +456,8 @@ test "CSPRNG" {
447456}
448457
449458test "Random weightedIndex" {
459 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
460
450461 // Make sure weightedIndex works for various integers and floats
451462 inline for (.{ u64, i4, f32, f64 }) |T| {
452463 var prng = DefaultPrng.init(0);
lib/std/segmented_list.zig+2
......@@ -409,6 +409,8 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type
409409}
410410
411411test "SegmentedList basic usage" {
412 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
413
412414 try testSegmentedList(0);
413415 try testSegmentedList(1);
414416 try testSegmentedList(2);
lib/std/simd.zig+9
......@@ -196,10 +196,13 @@ pub fn extract(
196196}
197197
198198test "vector patterns" {
199 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
200
199201 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
200202 // https://github.com/ziglang/zig/issues/12012
201203 return error.SkipZigTest;
202204 }
205
203206 const base = @Vector(4, u32){ 10, 20, 30, 40 };
204207 const other_base = @Vector(4, u32){ 55, 66, 77, 88 };
205208
......@@ -269,6 +272,8 @@ pub fn reverseOrder(vec: anytype) @TypeOf(vec) {
269272}
270273
271274test "vector shifting" {
275 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
276
272277 const base = @Vector(4, u32){ 10, 20, 30, 40 };
273278
274279 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)))
333338}
334339
335340test "vector searching" {
341 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
342
336343 const base = @Vector(8, u32){ 6, 4, 7, 4, 4, 2, 3, 7 };
337344
338345 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
424431}
425432
426433test "vector prefix scan" {
434 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
435
427436 if (comptime builtin.cpu.arch.isMIPS()) {
428437 return error.SkipZigTest;
429438 }
lib/std/sort.zig+11
......@@ -1,5 +1,6 @@
11const std = @import("std.zig");
22const assert = std.debug.assert;
3const builtin = @import("builtin");
34const testing = std.testing;
45const mem = std.mem;
56const math = std.math;
......@@ -176,6 +177,8 @@ const IdAndValue = struct {
176177};
177178
178179test "stable sort" {
180 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
181
179182 const expected = [_]IdAndValue{
180183 IdAndValue{ .id = 0, .value = 0 },
181184 IdAndValue{ .id = 1, .value = 0 },
......@@ -223,6 +226,8 @@ test "stable sort" {
223226}
224227
225228test "sort" {
229 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
230
226231 const u8cases = [_][]const []const u8{
227232 &[_][]const u8{
228233 "",
......@@ -301,6 +306,8 @@ test "sort" {
301306}
302307
303308test "sort descending" {
309 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
310
304311 const rev_cases = [_][]const []const i32{
305312 &[_][]const i32{
306313 &[_]i32{},
......@@ -340,6 +347,8 @@ test "sort descending" {
340347}
341348
342349test "sort with context in the middle of a slice" {
350 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
351
343352 const Context = struct {
344353 items: []i32,
345354
......@@ -379,6 +388,8 @@ test "sort with context in the middle of a slice" {
379388}
380389
381390test "sort fuzz testing" {
391 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
392
382393 var prng = std.rand.DefaultPrng.init(0x12345678);
383394 const random = prng.random();
384395 const test_case_count = 10;
lib/std/time.zig+4
......@@ -122,6 +122,8 @@ pub fn nanoTimestamp() i128 {
122122}
123123
124124test "timestamp" {
125 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
126
125127 const margin = ns_per_ms * 50;
126128
127129 const time_0 = milliTimestamp();
......@@ -319,6 +321,8 @@ pub const Timer = struct {
319321};
320322
321323test "Timer + Instant" {
324 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
325
322326 const margin = ns_per_ms * 150;
323327
324328 var timer = try Timer.start();
lib/std/treap.zig+2
......@@ -350,6 +350,8 @@ const TestTreap = Treap(u64, std.math.order);
350350const TestNode = TestTreap.Node;
351351
352352test "std.Treap: insert, find, replace, remove" {
353 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
354
353355 var treap = TestTreap{};
354356 var nodes: [10]TestNode = undefined;
355357
lib/std/unicode.zig+41
......@@ -1,5 +1,6 @@
11const std = @import("./std.zig");
22const assert = std.debug.assert;
3const builtin = @import("builtin");
34const testing = std.testing;
45const mem = std.mem;
56
......@@ -496,11 +497,15 @@ fn testUtf16CountCodepoints() !void {
496497}
497498
498499test "utf16 count codepoints" {
500 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
501
499502 try testUtf16CountCodepoints();
500503 try comptime testUtf16CountCodepoints();
501504}
502505
503506test "utf8 encode" {
507 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
508
504509 try comptime testUtf8Encode();
505510 try testUtf8Encode();
506511}
......@@ -527,6 +532,8 @@ fn testUtf8Encode() !void {
527532}
528533
529534test "utf8 encode error" {
535 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
536
530537 try comptime testUtf8EncodeError();
531538 try testUtf8EncodeError();
532539}
......@@ -543,6 +550,8 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void {
543550}
544551
545552test "utf8 iterator on ascii" {
553 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
554
546555 try comptime testUtf8IteratorOnAscii();
547556 try testUtf8IteratorOnAscii();
548557}
......@@ -563,6 +572,8 @@ fn testUtf8IteratorOnAscii() !void {
563572}
564573
565574test "utf8 view bad" {
575 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
576
566577 try comptime testUtf8ViewBad();
567578 try testUtf8ViewBad();
568579}
......@@ -573,6 +584,8 @@ fn testUtf8ViewBad() !void {
573584}
574585
575586test "utf8 view ok" {
587 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
588
576589 try comptime testUtf8ViewOk();
577590 try testUtf8ViewOk();
578591}
......@@ -593,6 +606,8 @@ fn testUtf8ViewOk() !void {
593606}
594607
595608test "validate slice" {
609 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
610
596611 try comptime testValidateSlice();
597612 try testValidateSlice();
598613
......@@ -633,6 +648,8 @@ fn testValidateSlice() !void {
633648}
634649
635650test "valid utf8" {
651 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
652
636653 try comptime testValidUtf8();
637654 try testValidUtf8();
638655}
......@@ -652,6 +669,8 @@ fn testValidUtf8() !void {
652669}
653670
654671test "invalid utf8 continuation bytes" {
672 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
673
655674 try comptime testInvalidUtf8ContinuationBytes();
656675 try testInvalidUtf8ContinuationBytes();
657676}
......@@ -684,6 +703,8 @@ fn testInvalidUtf8ContinuationBytes() !void {
684703}
685704
686705test "overlong utf8 codepoint" {
706 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
707
687708 try comptime testOverlongUtf8Codepoint();
688709 try testOverlongUtf8Codepoint();
689710}
......@@ -697,6 +718,8 @@ fn testOverlongUtf8Codepoint() !void {
697718}
698719
699720test "misc invalid utf8" {
721 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
722
700723 try comptime testMiscInvalidUtf8();
701724 try testMiscInvalidUtf8();
702725}
......@@ -712,6 +735,8 @@ fn testMiscInvalidUtf8() !void {
712735}
713736
714737test "utf8 iterator peeking" {
738 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
739
715740 try comptime testUtf8Peeking();
716741 try testUtf8Peeking();
717742}
......@@ -796,6 +821,8 @@ pub fn utf16leToUtf8(utf8: []u8, utf16le: []const u16) !usize {
796821}
797822
798823test "utf16leToUtf8" {
824 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
825
799826 var utf16le: [2]u16 = undefined;
800827 const utf16le_as_bytes = mem.sliceAsBytes(utf16le[0..]);
801828
......@@ -908,6 +935,8 @@ pub fn utf8ToUtf16Le(utf16le: []u16, utf8: []const u8) !usize {
908935}
909936
910937test "utf8ToUtf16Le" {
938 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
939
911940 var utf16le: [2]u16 = [_]u16{0} ** 2;
912941 {
913942 const length = try utf8ToUtf16Le(utf16le[0..], "𐐷");
......@@ -926,6 +955,8 @@ test "utf8ToUtf16Le" {
926955}
927956
928957test "utf8ToUtf16LeWithNull" {
958 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
959
929960 {
930961 const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "𐐷");
931962 defer testing.allocator.free(utf16);
......@@ -984,6 +1015,8 @@ fn testCalcUtf16LeLen() !void {
9841015}
9851016
9861017test "calculate utf16 string length of given utf8 string in u16" {
1018 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1019
9871020 try testCalcUtf16LeLen();
9881021 try comptime testCalcUtf16LeLen();
9891022}
......@@ -1017,6 +1050,8 @@ pub fn fmtUtf16le(utf16le: []const u16) std.fmt.Formatter(formatUtf16le) {
10171050}
10181051
10191052test "fmtUtf16le" {
1053 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1054
10201055 const expectFmt = std.testing.expectFmt;
10211056 try expectFmt("", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral(""))});
10221057 try expectFmt("foo", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral("foo"))});
......@@ -1030,6 +1065,8 @@ test "fmtUtf16le" {
10301065}
10311066
10321067test "utf8ToUtf16LeStringLiteral" {
1068 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1069
10331070 {
10341071 const bytes = [_:0]u16{
10351072 mem.nativeToLittle(u16, 0x41),
......@@ -1090,6 +1127,8 @@ fn testUtf8CountCodepoints() !void {
10901127}
10911128
10921129test "utf8 count codepoints" {
1130 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1131
10931132 try testUtf8CountCodepoints();
10941133 try comptime testUtf8CountCodepoints();
10951134}
......@@ -1106,6 +1145,8 @@ fn testUtf8ValidCodepoint() !void {
11061145}
11071146
11081147test "utf8 valid codepoint" {
1148 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1149
11091150 try testUtf8ValidCodepoint();
11101151 try comptime testUtf8ValidCodepoint();
11111152}
lib/std/zig/CrossTarget.zig+2
......@@ -785,6 +785,8 @@ fn parseOs(result: *CrossTarget, diags: *ParseOptions.Diagnostics, text: []const
785785}
786786
787787test "CrossTarget.parse" {
788 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
789
788790 if (builtin.target.isGnuLibC()) {
789791 var cross_target = try CrossTarget.parse(.{});
790792 cross_target.setGnuLibCVersion(2, 1, 1);
lib/std/zig/Parse.zig+2
......@@ -4102,5 +4102,7 @@ const TokenIndex = Ast.TokenIndex;
41024102const Token = std.zig.Token;
41034103
41044104test {
4105 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4106
41054107 _ = @import("parser_test.zig");
41064108}
lib/std/zig/fmt.zig+3
......@@ -1,4 +1,5 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const mem = std.mem;
34
45/// Print the string as a Zig identifier escaping it with @"" syntax if needed.
......@@ -95,6 +96,8 @@ pub fn fmtEscapes(bytes: []const u8) std.fmt.Formatter(stringEscape) {
9596}
9697
9798test "escape invalid identifiers" {
99 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
100
98101 const expectFmt = std.testing.expectFmt;
99102 try expectFmt("@\"while\"", "{}", .{fmtId("while")});
100103 try expectFmt("hello", "{}", .{fmtId("hello")});
lib/std/zig/tokenizer.zig+11
......@@ -1,4 +1,5 @@
11const std = @import("../std.zig");
2const builtin = @import("builtin");
23
34pub const Token = struct {
45 tag: Tag,
......@@ -1449,6 +1450,8 @@ test "chars" {
14491450}
14501451
14511452test "invalid token characters" {
1453 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1454
14521455 try testTokenize("#", &.{.invalid});
14531456 try testTokenize("`", &.{.invalid});
14541457 try testTokenize("'c", &.{.invalid});
......@@ -1478,6 +1481,8 @@ test "utf8" {
14781481}
14791482
14801483test "invalid utf8" {
1484 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1485
14811486 try testTokenize("//\x80", &.{
14821487 .invalid,
14831488 });
......@@ -1568,6 +1573,8 @@ test "pipe and then invalid" {
15681573}
15691574
15701575test "line comment and doc comment" {
1576 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1577
15711578 try testTokenize("//", &.{});
15721579 try testTokenize("// a / b", &.{});
15731580 try testTokenize("// /", &.{});
......@@ -1642,6 +1649,8 @@ test "range literals" {
16421649}
16431650
16441651test "number literals decimal" {
1652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1653
16451654 try testTokenize("0", &.{.number_literal});
16461655 try testTokenize("1", &.{.number_literal});
16471656 try testTokenize("2", &.{.number_literal});
......@@ -1890,6 +1899,8 @@ test "invalid token with unfinished escape right before eof" {
18901899}
18911900
18921901test "saturating operators" {
1902 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1903
18931904 try testTokenize("<<", &.{.angle_bracket_angle_bracket_left});
18941905 try testTokenize("<<|", &.{.angle_bracket_angle_bracket_left_pipe});
18951906 try testTokenize("<<|=", &.{.angle_bracket_angle_bracket_left_pipe_equal});
src/arch/x86_64/CodeGen.zig+158-97
......@@ -2895,13 +2895,16 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void {
28952895 }.signedness;
28962896
28972897 const src_mcv = try self.resolveInst(ty_op.operand);
2898 const src_storage_bits = switch (src_mcv) {
2898 const src_storage_bits: u16 = switch (src_mcv) {
28992899 .register, .register_offset => 64,
2900 .load_frame => |frame_addr| self.getFrameAddrSize(frame_addr) * 8,
2900 .register_pair => 128,
2901 .load_frame => |frame_addr| @intCast(self.getFrameAddrSize(frame_addr) * 8),
29012902 else => src_int_info.bits,
29022903 };
29032904
29042905 const dst_mcv = if (dst_int_info.bits <= src_storage_bits and
2906 std.math.divCeil(u16, dst_int_info.bits, 64) catch unreachable ==
2907 std.math.divCeil(u32, src_storage_bits, 64) catch unreachable and
29052908 self.reuseOperand(inst, ty_op.operand, 0, src_mcv)) src_mcv else dst: {
29062909 const dst_mcv = try self.allocRegOrMem(inst, true);
29072910 try self.genCopy(min_ty, dst_mcv, src_mcv);
......@@ -2976,8 +2979,21 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {
29762979
29772980 const dst_mcv = if (src_mcv.isRegister() and self.reuseOperand(inst, ty_op.operand, 0, src_mcv))
29782981 src_mcv
2979 else
2980 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) });
29812997
29822998 if (dst_ty.zigTypeTag(mod) == .Vector) {
29832999 assert(src_ty.zigTypeTag(mod) == .Vector and dst_ty.vectorLen(mod) == src_ty.vectorLen(mod));
......@@ -3048,14 +3064,15 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {
30483064 break :result dst_mcv;
30493065 }
30503066
3051 if (dst_abi_size > 8) {
3052 return self.fail("TODO implement trunc for abi sizes larger than 8", .{});
3053 }
3054
30553067 // when truncating a `u16` to `u5`, for example, those top 3 bits in the result
30563068 // have to be removed. this only happens if the dst if not a power-of-two size.
3057 if (self.regExtraBits(dst_ty) > 0)
3058 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 }
30593076
30603077 break :result dst_mcv;
30613078 };
......@@ -3378,7 +3395,7 @@ fn airMulSat(self: *Self, inst: Air.Inst.Index) !void {
33783395 const cc: Condition = if (ty.isSignedInt(mod)) cc: {
33793396 try self.genSetReg(limit_reg, ty, lhs_mcv);
33803397 try self.genBinOpMir(.{ ._, .xor }, ty, limit_mcv, rhs_mcv);
3381 try self.genShiftBinOpMir(.{ ._, .sa }, ty, limit_mcv, .{ .immediate = reg_bits - 1 });
3398 try self.genShiftBinOpMir(.{ ._r, .sa }, ty, limit_mcv, .{ .immediate = reg_bits - 1 });
33823399 try self.genBinOpMir(.{ ._, .xor }, ty, limit_mcv, .{
33833400 .immediate = (@as(u64, 1) << @intCast(reg_bits - 1)) - 1,
33843401 });
......@@ -3646,7 +3663,10 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
36463663 },
36473664 else => {
36483665 // For now, this is the only supported multiply that doesn't fit in a register.
3649 assert(dst_info.bits <= 128 and src_bits == 64);
3666 if (dst_info.bits > 128 or src_bits != 64)
3667 return self.fail("TODO implement airWithOverflow from {} to {}", .{
3668 src_ty.fmt(mod), dst_ty.fmt(mod),
3669 });
36503670
36513671 const frame_index =
36523672 try self.allocFrameIndex(FrameAlloc.initType(tuple_ty, mod));
......@@ -3798,11 +3818,13 @@ fn airShlSat(self: *Self, inst: Air.Inst.Index) !void {
37983818}
37993819
38003820fn airOptionalPayload(self: *Self, inst: Air.Inst.Index) !void {
3821 const mod = self.bin_file.options.module.?;
38013822 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
38023823 const result: MCValue = result: {
38033824 const pl_ty = self.typeOfIndex(inst);
3804 const opt_mcv = try self.resolveInst(ty_op.operand);
3825 if (!pl_ty.hasRuntimeBitsIgnoreComptime(mod)) break :result .none;
38053826
3827 const opt_mcv = try self.resolveInst(ty_op.operand);
38063828 if (self.reuseOperand(inst, ty_op.operand, 0, opt_mcv)) {
38073829 switch (opt_mcv) {
38083830 .register => |reg| try self.truncateRegister(pl_ty, reg),
......@@ -4422,42 +4444,46 @@ fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void {
44224444 // this is identical to the `airPtrElemPtr` codegen expect here an
44234445 // additional `mov` is needed at the end to get the actual value
44244446
4425 const elem_ty = ptr_ty.elemType2(mod);
4426 const elem_abi_size: u32 = @intCast(elem_ty.abiSize(mod));
4427 const index_ty = self.typeOf(bin_op.rhs);
4428 const index_mcv = try self.resolveInst(bin_op.rhs);
4429 const index_lock = switch (index_mcv) {
4430 .register => |reg| self.register_manager.lockRegAssumeUnused(reg),
4431 else => null,
4432 };
4433 defer if (index_lock) |lock| self.register_manager.unlockReg(lock);
4447 const result = result: {
4448 const elem_ty = ptr_ty.elemType2(mod);
4449 if (!elem_ty.hasRuntimeBitsIgnoreComptime(mod)) break :result .none;
44344450
4435 const offset_reg = try self.elemOffset(index_ty, index_mcv, elem_abi_size);
4436 const offset_lock = self.register_manager.lockRegAssumeUnused(offset_reg);
4437 defer self.register_manager.unlockReg(offset_lock);
4451 const elem_abi_size: u32 = @intCast(elem_ty.abiSize(mod));
4452 const index_ty = self.typeOf(bin_op.rhs);
4453 const index_mcv = try self.resolveInst(bin_op.rhs);
4454 const index_lock = switch (index_mcv) {
4455 .register => |reg| self.register_manager.lockRegAssumeUnused(reg),
4456 else => null,
4457 };
4458 defer if (index_lock) |lock| self.register_manager.unlockReg(lock);
44384459
4439 const ptr_mcv = try self.resolveInst(bin_op.lhs);
4440 const elem_ptr_reg = if (ptr_mcv.isRegister() and self.liveness.operandDies(inst, 0))
4441 ptr_mcv.register
4442 else
4443 try self.copyToTmpRegister(ptr_ty, ptr_mcv);
4444 const elem_ptr_lock = self.register_manager.lockRegAssumeUnused(elem_ptr_reg);
4445 defer self.register_manager.unlockReg(elem_ptr_lock);
4446 try self.asmRegisterRegister(
4447 .{ ._, .add },
4448 elem_ptr_reg,
4449 offset_reg,
4450 );
4460 const offset_reg = try self.elemOffset(index_ty, index_mcv, elem_abi_size);
4461 const offset_lock = self.register_manager.lockRegAssumeUnused(offset_reg);
4462 defer self.register_manager.unlockReg(offset_lock);
44514463
4452 const dst_mcv = try self.allocRegOrMem(inst, true);
4453 const dst_lock = switch (dst_mcv) {
4454 .register => |reg| self.register_manager.lockRegAssumeUnused(reg),
4455 else => null,
4456 };
4457 defer if (dst_lock) |lock| self.register_manager.unlockReg(lock);
4458 try self.load(dst_mcv, ptr_ty, .{ .register = elem_ptr_reg });
4464 const ptr_mcv = try self.resolveInst(bin_op.lhs);
4465 const elem_ptr_reg = if (ptr_mcv.isRegister() and self.liveness.operandDies(inst, 0))
4466 ptr_mcv.register
4467 else
4468 try self.copyToTmpRegister(ptr_ty, ptr_mcv);
4469 const elem_ptr_lock = self.register_manager.lockRegAssumeUnused(elem_ptr_reg);
4470 defer self.register_manager.unlockReg(elem_ptr_lock);
4471 try self.asmRegisterRegister(
4472 .{ ._, .add },
4473 elem_ptr_reg,
4474 offset_reg,
4475 );
44594476
4460 return self.finishAir(inst, dst_mcv, .{ bin_op.lhs, bin_op.rhs, .none });
4477 const dst_mcv = try self.allocRegOrMem(inst, true);
4478 const dst_lock = switch (dst_mcv) {
4479 .register => |reg| self.register_manager.lockRegAssumeUnused(reg),
4480 else => null,
4481 };
4482 defer if (dst_lock) |lock| self.register_manager.unlockReg(lock);
4483 try self.load(dst_mcv, ptr_ty, .{ .register = elem_ptr_reg });
4484 break :result dst_mcv;
4485 };
4486 return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none });
44614487}
44624488
44634489fn airPtrElemPtr(self: *Self, inst: Air.Inst.Index) !void {
......@@ -4937,7 +4963,7 @@ fn byteSwap(self: *Self, inst: Air.Inst.Index, src_ty: Type, src_mcv: MCValue, m
49374963 const mod = self.bin_file.options.module.?;
49384964 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
49394965
4940 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(
49414967 "TODO implement byteSwap for {}",
49424968 .{src_ty.fmt(mod)},
49434969 );
......@@ -5788,15 +5814,17 @@ fn packedLoad(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) Inn
57885814 const ptr_info = ptr_ty.ptrInfo(mod);
57895815
57905816 const val_ty = ptr_info.child.toType();
5817 if (!val_ty.hasRuntimeBitsIgnoreComptime(mod)) return;
57915818 const val_abi_size: u32 = @intCast(val_ty.abiSize(mod));
5819
5820 if (val_abi_size > 8) return self.fail("TODO implement packed load of {}", .{val_ty.fmt(mod)});
5821
57925822 const limb_abi_size: u32 = @min(val_abi_size, 8);
57935823 const limb_abi_bits = limb_abi_size * 8;
57945824 const val_byte_off: i32 = @intCast(ptr_info.packed_offset.bit_offset / limb_abi_bits * limb_abi_size);
57955825 const val_bit_off = ptr_info.packed_offset.bit_offset % limb_abi_bits;
57965826 const val_extra_bits = self.regExtraBits(val_ty);
57975827
5798 if (val_abi_size > 8) return self.fail("TODO implement packed load of {}", .{val_ty.fmt(mod)});
5799
58005828 const ptr_reg = try self.copyToTmpRegister(ptr_ty, ptr_mcv);
58015829 const ptr_lock = self.register_manager.lockRegAssumeUnused(ptr_reg);
58025830 defer self.register_manager.unlockReg(ptr_lock);
......@@ -5859,6 +5887,7 @@ fn packedLoad(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) Inn
58595887fn load(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerError!void {
58605888 const mod = self.bin_file.options.module.?;
58615889 const dst_ty = ptr_ty.childType(mod);
5890 if (!dst_ty.hasRuntimeBitsIgnoreComptime(mod)) return;
58625891 switch (ptr_mcv) {
58635892 .none,
58645893 .unreach,
......@@ -5935,6 +5964,7 @@ fn packedStore(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) In
59355964 const mod = self.bin_file.options.module.?;
59365965 const ptr_info = ptr_ty.ptrInfo(mod);
59375966 const src_ty = ptr_ty.childType(mod);
5967 if (!src_ty.hasRuntimeBitsIgnoreComptime(mod)) return;
59385968
59395969 const limb_abi_size: u16 = @min(ptr_info.packed_offset.host_size, 8);
59405970 const limb_abi_bits = limb_abi_size * 8;
......@@ -6006,6 +6036,7 @@ fn packedStore(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) In
60066036fn store(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerError!void {
60076037 const mod = self.bin_file.options.module.?;
60086038 const src_ty = ptr_ty.childType(mod);
6039 if (!src_ty.hasRuntimeBitsIgnoreComptime(mod)) return;
60096040 switch (ptr_mcv) {
60106041 .none,
60116042 .unreach,
......@@ -10476,39 +10507,44 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
1047610507 },
1047710508 else => return self.fail("invalid constraint: '{s}'", .{constraint}),
1047810509 };
10479 const arg_maybe_reg: ?Register = if (mem.eql(u8, constraint[1..], "r"))
10480 self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse
10481 return self.fail("ran out of registers lowering inline asm", .{})
10482 else if (mem.eql(u8, constraint[1..], "m"))
10483 if (output != .none) null else return self.fail(
10484 "memory constraint unsupported for asm result: '{s}'",
10485 .{constraint},
10486 )
10487 else if (mem.eql(u8, constraint[1..], "g") or
10488 mem.eql(u8, constraint[1..], "rm") or mem.eql(u8, constraint[1..], "mr") or
10489 mem.eql(u8, constraint[1..], "r,m") or mem.eql(u8, constraint[1..], "m,r"))
10490 self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse
10491 if (output != .none)
10492 null
10493 else
10494 return self.fail("ran out of registers lowering inline asm", .{})
10495 else if (mem.startsWith(u8, constraint[1..], "{") and mem.endsWith(u8, constraint[1..], "}"))
10496 parseRegName(constraint[1 + "{".len .. constraint.len - "}".len]) orelse
10497 return self.fail("invalid register constraint: '{s}'", .{constraint})
10498 else
10499 return self.fail("invalid constraint: '{s}'", .{constraint});
10500 const arg_mcv: MCValue = if (arg_maybe_reg) |reg| .{ .register = reg } else arg: {
10501 const ptr_mcv = try self.resolveInst(output);
10502 switch (ptr_mcv) {
10503 .immediate => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |_|
10504 break :arg ptr_mcv.deref(),
10505 .register, .register_offset, .lea_frame => break :arg ptr_mcv.deref(),
10506 else => {},
10507 }
10508 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 };
1050910545 };
1051010546 if (arg_mcv.getReg()) |reg| if (RegisterManager.indexOfRegIntoTracked(reg)) |_| {
10511 _ = self.register_manager.lockRegAssumeUnused(reg);
10547 _ = self.register_manager.lockReg(reg);
1051210548 };
1051310549 if (!mem.eql(u8, name, "_"))
1051410550 arg_map.putAssumeCapacityNoClobber(name, @intCast(args.items.len));
......@@ -10570,6 +10606,10 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
1057010606 try self.register_manager.getReg(reg, null);
1057110607 try self.genSetReg(reg, ty, input_mcv);
1057210608 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];
1057310613 } else return self.fail("invalid constraint: '{s}'", .{constraint});
1057410614 if (arg_mcv.getReg()) |reg| if (RegisterManager.indexOfRegIntoTracked(reg)) |_| {
1057510615 _ = self.register_manager.lockReg(reg);
......@@ -10695,7 +10735,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
1069510735 mnem_name[mnem_prefix.len .. mnem_name.len - mnem_suffix.len],
1069610736 ) orelse continue };
1069710737 } else {
10698 assert(prefix != .none);
10738 assert(prefix != .none); // no combination of fixes produced a known mnemonic
1069910739 return self.fail("invalid prefix for mnemonic: '{s} {s}'", .{
1070010740 @tagName(prefix), mnem_str,
1070110741 });
......@@ -10926,6 +10966,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
1092610966
1092710967 if (output == .none) continue;
1092810968 if (arg_mcv != .register) continue;
10969 if (constraint.len == 2 and std.ascii.isDigit(constraint[1])) continue;
1092910970 try self.store(self.typeOf(output), .{ .air_ref = output }, arg_mcv);
1093010971 }
1093110972
......@@ -11019,6 +11060,7 @@ fn moveStrategy(self: *Self, ty: Type, aligned: bool) !MoveStrategy {
1101911060 else => {},
1102011061 },
1102111062 .Vector => switch (ty.childType(mod).zigTypeTag(mod)) {
11063 .Bool => return .{ .move = .{ ._, .mov } },
1102211064 .Int => switch (ty.childType(mod).intInfo(mod).bits) {
1102311065 8 => switch (ty.vectorLen(mod)) {
1102411066 1 => if (self.hasFeature(.avx)) return .{ .vex_insert_extract = .{
......@@ -11284,7 +11326,6 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr
1128411326 .none,
1128511327 .unreach,
1128611328 .dead,
11287 .register_pair,
1128811329 .register_overflow,
1128911330 .reserved_frame,
1129011331 => unreachable,
......@@ -11388,6 +11429,7 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr
1138811429 },
1138911430 .x87, .mmx => unreachable,
1139011431 },
11432 .register_pair => |src_regs| try self.genSetReg(dst_reg, ty, .{ .register = src_regs[0] }),
1139111433 .register_offset,
1139211434 .indirect,
1139311435 .load_frame,
......@@ -11521,10 +11563,13 @@ fn genSetMem(self: *Self, base: Memory.Base, disp: i32, ty: Type, src_mcv: MCVal
1152111563 .undef => {},
1152211564 .immediate => |imm| switch (abi_size) {
1152311565 1, 2, 4 => {
11524 const immediate = if (ty.isSignedInt(mod))
11525 Immediate.s(@truncate(@as(i64, @bitCast(imm))))
11566 const immediate = switch (if (ty.isAbiInt(mod))
11567 ty.intInfo(mod).signedness
1152611568 else
11527 Immediate.u(@as(u32, @intCast(imm)));
11569 .unsigned) {
11570 .signed => Immediate.s(@truncate(@as(i64, @bitCast(imm)))),
11571 .unsigned => Immediate.u(@as(u32, @intCast(imm))),
11572 };
1152811573 try self.asmMemoryImmediate(
1152911574 .{ ._, .mov },
1153011575 Memory.sib(Memory.PtrSize.fromSize(abi_size), .{ .base = base, .disp = disp }),
......@@ -11586,19 +11631,35 @@ fn genSetMem(self: *Self, base: Memory.Base, disp: i32, ty: Type, src_mcv: MCVal
1158611631 .{ .base = base, .disp = disp + @as(i32, @intCast(src_reg_i * 8)) },
1158711632 ), registerAlias(src_reg, part_size));
1158811633 },
11589 .register_overflow => |ro| {
11590 try self.genSetMem(
11591 base,
11592 disp + @as(i32, @intCast(ty.structFieldOffset(0, mod))),
11593 ty.structFieldType(0, mod),
11594 .{ .register = ro.reg },
11595 );
11596 try self.genSetMem(
11597 base,
11598 disp + @as(i32, @intCast(ty.structFieldOffset(1, mod))),
11599 ty.structFieldType(1, mod),
11600 .{ .eflags = ro.eflags },
11601 );
11634 .register_overflow => |ro| switch (ty.zigTypeTag(mod)) {
11635 .Struct => {
11636 try self.genSetMem(
11637 base,
11638 disp + @as(i32, @intCast(ty.structFieldOffset(0, mod))),
11639 ty.structFieldType(0, mod),
11640 .{ .register = ro.reg },
11641 );
11642 try self.genSetMem(
11643 base,
11644 disp + @as(i32, @intCast(ty.structFieldOffset(1, mod))),
11645 ty.structFieldType(1, mod),
11646 .{ .eflags = ro.eflags },
11647 );
11648 },
11649 .Optional => {
11650 assert(!ty.optionalReprIsPayload(mod));
11651 const child_ty = ty.optionalChild(mod);
11652 try self.genSetMem(base, disp, child_ty, .{ .register = ro.reg });
11653 try self.genSetMem(
11654 base,
11655 disp + @as(i32, @intCast(child_ty.abiSize(mod))),
11656 Type.bool,
11657 .{ .eflags = ro.eflags },
11658 );
11659 },
11660 else => return self.fail("TODO implement genSetMem for {s} of {}", .{
11661 @tagName(src_mcv), ty.fmt(mod),
11662 }),
1160211663 },
1160311664 .register_offset,
1160411665 .memory,
src/arch/x86_64/Encoding.zig+3-3
......@@ -232,7 +232,7 @@ pub const Mnemonic = enum {
232232 cmp,
233233 cmps, cmpsb, cmpsd, cmpsq, cmpsw,
234234 cmpxchg, cmpxchg8b, cmpxchg16b,
235 cqo, cwd, cwde,
235 cpuid, cqo, cwd, cwde,
236236 div,
237237 idiv, imul, int3,
238238 ja, jae, jb, jbe, jc, jrcxz, je, jg, jge, jl, jle, jna, jnae, jnb, jnbe,
......@@ -246,7 +246,7 @@ pub const Mnemonic = enum {
246246 movsx, movsxd, movzx, mul,
247247 neg, nop, not,
248248 @"or",
249 pop, popcnt, push,
249 pause, pop, popcnt, push,
250250 rcl, rcr, ret, rol, ror,
251251 sal, sar, sbb,
252252 scas, scasb, scasd, scasq, scasw,
......@@ -258,7 +258,7 @@ pub const Mnemonic = enum {
258258 stos, stosb, stosd, stosq, stosw,
259259 @"test", tzcnt,
260260 ud2,
261 xadd, xchg, xor,
261 xadd, xchg, xgetbv, xor,
262262 // X87
263263 fabs, fchs, ffree, fisttp, fld, fst, fstp,
264264 // MMX
src/arch/x86_64/Mir.zig+6
......@@ -327,6 +327,8 @@ pub const Inst = struct {
327327 /// Compare and exchange
328328 /// Compare and exchange bytes
329329 cmpxchg,
330 /// CPU identification
331 cpuid,
330332 /// Convert doubleword to quadword
331333 cqo,
332334 /// Convert word to doubleword
......@@ -386,6 +388,8 @@ pub const Inst = struct {
386388 /// Bitwise logical or of packed single-precision floating-point values
387389 /// Bitwise logical or of packed double-precision floating-point values
388390 @"or",
391 /// Spin loop hint
392 pause,
389393 /// Pop
390394 pop,
391395 /// Return the count of number of bits set to 1
......@@ -437,6 +441,8 @@ pub const Inst = struct {
437441 xadd,
438442 /// Exchange register/memory with register
439443 xchg,
444 /// Get value of extended control register
445 xgetbv,
440446 /// Logical exclusive-or
441447 /// Bitwise logical xor of packed single-precision floating-point values
442448 /// 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{
266266 .{ .cmpxchg8b, .m, &.{ .m64 }, &.{ 0x0f, 0xc7 }, 1, .none, .none },
267267 .{ .cmpxchg16b, .m, &.{ .m128 }, &.{ 0x0f, 0xc7 }, 1, .long, .none },
268268
269 .{ .cpuid, .np, &.{}, &.{ 0x0f, 0xa2 }, 0, .none, .none },
270
269271 .{ .div, .m, &.{ .rm8 }, &.{ 0xf6 }, 6, .none, .none },
270272 .{ .div, .m, &.{ .rm8 }, &.{ 0xf6 }, 6, .rex, .none },
271273 .{ .div, .m, &.{ .rm16 }, &.{ 0xf7 }, 6, .short, .none },
......@@ -469,6 +471,8 @@ pub const table = [_]Entry{
469471 .{ .@"or", .rm, &.{ .r32, .rm32 }, &.{ 0x0b }, 0, .none, .none },
470472 .{ .@"or", .rm, &.{ .r64, .rm64 }, &.{ 0x0b }, 0, .long, .none },
471473
474 .{ .pause, .np, &.{}, &.{ 0xf3, 0x90 }, 0, .none, .none },
475
472476 .{ .pop, .o, &.{ .r16 }, &.{ 0x58 }, 0, .short, .none },
473477 .{ .pop, .o, &.{ .r64 }, &.{ 0x58 }, 0, .none, .none },
474478 .{ .pop, .m, &.{ .rm16 }, &.{ 0x8f }, 0, .short, .none },
......@@ -805,6 +809,8 @@ pub const table = [_]Entry{
805809 .{ .xchg, .rm, &.{ .r32, .rm32 }, &.{ 0x87 }, 0, .none, .none },
806810 .{ .xchg, .rm, &.{ .r64, .rm64 }, &.{ 0x87 }, 0, .long, .none },
807811
812 .{ .xgetbv, .np, &.{}, &.{ 0x0f, 0x01 }, 0, .none, .none },
813
808814 .{ .xor, .zi, &.{ .al, .imm8 }, &.{ 0x34 }, 0, .none, .none },
809815 .{ .xor, .zi, &.{ .ax, .imm16 }, &.{ 0x35 }, 0, .short, .none },
810816 .{ .xor, .zi, &.{ .eax, .imm32 }, &.{ 0x35 }, 0, .none, .none },
src/codegen.zig+2-2
......@@ -545,7 +545,7 @@ pub fn generateSymbol(
545545
546546 if (layout.payload_size == 0) {
547547 return generateSymbol(bin_file, src_loc, .{
548 .ty = typed_value.ty.unionTagType(mod).?,
548 .ty = typed_value.ty.unionTagTypeSafety(mod).?,
549549 .val = un.tag.toValue(),
550550 }, code, debug_output, reloc_info);
551551 }
......@@ -553,7 +553,7 @@ pub fn generateSymbol(
553553 // Check if we should store the tag first.
554554 if (layout.tag_size > 0 and layout.tag_align.compare(.gte, layout.payload_align)) {
555555 switch (try generateSymbol(bin_file, src_loc, .{
556 .ty = typed_value.ty.unionTagType(mod).?,
556 .ty = typed_value.ty.unionTagTypeSafety(mod).?,
557557 .val = un.tag.toValue(),
558558 }, code, debug_output, reloc_info)) {
559559 .ok => {},
test/behavior/basic.zig+1-1
......@@ -745,12 +745,12 @@ test "auto created variables have correct alignment" {
745745
746746test "extern variable with non-pointer opaque type" {
747747 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
748 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
749748 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
750749 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
751750 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
752751 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
753752 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
753 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
754754
755755 @export(var_to_export, .{ .name = "opaque_extern_var" });
756756 try expect(@as(*align(1) u32, @ptrCast(&opaque_extern_var)).* == 42);
test/behavior/bitcast.zig+2-1
......@@ -411,8 +411,9 @@ test "bitcast nan float does not modify signaling bit" {
411411 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
412412 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
413413 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
414 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
415414 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
416417 // TODO: https://github.com/ziglang/zig/issues/14366
417418 if (builtin.zig_backend == .stage2_llvm and comptime builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
418419
test/behavior/bugs/6781.zig+1-1
......@@ -64,11 +64,11 @@ pub const JournalHeader = packed struct {
6464test "fixed" {
6565 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
6666 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
67 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
6867 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
6968 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
7069 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
7170 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
71 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
7272
7373 var buffer align(@alignOf(JournalHeader)) = [_]u8{0} ** 65536;
7474 var entry = std.mem.bytesAsValue(JournalHeader, buffer[0..@sizeOf(JournalHeader)]);
test/behavior/bugs/920.zig+1-1
......@@ -57,11 +57,11 @@ const NormalDist = blk: {
5757};
5858
5959test "bug 920 fixed" {
60 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
6160 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
6261 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
6362 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
6463 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;
6565
6666 const NormalDist1 = blk: {
6767 break :blk ZigTableGen(true, norm_r, norm_v, norm_f, norm_f_inv, norm_zero_case);
test/behavior/cast.zig+3-4
......@@ -1606,8 +1606,8 @@ test "peer type resolution: const sentinel slice and mutable non-sentinel slice"
16061606test "peer type resolution: float and comptime-known fixed-width integer" {
16071607 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
16081608 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1609 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
16101609 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;
16111611
16121612 const i: u8 = 100;
16131613 var f: f32 = 1.234;
......@@ -2372,7 +2372,7 @@ test "@intFromBool on vector" {
23722372}
23732373
23742374test "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;
23762376
23772377 const from: i32 = undefined;
23782378 var to: f32 = from;
......@@ -2383,7 +2383,6 @@ test "numeric coercions with undefined" {
23832383
23842384test "15-bit int to float" {
23852385 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
2386 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
23872386
23882387 var a: u15 = 42;
23892388 var b: f32 = @floatFromInt(a);
......@@ -2391,11 +2390,11 @@ test "15-bit int to float" {
23912390}
23922391
23932392test "@as does not corrupt values with incompatible representations" {
2394 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
23952393 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
23962394 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
23972395 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
23982396 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;
23992398
24002399 const x: f32 = @as(f16, blk: {
24012400 if (false) {
test/behavior/cast_int.zig-1
......@@ -199,7 +199,6 @@ test "load non byte-sized value in union" {
199199 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
200200 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;
201201 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
202 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
203202 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
204203
205204 // note: this bug is triggered by the == operator, expectEqual will hide it
test/behavior/fn.zig+1-1
......@@ -425,8 +425,8 @@ test "implicit cast function to function ptr" {
425425 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
426426 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
427427 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
428 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
429428 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
429 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
430430
431431 const S1 = struct {
432432 export fn someFunctionThatReturnsAValue() c_int {
test/behavior/int128.zig-1
......@@ -66,7 +66,6 @@ test "int128" {
6666
6767test "truncate int128" {
6868 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
69 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
7069 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
7170 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
7271 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" {
659659test "nested packed struct field access test" {
660660 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
661661 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
663662 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
664663 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
665664 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
666665 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
668668 const Vec2 = packed struct {
669669 x: f32,
670670 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" {
151151
152152test "Macro that uses division operator. Issue #13162" {
153153 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
154 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
155154 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
156155 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
157156 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
158157 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;
159159
160160 try expectEqual(@as(c_int, 42), h.DIVIDE_CONSTANT(@as(c_int, 42_000)));
161161 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" {
370370test "tuple of struct concatenation and coercion to array" {
371371 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
372372 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
373 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
374373 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;
375375
376376 const StructWithDefault = struct { value: f32 = 42 };
377377 const SomeStruct = struct { array: [4]StructWithDefault };
test/behavior/vector.zig+1-1
......@@ -1329,8 +1329,8 @@ test "store to vector in slice" {
13291329 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
13301330 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
13311331 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
1332 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
13331332 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;
13341334
13351335 var v = [_]@Vector(3, f32){
13361336 .{ 1, 1, 1 },
test/tests.zig+7-3
......@@ -985,7 +985,9 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
985985 continue;
986986
987987 // TODO get compiler-rt tests passing for self-hosted backends.
988 if (test_target.use_llvm == false and mem.eql(u8, options.name, "compiler-rt"))
988 if ((test_target.target.getCpuArch() != .x86_64 or
989 test_target.target.getObjectFormat() != .elf) and
990 test_target.use_llvm == false and mem.eql(u8, options.name, "compiler-rt"))
989991 continue;
990992
991993 // TODO get compiler-rt tests passing for wasm32-wasi
......@@ -1002,8 +1004,10 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
10021004 test_target.use_llvm == false and mem.eql(u8, options.name, "universal-libc"))
10031005 continue;
10041006
1005 // TODO get std lib tests passing for self-hosted backends.
1006 if (test_target.use_llvm == false and mem.eql(u8, options.name, "std"))
1007 // TODO get std lib tests passing for other self-hosted backends.
1008 if ((test_target.target.getCpuArch() != .x86_64 or
1009 test_target.target.getObjectFormat() != .elf) and
1010 test_target.use_llvm == false and mem.eql(u8, options.name, "std"))
10071011 continue;
10081012
10091013 const want_this_mode = for (options.optimize_modes) |m| {
tools/lldb_pretty_printers.py+19-8
......@@ -355,17 +355,28 @@ class Module_Decl__Module_Decl_Index_SynthProvider:
355355 def __init__(self, value, _=None): self.value = value
356356 def update(self):
357357 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')
363361 except: pass
364362 def has_children(self): return True
365363 def num_children(self): return 1
366364 def get_child_index(self, name): return 0 if name == 'decl' else -1
367365 def get_child_at_index(self, index): return self.ptr if index == 0 else None
368366
367class 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
369380class TagOrPayloadPtr_SynthProvider:
370381 def __init__(self, value, _=None): self.value = value
371382 def update(self):
......@@ -440,10 +451,9 @@ class InternPool_Index_SynthProvider:
440451 for encoding_field in encoding_type.fields:
441452 if encoding_field.name == 'data':
442453 if encoding_field.type.IsPointerType():
443 data_type = encoding_field.type.GetPointeeType()
444454 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
447457 else:
448458 self.data = data.Cast(encoding_field.type).Clone('data')
449459 elif encoding_field.name == 'trailing':
......@@ -700,6 +710,7 @@ def __lldb_init_module(debugger, _=None):
700710 add(debugger, category='zig.stage2', regex=True, type=MultiArrayList_Entry('Air\\.Inst'), identifier='TagAndPayload', synth=True, inline_children=True, summary=True)
701711 add(debugger, category='zig.stage2', regex=True, type='^Air\\.Inst\\.Data\\.Data__struct_[1-9][0-9]*$', inline_children=True, summary=True)
702712 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)
703714 add(debugger, category='zig.stage2', type='Module.LazySrcLoc', identifier='zig_TaggedUnion', synth=True)
704715 add(debugger, category='zig.stage2', type='InternPool.Index', synth=True)
705716 add(debugger, category='zig.stage2', type='InternPool.NullTerminatedString', summary=True)