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 @@...@@ -4,6 +4,7 @@
4// https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/test/builtins/Unit/subtf3_test.c4// https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/test/builtins/Unit/subtf3_test.c
55
6const std = @import("std");6const std = @import("std");
7const builtin = @import("builtin");
7const math = std.math;8const math = std.math;
8const qnan128: f128 = @bitCast(@as(u128, 0x7fff800000000000) << 64);9const 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 {...@@ -34,6 +35,8 @@ fn test__addtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {
34}35}
3536
36test "addtf3" {37test "addtf3" {
38 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
39
37 try test__addtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);40 try test__addtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
3841
39 // NaN + any = NaN42 // NaN + any = NaN
...@@ -73,6 +76,9 @@ fn test__subtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {...@@ -73,6 +76,9 @@ fn test__subtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {
73}76}
7477
75test "subtf3" {78test "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
76 // qNaN - any = qNaN82 // qNaN - any = qNaN
77 try test__subtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);83 try test__subtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
7884
...@@ -103,6 +109,8 @@ fn test__addxf3(a: f80, b: f80, expected: u80) !void {...@@ -103,6 +109,8 @@ fn test__addxf3(a: f80, b: f80, expected: u80) !void {
103}109}
104110
105test "addxf3" {111test "addxf3" {
112 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
113
106 // NaN + any = NaN114 // NaN + any = NaN
107 try test__addxf3(qnan80, 0x1.23456789abcdefp+5, @as(u80, @bitCast(qnan80)));115 try test__addxf3(qnan80, 0x1.23456789abcdefp+5, @as(u80, @bitCast(qnan80)));
108 try test__addxf3(@as(f80, @bitCast(@as(u80, 0x7fff_8000_8000_3000_0000))), 0x1.23456789abcdefp+5, @as(u80, @bitCast(qnan80)));116 try test__addxf3(@as(f80, @bitCast(@as(u80, 0x7fff_8000_8000_3000_0000))), 0x1.23456789abcdefp+5, @as(u80, @bitCast(qnan80)));
lib/compiler_rt/addoti4_test.zig+2
...@@ -23,6 +23,8 @@ fn simple_addoti4(a: i128, b: i128, overflow: *c_int) i128 {...@@ -23,6 +23,8 @@ fn simple_addoti4(a: i128, b: i128, overflow: *c_int) i128 {
23}23}
2424
25test "addoti4" {25test "addoti4" {
26 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
27
26 const min: i128 = math.minInt(i128);28 const min: i128 = math.minInt(i128);
27 const max: i128 = math.maxInt(i128);29 const max: i128 = math.maxInt(i128);
28 var i: i128 = 1;30 var i: i128 = 1;
lib/compiler_rt/comparef.zig+2
...@@ -98,6 +98,8 @@ pub inline fn cmp_f80(comptime RT: type, a: f80, b: f80) RT {...@@ -98,6 +98,8 @@ pub inline fn cmp_f80(comptime RT: type, a: f80, b: f80) RT {
98}98}
9999
100test "cmp_f80" {100test "cmp_f80" {
101 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
102
101 inline for (.{ LE, GE }) |RT| {103 inline for (.{ LE, GE }) |RT| {
102 try std.testing.expect(cmp_f80(RT, 1.0, 1.0) == RT.Equal);104 try std.testing.expect(cmp_f80(RT, 1.0, 1.0) == RT.Equal);
103 try std.testing.expect(cmp_f80(RT, 0.0, -0.0) == RT.Equal);105 try std.testing.expect(cmp_f80(RT, 0.0, -0.0) == RT.Equal);
lib/compiler_rt/cos.zig+2-2
...@@ -1,6 +1,4 @@...@@ -1,6 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const arch = builtin.cpu.arch;
4const math = std.math;2const math = std.math;
5const expect = std.testing.expect;3const expect = std.testing.expect;
6const common = @import("common.zig");4const common = @import("common.zig");
...@@ -136,6 +134,8 @@ pub fn cosl(x: c_longdouble) callconv(.C) c_longdouble {...@@ -136,6 +134,8 @@ pub fn cosl(x: c_longdouble) callconv(.C) c_longdouble {
136}134}
137135
138test "cos32" {136test "cos32" {
137 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
138
139 const epsilon = 0.00001;139 const epsilon = 0.00001;
140140
141 try expect(math.approxEqAbs(f32, cosf(0.0), 1.0, epsilon));141 try expect(math.approxEqAbs(f32, cosf(0.0), 1.0, epsilon));
lib/compiler_rt/divtf3_test.zig+4
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const math = std.math;3const math = std.math;
3const testing = std.testing;4const testing = std.testing;
45
...@@ -30,6 +31,9 @@ fn test__divtf3(a: f128, b: f128, expectedHi: u64, expectedLo: u64) !void {...@@ -30,6 +31,9 @@ fn test__divtf3(a: f128, b: f128, expectedHi: u64, expectedLo: u64) !void {
30}31}
3132
32test "divtf3" {33test "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
33 // NaN / any = NaN37 // NaN / any = NaN
34 try test__divtf3(math.nan(f128), 0x1.23456789abcdefp+5, 0x7fff800000000000, 0);38 try test__divtf3(math.nan(f128), 0x1.23456789abcdefp+5, 0x7fff800000000000, 0);
35 // inf / any(except inf and nan) = inf39 // 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 {...@@ -39,6 +39,8 @@ fn test__divxf3(a: f80, b: f80) !void {
39}39}
4040
41test "divxf3" {41test "divxf3" {
42 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
43
42 // NaN / any = NaN44 // NaN / any = NaN
43 try expect__divxf3_result(math.nan(f80), 0x1.23456789abcdefp+5, 0x7fffC000000000000000);45 try expect__divxf3_result(math.nan(f80), 0x1.23456789abcdefp+5, 0x7fffC000000000000000);
44 // inf / any(except inf and nan) = inf46 // inf / any(except inf and nan) = inf
lib/compiler_rt/float_from_int_test.zig+22
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const testing = std.testing;3const testing = std.testing;
3const math = std.math;4const math = std.math;
45
...@@ -125,6 +126,9 @@ fn test__floatuntisf(a: u128, expected: f32) !void {...@@ -125,6 +126,9 @@ fn test__floatuntisf(a: u128, expected: f32) !void {
125}126}
126127
127test "floattisf" {128test "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
128 try test__floattisf(0, 0.0);132 try test__floattisf(0, 0.0);
129133
130 try test__floattisf(1, 1.0);134 try test__floattisf(1, 1.0);
...@@ -171,6 +175,9 @@ test "floattisf" {...@@ -171,6 +175,9 @@ test "floattisf" {
171}175}
172176
173test "floatuntisf" {177test "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
174 try test__floatuntisf(0, 0.0);181 try test__floatuntisf(0, 0.0);
175182
176 try test__floatuntisf(1, 1.0);183 try test__floatuntisf(1, 1.0);
...@@ -367,6 +374,9 @@ fn test__floatuntidf(a: u128, expected: f64) !void {...@@ -367,6 +374,9 @@ fn test__floatuntidf(a: u128, expected: f64) !void {
367}374}
368375
369test "floattidf" {376test "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
370 try test__floattidf(0, 0.0);380 try test__floattidf(0, 0.0);
371381
372 try test__floattidf(1, 1.0);382 try test__floattidf(1, 1.0);
...@@ -437,6 +447,9 @@ test "floattidf" {...@@ -437,6 +447,9 @@ test "floattidf" {
437}447}
438448
439test "floatuntidf" {449test "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
440 try test__floatuntidf(0, 0.0);453 try test__floatuntidf(0, 0.0);
441454
442 try test__floatuntidf(1, 1.0);455 try test__floatuntidf(1, 1.0);
...@@ -582,6 +595,9 @@ test "floatditf" {...@@ -582,6 +595,9 @@ test "floatditf" {
582}595}
583596
584test "floatunditf" {597test "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
585 try test__floatunditf(0xffffffffffffffff, 0x403effffffffffff, 0xfffe000000000000);601 try test__floatunditf(0xffffffffffffffff, 0x403effffffffffff, 0xfffe000000000000);
586 try test__floatunditf(0xfffffffffffffffe, 0x403effffffffffff, 0xfffc000000000000);602 try test__floatunditf(0xfffffffffffffffe, 0x403effffffffffff, 0xfffc000000000000);
587 try test__floatunditf(0x8000000000000000, 0x403e000000000000, 0x0);603 try test__floatunditf(0x8000000000000000, 0x403e000000000000, 0x0);
...@@ -603,6 +619,9 @@ fn test__floatuntitf(a: u128, expected: f128) !void {...@@ -603,6 +619,9 @@ fn test__floatuntitf(a: u128, expected: f128) !void {
603}619}
604620
605test "floattitf" {621test "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
606 try test__floattitf(0, 0.0);625 try test__floattitf(0, 0.0);
607626
608 try test__floattitf(1, 1.0);627 try test__floattitf(1, 1.0);
...@@ -685,6 +704,9 @@ test "floattitf" {...@@ -685,6 +704,9 @@ test "floattitf" {
685}704}
686705
687test "floatuntitf" {706test "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
688 try test__floatuntitf(0, 0.0);710 try test__floatuntitf(0, 0.0);
689711
690 try test__floatuntitf(1, 1.0);712 try test__floatuntitf(1, 1.0);
lib/compiler_rt/fma.zig+3
...@@ -343,6 +343,9 @@ test "64" {...@@ -343,6 +343,9 @@ test "64" {
343}343}
344344
345test "128" {345test "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
346 const epsilon = 0.000001;349 const epsilon = 0.000001;
347350
348 try expect(math.approxEqAbs(f128, fmaq(0.0, 5.0, 9.124), 9.124, epsilon));351 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 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const fmod = @import("fmod.zig");3const fmod = @import("fmod.zig");
3const testing = std.testing;4const testing = std.testing;
45
...@@ -22,6 +23,9 @@ fn test_fmodx_infs() !void {...@@ -22,6 +23,9 @@ fn test_fmodx_infs() !void {
22}23}
2324
24test "fmodx" {25test "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
25 try test_fmodx(6.4, 4.0, 2.4);29 try test_fmodx(6.4, 4.0, 2.4);
26 try test_fmodx(6.4, -4.0, 2.4);30 try test_fmodx(6.4, -4.0, 2.4);
27 try test_fmodx(-6.4, 4.0, -2.4);31 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 {...@@ -42,6 +42,8 @@ pub fn __divmodti4(a: i128, b: i128, rem: *i128) callconv(.C) i128 {
42}42}
4343
44test "test_divmodti4" {44test "test_divmodti4" {
45 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
46
45 const cases = [_][4]i128{47 const cases = [_][4]i128{
46 [_]i128{ 0, 1, 0, 0 },48 [_]i128{ 0, 1, 0, 0 },
47 [_]i128{ 0, -1, 0, 0 },49 [_]i128{ 0, -1, 0, 0 },
lib/compiler_rt/int_from_float_test.zig+37
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const testing = std.testing;3const testing = std.testing;
3const math = std.math;4const math = std.math;
45
...@@ -40,6 +41,8 @@ fn test__fixunssfsi(a: f32, expected: u32) !void {...@@ -40,6 +41,8 @@ fn test__fixunssfsi(a: f32, expected: u32) !void {
40}41}
4142
42test "fixsfsi" {43test "fixsfsi" {
44 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
45
43 try test__fixsfsi(-math.floatMax(f32), math.minInt(i32));46 try test__fixsfsi(-math.floatMax(f32), math.minInt(i32));
4447
45 try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));48 try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
...@@ -103,6 +106,8 @@ test "fixsfsi" {...@@ -103,6 +106,8 @@ test "fixsfsi" {
103}106}
104107
105test "fixunssfsi" {108test "fixunssfsi" {
109 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
110
106 try test__fixunssfsi(0.0, 0);111 try test__fixunssfsi(0.0, 0);
107112
108 try test__fixunssfsi(0.5, 0);113 try test__fixunssfsi(0.5, 0);
...@@ -142,6 +147,8 @@ fn test__fixunssfdi(a: f32, expected: u64) !void {...@@ -142,6 +147,8 @@ fn test__fixunssfdi(a: f32, expected: u64) !void {
142}147}
143148
144test "fixsfdi" {149test "fixsfdi" {
150 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
151
145 try test__fixsfdi(-math.floatMax(f32), math.minInt(i64));152 try test__fixsfdi(-math.floatMax(f32), math.minInt(i64));
146153
147 try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));154 try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
...@@ -197,6 +204,8 @@ test "fixsfdi" {...@@ -197,6 +204,8 @@ test "fixsfdi" {
197}204}
198205
199test "fixunssfdi" {206test "fixunssfdi" {
207 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
208
200 try test__fixunssfdi(0.0, 0);209 try test__fixunssfdi(0.0, 0);
201210
202 try test__fixunssfdi(0.5, 0);211 try test__fixunssfdi(0.5, 0);
...@@ -235,6 +244,8 @@ fn test__fixunssfti(a: f32, expected: u128) !void {...@@ -235,6 +244,8 @@ fn test__fixunssfti(a: f32, expected: u128) !void {
235}244}
236245
237test "fixsfti" {246test "fixsfti" {
247 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
248
238 try test__fixsfti(-math.floatMax(f32), math.minInt(i128));249 try test__fixsfti(-math.floatMax(f32), math.minInt(i128));
239250
240 try test__fixsfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));251 try test__fixsfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
...@@ -306,6 +317,8 @@ test "fixsfti" {...@@ -306,6 +317,8 @@ test "fixsfti" {
306}317}
307318
308test "fixunssfti" {319test "fixunssfti" {
320 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
321
309 try test__fixunssfti(0.0, 0);322 try test__fixunssfti(0.0, 0);
310323
311 try test__fixunssfti(0.5, 0);324 try test__fixunssfti(0.5, 0);
...@@ -352,6 +365,8 @@ fn test__fixunsdfsi(a: f64, expected: u32) !void {...@@ -352,6 +365,8 @@ fn test__fixunsdfsi(a: f64, expected: u32) !void {
352}365}
353366
354test "fixdfsi" {367test "fixdfsi" {
368 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
369
355 try test__fixdfsi(-math.floatMax(f64), math.minInt(i32));370 try test__fixdfsi(-math.floatMax(f64), math.minInt(i32));
356371
357 try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));372 try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
...@@ -413,6 +428,8 @@ test "fixdfsi" {...@@ -413,6 +428,8 @@ test "fixdfsi" {
413}428}
414429
415test "fixunsdfsi" {430test "fixunsdfsi" {
431 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
432
416 try test__fixunsdfsi(0.0, 0);433 try test__fixunsdfsi(0.0, 0);
417434
418 try test__fixunsdfsi(0.5, 0);435 try test__fixunsdfsi(0.5, 0);
...@@ -455,6 +472,8 @@ fn test__fixunsdfdi(a: f64, expected: u64) !void {...@@ -455,6 +472,8 @@ fn test__fixunsdfdi(a: f64, expected: u64) !void {
455}472}
456473
457test "fixdfdi" {474test "fixdfdi" {
475 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
476
458 try test__fixdfdi(-math.floatMax(f64), math.minInt(i64));477 try test__fixdfdi(-math.floatMax(f64), math.minInt(i64));
459478
460 try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));479 try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
...@@ -508,6 +527,8 @@ test "fixdfdi" {...@@ -508,6 +527,8 @@ test "fixdfdi" {
508}527}
509528
510test "fixunsdfdi" {529test "fixunsdfdi" {
530 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
531
511 try test__fixunsdfdi(0.0, 0);532 try test__fixunsdfdi(0.0, 0);
512 try test__fixunsdfdi(0.5, 0);533 try test__fixunsdfdi(0.5, 0);
513 try test__fixunsdfdi(0.99, 0);534 try test__fixunsdfdi(0.99, 0);
...@@ -550,6 +571,8 @@ fn test__fixunsdfti(a: f64, expected: u128) !void {...@@ -550,6 +571,8 @@ fn test__fixunsdfti(a: f64, expected: u128) !void {
550}571}
551572
552test "fixdfti" {573test "fixdfti" {
574 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
575
553 try test__fixdfti(-math.floatMax(f64), math.minInt(i128));576 try test__fixdfti(-math.floatMax(f64), math.minInt(i128));
554577
555 try test__fixdfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));578 try test__fixdfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
...@@ -603,6 +626,8 @@ test "fixdfti" {...@@ -603,6 +626,8 @@ test "fixdfti" {
603}626}
604627
605test "fixunsdfti" {628test "fixunsdfti" {
629 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
630
606 try test__fixunsdfti(0.0, 0);631 try test__fixunsdfti(0.0, 0);
607632
608 try test__fixunsdfti(0.5, 0);633 try test__fixunsdfti(0.5, 0);
...@@ -652,6 +677,8 @@ fn test__fixunstfsi(a: f128, expected: u32) !void {...@@ -652,6 +677,8 @@ fn test__fixunstfsi(a: f128, expected: u32) !void {
652}677}
653678
654test "fixtfsi" {679test "fixtfsi" {
680 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
681
655 try test__fixtfsi(-math.floatMax(f128), math.minInt(i32));682 try test__fixtfsi(-math.floatMax(f128), math.minInt(i32));
656683
657 try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));684 try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
...@@ -715,6 +742,8 @@ test "fixtfsi" {...@@ -715,6 +742,8 @@ test "fixtfsi" {
715}742}
716743
717test "fixunstfsi" {744test "fixunstfsi" {
745 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
746
718 try test__fixunstfsi(math.inf(f128), 0xffffffff);747 try test__fixunstfsi(math.inf(f128), 0xffffffff);
719 try test__fixunstfsi(0, 0x0);748 try test__fixunstfsi(0, 0x0);
720 try test__fixunstfsi(0x1.23456789abcdefp+5, 0x24);749 try test__fixunstfsi(0x1.23456789abcdefp+5, 0x24);
...@@ -738,6 +767,8 @@ fn test__fixunstfdi(a: f128, expected: u64) !void {...@@ -738,6 +767,8 @@ fn test__fixunstfdi(a: f128, expected: u64) !void {
738}767}
739768
740test "fixtfdi" {769test "fixtfdi" {
770 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
771
741 try test__fixtfdi(-math.floatMax(f128), math.minInt(i64));772 try test__fixtfdi(-math.floatMax(f128), math.minInt(i64));
742773
743 try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));774 try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
...@@ -801,6 +832,8 @@ test "fixtfdi" {...@@ -801,6 +832,8 @@ test "fixtfdi" {
801}832}
802833
803test "fixunstfdi" {834test "fixunstfdi" {
835 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
836
804 try test__fixunstfdi(0.0, 0);837 try test__fixunstfdi(0.0, 0);
805838
806 try test__fixunstfdi(0.5, 0);839 try test__fixunstfdi(0.5, 0);
...@@ -853,6 +886,8 @@ fn test__fixunstfti(a: f128, expected: u128) !void {...@@ -853,6 +886,8 @@ fn test__fixunstfti(a: f128, expected: u128) !void {
853}886}
854887
855test "fixtfti" {888test "fixtfti" {
889 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
890
856 try test__fixtfti(-math.floatMax(f128), math.minInt(i128));891 try test__fixtfti(-math.floatMax(f128), math.minInt(i128));
857892
858 try test__fixtfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));893 try test__fixtfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
...@@ -934,6 +969,8 @@ fn test__fixunshfti(a: f16, expected: u128) !void {...@@ -934,6 +969,8 @@ fn test__fixunshfti(a: f16, expected: u128) !void {
934}969}
935970
936test "fixunshfti for f16" {971test "fixunshfti for f16" {
972 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
973
937 try test__fixunshfti(math.inf(f16), math.maxInt(u128));974 try test__fixunshfti(math.inf(f16), math.maxInt(u128));
938 try test__fixunshfti(math.floatMax(f16), 65504);975 try test__fixunshfti(math.floatMax(f16), 65504);
939}976}
lib/compiler_rt/mulf3_test.zig+4
...@@ -3,6 +3,7 @@...@@ -3,6 +3,7 @@
3// https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/test/builtins/Unit/multf3_test.c3// https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/test/builtins/Unit/multf3_test.c
44
5const std = @import("std");5const std = @import("std");
6const builtin = @import("builtin");
6const math = std.math;7const math = std.math;
7const qnan128: f128 = @bitCast(@as(u128, 0x7fff800000000000) << 64);8const qnan128: f128 = @bitCast(@as(u128, 0x7fff800000000000) << 64);
8const inf128: f128 = @bitCast(@as(u128, 0x7fff000000000000) << 64);9const inf128: f128 = @bitCast(@as(u128, 0x7fff000000000000) << 64);
...@@ -48,6 +49,9 @@ fn makeNaN128(rand: u64) f128 {...@@ -48,6 +49,9 @@ fn makeNaN128(rand: u64) f128 {
48 return @bitCast(int_result);49 return @bitCast(int_result);
49}50}
50test "multf3" {51test "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
51 // qNaN * any = qNaN55 // qNaN * any = qNaN
52 try test__multf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);56 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 {...@@ -6,7 +6,9 @@ fn test__negti2(a: i128, expected: i128) !void {
6 try testing.expectEqual(expected, result);6 try testing.expectEqual(expected, result);
7}7}
88
9test "negdi2" {9test "negti2" {
10 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
11
10 // TODO ensuring that math.minInt(i128); returns error12 // TODO ensuring that math.minInt(i128); returns error
1113
12 try test__negti2(-3, 3);14 try test__negti2(-3, 3);
lib/compiler_rt/powiXf2_test.zig+11-2
...@@ -3,8 +3,10 @@...@@ -3,8 +3,10 @@
3// powihf2 adapted from powisf2 tests3// powihf2 adapted from powisf2 tests
44
5const powiXf2 = @import("powiXf2.zig");5const powiXf2 = @import("powiXf2.zig");
6const testing = @import("std").testing;6const std = @import("std");
7const math = @import("std").math;7const builtin = @import("builtin");
8const testing = std.testing;
9const math = std.math;
810
9fn test__powihf2(a: f16, b: i32, expected: f16) !void {11fn test__powihf2(a: f16, b: i32, expected: f16) !void {
10 var result = powiXf2.__powihf2(a, b);12 var result = powiXf2.__powihf2(a, b);
...@@ -32,6 +34,9 @@ fn test__powixf2(a: f80, b: i32, expected: f80) !void {...@@ -32,6 +34,9 @@ fn test__powixf2(a: f80, b: i32, expected: f80) !void {
32}34}
3335
34test "powihf2" {36test "powihf2" {
37 if (builtin.zig_backend == .stage2_x86_64 and
38 !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .f16c)) return error.SkipZigTest;
39
35 const inf_f16 = math.inf(f16);40 const inf_f16 = math.inf(f16);
36 try test__powisf2(0, 0, 1);41 try test__powisf2(0, 0, 1);
37 try test__powihf2(1, 0, 1);42 try test__powihf2(1, 0, 1);
...@@ -351,6 +356,8 @@ test "powidf2" {...@@ -351,6 +356,8 @@ test "powidf2" {
351}356}
352357
353test "powitf2" {358test "powitf2" {
359 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
360
354 const inf_f128 = math.inf(f128);361 const inf_f128 = math.inf(f128);
355 try test__powitf2(0, 0, 1);362 try test__powitf2(0, 0, 1);
356 try test__powitf2(1, 0, 1);363 try test__powitf2(1, 0, 1);
...@@ -456,6 +463,8 @@ test "powitf2" {...@@ -456,6 +463,8 @@ test "powitf2" {
456}463}
457464
458test "powixf2" {465test "powixf2" {
466 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
467
459 const inf_f80 = math.inf(f80);468 const inf_f80 = math.inf(f80);
460 try test__powixf2(0, 0, 1);469 try test__powixf2(0, 0, 1);
461 try test__powixf2(1, 0, 1);470 try test__powixf2(1, 0, 1);
lib/compiler_rt/sin.zig+2
...@@ -140,6 +140,8 @@ pub fn sinl(x: c_longdouble) callconv(.C) c_longdouble {...@@ -140,6 +140,8 @@ pub fn sinl(x: c_longdouble) callconv(.C) c_longdouble {
140}140}
141141
142test "sin32" {142test "sin32" {
143 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
144
143 const epsilon = 0.00001;145 const epsilon = 0.00001;
144146
145 try expect(math.approxEqAbs(f32, sinf(0.0), 0.0, epsilon));147 try expect(math.approxEqAbs(f32, sinf(0.0), 0.0, epsilon));
lib/compiler_rt/suboti4_test.zig+2
...@@ -27,6 +27,8 @@ pub fn simple_suboti4(a: i128, b: i128, overflow: *c_int) i128 {...@@ -27,6 +27,8 @@ pub fn simple_suboti4(a: i128, b: i128, overflow: *c_int) i128 {
27}27}
2828
29test "suboti3" {29test "suboti3" {
30 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
31
30 const min: i128 = math.minInt(i128);32 const min: i128 = math.minInt(i128);
31 const max: i128 = math.maxInt(i128);33 const max: i128 = math.maxInt(i128);
32 var i: i128 = 1;34 var i: i128 = 1;
lib/compiler_rt/tan.zig+4
...@@ -131,6 +131,8 @@ test "tan" {...@@ -131,6 +131,8 @@ test "tan" {
131}131}
132132
133test "tan32" {133test "tan32" {
134 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
135
134 const epsilon = 0.00001;136 const epsilon = 0.00001;
135137
136 try expect(math.approxEqAbs(f32, tanf(0.0), 0.0, epsilon));138 try expect(math.approxEqAbs(f32, tanf(0.0), 0.0, epsilon));
...@@ -142,6 +144,8 @@ test "tan32" {...@@ -142,6 +144,8 @@ test "tan32" {
142}144}
143145
144test "tan64" {146test "tan64" {
147 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
148
145 const epsilon = 0.000001;149 const epsilon = 0.000001;
146150
147 try expect(math.approxEqAbs(f64, tan(0.0), 0.0, epsilon));151 try expect(math.approxEqAbs(f64, tan(0.0), 0.0, epsilon));
lib/compiler_rt/udivmodei4.zig+4-1
...@@ -129,7 +129,10 @@ pub fn __umodei4(r_p: [*]u32, u_p: [*]const u32, v_p: [*]const u32, bits: usize)...@@ -129,7 +129,10 @@ pub fn __umodei4(r_p: [*]u32, u_p: [*]const u32, v_p: [*]const u32, bits: usize)
129}129}
130130
131test "__udivei4/__umodei4" {131test "__udivei4/__umodei4" {
132 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO132 switch (builtin.zig_backend) {
133 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
134 else => {},
135 }
133136
134 const RndGen = std.rand.DefaultPrng;137 const RndGen = std.rand.DefaultPrng;
135 var rnd = RndGen.init(42);138 var rnd = RndGen.init(42);
lib/std/Build/Cache.zig+10
...@@ -1007,6 +1007,8 @@ test "cache file and then recall it" {...@@ -1007,6 +1007,8 @@ test "cache file and then recall it" {
1007 return error.SkipZigTest;1007 return error.SkipZigTest;
1008 }1008 }
10091009
1010 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1011
1010 var tmp = testing.tmpDir(.{});1012 var tmp = testing.tmpDir(.{});
1011 defer tmp.cleanup();1013 defer tmp.cleanup();
10121014
...@@ -1072,6 +1074,9 @@ test "check that changing a file makes cache fail" {...@@ -1072,6 +1074,9 @@ test "check that changing a file makes cache fail" {
1072 // https://github.com/ziglang/zig/issues/54371074 // https://github.com/ziglang/zig/issues/5437
1073 return error.SkipZigTest;1075 return error.SkipZigTest;
1074 }1076 }
1077
1078 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1079
1075 var tmp = testing.tmpDir(.{});1080 var tmp = testing.tmpDir(.{});
1076 defer tmp.cleanup();1081 defer tmp.cleanup();
10771082
...@@ -1146,6 +1151,8 @@ test "no file inputs" {...@@ -1146,6 +1151,8 @@ test "no file inputs" {
1146 return error.SkipZigTest;1151 return error.SkipZigTest;
1147 }1152 }
11481153
1154 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1155
1149 var tmp = testing.tmpDir(.{});1156 var tmp = testing.tmpDir(.{});
1150 defer tmp.cleanup();1157 defer tmp.cleanup();
11511158
...@@ -1193,6 +1200,9 @@ test "Manifest with files added after initial hash work" {...@@ -1193,6 +1200,9 @@ test "Manifest with files added after initial hash work" {
1193 // https://github.com/ziglang/zig/issues/54371200 // https://github.com/ziglang/zig/issues/5437
1194 return error.SkipZigTest;1201 return error.SkipZigTest;
1195 }1202 }
1203
1204 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1205
1196 var tmp = testing.tmpDir(.{});1206 var tmp = testing.tmpDir(.{});
1197 defer tmp.cleanup();1207 defer tmp.cleanup();
11981208
lib/std/Build/Step/Options.zig+2
...@@ -296,6 +296,8 @@ const Arg = struct {...@@ -296,6 +296,8 @@ const Arg = struct {
296test Options {296test Options {
297 if (builtin.os.tag == .wasi) return error.SkipZigTest;297 if (builtin.os.tag == .wasi) return error.SkipZigTest;
298298
299 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
300
299 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);301 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
300 defer arena.deinit();302 defer arena.deinit();
301303
lib/std/Thread/Condition.zig+6
...@@ -369,6 +369,8 @@ test "Condition - signal" {...@@ -369,6 +369,8 @@ test "Condition - signal" {
369 return error.SkipZigTest;369 return error.SkipZigTest;
370 }370 }
371371
372 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
373
372 const num_threads = 4;374 const num_threads = 4;
373375
374 const SignalTest = struct {376 const SignalTest = struct {
...@@ -498,6 +500,8 @@ test "Condition - broadcasting" {...@@ -498,6 +500,8 @@ test "Condition - broadcasting" {
498 return error.SkipZigTest;500 return error.SkipZigTest;
499 }501 }
500502
503 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
504
501 const num_threads = 10;505 const num_threads = 10;
502506
503 const BroadcastTest = struct {507 const BroadcastTest = struct {
...@@ -565,6 +569,8 @@ test "Condition - broadcasting - wake all threads" {...@@ -565,6 +569,8 @@ test "Condition - broadcasting - wake all threads" {
565 return error.SkipZigTest;569 return error.SkipZigTest;
566 }570 }
567571
572 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
573
568 var num_runs: usize = 1;574 var num_runs: usize = 1;
569 const num_threads = 10;575 const num_threads = 10;
570576
lib/std/Thread/Mutex.zig+2
...@@ -289,6 +289,8 @@ test "Mutex - many contended" {...@@ -289,6 +289,8 @@ test "Mutex - many contended" {
289 return error.SkipZigTest;289 return error.SkipZigTest;
290 }290 }
291291
292 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
293
292 const num_threads = 4;294 const num_threads = 4;
293 const num_increments = 1000;295 const num_increments = 1000;
294296
lib/std/Thread/RwLock.zig+2
...@@ -297,6 +297,8 @@ test "RwLock - concurrent access" {...@@ -297,6 +297,8 @@ test "RwLock - concurrent access" {
297 if (builtin.single_threaded)297 if (builtin.single_threaded)
298 return;298 return;
299299
300 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
301
300 const num_writers: usize = 2;302 const num_writers: usize = 2;
301 const num_readers: usize = 4;303 const num_readers: usize = 4;
302 const num_writes: usize = 10000;304 const num_writes: usize = 10000;
lib/std/Uri.zig+2
...@@ -685,6 +685,8 @@ test "Special test" {...@@ -685,6 +685,8 @@ test "Special test" {
685}685}
686686
687test "URI escaping" {687test "URI escaping" {
688 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
689
688 const input = "\\ö/ äöß ~~.adas-https://canvas:123/#ads&&sad";690 const input = "\\ö/ äöß ~~.adas-https://canvas:123/#ads&&sad";
689 const expected = "%5C%C3%B6%2F%20%C3%A4%C3%B6%C3%9F%20~~.adas-https%3A%2F%2Fcanvas%3A123%2F%23ads%26%26sad";691 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 @@...@@ -1,4 +1,5 @@
1const std = @import("std.zig");1const std = @import("std.zig");
2const builtin = @import("builtin");
2const debug = std.debug;3const debug = std.debug;
3const assert = debug.assert;4const assert = debug.assert;
4const testing = std.testing;5const testing = std.testing;
...@@ -2137,6 +2138,8 @@ test "ensure capacity leak" {...@@ -2137,6 +2138,8 @@ test "ensure capacity leak" {
2137}2138}
21382139
2139test "big map" {2140test "big map" {
2141 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2142
2140 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2143 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2141 defer map.deinit();2144 defer map.deinit();
21422145
...@@ -2190,6 +2193,8 @@ test "big map" {...@@ -2190,6 +2193,8 @@ test "big map" {
2190}2193}
21912194
2192test "clone" {2195test "clone" {
2196 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2197
2193 var original = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2198 var original = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2194 defer original.deinit();2199 defer original.deinit();
21952200
...@@ -2216,6 +2221,8 @@ test "clone" {...@@ -2216,6 +2221,8 @@ test "clone" {
2216}2221}
22172222
2218test "shrink" {2223test "shrink" {
2224 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2225
2219 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2226 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2220 defer map.deinit();2227 defer map.deinit();
22212228
...@@ -2256,6 +2263,8 @@ test "shrink" {...@@ -2256,6 +2263,8 @@ test "shrink" {
2256}2263}
22572264
2258test "pop" {2265test "pop" {
2266 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2267
2259 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2268 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2260 defer map.deinit();2269 defer map.deinit();
22612270
...@@ -2274,6 +2283,8 @@ test "pop" {...@@ -2274,6 +2283,8 @@ test "pop" {
2274}2283}
22752284
2276test "popOrNull" {2285test "popOrNull" {
2286 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2287
2277 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2288 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2278 defer map.deinit();2289 defer map.deinit();
22792290
...@@ -2294,6 +2305,8 @@ test "popOrNull" {...@@ -2294,6 +2305,8 @@ test "popOrNull" {
2294}2305}
22952306
2296test "reIndex" {2307test "reIndex" {
2308 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2309
2297 var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);2310 var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);
2298 defer map.deinit();2311 defer map.deinit();
22992312
...@@ -2338,6 +2351,8 @@ test "auto store_hash" {...@@ -2338,6 +2351,8 @@ test "auto store_hash" {
2338}2351}
23392352
2340test "sort" {2353test "sort" {
2354 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2355
2341 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);2356 var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
2342 defer map.deinit();2357 defer map.deinit();
23432358
lib/std/array_list.zig+11
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std.zig");1const std = @import("std.zig");
2const builtin = @import("builtin");
2const debug = std.debug;3const debug = std.debug;
3const assert = debug.assert;4const assert = debug.assert;
4const testing = std.testing;5const testing = std.testing;
...@@ -1183,6 +1184,8 @@ test "std.ArrayList/ArrayListUnmanaged.initCapacity" {...@@ -1183,6 +1184,8 @@ test "std.ArrayList/ArrayListUnmanaged.initCapacity" {
1183}1184}
11841185
1185test "std.ArrayList/ArrayListUnmanaged.clone" {1186test "std.ArrayList/ArrayListUnmanaged.clone" {
1187 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1188
1186 const a = testing.allocator;1189 const a = testing.allocator;
1187 {1190 {
1188 var array = ArrayList(i32).init(a);1191 var array = ArrayList(i32).init(a);
...@@ -1224,6 +1227,8 @@ test "std.ArrayList/ArrayListUnmanaged.clone" {...@@ -1224,6 +1227,8 @@ test "std.ArrayList/ArrayListUnmanaged.clone" {
1224}1227}
12251228
1226test "std.ArrayList/ArrayListUnmanaged.basic" {1229test "std.ArrayList/ArrayListUnmanaged.basic" {
1230 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1231
1227 const a = testing.allocator;1232 const a = testing.allocator;
1228 {1233 {
1229 var list = ArrayList(i32).init(a);1234 var list = ArrayList(i32).init(a);
...@@ -1508,6 +1513,8 @@ test "std.ArrayList/ArrayListUnmanaged.insert" {...@@ -1508,6 +1513,8 @@ test "std.ArrayList/ArrayListUnmanaged.insert" {
1508}1513}
15091514
1510test "std.ArrayList/ArrayListUnmanaged.insertSlice" {1515test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
1516 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1517
1511 const a = testing.allocator;1518 const a = testing.allocator;
1512 {1519 {
1513 var list = ArrayList(i32).init(a);1520 var list = ArrayList(i32).init(a);
...@@ -1554,6 +1561,8 @@ test "std.ArrayList/ArrayListUnmanaged.insertSlice" {...@@ -1554,6 +1561,8 @@ test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
1554}1561}
15551562
1556test "std.ArrayList/ArrayListUnmanaged.replaceRange" {1563test "std.ArrayList/ArrayListUnmanaged.replaceRange" {
1564 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1565
1557 var arena = std.heap.ArenaAllocator.init(testing.allocator);1566 var arena = std.heap.ArenaAllocator.init(testing.allocator);
1558 defer arena.deinit();1567 defer arena.deinit();
1559 const a = arena.allocator();1568 const a = arena.allocator();
...@@ -1725,6 +1734,8 @@ test "shrink still sets length when resizing is disabled" {...@@ -1725,6 +1734,8 @@ test "shrink still sets length when resizing is disabled" {
1725}1734}
17261735
1727test "shrinkAndFree with a copy" {1736test "shrinkAndFree with a copy" {
1737 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1738
1728 var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 });1739 var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 });
1729 const a = failing_allocator.allocator();1740 const a = failing_allocator.allocator();
17301741
lib/std/atomic/Atomic.zig+4
...@@ -374,6 +374,8 @@ const atomic_rmw_orderings = [_]Ordering{...@@ -374,6 +374,8 @@ const atomic_rmw_orderings = [_]Ordering{
374};374};
375375
376test "Atomic.swap" {376test "Atomic.swap" {
377 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
378
377 inline for (atomic_rmw_orderings) |ordering| {379 inline for (atomic_rmw_orderings) |ordering| {
378 var x = Atomic(usize).init(5);380 var x = Atomic(usize).init(5);
379 try testing.expectEqual(x.swap(10, ordering), 5);381 try testing.expectEqual(x.swap(10, ordering), 5);
...@@ -467,6 +469,8 @@ test "Atomic.fetchSub" {...@@ -467,6 +469,8 @@ test "Atomic.fetchSub" {
467}469}
468470
469test "Atomic.fetchMin" {471test "Atomic.fetchMin" {
472 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
473
470 inline for (atomicIntTypes()) |Int| {474 inline for (atomicIntTypes()) |Int| {
471 inline for (atomic_rmw_orderings) |ordering| {475 inline for (atomic_rmw_orderings) |ordering| {
472 var x = Atomic(Int).init(5);476 var x = Atomic(Int).init(5);
lib/std/atomic/queue.zig+2
...@@ -175,6 +175,8 @@ const puts_per_thread = 500;...@@ -175,6 +175,8 @@ const puts_per_thread = 500;
175const put_thread_count = 3;175const put_thread_count = 3;
176176
177test "std.atomic.Queue" {177test "std.atomic.Queue" {
178 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
179
178 var plenty_of_memory = try std.heap.page_allocator.alloc(u8, 300 * 1024);180 var plenty_of_memory = try std.heap.page_allocator.alloc(u8, 300 * 1024);
179 defer std.heap.page_allocator.free(plenty_of_memory);181 defer std.heap.page_allocator.free(plenty_of_memory);
180182
lib/std/base64.zig+7
...@@ -1,5 +1,6 @@...@@ -1,5 +1,6 @@
1const std = @import("std.zig");1const std = @import("std.zig");
2const assert = std.debug.assert;2const assert = std.debug.assert;
3const builtin = @import("builtin");
3const testing = std.testing;4const testing = std.testing;
4const mem = std.mem;5const mem = std.mem;
56
...@@ -354,12 +355,16 @@ pub const Base64DecoderWithIgnore = struct {...@@ -354,12 +355,16 @@ pub const Base64DecoderWithIgnore = struct {
354};355};
355356
356test "base64" {357test "base64" {
358 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
359
357 @setEvalBranchQuota(8000);360 @setEvalBranchQuota(8000);
358 try testBase64();361 try testBase64();
359 try comptime testAllApis(standard, "comptime", "Y29tcHRpbWU=");362 try comptime testAllApis(standard, "comptime", "Y29tcHRpbWU=");
360}363}
361364
362test "base64 padding dest overflow" {365test "base64 padding dest overflow" {
366 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
367
363 const input = "foo";368 const input = "foo";
364369
365 var expect: [128]u8 = undefined;370 var expect: [128]u8 = undefined;
...@@ -374,6 +379,8 @@ test "base64 padding dest overflow" {...@@ -374,6 +379,8 @@ test "base64 padding dest overflow" {
374}379}
375380
376test "base64 url_safe_no_pad" {381test "base64 url_safe_no_pad" {
382 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
383
377 @setEvalBranchQuota(8000);384 @setEvalBranchQuota(8000);
378 try testBase64UrlSafeNoPad();385 try testBase64UrlSafeNoPad();
379 try comptime testAllApis(url_safe_no_pad, "comptime", "Y29tcHRpbWU");386 try comptime testAllApis(url_safe_no_pad, "comptime", "Y29tcHRpbWU");
lib/std/bit_set.zig+14-1
...@@ -33,6 +33,7 @@...@@ -33,6 +33,7 @@
33const std = @import("std.zig");33const std = @import("std.zig");
34const assert = std.debug.assert;34const assert = std.debug.assert;
35const Allocator = std.mem.Allocator;35const Allocator = std.mem.Allocator;
36const builtin = @import("builtin");
3637
37/// Returns the optimal static bit set type for the specified number38/// Returns the optimal static bit set type for the specified number
38/// of elements: either `IntegerBitSet` or `ArrayBitSet`,39/// of elements: either `IntegerBitSet` or `ArrayBitSet`,
...@@ -1636,7 +1637,10 @@ fn testStaticBitSet(comptime Set: type) !void {...@@ -1636,7 +1637,10 @@ fn testStaticBitSet(comptime Set: type) !void {
1636}1637}
16371638
1638test "IntegerBitSet" {1639test "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
1641 try testStaticBitSet(IntegerBitSet(0));1645 try testStaticBitSet(IntegerBitSet(0));
1642 try testStaticBitSet(IntegerBitSet(1));1646 try testStaticBitSet(IntegerBitSet(1));
...@@ -1649,6 +1653,11 @@ test "IntegerBitSet" {...@@ -1649,6 +1653,11 @@ test "IntegerBitSet" {
1649}1653}
16501654
1651test "ArrayBitSet" {1655test "ArrayBitSet" {
1656 switch (builtin.zig_backend) {
1657 .stage2_x86_64 => return error.SkipZigTest,
1658 else => {},
1659 }
1660
1652 inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| {1661 inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| {
1653 try testStaticBitSet(ArrayBitSet(u8, size));1662 try testStaticBitSet(ArrayBitSet(u8, size));
1654 try testStaticBitSet(ArrayBitSet(u16, size));1663 try testStaticBitSet(ArrayBitSet(u16, size));
...@@ -1659,6 +1668,8 @@ test "ArrayBitSet" {...@@ -1659,6 +1668,8 @@ test "ArrayBitSet" {
1659}1668}
16601669
1661test "DynamicBitSetUnmanaged" {1670test "DynamicBitSetUnmanaged" {
1671 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1672
1662 const allocator = std.testing.allocator;1673 const allocator = std.testing.allocator;
1663 var a = try DynamicBitSetUnmanaged.initEmpty(allocator, 300);1674 var a = try DynamicBitSetUnmanaged.initEmpty(allocator, 300);
1664 try testing.expectEqual(@as(usize, 0), a.count());1675 try testing.expectEqual(@as(usize, 0), a.count());
...@@ -1712,6 +1723,8 @@ test "DynamicBitSetUnmanaged" {...@@ -1712,6 +1723,8 @@ test "DynamicBitSetUnmanaged" {
1712}1723}
17131724
1714test "DynamicBitSet" {1725test "DynamicBitSet" {
1726 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1727
1715 const allocator = std.testing.allocator;1728 const allocator = std.testing.allocator;
1716 var a = try DynamicBitSet.initEmpty(allocator, 300);1729 var a = try DynamicBitSet.initEmpty(allocator, 300);
1717 try testing.expectEqual(@as(usize, 0), a.count());1730 try testing.expectEqual(@as(usize, 0), a.count());
lib/std/compress/deflate/compressor.zig+2
...@@ -1069,6 +1069,8 @@ var deflate_tests = [_]DeflateTest{...@@ -1069,6 +1069,8 @@ var deflate_tests = [_]DeflateTest{
1069};1069};
10701070
1071test "deflate" {1071test "deflate" {
1072 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1073
1072 for (deflate_tests) |dt| {1074 for (deflate_tests) |dt| {
1073 var output = ArrayList(u8).init(testing.allocator);1075 var output = ArrayList(u8).init(testing.allocator);
1074 defer output.deinit();1076 defer output.deinit();
lib/std/compress/deflate/compressor_test.zig+18
...@@ -154,6 +154,8 @@ fn testToFromWithLimit(input: []const u8, limit: [11]u32) !void {...@@ -154,6 +154,8 @@ fn testToFromWithLimit(input: []const u8, limit: [11]u32) !void {
154}154}
155155
156test "deflate/inflate" {156test "deflate/inflate" {
157 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
158
157 var limits = [_]u32{0} ** 11;159 var limits = [_]u32{0} ** 11;
158160
159 var test0 = [_]u8{};161 var test0 = [_]u8{};
...@@ -178,6 +180,8 @@ test "deflate/inflate" {...@@ -178,6 +180,8 @@ test "deflate/inflate" {
178}180}
179181
180test "very long sparse chunk" {182test "very long sparse chunk" {
183 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
184
181 // A SparseReader returns a stream consisting of 0s ending with 65,536 (1<<16) 1s.185 // A SparseReader returns a stream consisting of 0s ending with 65,536 (1<<16) 1s.
182 // This tests missing hash references in a very large input.186 // This tests missing hash references in a very large input.
183 const SparseReader = struct {187 const SparseReader = struct {
...@@ -239,6 +243,8 @@ test "very long sparse chunk" {...@@ -239,6 +243,8 @@ test "very long sparse chunk" {
239}243}
240244
241test "compressor reset" {245test "compressor reset" {
246 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
247
242 for (std.enums.values(deflate.Compression)) |c| {248 for (std.enums.values(deflate.Compression)) |c| {
243 try testWriterReset(c, null);249 try testWriterReset(c, null);
244 try testWriterReset(c, "dict");250 try testWriterReset(c, "dict");
...@@ -289,6 +295,8 @@ fn testWriterReset(level: deflate.Compression, dict: ?[]const u8) !void {...@@ -289,6 +295,8 @@ fn testWriterReset(level: deflate.Compression, dict: ?[]const u8) !void {
289}295}
290296
291test "decompressor dictionary" {297test "decompressor dictionary" {
298 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
299
292 const dict = "hello world"; // dictionary300 const dict = "hello world"; // dictionary
293 const text = "hello again world";301 const text = "hello again world";
294302
...@@ -329,6 +337,8 @@ test "decompressor dictionary" {...@@ -329,6 +337,8 @@ test "decompressor dictionary" {
329}337}
330338
331test "compressor dictionary" {339test "compressor dictionary" {
340 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
341
332 const dict = "hello world";342 const dict = "hello world";
333 const text = "hello again world";343 const text = "hello again world";
334344
...@@ -375,6 +385,8 @@ test "compressor dictionary" {...@@ -375,6 +385,8 @@ test "compressor dictionary" {
375// Update the hash for best_speed only if d.index < d.maxInsertIndex385// Update the hash for best_speed only if d.index < d.maxInsertIndex
376// See https://golang.org/issue/2508386// See https://golang.org/issue/2508
377test "Go non-regression test for 2508" {387test "Go non-regression test for 2508" {
388 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
389
378 var comp = try compressor(390 var comp = try compressor(
379 testing.allocator,391 testing.allocator,
380 io.null_writer,392 io.null_writer,
...@@ -392,6 +404,8 @@ test "Go non-regression test for 2508" {...@@ -392,6 +404,8 @@ test "Go non-regression test for 2508" {
392}404}
393405
394test "deflate/inflate string" {406test "deflate/inflate string" {
407 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
408
395 const StringTest = struct {409 const StringTest = struct {
396 filename: []const u8,410 filename: []const u8,
397 limit: [11]u32,411 limit: [11]u32,
...@@ -439,6 +453,8 @@ test "deflate/inflate string" {...@@ -439,6 +453,8 @@ test "deflate/inflate string" {
439}453}
440454
441test "inflate reset" {455test "inflate reset" {
456 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
457
442 const strings = [_][]const u8{458 const strings = [_][]const u8{
443 "lorem ipsum izzle fo rizzle",459 "lorem ipsum izzle fo rizzle",
444 "the quick brown fox jumped over",460 "the quick brown fox jumped over",
...@@ -485,6 +501,8 @@ test "inflate reset" {...@@ -485,6 +501,8 @@ test "inflate reset" {
485}501}
486502
487test "inflate reset dictionary" {503test "inflate reset dictionary" {
504 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
505
488 const dict = "the lorem fox";506 const dict = "the lorem fox";
489 const strings = [_][]const u8{507 const strings = [_][]const u8{
490 "lorem ipsum izzle fo rizzle",508 "lorem ipsum izzle fo rizzle",
lib/std/compress/deflate/deflate_fast.zig+2
...@@ -649,6 +649,8 @@ test "best speed shift offsets" {...@@ -649,6 +649,8 @@ test "best speed shift offsets" {
649}649}
650650
651test "best speed reset" {651test "best speed reset" {
652 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
652 // test that encoding is consistent across a warparound of the table offset.654 // test that encoding is consistent across a warparound of the table offset.
653 // See https://github.com/golang/go/issues/34121655 // See https://github.com/golang/go/issues/34121
654 const fmt = std.fmt;656 const fmt = std.fmt;
lib/std/compress/deflate/deflate_fast_test.zig+5
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const expect = std.testing.expect;3const expect = std.testing.expect;
3const io = std.io;4const io = std.io;
4const mem = std.mem;5const mem = std.mem;
...@@ -11,6 +12,8 @@ const inflate = @import("decompressor.zig");...@@ -11,6 +12,8 @@ const inflate = @import("decompressor.zig");
11const deflate_const = @import("deflate_const.zig");12const deflate_const = @import("deflate_const.zig");
1213
13test "best speed" {14test "best speed" {
15 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
16
14 // Tests that round-tripping through deflate and then inflate recovers the original input.17 // Tests that round-tripping through deflate and then inflate recovers the original input.
15 // The Write sizes are near the thresholds in the compressor.encSpeed method (0, 16, 128), as well18 // The Write sizes are near the thresholds in the compressor.encSpeed method (0, 16, 128), as well
16 // as near `deflate_const.max_store_block_size` (65535).19 // as near `deflate_const.max_store_block_size` (65535).
...@@ -93,6 +96,8 @@ test "best speed" {...@@ -93,6 +96,8 @@ test "best speed" {
93}96}
9497
95test "best speed max match offset" {98test "best speed max match offset" {
99 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
100
96 const abc = "abcdefgh";101 const abc = "abcdefgh";
97 const xyz = "stuvwxyz";102 const xyz = "stuvwxyz";
98 const input_margin = 16 - 1;103 const input_margin = 16 - 1;
lib/std/compress/deflate/huffman_bit_writer.zig+6
...@@ -845,6 +845,8 @@ const testing = std.testing;...@@ -845,6 +845,8 @@ const testing = std.testing;
845const ArrayList = std.ArrayList;845const ArrayList = std.ArrayList;
846846
847test "writeBlockHuff" {847test "writeBlockHuff" {
848 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
849
848 // Tests huffman encoding against reference files to detect possible regressions.850 // Tests huffman encoding against reference files to detect possible regressions.
849 // If encoding/bit allocation changes you can regenerate these files851 // If encoding/bit allocation changes you can regenerate these files
850852
...@@ -1569,6 +1571,8 @@ const TestType = enum {...@@ -1569,6 +1571,8 @@ const TestType = enum {
1569};1571};
15701572
1571test "writeBlock" {1573test "writeBlock" {
1574 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1575
1572 // tests if the writeBlock encoding has changed.1576 // tests if the writeBlock encoding has changed.
15731577
1574 const ttype: TestType = .write_block;1578 const ttype: TestType = .write_block;
...@@ -1584,6 +1588,8 @@ test "writeBlock" {...@@ -1584,6 +1588,8 @@ test "writeBlock" {
1584}1588}
15851589
1586test "writeBlockDynamic" {1590test "writeBlockDynamic" {
1591 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1592
1587 // tests if the writeBlockDynamic encoding has changed.1593 // tests if the writeBlockDynamic encoding has changed.
15881594
1589 const ttype: TestType = .write_dyn_block;1595 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 {...@@ -360,6 +360,8 @@ fn byFreq(context: void, a: LiteralNode, b: LiteralNode) bool {
360}360}
361361
362test "generate a Huffman code from an array of frequencies" {362test "generate a Huffman code from an array of frequencies" {
363 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
364
363 var freqs: [19]u16 = [_]u16{365 var freqs: [19]u16 = [_]u16{
364 8, // 0366 8, // 0
365 1, // 1367 1, // 1
lib/std/compress/gzip.zig+2
...@@ -174,6 +174,8 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {...@@ -174,6 +174,8 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
174// https://tools.ietf.org/rfc/rfc1952.txt length=25037 bytes174// https://tools.ietf.org/rfc/rfc1952.txt length=25037 bytes
175// SHA256=164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67175// SHA256=164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67
176test "compressed data" {176test "compressed data" {
177 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
178
177 try testReader(179 try testReader(
178 @embedFile("testdata/rfc1952.txt.gz"),180 @embedFile("testdata/rfc1952.txt.gz"),
179 @embedFile("testdata/rfc1952.txt"),181 @embedFile("testdata/rfc1952.txt"),
lib/std/compress/lzma/test.zig+17
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("../../std.zig");1const std = @import("../../std.zig");
2const builtin = @import("builtin");
2const lzma = @import("../lzma.zig");3const lzma = @import("../lzma.zig");
34
4fn testDecompress(compressed: []const u8) ![]u8 {5fn testDecompress(compressed: []const u8) ![]u8 {
...@@ -22,6 +23,8 @@ fn testDecompressError(expected: anyerror, compressed: []const u8) !void {...@@ -22,6 +23,8 @@ fn testDecompressError(expected: anyerror, compressed: []const u8) !void {
22}23}
2324
24test "LZMA: decompress empty world" {25test "LZMA: decompress empty world" {
26 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
27
25 try testDecompressEqual(28 try testDecompressEqual(
26 "",29 "",
27 &[_]u8{30 &[_]u8{
...@@ -32,6 +35,8 @@ test "LZMA: decompress empty world" {...@@ -32,6 +35,8 @@ test "LZMA: decompress empty world" {
32}35}
3336
34test "LZMA: decompress hello world" {37test "LZMA: decompress hello world" {
38 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
39
35 try testDecompressEqual(40 try testDecompressEqual(
36 "Hello world\n",41 "Hello world\n",
37 &[_]u8{42 &[_]u8{
...@@ -43,6 +48,8 @@ test "LZMA: decompress hello world" {...@@ -43,6 +48,8 @@ test "LZMA: decompress hello world" {
43}48}
4449
45test "LZMA: decompress huge dict" {50test "LZMA: decompress huge dict" {
51 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
52
46 try testDecompressEqual(53 try testDecompressEqual(
47 "Hello world\n",54 "Hello world\n",
48 &[_]u8{55 &[_]u8{
...@@ -54,6 +61,8 @@ test "LZMA: decompress huge dict" {...@@ -54,6 +61,8 @@ test "LZMA: decompress huge dict" {
54}61}
5562
56test "LZMA: unknown size with end of payload marker" {63test "LZMA: unknown size with end of payload marker" {
64 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
65
57 try testDecompressEqual(66 try testDecompressEqual(
58 "Hello\nWorld!\n",67 "Hello\nWorld!\n",
59 @embedFile("testdata/good-unknown_size-with_eopm.lzma"),68 @embedFile("testdata/good-unknown_size-with_eopm.lzma"),
...@@ -61,6 +70,8 @@ test "LZMA: unknown size with end of payload marker" {...@@ -61,6 +70,8 @@ test "LZMA: unknown size with end of payload marker" {
61}70}
6271
63test "LZMA: known size without end of payload marker" {72test "LZMA: known size without end of payload marker" {
73 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
74
64 try testDecompressEqual(75 try testDecompressEqual(
65 "Hello\nWorld!\n",76 "Hello\nWorld!\n",
66 @embedFile("testdata/good-known_size-without_eopm.lzma"),77 @embedFile("testdata/good-known_size-without_eopm.lzma"),
...@@ -68,6 +79,8 @@ test "LZMA: known size without end of payload marker" {...@@ -68,6 +79,8 @@ test "LZMA: known size without end of payload marker" {
68}79}
6980
70test "LZMA: known size with end of payload marker" {81test "LZMA: known size with end of payload marker" {
82 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
83
71 try testDecompressEqual(84 try testDecompressEqual(
72 "Hello\nWorld!\n",85 "Hello\nWorld!\n",
73 @embedFile("testdata/good-known_size-with_eopm.lzma"),86 @embedFile("testdata/good-known_size-with_eopm.lzma"),
...@@ -75,6 +88,8 @@ test "LZMA: known size with end of payload marker" {...@@ -75,6 +88,8 @@ test "LZMA: known size with end of payload marker" {
75}88}
7689
77test "LZMA: too big uncompressed size in header" {90test "LZMA: too big uncompressed size in header" {
91 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
92
78 try testDecompressError(93 try testDecompressError(
79 error.CorruptInput,94 error.CorruptInput,
80 @embedFile("testdata/bad-too_big_size-with_eopm.lzma"),95 @embedFile("testdata/bad-too_big_size-with_eopm.lzma"),
...@@ -82,6 +97,8 @@ test "LZMA: too big uncompressed size in header" {...@@ -82,6 +97,8 @@ test "LZMA: too big uncompressed size in header" {
82}97}
8398
84test "LZMA: too small uncompressed size in header" {99test "LZMA: too small uncompressed size in header" {
100 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
101
85 try testDecompressError(102 try testDecompressError(
86 error.CorruptInput,103 error.CorruptInput,
87 @embedFile("testdata/bad-too_small_size-without_eopm-3.lzma"),104 @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;...@@ -50,6 +50,8 @@ const expectEqualSlices = std.testing.expectEqualSlices;
50const expectError = std.testing.expectError;50const expectError = std.testing.expectError;
5151
52test "Vec2D.init" {52test "Vec2D.init" {
53 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
54
53 const allocator = testing.allocator;55 const allocator = testing.allocator;
54 var vec2d = try Vec2D(i32).init(allocator, 1, .{ 2, 3 });56 var vec2d = try Vec2D(i32).init(allocator, 1, .{ 2, 3 });
55 defer vec2d.deinit(allocator);57 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 {...@@ -19,6 +19,8 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
19}19}
2020
21test "compressed data" {21test "compressed data" {
22 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
23
22 try testReader(@embedFile("testdata/good-0-empty.xz"), "");24 try testReader(@embedFile("testdata/good-0-empty.xz"), "");
2325
24 inline for ([_][]const u8{26 inline for ([_][]const u8{
lib/std/compress/zlib.zig+4
...@@ -199,6 +199,8 @@ fn testDecompress(data: []const u8, expected: []const u8) !void {...@@ -199,6 +199,8 @@ fn testDecompress(data: []const u8, expected: []const u8) !void {
199// https://tools.ietf.org/rfc/rfc1951.txt length=36944 bytes199// https://tools.ietf.org/rfc/rfc1951.txt length=36944 bytes
200// SHA256=5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009200// SHA256=5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009
201test "compressed data" {201test "compressed data" {
202 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
203
202 const rfc1951_txt = @embedFile("testdata/rfc1951.txt");204 const rfc1951_txt = @embedFile("testdata/rfc1951.txt");
203205
204 // Compressed with compression level = 0206 // Compressed with compression level = 0
...@@ -264,6 +266,8 @@ test "sanity checks" {...@@ -264,6 +266,8 @@ test "sanity checks" {
264}266}
265267
266test "compress data" {268test "compress data" {
269 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
270
267 const allocator = testing.allocator;271 const allocator = testing.allocator;
268 const rfc1951_txt = @embedFile("testdata/rfc1951.txt");272 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 {...@@ -264,6 +264,8 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
264}264}
265265
266test "zstandard decompression" {266test "zstandard decompression" {
267 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
268
267 const uncompressed = @embedFile("testdata/rfc8478.txt");269 const uncompressed = @embedFile("testdata/rfc8478.txt");
268 const compressed3 = @embedFile("testdata/rfc8478.txt.zst.3");270 const compressed3 = @embedFile("testdata/rfc8478.txt.zst.3");
269 const compressed19 = @embedFile("testdata/rfc8478.txt.zst.19");271 const compressed19 = @embedFile("testdata/rfc8478.txt.zst.19");
lib/std/crypto.zig+2
...@@ -314,6 +314,8 @@ test "CSPRNG" {...@@ -314,6 +314,8 @@ test "CSPRNG" {
314}314}
315315
316test "issue #4532: no index out of bounds" {316test "issue #4532: no index out of bounds" {
317 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
318
317 const types = [_]type{319 const types = [_]type{
318 hash.Md5,320 hash.Md5,
319 hash.Sha1,321 hash.Sha1,
lib/std/crypto/25519/curve25519.zig+5
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const crypto = std.crypto;3const crypto = std.crypto;
34
4const IdentityElementError = crypto.errors.IdentityElementError;5const IdentityElementError = crypto.errors.IdentityElementError;
...@@ -111,6 +112,8 @@ pub const Curve25519 = struct {...@@ -111,6 +112,8 @@ pub const Curve25519 = struct {
111};112};
112113
113test "curve25519" {114test "curve25519" {
115 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
116
114 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 };117 var s = [32]u8{ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8 };
115 const p = try Curve25519.basePoint.clampedMul(s);118 const p = try Curve25519.basePoint.clampedMul(s);
116 try p.rejectIdentity();119 try p.rejectIdentity();
...@@ -125,6 +128,8 @@ test "curve25519" {...@@ -125,6 +128,8 @@ test "curve25519" {
125}128}
126129
127test "curve25519 small order check" {130test "curve25519 small order check" {
131 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
132
128 var s: [32]u8 = [_]u8{1} ++ [_]u8{0} ** 31;133 var s: [32]u8 = [_]u8{1} ++ [_]u8{0} ** 31;
129 const small_order_ss: [7][32]u8 = .{134 const small_order_ss: [7][32]u8 = .{
130 .{135 .{
lib/std/crypto/25519/ed25519.zig+15-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1const builtin = @import("builtin");
2const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
3const crypto = std.crypto;3const crypto = std.crypto;
4const debug = std.debug;4const debug = std.debug;
5const fmt = std.fmt;5const fmt = std.fmt;
...@@ -484,6 +484,8 @@ pub const Ed25519 = struct {...@@ -484,6 +484,8 @@ pub const Ed25519 = struct {
484};484};
485485
486test "ed25519 key pair creation" {486test "ed25519 key pair creation" {
487 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
488
487 var seed: [32]u8 = undefined;489 var seed: [32]u8 = undefined;
488 _ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");490 _ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");
489 const key_pair = try Ed25519.KeyPair.create(seed);491 const key_pair = try Ed25519.KeyPair.create(seed);
...@@ -493,6 +495,8 @@ test "ed25519 key pair creation" {...@@ -493,6 +495,8 @@ test "ed25519 key pair creation" {
493}495}
494496
495test "ed25519 signature" {497test "ed25519 signature" {
498 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
499
496 var seed: [32]u8 = undefined;500 var seed: [32]u8 = undefined;
497 _ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");501 _ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");
498 const key_pair = try Ed25519.KeyPair.create(seed);502 const key_pair = try Ed25519.KeyPair.create(seed);
...@@ -505,6 +509,8 @@ test "ed25519 signature" {...@@ -505,6 +509,8 @@ test "ed25519 signature" {
505}509}
506510
507test "ed25519 batch verification" {511test "ed25519 batch verification" {
512 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
513
508 var i: usize = 0;514 var i: usize = 0;
509 while (i < 100) : (i += 1) {515 while (i < 100) : (i += 1) {
510 const key_pair = try Ed25519.KeyPair.create(null);516 const key_pair = try Ed25519.KeyPair.create(null);
...@@ -534,6 +540,8 @@ test "ed25519 batch verification" {...@@ -534,6 +540,8 @@ test "ed25519 batch verification" {
534}540}
535541
536test "ed25519 test vectors" {542test "ed25519 test vectors" {
543 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
544
537 const Vec = struct {545 const Vec = struct {
538 msg_hex: *const [64:0]u8,546 msg_hex: *const [64:0]u8,
539 public_key_hex: *const [64:0]u8,547 public_key_hex: *const [64:0]u8,
...@@ -636,6 +644,8 @@ test "ed25519 test vectors" {...@@ -636,6 +644,8 @@ test "ed25519 test vectors" {
636}644}
637645
638test "ed25519 with blind keys" {646test "ed25519 with blind keys" {
647 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
648
639 const BlindKeyPair = Ed25519.key_blinding.BlindKeyPair;649 const BlindKeyPair = Ed25519.key_blinding.BlindKeyPair;
640650
641 // Create a standard Ed25519 key pair651 // Create a standard Ed25519 key pair
...@@ -659,6 +669,8 @@ test "ed25519 with blind keys" {...@@ -659,6 +669,8 @@ test "ed25519 with blind keys" {
659}669}
660670
661test "ed25519 signatures with streaming" {671test "ed25519 signatures with streaming" {
672 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
673
662 const kp = try Ed25519.KeyPair.create(null);674 const kp = try Ed25519.KeyPair.create(null);
663675
664 var signer = try kp.signer(null);676 var signer = try kp.signer(null);
...@@ -675,6 +687,8 @@ test "ed25519 signatures with streaming" {...@@ -675,6 +687,8 @@ test "ed25519 signatures with streaming" {
675}687}
676688
677test "ed25519 key pair from secret key" {689test "ed25519 key pair from secret key" {
690 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
691
678 const kp = try Ed25519.KeyPair.create(null);692 const kp = try Ed25519.KeyPair.create(null);
679 const kp2 = try Ed25519.KeyPair.fromSecretKey(kp.secret_key);693 const kp2 = try Ed25519.KeyPair.fromSecretKey(kp.secret_key);
680 try std.testing.expectEqualSlices(u8, &kp.secret_key.toBytes(), &kp2.secret_key.toBytes());694 try std.testing.expectEqualSlices(u8, &kp.secret_key.toBytes(), &kp2.secret_key.toBytes());
lib/std/crypto/25519/edwards25519.zig+11
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const crypto = std.crypto;3const crypto = std.crypto;
3const debug = std.debug;4const debug = std.debug;
4const fmt = std.fmt;5const fmt = std.fmt;
...@@ -494,6 +495,8 @@ pub const Edwards25519 = struct {...@@ -494,6 +495,8 @@ pub const Edwards25519 = struct {
494const htest = @import("../test.zig");495const htest = @import("../test.zig");
495496
496test "edwards25519 packing/unpacking" {497test "edwards25519 packing/unpacking" {
498 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
499
497 const s = [_]u8{170} ++ [_]u8{0} ** 31;500 const s = [_]u8{170} ++ [_]u8{0} ** 31;
498 var b = Edwards25519.basePoint;501 var b = Edwards25519.basePoint;
499 const pk = try b.mul(s);502 const pk = try b.mul(s);
...@@ -530,6 +533,8 @@ test "edwards25519 packing/unpacking" {...@@ -530,6 +533,8 @@ test "edwards25519 packing/unpacking" {
530}533}
531534
532test "edwards25519 point addition/subtraction" {535test "edwards25519 point addition/subtraction" {
536 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
537
533 var s1: [32]u8 = undefined;538 var s1: [32]u8 = undefined;
534 var s2: [32]u8 = undefined;539 var s2: [32]u8 = undefined;
535 crypto.random.bytes(&s1);540 crypto.random.bytes(&s1);
...@@ -544,6 +549,8 @@ test "edwards25519 point addition/subtraction" {...@@ -544,6 +549,8 @@ test "edwards25519 point addition/subtraction" {
544}549}
545550
546test "edwards25519 uniform-to-point" {551test "edwards25519 uniform-to-point" {
552 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
553
547 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 };554 var r = [32]u8{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 };
548 var p = Edwards25519.fromUniform(r);555 var p = Edwards25519.fromUniform(r);
549 try htest.assertEqual("0691eee3cf70a0056df6bfa03120635636581b5c4ea571dfc680f78c7e0b4137", p.toBytes()[0..]);556 try htest.assertEqual("0691eee3cf70a0056df6bfa03120635636581b5c4ea571dfc680f78c7e0b4137", p.toBytes()[0..]);
...@@ -555,6 +562,8 @@ test "edwards25519 uniform-to-point" {...@@ -555,6 +562,8 @@ test "edwards25519 uniform-to-point" {
555562
556// Test vectors from draft-irtf-cfrg-hash-to-curve-12563// Test vectors from draft-irtf-cfrg-hash-to-curve-12
557test "edwards25519 hash-to-curve operation" {564test "edwards25519 hash-to-curve operation" {
565 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
566
558 var p = Edwards25519.fromString(true, "QUUX-V01-CS02-with-edwards25519_XMD:SHA-512_ELL2_RO_", "abc");567 var p = Edwards25519.fromString(true, "QUUX-V01-CS02-with-edwards25519_XMD:SHA-512_ELL2_RO_", "abc");
559 try htest.assertEqual("31558a26887f23fb8218f143e69d5f0af2e7831130bd5b432ef23883b895839a", p.toBytes()[0..]);568 try htest.assertEqual("31558a26887f23fb8218f143e69d5f0af2e7831130bd5b432ef23883b895839a", p.toBytes()[0..]);
560569
...@@ -563,6 +572,8 @@ test "edwards25519 hash-to-curve operation" {...@@ -563,6 +572,8 @@ test "edwards25519 hash-to-curve operation" {
563}572}
564573
565test "edwards25519 implicit reduction of invalid scalars" {574test "edwards25519 implicit reduction of invalid scalars" {
575 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
576
566 const s = [_]u8{0} ** 31 ++ [_]u8{255};577 const s = [_]u8{0} ** 31 ++ [_]u8{255};
567 const p1 = try Edwards25519.basePoint.mulPublic(s);578 const p1 = try Edwards25519.basePoint.mulPublic(s);
568 const p2 = try Edwards25519.basePoint.mul(s);579 const p2 = try Edwards25519.basePoint.mul(s);
lib/std/crypto/25519/ristretto255.zig+2
...@@ -168,6 +168,8 @@ pub const Ristretto255 = struct {...@@ -168,6 +168,8 @@ pub const Ristretto255 = struct {
168};168};
169169
170test "ristretto255" {170test "ristretto255" {
171 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
172
171 const p = Ristretto255.basePoint;173 const p = Ristretto255.basePoint;
172 var buf: [256]u8 = undefined;174 var buf: [256]u8 = undefined;
173 try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{s}", .{std.fmt.fmtSliceHexUpper(&p.toBytes())}), "E2F2AE0A6ABC4E71A884A961C500515F58E30B6AA582DD8DB6A65945E08D2D76");175 try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{s}", .{std.fmt.fmtSliceHexUpper(&p.toBytes())}), "E2F2AE0A6ABC4E71A884A961C500515F58E30B6AA582DD8DB6A65945E08D2D76");
lib/std/crypto/25519/x25519.zig+15
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const crypto = std.crypto;3const crypto = std.crypto;
3const mem = std.mem;4const mem = std.mem;
4const fmt = std.fmt;5const fmt = std.fmt;
...@@ -82,6 +83,8 @@ pub const X25519 = struct {...@@ -82,6 +83,8 @@ pub const X25519 = struct {
82const htest = @import("../test.zig");83const htest = @import("../test.zig");
8384
84test "x25519 public key calculation from secret key" {85test "x25519 public key calculation from secret key" {
86 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
87
85 var sk: [32]u8 = undefined;88 var sk: [32]u8 = undefined;
86 var pk_expected: [32]u8 = undefined;89 var pk_expected: [32]u8 = undefined;
87 _ = try fmt.hexToBytes(sk[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");90 _ = try fmt.hexToBytes(sk[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");
...@@ -91,6 +94,8 @@ test "x25519 public key calculation from secret key" {...@@ -91,6 +94,8 @@ test "x25519 public key calculation from secret key" {
91}94}
9295
93test "x25519 rfc7748 vector1" {96test "x25519 rfc7748 vector1" {
97 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
98
94 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 };99 const secret_key = [32]u8{ 0xa5, 0x46, 0xe3, 0x6b, 0xf0, 0x52, 0x7c, 0x9d, 0x3b, 0x16, 0x15, 0x4b, 0x82, 0x46, 0x5e, 0xdd, 0x62, 0x14, 0x4c, 0x0a, 0xc1, 0xfc, 0x5a, 0x18, 0x50, 0x6a, 0x22, 0x44, 0xba, 0x44, 0x9a, 0xc4 };
95 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 };100 const public_key = [32]u8{ 0xe6, 0xdb, 0x68, 0x67, 0x58, 0x30, 0x30, 0xdb, 0x35, 0x94, 0xc1, 0xa4, 0x24, 0xb1, 0x5f, 0x7c, 0x72, 0x66, 0x24, 0xec, 0x26, 0xb3, 0x35, 0x3b, 0x10, 0xa9, 0x03, 0xa6, 0xd0, 0xab, 0x1c, 0x4c };
96101
...@@ -101,6 +106,8 @@ test "x25519 rfc7748 vector1" {...@@ -101,6 +106,8 @@ test "x25519 rfc7748 vector1" {
101}106}
102107
103test "x25519 rfc7748 vector2" {108test "x25519 rfc7748 vector2" {
109 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
110
104 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 };111 const secret_key = [32]u8{ 0x4b, 0x66, 0xe9, 0xd4, 0xd1, 0xb4, 0x67, 0x3c, 0x5a, 0xd2, 0x26, 0x91, 0x95, 0x7d, 0x6a, 0xf5, 0xc1, 0x1b, 0x64, 0x21, 0xe0, 0xea, 0x01, 0xd4, 0x2c, 0xa4, 0x16, 0x9e, 0x79, 0x18, 0xba, 0x0d };
105 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 };112 const public_key = [32]u8{ 0xe5, 0x21, 0x0f, 0x12, 0x78, 0x68, 0x11, 0xd3, 0xf4, 0xb7, 0x95, 0x9d, 0x05, 0x38, 0xae, 0x2c, 0x31, 0xdb, 0xe7, 0x10, 0x6f, 0xc0, 0x3c, 0x3e, 0xfc, 0x4c, 0xd5, 0x49, 0xc7, 0x15, 0xa4, 0x93 };
106113
...@@ -111,6 +118,8 @@ test "x25519 rfc7748 vector2" {...@@ -111,6 +118,8 @@ test "x25519 rfc7748 vector2" {
111}118}
112119
113test "x25519 rfc7748 one iteration" {120test "x25519 rfc7748 one iteration" {
121 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
122
114 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 };123 const initial_value = [32]u8{ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
115 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 };124 const expected_output = [32]u8{ 0x42, 0x2c, 0x8e, 0x7a, 0x62, 0x27, 0xd7, 0xbc, 0xa1, 0x35, 0x0b, 0x3e, 0x2b, 0xb7, 0x27, 0x9f, 0x78, 0x97, 0xb8, 0x7b, 0xb6, 0x85, 0x4b, 0x78, 0x3c, 0x60, 0xe8, 0x03, 0x11, 0xae, 0x30, 0x79 };
116125
...@@ -128,6 +137,8 @@ test "x25519 rfc7748 one iteration" {...@@ -128,6 +137,8 @@ test "x25519 rfc7748 one iteration" {
128}137}
129138
130test "x25519 rfc7748 1,000 iterations" {139test "x25519 rfc7748 1,000 iterations" {
140 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
141
131 // These iteration tests are slow so we always skip them. Results have been verified.142 // These iteration tests are slow so we always skip them. Results have been verified.
132 if (true) {143 if (true) {
133 return error.SkipZigTest;144 return error.SkipZigTest;
...@@ -150,6 +161,8 @@ test "x25519 rfc7748 1,000 iterations" {...@@ -150,6 +161,8 @@ test "x25519 rfc7748 1,000 iterations" {
150}161}
151162
152test "x25519 rfc7748 1,000,000 iterations" {163test "x25519 rfc7748 1,000,000 iterations" {
164 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
165
153 if (true) {166 if (true) {
154 return error.SkipZigTest;167 return error.SkipZigTest;
155 }168 }
...@@ -171,6 +184,8 @@ test "x25519 rfc7748 1,000,000 iterations" {...@@ -171,6 +184,8 @@ test "x25519 rfc7748 1,000,000 iterations" {
171}184}
172185
173test "edwards25519 -> curve25519 map" {186test "edwards25519 -> curve25519 map" {
187 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
188
174 const ed_kp = try crypto.sign.Ed25519.KeyPair.create([_]u8{0x42} ** 32);189 const ed_kp = try crypto.sign.Ed25519.KeyPair.create([_]u8{0x42} ** 32);
175 const mont_kp = try X25519.KeyPair.fromEd25519(ed_kp);190 const mont_kp = try X25519.KeyPair.fromEd25519(ed_kp);
176 try htest.assertEqual("90e7595fc89e52fdfddce9c6a43d74dbf6047025ee0462d2d172e8b6a2841d6e", &mont_kp.secret_key);191 try htest.assertEqual("90e7595fc89e52fdfddce9c6a43d74dbf6047025ee0462d2d172e8b6a2841d6e", &mont_kp.secret_key);
lib/std/crypto/Certificate.zig+6
...@@ -624,6 +624,8 @@ pub fn parseTimeDigits(text: *const [2]u8, min: u8, max: u8) !u8 {...@@ -624,6 +624,8 @@ pub fn parseTimeDigits(text: *const [2]u8, min: u8, max: u8) !u8 {
624}624}
625625
626test parseTimeDigits {626test parseTimeDigits {
627 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
628
627 const expectEqual = std.testing.expectEqual;629 const expectEqual = std.testing.expectEqual;
628 try expectEqual(@as(u8, 0), try parseTimeDigits("00", 0, 99));630 try expectEqual(@as(u8, 0), try parseTimeDigits("00", 0, 99));
629 try expectEqual(@as(u8, 99), try parseTimeDigits("99", 0, 99));631 try expectEqual(@as(u8, 99), try parseTimeDigits("99", 0, 99));
...@@ -645,6 +647,8 @@ pub fn parseYear4(text: *const [4]u8) !u16 {...@@ -645,6 +647,8 @@ pub fn parseYear4(text: *const [4]u8) !u16 {
645}647}
646648
647test parseYear4 {649test parseYear4 {
650 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
651
648 const expectEqual = std.testing.expectEqual;652 const expectEqual = std.testing.expectEqual;
649 try expectEqual(@as(u16, 0), try parseYear4("0000"));653 try expectEqual(@as(u16, 0), try parseYear4("0000"));
650 try expectEqual(@as(u16, 9999), try parseYear4("9999"));654 try expectEqual(@as(u16, 9999), try parseYear4("9999"));
...@@ -1119,3 +1123,5 @@ pub const rsa = struct {...@@ -1119,3 +1123,5 @@ pub const rsa = struct {
1119 return res;1123 return res;
1120 }1124 }
1121};1125};
1126
1127const builtin = @import("builtin");
lib/std/crypto/Certificate/Bundle.zig+2
...@@ -318,6 +318,8 @@ const MapContext = struct {...@@ -318,6 +318,8 @@ const MapContext = struct {
318test "scan for OS-provided certificates" {318test "scan for OS-provided certificates" {
319 if (builtin.os.tag == .wasi) return error.SkipZigTest;319 if (builtin.os.tag == .wasi) return error.SkipZigTest;
320320
321 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
322
321 var bundle: Bundle = .{};323 var bundle: Bundle = .{};
322 defer bundle.deinit(std.testing.allocator);324 defer bundle.deinit(std.testing.allocator);
323325
lib/std/crypto/aegis.zig+15
...@@ -17,6 +17,7 @@...@@ -17,6 +17,7 @@
17//! https://datatracker.ietf.org/doc/draft-irtf-cfrg-aegis-aead/17//! https://datatracker.ietf.org/doc/draft-irtf-cfrg-aegis-aead/
1818
19const std = @import("std");19const std = @import("std");
20const builtin = @import("builtin");
20const crypto = std.crypto;21const crypto = std.crypto;
21const mem = std.mem;22const mem = std.mem;
22const assert = std.debug.assert;23const assert = std.debug.assert;
...@@ -513,6 +514,8 @@ const htest = @import("test.zig");...@@ -513,6 +514,8 @@ const htest = @import("test.zig");
513const testing = std.testing;514const testing = std.testing;
514515
515test "Aegis128L test vector 1" {516test "Aegis128L test vector 1" {
517 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
518
516 const key: [Aegis128L.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 14;519 const key: [Aegis128L.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 14;
517 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 13;520 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 13;
518 const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };521 const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
...@@ -536,6 +539,8 @@ test "Aegis128L test vector 1" {...@@ -536,6 +539,8 @@ test "Aegis128L test vector 1" {
536}539}
537540
538test "Aegis128L test vector 2" {541test "Aegis128L test vector 2" {
542 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
543
539 const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;544 const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;
540 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;545 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;
541 const ad = [_]u8{};546 const ad = [_]u8{};
...@@ -553,6 +558,8 @@ test "Aegis128L test vector 2" {...@@ -553,6 +558,8 @@ test "Aegis128L test vector 2" {
553}558}
554559
555test "Aegis128L test vector 3" {560test "Aegis128L test vector 3" {
561 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
562
556 const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;563 const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;
557 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;564 const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;
558 const ad = [_]u8{};565 const ad = [_]u8{};
...@@ -569,6 +576,8 @@ test "Aegis128L test vector 3" {...@@ -569,6 +576,8 @@ test "Aegis128L test vector 3" {
569}576}
570577
571test "Aegis256 test vector 1" {578test "Aegis256 test vector 1" {
579 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
580
572 const key: [Aegis256.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 30;581 const key: [Aegis256.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 30;
573 const nonce: [Aegis256.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 29;582 const nonce: [Aegis256.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 29;
574 const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };583 const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
...@@ -592,6 +601,8 @@ test "Aegis256 test vector 1" {...@@ -592,6 +601,8 @@ test "Aegis256 test vector 1" {
592}601}
593602
594test "Aegis256 test vector 2" {603test "Aegis256 test vector 2" {
604 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
605
595 const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;606 const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;
596 const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;607 const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;
597 const ad = [_]u8{};608 const ad = [_]u8{};
...@@ -609,6 +620,8 @@ test "Aegis256 test vector 2" {...@@ -609,6 +620,8 @@ test "Aegis256 test vector 2" {
609}620}
610621
611test "Aegis256 test vector 3" {622test "Aegis256 test vector 3" {
623 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
624
612 const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;625 const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;
613 const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;626 const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;
614 const ad = [_]u8{};627 const ad = [_]u8{};
...@@ -625,6 +638,8 @@ test "Aegis256 test vector 3" {...@@ -625,6 +638,8 @@ test "Aegis256 test vector 3" {
625}638}
626639
627test "Aegis MAC" {640test "Aegis MAC" {
641 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
642
628 const key = [_]u8{0x00} ** Aegis128LMac.key_length;643 const key = [_]u8{0x00} ** Aegis128LMac.key_length;
629 var msg: [64]u8 = undefined;644 var msg: [64]u8 = undefined;
630 for (&msg, 0..) |*m, i| {645 for (&msg, 0..) |*m, i| {
lib/std/crypto/aes.zig+10
...@@ -28,6 +28,8 @@ pub const Aes128 = impl.Aes128;...@@ -28,6 +28,8 @@ pub const Aes128 = impl.Aes128;
28pub const Aes256 = impl.Aes256;28pub const Aes256 = impl.Aes256;
2929
30test "ctr" {30test "ctr" {
31 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
32
31 // NIST SP 800-38A pp 55-5833 // NIST SP 800-38A pp 55-58
32 const ctr = @import("modes.zig").ctr;34 const ctr = @import("modes.zig").ctr;
3335
...@@ -53,6 +55,8 @@ test "ctr" {...@@ -53,6 +55,8 @@ test "ctr" {
53}55}
5456
55test "encrypt" {57test "encrypt" {
58 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
59
56 // Appendix B60 // Appendix B
57 {61 {
58 const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };62 const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
...@@ -82,6 +86,8 @@ test "encrypt" {...@@ -82,6 +86,8 @@ test "encrypt" {
82}86}
8387
84test "decrypt" {88test "decrypt" {
89 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
90
85 // Appendix B91 // Appendix B
86 {92 {
87 const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };93 const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
...@@ -111,6 +117,8 @@ test "decrypt" {...@@ -111,6 +117,8 @@ test "decrypt" {
111}117}
112118
113test "expand 128-bit key" {119test "expand 128-bit key" {
120 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
121
114 const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };122 const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
115 const exp_enc = [_]*const [32:0]u8{123 const exp_enc = [_]*const [32:0]u8{
116 "2b7e151628aed2a6abf7158809cf4f3c", "a0fafe1788542cb123a339392a6c7605", "f2c295f27a96b9435935807a7359f67f", "3d80477d4716fe3e1e237e446d7a883b", "ef44a541a8525b7fb671253bdb0bad00", "d4d1c6f87c839d87caf2b8bc11f915bc", "6d88a37a110b3efddbf98641ca0093fd", "4e54f70e5f5fc9f384a64fb24ea6dc4f", "ead27321b58dbad2312bf5607f8d292f", "ac7766f319fadc2128d12941575c006e", "d014f9a8c9ee2589e13f0cc8b6630ca6",124 "2b7e151628aed2a6abf7158809cf4f3c", "a0fafe1788542cb123a339392a6c7605", "f2c295f27a96b9435935807a7359f67f", "3d80477d4716fe3e1e237e446d7a883b", "ef44a541a8525b7fb671253bdb0bad00", "d4d1c6f87c839d87caf2b8bc11f915bc", "6d88a37a110b3efddbf98641ca0093fd", "4e54f70e5f5fc9f384a64fb24ea6dc4f", "ead27321b58dbad2312bf5607f8d292f", "ac7766f319fadc2128d12941575c006e", "d014f9a8c9ee2589e13f0cc8b6630ca6",
...@@ -133,6 +141,8 @@ test "expand 128-bit key" {...@@ -133,6 +141,8 @@ test "expand 128-bit key" {
133}141}
134142
135test "expand 256-bit key" {143test "expand 256-bit key" {
144 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
145
136 const key = [_]u8{146 const key = [_]u8{
137 0x60, 0x3d, 0xeb, 0x10,147 0x60, 0x3d, 0xeb, 0x10,
138 0x15, 0xca, 0x71, 0xbe,148 0x15, 0xca, 0x71, 0xbe,
lib/std/crypto/aes_gcm.zig+9
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const assert = std.debug.assert;3const assert = std.debug.assert;
3const crypto = std.crypto;4const crypto = std.crypto;
4const debug = std.debug;5const debug = std.debug;
...@@ -112,6 +113,8 @@ const htest = @import("test.zig");...@@ -112,6 +113,8 @@ const htest = @import("test.zig");
112const testing = std.testing;113const testing = std.testing;
113114
114test "Aes256Gcm - Empty message and no associated data" {115test "Aes256Gcm - Empty message and no associated data" {
116 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
117
115 const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;118 const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
116 const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;119 const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
117 const ad = "";120 const ad = "";
...@@ -124,6 +127,8 @@ test "Aes256Gcm - Empty message and no associated data" {...@@ -124,6 +127,8 @@ test "Aes256Gcm - Empty message and no associated data" {
124}127}
125128
126test "Aes256Gcm - Associated data only" {129test "Aes256Gcm - Associated data only" {
130 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
131
127 const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;132 const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
128 const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;133 const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
129 const m = "";134 const m = "";
...@@ -136,6 +141,8 @@ test "Aes256Gcm - Associated data only" {...@@ -136,6 +141,8 @@ test "Aes256Gcm - Associated data only" {
136}141}
137142
138test "Aes256Gcm - Message only" {143test "Aes256Gcm - Message only" {
144 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
145
139 const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;146 const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
140 const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;147 const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
141 const m = "Test with message only";148 const m = "Test with message only";
...@@ -153,6 +160,8 @@ test "Aes256Gcm - Message only" {...@@ -153,6 +160,8 @@ test "Aes256Gcm - Message only" {
153}160}
154161
155test "Aes256Gcm - Message and associated data" {162test "Aes256Gcm - Message and associated data" {
163 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
164
156 const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;165 const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
157 const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;166 const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
158 const m = "Test with message";167 const m = "Test with message";
lib/std/crypto/aes_ocb.zig+16-4
...@@ -261,7 +261,10 @@ inline fn xorWith(x: *Block, y: Block) void {...@@ -261,7 +261,10 @@ inline fn xorWith(x: *Block, y: Block) void {
261const hexToBytes = std.fmt.hexToBytes;261const hexToBytes = std.fmt.hexToBytes;
262262
263test "AesOcb test vector 1" {263test "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
266 var k: [Aes128Ocb.key_length]u8 = undefined;269 var k: [Aes128Ocb.key_length]u8 = undefined;
267 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;270 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
...@@ -280,7 +283,10 @@ test "AesOcb test vector 1" {...@@ -280,7 +283,10 @@ test "AesOcb test vector 1" {
280}283}
281284
282test "AesOcb test vector 2" {285test "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
285 var k: [Aes128Ocb.key_length]u8 = undefined;291 var k: [Aes128Ocb.key_length]u8 = undefined;
286 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;292 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
...@@ -301,7 +307,10 @@ test "AesOcb test vector 2" {...@@ -301,7 +307,10 @@ test "AesOcb test vector 2" {
301}307}
302308
303test "AesOcb test vector 3" {309test "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
306 var k: [Aes128Ocb.key_length]u8 = undefined;315 var k: [Aes128Ocb.key_length]u8 = undefined;
307 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;316 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
...@@ -325,7 +334,10 @@ test "AesOcb test vector 3" {...@@ -325,7 +334,10 @@ test "AesOcb test vector 3" {
325}334}
326335
327test "AesOcb test vector 4" {336test "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
330 var k: [Aes128Ocb.key_length]u8 = undefined;342 var k: [Aes128Ocb.key_length]u8 = undefined;
331 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;343 var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
lib/std/crypto/argon2.zig+14
...@@ -622,6 +622,8 @@ pub fn strVerify(...@@ -622,6 +622,8 @@ pub fn strVerify(
622}622}
623623
624test "argon2d" {624test "argon2d" {
625 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
626
625 const password = [_]u8{0x01} ** 32;627 const password = [_]u8{0x01} ** 32;
626 const salt = [_]u8{0x02} ** 16;628 const salt = [_]u8{0x02} ** 16;
627 const secret = [_]u8{0x03} ** 8;629 const secret = [_]u8{0x03} ** 8;
...@@ -647,6 +649,8 @@ test "argon2d" {...@@ -647,6 +649,8 @@ test "argon2d" {
647}649}
648650
649test "argon2i" {651test "argon2i" {
652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
650 const password = [_]u8{0x01} ** 32;654 const password = [_]u8{0x01} ** 32;
651 const salt = [_]u8{0x02} ** 16;655 const salt = [_]u8{0x02} ** 16;
652 const secret = [_]u8{0x03} ** 8;656 const secret = [_]u8{0x03} ** 8;
...@@ -672,6 +676,8 @@ test "argon2i" {...@@ -672,6 +676,8 @@ test "argon2i" {
672}676}
673677
674test "argon2id" {678test "argon2id" {
679 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
680
675 const password = [_]u8{0x01} ** 32;681 const password = [_]u8{0x01} ** 32;
676 const salt = [_]u8{0x02} ** 16;682 const salt = [_]u8{0x02} ** 16;
677 const secret = [_]u8{0x03} ** 8;683 const secret = [_]u8{0x03} ** 8;
...@@ -697,6 +703,8 @@ test "argon2id" {...@@ -697,6 +703,8 @@ test "argon2id" {
697}703}
698704
699test "kdf" {705test "kdf" {
706 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
707
700 const password = "password";708 const password = "password";
701 const salt = "somesalt";709 const salt = "somesalt";
702710
...@@ -896,6 +904,8 @@ test "kdf" {...@@ -896,6 +904,8 @@ test "kdf" {
896}904}
897905
898test "phc format hasher" {906test "phc format hasher" {
907 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
908
899 const allocator = std.testing.allocator;909 const allocator = std.testing.allocator;
900 const password = "testpass";910 const password = "testpass";
901911
...@@ -911,6 +921,8 @@ test "phc format hasher" {...@@ -911,6 +921,8 @@ test "phc format hasher" {
911}921}
912922
913test "password hash and password verify" {923test "password hash and password verify" {
924 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
925
914 const allocator = std.testing.allocator;926 const allocator = std.testing.allocator;
915 const password = "testpass";927 const password = "testpass";
916928
...@@ -924,6 +936,8 @@ test "password hash and password verify" {...@@ -924,6 +936,8 @@ test "password hash and password verify" {
924}936}
925937
926test "kdf derived key length" {938test "kdf derived key length" {
939 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
940
927 const allocator = std.testing.allocator;941 const allocator = std.testing.allocator;
928942
929 const password = "testpass";943 const password = "testpass";
lib/std/crypto/bcrypt.zig+7
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const base64 = std.base64;3const base64 = std.base64;
3const crypto = std.crypto;4const crypto = std.crypto;
4const debug = std.debug;5const debug = std.debug;
...@@ -753,6 +754,8 @@ pub fn strVerify(...@@ -753,6 +754,8 @@ pub fn strVerify(
753}754}
754755
755test "bcrypt codec" {756test "bcrypt codec" {
757 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
758
756 var salt: [salt_length]u8 = undefined;759 var salt: [salt_length]u8 = undefined;
757 crypto.random.bytes(&salt);760 crypto.random.bytes(&salt);
758 var salt_str: [salt_str_length]u8 = undefined;761 var salt_str: [salt_str_length]u8 = undefined;
...@@ -763,6 +766,8 @@ test "bcrypt codec" {...@@ -763,6 +766,8 @@ test "bcrypt codec" {
763}766}
764767
765test "bcrypt crypt format" {768test "bcrypt crypt format" {
769 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
770
766 var hash_options = HashOptions{771 var hash_options = HashOptions{
767 .params = .{ .rounds_log = 5 },772 .params = .{ .rounds_log = 5 },
768 .encoding = .crypt,773 .encoding = .crypt,
...@@ -803,6 +808,8 @@ test "bcrypt crypt format" {...@@ -803,6 +808,8 @@ test "bcrypt crypt format" {
803}808}
804809
805test "bcrypt phc format" {810test "bcrypt phc format" {
811 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
812
806 var hash_options = HashOptions{813 var hash_options = HashOptions{
807 .params = .{ .rounds_log = 5 },814 .params = .{ .rounds_log = 5 },
808 .encoding = .phc,815 .encoding = .phc,
lib/std/crypto/blake3.zig+3-1
...@@ -200,7 +200,7 @@ const CompressGeneric = struct {...@@ -200,7 +200,7 @@ const CompressGeneric = struct {
200 }200 }
201};201};
202202
203const compress = if (builtin.cpu.arch == .x86_64)203const compress = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_x86_64)
204 CompressVectorized.compress204 CompressVectorized.compress
205else205else
206 CompressGeneric.compress;206 CompressGeneric.compress;
...@@ -682,6 +682,8 @@ fn testBlake3(hasher: *Blake3, input_len: usize, expected_hex: [262]u8) !void {...@@ -682,6 +682,8 @@ fn testBlake3(hasher: *Blake3, input_len: usize, expected_hex: [262]u8) !void {
682}682}
683683
684test "BLAKE3 reference test cases" {684test "BLAKE3 reference test cases" {
685 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
686
685 var hash_state = Blake3.init(.{});687 var hash_state = Blake3.init(.{});
686 const hash = &hash_state;688 const hash = &hash_state;
687 var keyed_hash_state = Blake3.init(.{ .key = reference_test.key.* });689 var keyed_hash_state = Blake3.init(.{ .key = reference_test.key.* });
lib/std/crypto/chacha20.zig+22
...@@ -499,6 +499,8 @@ fn ChaChaNonVecImpl(comptime rounds_nb: usize) type {...@@ -499,6 +499,8 @@ fn ChaChaNonVecImpl(comptime rounds_nb: usize) type {
499fn ChaChaImpl(comptime rounds_nb: usize) type {499fn ChaChaImpl(comptime rounds_nb: usize) type {
500 switch (builtin.cpu.arch) {500 switch (builtin.cpu.arch) {
501 .x86_64 => {501 .x86_64 => {
502 if (builtin.zig_backend == .stage2_x86_64) return ChaChaNonVecImpl(rounds_nb);
503
502 const has_avx2 = std.Target.x86.featureSetHas(builtin.cpu.features, .avx2);504 const has_avx2 = std.Target.x86.featureSetHas(builtin.cpu.features, .avx2);
503 const has_avx512f = std.Target.x86.featureSetHas(builtin.cpu.features, .avx512f);505 const has_avx512f = std.Target.x86.featureSetHas(builtin.cpu.features, .avx512f);
504 if (has_avx512f) return ChaChaVecImpl(rounds_nb, 4);506 if (has_avx512f) return ChaChaVecImpl(rounds_nb, 4);
...@@ -757,6 +759,8 @@ fn XChaChaPoly1305(comptime rounds_nb: usize) type {...@@ -757,6 +759,8 @@ fn XChaChaPoly1305(comptime rounds_nb: usize) type {
757}759}
758760
759test "chacha20 AEAD API" {761test "chacha20 AEAD API" {
762 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
763
760 const aeads = [_]type{ ChaCha20Poly1305, XChaCha20Poly1305 };764 const aeads = [_]type{ ChaCha20Poly1305, XChaCha20Poly1305 };
761 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.";765 const m = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.";
762 const ad = "Additional data";766 const ad = "Additional data";
...@@ -778,6 +782,8 @@ test "chacha20 AEAD API" {...@@ -778,6 +782,8 @@ test "chacha20 AEAD API" {
778782
779// https://tools.ietf.org/html/rfc7539#section-2.4.2783// https://tools.ietf.org/html/rfc7539#section-2.4.2
780test "crypto.chacha20 test vector sunscreen" {784test "crypto.chacha20 test vector sunscreen" {
785 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
786
781 const expected_result = [_]u8{787 const expected_result = [_]u8{
782 0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80,788 0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80,
783 0x41, 0xba, 0x07, 0x28, 0xdd, 0x0d, 0x69, 0x81,789 0x41, 0xba, 0x07, 0x28, 0xdd, 0x0d, 0x69, 0x81,
...@@ -819,6 +825,8 @@ test "crypto.chacha20 test vector sunscreen" {...@@ -819,6 +825,8 @@ test "crypto.chacha20 test vector sunscreen" {
819825
820// https://tools.ietf.org/html/draft-agl-tls-chacha20poly1305-04#section-7826// https://tools.ietf.org/html/draft-agl-tls-chacha20poly1305-04#section-7
821test "crypto.chacha20 test vector 1" {827test "crypto.chacha20 test vector 1" {
828 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
829
822 const expected_result = [_]u8{830 const expected_result = [_]u8{
823 0x76, 0xb8, 0xe0, 0xad, 0xa0, 0xf1, 0x3d, 0x90,831 0x76, 0xb8, 0xe0, 0xad, 0xa0, 0xf1, 0x3d, 0x90,
824 0x40, 0x5d, 0x6a, 0xe5, 0x53, 0x86, 0xbd, 0x28,832 0x40, 0x5d, 0x6a, 0xe5, 0x53, 0x86, 0xbd, 0x28,
...@@ -853,6 +861,8 @@ test "crypto.chacha20 test vector 1" {...@@ -853,6 +861,8 @@ test "crypto.chacha20 test vector 1" {
853}861}
854862
855test "crypto.chacha20 test vector 2" {863test "crypto.chacha20 test vector 2" {
864 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
865
856 const expected_result = [_]u8{866 const expected_result = [_]u8{
857 0x45, 0x40, 0xf0, 0x5a, 0x9f, 0x1f, 0xb2, 0x96,867 0x45, 0x40, 0xf0, 0x5a, 0x9f, 0x1f, 0xb2, 0x96,
858 0xd7, 0x73, 0x6e, 0x7b, 0x20, 0x8e, 0x3c, 0x96,868 0xd7, 0x73, 0x6e, 0x7b, 0x20, 0x8e, 0x3c, 0x96,
...@@ -887,6 +897,8 @@ test "crypto.chacha20 test vector 2" {...@@ -887,6 +897,8 @@ test "crypto.chacha20 test vector 2" {
887}897}
888898
889test "crypto.chacha20 test vector 3" {899test "crypto.chacha20 test vector 3" {
900 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
901
890 const expected_result = [_]u8{902 const expected_result = [_]u8{
891 0xde, 0x9c, 0xba, 0x7b, 0xf3, 0xd6, 0x9e, 0xf5,903 0xde, 0x9c, 0xba, 0x7b, 0xf3, 0xd6, 0x9e, 0xf5,
892 0xe7, 0x86, 0xdc, 0x63, 0x97, 0x3f, 0x65, 0x3a,904 0xe7, 0x86, 0xdc, 0x63, 0x97, 0x3f, 0x65, 0x3a,
...@@ -921,6 +933,8 @@ test "crypto.chacha20 test vector 3" {...@@ -921,6 +933,8 @@ test "crypto.chacha20 test vector 3" {
921}933}
922934
923test "crypto.chacha20 test vector 4" {935test "crypto.chacha20 test vector 4" {
936 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
937
924 const expected_result = [_]u8{938 const expected_result = [_]u8{
925 0xef, 0x3f, 0xdf, 0xd6, 0xc6, 0x15, 0x78, 0xfb,939 0xef, 0x3f, 0xdf, 0xd6, 0xc6, 0x15, 0x78, 0xfb,
926 0xf5, 0xcf, 0x35, 0xbd, 0x3d, 0xd3, 0x3b, 0x80,940 0xf5, 0xcf, 0x35, 0xbd, 0x3d, 0xd3, 0x3b, 0x80,
...@@ -955,6 +969,8 @@ test "crypto.chacha20 test vector 4" {...@@ -955,6 +969,8 @@ test "crypto.chacha20 test vector 4" {
955}969}
956970
957test "crypto.chacha20 test vector 5" {971test "crypto.chacha20 test vector 5" {
972 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
973
958 const expected_result = [_]u8{974 const expected_result = [_]u8{
959 0xf7, 0x98, 0xa1, 0x89, 0xf1, 0x95, 0xe6, 0x69,975 0xf7, 0x98, 0xa1, 0x89, 0xf1, 0x95, 0xe6, 0x69,
960 0x82, 0x10, 0x5f, 0xfb, 0x64, 0x0b, 0xb7, 0x75,976 0x82, 0x10, 0x5f, 0xfb, 0x64, 0x0b, 0xb7, 0x75,
...@@ -1027,6 +1043,8 @@ test "crypto.chacha20 test vector 5" {...@@ -1027,6 +1043,8 @@ test "crypto.chacha20 test vector 5" {
1027}1043}
10281044
1029test "seal" {1045test "seal" {
1046 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1047
1030 {1048 {
1031 const m = "";1049 const m = "";
1032 const ad = "";1050 const ad = "";
...@@ -1077,6 +1095,8 @@ test "seal" {...@@ -1077,6 +1095,8 @@ test "seal" {
1077}1095}
10781096
1079test "open" {1097test "open" {
1098 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1099
1080 {1100 {
1081 const c = [_]u8{ 0xa0, 0x78, 0x4d, 0x7a, 0x47, 0x16, 0xf3, 0xfe, 0xb4, 0xf6, 0x4e, 0x7f, 0x4b, 0x39, 0xbf, 0x4 };1101 const c = [_]u8{ 0xa0, 0x78, 0x4d, 0x7a, 0x47, 0x16, 0xf3, 0xfe, 0xb4, 0xf6, 0x4e, 0x7f, 0x4b, 0x39, 0xbf, 0x4 };
1082 const ad = "";1102 const ad = "";
...@@ -1141,6 +1161,8 @@ test "open" {...@@ -1141,6 +1161,8 @@ test "open" {
1141}1161}
11421162
1143test "crypto.xchacha20" {1163test "crypto.xchacha20" {
1164 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1165
1144 const key = [_]u8{69} ** 32;1166 const key = [_]u8{69} ** 32;
1145 const nonce = [_]u8{42} ** 24;1167 const nonce = [_]u8{42} ** 24;
1146 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.";1168 const m = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.";
lib/std/crypto/cmac.zig+9
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const crypto = std.crypto;3const crypto = std.crypto;
3const mem = std.mem;4const mem = std.mem;
45
...@@ -93,6 +94,8 @@ pub fn Cmac(comptime BlockCipher: type) type {...@@ -93,6 +94,8 @@ pub fn Cmac(comptime BlockCipher: type) type {
93const testing = std.testing;94const testing = std.testing;
9495
95test "CmacAes128 - Example 1: len = 0" {96test "CmacAes128 - Example 1: len = 0" {
97 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
98
96 const key = [_]u8{99 const key = [_]u8{
97 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,100 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
98 };101 };
...@@ -106,6 +109,8 @@ test "CmacAes128 - Example 1: len = 0" {...@@ -106,6 +109,8 @@ test "CmacAes128 - Example 1: len = 0" {
106}109}
107110
108test "CmacAes128 - Example 2: len = 16" {111test "CmacAes128 - Example 2: len = 16" {
112 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
113
109 const key = [_]u8{114 const key = [_]u8{
110 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,115 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
111 };116 };
...@@ -121,6 +126,8 @@ test "CmacAes128 - Example 2: len = 16" {...@@ -121,6 +126,8 @@ test "CmacAes128 - Example 2: len = 16" {
121}126}
122127
123test "CmacAes128 - Example 3: len = 40" {128test "CmacAes128 - Example 3: len = 40" {
129 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
130
124 const key = [_]u8{131 const key = [_]u8{
125 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,132 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
126 };133 };
...@@ -138,6 +145,8 @@ test "CmacAes128 - Example 3: len = 40" {...@@ -138,6 +145,8 @@ test "CmacAes128 - Example 3: len = 40" {
138}145}
139146
140test "CmacAes128 - Example 4: len = 64" {147test "CmacAes128 - Example 4: len = 64" {
148 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
149
141 const key = [_]u8{150 const key = [_]u8{
142 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,151 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
143 };152 };
lib/std/crypto/ecdsa.zig+24-6
...@@ -372,7 +372,10 @@ pub fn Ecdsa(comptime Curve: type, comptime Hash: type) type {...@@ -372,7 +372,10 @@ pub fn Ecdsa(comptime Curve: type, comptime Hash: type) type {
372}372}
373373
374test "ECDSA - Basic operations over EcdsaP384Sha384" {374test "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
377 const Scheme = EcdsaP384Sha384;380 const Scheme = EcdsaP384Sha384;
378 const kp = try Scheme.KeyPair.create(null);381 const kp = try Scheme.KeyPair.create(null);
...@@ -388,7 +391,10 @@ test "ECDSA - Basic operations over EcdsaP384Sha384" {...@@ -388,7 +391,10 @@ test "ECDSA - Basic operations over EcdsaP384Sha384" {
388}391}
389392
390test "ECDSA - Basic operations over Secp256k1" {393test "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
393 const Scheme = EcdsaSecp256k1Sha256oSha256;399 const Scheme = EcdsaSecp256k1Sha256oSha256;
394 const kp = try Scheme.KeyPair.create(null);400 const kp = try Scheme.KeyPair.create(null);
...@@ -404,7 +410,10 @@ test "ECDSA - Basic operations over Secp256k1" {...@@ -404,7 +410,10 @@ test "ECDSA - Basic operations over Secp256k1" {
404}410}
405411
406test "ECDSA - Basic operations over EcdsaP384Sha256" {412test "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
409 const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);418 const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);
410 const kp = try Scheme.KeyPair.create(null);419 const kp = try Scheme.KeyPair.create(null);
...@@ -420,7 +429,10 @@ test "ECDSA - Basic operations over EcdsaP384Sha256" {...@@ -420,7 +429,10 @@ test "ECDSA - Basic operations over EcdsaP384Sha256" {
420}429}
421430
422test "ECDSA - Verifying a existing signature with EcdsaP384Sha256" {431test "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
425 const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);437 const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);
426 // zig fmt: off438 // zig fmt: off
...@@ -464,7 +476,10 @@ const TestVector = struct {...@@ -464,7 +476,10 @@ const TestVector = struct {
464};476};
465477
466test "ECDSA - Test vectors from Project Wycheproof" {478test "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
469 const vectors = [_]TestVector{484 const vectors = [_]TestVector{
470 .{ .key = "042927b10512bae3eddcfe467828128bad2903269919f7086069c8c4df6c732838c7787964eaac00e5921fb1498a60f4606766b3d9685001558d1a974e7341513e", .msg = "313233343030", .sig = "304402202ba3a8be6b94d5ec80a6d9d1190a436effe50d85a1eee859b8cc6af9bd5c2e1802204cd60b855d442f5b3c7b11eb6c4e0ae7525fe710fab9aa7c77a67f79e6fadd76", .result = .valid },485 .{ .key = "042927b10512bae3eddcfe467828128bad2903269919f7086069c8c4df6c732838c7787964eaac00e5921fb1498a60f4606766b3d9685001558d1a974e7341513e", .msg = "313233343030", .sig = "304402202ba3a8be6b94d5ec80a6d9d1190a436effe50d85a1eee859b8cc6af9bd5c2e1802204cd60b855d442f5b3c7b11eb6c4e0ae7525fe710fab9aa7c77a67f79e6fadd76", .result = .valid },
...@@ -878,7 +893,10 @@ fn tvTry(vector: TestVector) !void {...@@ -878,7 +893,10 @@ fn tvTry(vector: TestVector) !void {
878}893}
879894
880test "ECDSA - Sec1 encoding/decoding" {895test "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
883 const Scheme = EcdsaP384Sha384;901 const Scheme = EcdsaP384Sha384;
884 const kp = try Scheme.KeyPair.create(null);902 const kp = try Scheme.KeyPair.create(null);
lib/std/crypto/ff.zig+4-1
...@@ -912,7 +912,10 @@ const ct_unprotected = struct {...@@ -912,7 +912,10 @@ const ct_unprotected = struct {
912};912};
913913
914test {914test {
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
917 const M = Modulus(256);920 const M = Modulus(256);
918 const m = try M.fromPrimitive(u256, 3429938563481314093726330772853735541133072814650493833233);921 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 {...@@ -422,6 +422,8 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
422const htest = @import("test.zig");422const htest = @import("test.zig");
423423
424test "ghash" {424test "ghash" {
425 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
426
425 const key = [_]u8{0x42} ** 16;427 const key = [_]u8{0x42} ** 16;
426 const m = [_]u8{0x69} ** 256;428 const m = [_]u8{0x69} ** 256;
427429
...@@ -439,6 +441,8 @@ test "ghash" {...@@ -439,6 +441,8 @@ test "ghash" {
439}441}
440442
441test "ghash2" {443test "ghash2" {
444 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
445
442 var key: [16]u8 = undefined;446 var key: [16]u8 = undefined;
443 var i: usize = 0;447 var i: usize = 0;
444 while (i < key.len) : (i += 1) {448 while (i < key.len) : (i += 1) {
...@@ -472,6 +476,8 @@ test "ghash2" {...@@ -472,6 +476,8 @@ test "ghash2" {
472}476}
473477
474test "polyval" {478test "polyval" {
479 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
480
475 const key = [_]u8{0x42} ** 16;481 const key = [_]u8{0x42} ** 16;
476 const m = [_]u8{0x69} ** 256;482 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);...@@ -65,6 +65,8 @@ pub const Sha384oSha384 = Composition(sha2.Sha384, sha2.Sha384);
65pub const Sha512oSha512 = Composition(sha2.Sha512, sha2.Sha512);65pub const Sha512oSha512 = Composition(sha2.Sha512, sha2.Sha512);
6666
67test "Hash composition" {67test "Hash composition" {
68 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
69
68 const Sha256 = sha2.Sha256;70 const Sha256 = sha2.Sha256;
69 const msg = "test";71 const msg = "test";
7072
lib/std/crypto/hkdf.zig+2
...@@ -72,6 +72,8 @@ pub fn Hkdf(comptime Hmac: type) type {...@@ -72,6 +72,8 @@ pub fn Hkdf(comptime Hmac: type) type {
72const htest = @import("test.zig");72const htest = @import("test.zig");
7373
74test "Hkdf" {74test "Hkdf" {
75 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
76
75 const ikm = [_]u8{0x0b} ** 22;77 const ikm = [_]u8{0x0b} ** 22;
76 const salt = [_]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c };78 const salt = [_]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c };
77 const context = [_]u8{ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9 };79 const context = [_]u8{ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9 };
lib/std/crypto/kyber_d00.zig+28
...@@ -553,6 +553,8 @@ const inv_ntt_reductions = [_]i16{...@@ -553,6 +553,8 @@ const inv_ntt_reductions = [_]i16{
553};553};
554554
555test "invNTTReductions bounds" {555test "invNTTReductions bounds" {
556 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
557
556 // Checks whether the reductions proposed by invNTTReductions558 // Checks whether the reductions proposed by invNTTReductions
557 // don't overflow during invNTT().559 // don't overflow during invNTT().
558 var xs = [_]i32{1} ** 256; // start at |x| ≤ q560 var xs = [_]i32{1} ** 256; // start at |x| ≤ q
...@@ -656,6 +658,8 @@ fn montReduce(x: i32) i16 {...@@ -656,6 +658,8 @@ fn montReduce(x: i32) i16 {
656}658}
657659
658test "Test montReduce" {660test "Test montReduce" {
661 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
662
659 var rnd = RndGen.init(0);663 var rnd = RndGen.init(0);
660 for (0..1000) |_| {664 for (0..1000) |_| {
661 const bound = comptime @as(i32, Q) * (1 << 15);665 const bound = comptime @as(i32, Q) * (1 << 15);
...@@ -674,6 +678,8 @@ fn feToMont(x: i16) i16 {...@@ -674,6 +678,8 @@ fn feToMont(x: i16) i16 {
674}678}
675679
676test "Test feToMont" {680test "Test feToMont" {
681 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
682
677 var x: i32 = -(1 << 15);683 var x: i32 = -(1 << 15);
678 while (x < 1 << 15) : (x += 1) {684 while (x < 1 << 15) : (x += 1) {
679 const y = feToMont(@as(i16, @intCast(x)));685 const y = feToMont(@as(i16, @intCast(x)));
...@@ -707,6 +713,8 @@ fn feBarrettReduce(x: i16) i16 {...@@ -707,6 +713,8 @@ fn feBarrettReduce(x: i16) i16 {
707}713}
708714
709test "Test Barrett reduction" {715test "Test Barrett reduction" {
716 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
717
710 var x: i32 = -(1 << 15);718 var x: i32 = -(1 << 15);
711 while (x < 1 << 15) : (x += 1) {719 while (x < 1 << 15) : (x += 1) {
712 var y1 = feBarrettReduce(@as(i16, @intCast(x)));720 var y1 = feBarrettReduce(@as(i16, @intCast(x)));
...@@ -727,6 +735,8 @@ fn csubq(x: i16) i16 {...@@ -727,6 +735,8 @@ fn csubq(x: i16) i16 {
727}735}
728736
729test "Test csubq" {737test "Test csubq" {
738 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
739
730 var x: i32 = -29439;740 var x: i32 = -29439;
731 while (x < 1 << 15) : (x += 1) {741 while (x < 1 << 15) : (x += 1) {
732 const y1 = csubq(@as(i16, @intCast(x)));742 const y1 = csubq(@as(i16, @intCast(x)));
...@@ -1466,6 +1476,8 @@ fn cmov(comptime len: usize, dst: *[len]u8, src: [len]u8, b: u1) void {...@@ -1466,6 +1476,8 @@ fn cmov(comptime len: usize, dst: *[len]u8, src: [len]u8, b: u1) void {
1466}1476}
14671477
1468test "MulHat" {1478test "MulHat" {
1479 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1480
1469 var rnd = RndGen.init(0);1481 var rnd = RndGen.init(0);
14701482
1471 for (0..100) |_| {1483 for (0..100) |_| {
...@@ -1497,6 +1509,8 @@ test "MulHat" {...@@ -1497,6 +1509,8 @@ test "MulHat" {
1497}1509}
14981510
1499test "NTT" {1511test "NTT" {
1512 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1513
1500 var rnd = RndGen.init(0);1514 var rnd = RndGen.init(0);
15011515
1502 for (0..1000) |_| {1516 for (0..1000) |_| {
...@@ -1520,6 +1534,8 @@ test "NTT" {...@@ -1520,6 +1534,8 @@ test "NTT" {
1520}1534}
15211535
1522test "Compression" {1536test "Compression" {
1537 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1538
1523 var rnd = RndGen.init(0);1539 var rnd = RndGen.init(0);
1524 inline for (.{ 1, 4, 5, 10, 11 }) |d| {1540 inline for (.{ 1, 4, 5, 10, 11 }) |d| {
1525 for (0..1000) |_| {1541 for (0..1000) |_| {
...@@ -1532,6 +1548,8 @@ test "Compression" {...@@ -1532,6 +1548,8 @@ test "Compression" {
1532}1548}
15331549
1534test "noise" {1550test "noise" {
1551 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1552
1535 var seed: [32]u8 = undefined;1553 var seed: [32]u8 = undefined;
1536 for (&seed, 0..) |*s, i| {1554 for (&seed, 0..) |*s, i| {
1537 s.* = @as(u8, @intCast(i));1555 s.* = @as(u8, @intCast(i));
...@@ -1578,6 +1596,8 @@ test "noise" {...@@ -1578,6 +1596,8 @@ test "noise" {
1578}1596}
15791597
1580test "uniform sampling" {1598test "uniform sampling" {
1599 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1600
1581 var seed: [32]u8 = undefined;1601 var seed: [32]u8 = undefined;
1582 for (&seed, 0..) |*s, i| {1602 for (&seed, 0..) |*s, i| {
1583 s.* = @as(u8, @intCast(i));1603 s.* = @as(u8, @intCast(i));
...@@ -1611,6 +1631,8 @@ test "uniform sampling" {...@@ -1611,6 +1631,8 @@ test "uniform sampling" {
1611}1631}
16121632
1613test "Polynomial packing" {1633test "Polynomial packing" {
1634 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1635
1614 var rnd = RndGen.init(0);1636 var rnd = RndGen.init(0);
16151637
1616 for (0..1000) |_| {1638 for (0..1000) |_| {
...@@ -1620,6 +1642,8 @@ test "Polynomial packing" {...@@ -1620,6 +1642,8 @@ test "Polynomial packing" {
1620}1642}
16211643
1622test "Test inner PKE" {1644test "Test inner PKE" {
1645 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1646
1623 var seed: [32]u8 = undefined;1647 var seed: [32]u8 = undefined;
1624 var pt: [32]u8 = undefined;1648 var pt: [32]u8 = undefined;
1625 for (&seed, &pt, 0..) |*s, *p, i| {1649 for (&seed, &pt, 0..) |*s, *p, i| {
...@@ -1641,6 +1665,8 @@ test "Test inner PKE" {...@@ -1641,6 +1665,8 @@ test "Test inner PKE" {
1641}1665}
16421666
1643test "Test happy flow" {1667test "Test happy flow" {
1668 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1669
1644 var seed: [64]u8 = undefined;1670 var seed: [64]u8 = undefined;
1645 for (&seed, 0..) |*s, i| {1671 for (&seed, 0..) |*s, i| {
1646 s.* = @as(u8, @intCast(i));1672 s.* = @as(u8, @intCast(i));
...@@ -1667,6 +1693,8 @@ test "Test happy flow" {...@@ -1667,6 +1693,8 @@ test "Test happy flow" {
1667const sha2 = crypto.hash.sha2;1693const sha2 = crypto.hash.sha2;
16681694
1669test "NIST KAT test" {1695test "NIST KAT test" {
1696 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1697
1670 inline for (.{1698 inline for (.{
1671 .{ Kyber512, "e9c2bd37133fcb40772f81559f14b1f58dccd1c816701be9ba6214d43baf4547" },1699 .{ Kyber512, "e9c2bd37133fcb40772f81559f14b1f58dccd1c816701be9ba6214d43baf4547" },
1672 .{ Kyber1024, "89248f2f33f7f4f7051729111f3049c409a933ec904aedadf035f30fa5646cd5" },1700 .{ Kyber1024, "89248f2f33f7f4f7051729111f3049c409a933ec904aedadf035f30fa5646cd5" },
lib/std/crypto/pbkdf2.zig+15
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const mem = std.mem;3const mem = std.mem;
3const maxInt = std.math.maxInt;4const maxInt = std.math.maxInt;
4const OutputTooLongError = std.crypto.errors.OutputTooLongError;5const OutputTooLongError = std.crypto.errors.OutputTooLongError;
...@@ -151,6 +152,8 @@ const HmacSha1 = std.crypto.auth.hmac.HmacSha1;...@@ -151,6 +152,8 @@ const HmacSha1 = std.crypto.auth.hmac.HmacSha1;
151// RFC 6070 PBKDF2 HMAC-SHA1 Test Vectors152// RFC 6070 PBKDF2 HMAC-SHA1 Test Vectors
152153
153test "RFC 6070 one iteration" {154test "RFC 6070 one iteration" {
155 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
156
154 const p = "password";157 const p = "password";
155 const s = "salt";158 const s = "salt";
156 const c = 1;159 const c = 1;
...@@ -166,6 +169,8 @@ test "RFC 6070 one iteration" {...@@ -166,6 +169,8 @@ test "RFC 6070 one iteration" {
166}169}
167170
168test "RFC 6070 two iterations" {171test "RFC 6070 two iterations" {
172 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
173
169 const p = "password";174 const p = "password";
170 const s = "salt";175 const s = "salt";
171 const c = 2;176 const c = 2;
...@@ -181,6 +186,8 @@ test "RFC 6070 two iterations" {...@@ -181,6 +186,8 @@ test "RFC 6070 two iterations" {
181}186}
182187
183test "RFC 6070 4096 iterations" {188test "RFC 6070 4096 iterations" {
189 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
190
184 const p = "password";191 const p = "password";
185 const s = "salt";192 const s = "salt";
186 const c = 4096;193 const c = 4096;
...@@ -196,6 +203,8 @@ test "RFC 6070 4096 iterations" {...@@ -196,6 +203,8 @@ test "RFC 6070 4096 iterations" {
196}203}
197204
198test "RFC 6070 16,777,216 iterations" {205test "RFC 6070 16,777,216 iterations" {
206 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
207
199 // These iteration tests are slow so we always skip them. Results have been verified.208 // These iteration tests are slow so we always skip them. Results have been verified.
200 if (true) {209 if (true) {
201 return error.SkipZigTest;210 return error.SkipZigTest;
...@@ -216,6 +225,8 @@ test "RFC 6070 16,777,216 iterations" {...@@ -216,6 +225,8 @@ test "RFC 6070 16,777,216 iterations" {
216}225}
217226
218test "RFC 6070 multi-block salt and password" {227test "RFC 6070 multi-block salt and password" {
228 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
229
219 const p = "passwordPASSWORDpassword";230 const p = "passwordPASSWORDpassword";
220 const s = "saltSALTsaltSALTsaltSALTsaltSALTsalt";231 const s = "saltSALTsaltSALTsaltSALTsaltSALTsalt";
221 const c = 4096;232 const c = 4096;
...@@ -231,6 +242,8 @@ test "RFC 6070 multi-block salt and password" {...@@ -231,6 +242,8 @@ test "RFC 6070 multi-block salt and password" {
231}242}
232243
233test "RFC 6070 embedded NUL" {244test "RFC 6070 embedded NUL" {
245 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
246
234 const p = "pass\x00word";247 const p = "pass\x00word";
235 const s = "sa\x00lt";248 const s = "sa\x00lt";
236 const c = 4096;249 const c = 4096;
...@@ -246,6 +259,8 @@ test "RFC 6070 embedded NUL" {...@@ -246,6 +259,8 @@ test "RFC 6070 embedded NUL" {
246}259}
247260
248test "Very large dk_len" {261test "Very large dk_len" {
262 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
263
249 // This test allocates 8GB of memory and is expected to take several hours to run.264 // This test allocates 8GB of memory and is expected to take several hours to run.
250 if (true) {265 if (true) {
251 return error.SkipZigTest;266 return error.SkipZigTest;
lib/std/crypto/pcurves/p256.zig+2
...@@ -478,5 +478,7 @@ pub const AffineCoordinates = struct {...@@ -478,5 +478,7 @@ pub const AffineCoordinates = struct {
478};478};
479479
480test {480test {
481 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
482
481 _ = @import("tests/p256.zig");483 _ = @import("tests/p256.zig");
482}484}
lib/std/crypto/pcurves/p384.zig+4-1
...@@ -478,7 +478,10 @@ pub const AffineCoordinates = struct {...@@ -478,7 +478,10 @@ pub const AffineCoordinates = struct {
478};478};
479479
480test {480test {
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
483 _ = @import("tests/p384.zig");486 _ = @import("tests/p384.zig");
484}487}
lib/std/crypto/pcurves/secp256k1.zig+4-1
...@@ -556,7 +556,10 @@ pub const AffineCoordinates = struct {...@@ -556,7 +556,10 @@ pub const AffineCoordinates = struct {
556};556};
557557
558test {558test {
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
561 _ = @import("tests/secp256k1.zig");564 _ = @import("tests/secp256k1.zig");
562}565}
lib/std/crypto/phc_encoding.zig+9
...@@ -1,6 +1,7 @@...@@ -1,6 +1,7 @@
1// https://github.com/P-H-C/phc-string-format1// https://github.com/P-H-C/phc-string-format
22
3const std = @import("std");3const std = @import("std");
4const builtin = @import("builtin");
4const fmt = std.fmt;5const fmt = std.fmt;
5const io = std.io;6const io = std.io;
6const mem = std.mem;7const mem = std.mem;
...@@ -263,6 +264,8 @@ fn kvSplit(str: []const u8) !struct { key: []const u8, value: []const u8 } {...@@ -263,6 +264,8 @@ fn kvSplit(str: []const u8) !struct { key: []const u8, value: []const u8 } {
263}264}
264265
265test "phc format - encoding/decoding" {266test "phc format - encoding/decoding" {
267 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
268
266 const Input = struct {269 const Input = struct {
267 str: []const u8,270 str: []const u8,
268 HashResult: type,271 HashResult: type,
...@@ -348,18 +351,24 @@ test "phc format - encoding/decoding" {...@@ -348,18 +351,24 @@ test "phc format - encoding/decoding" {
348}351}
349352
350test "phc format - empty input string" {353test "phc format - empty input string" {
354 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
355
351 const s = "";356 const s = "";
352 const v = deserialize(struct { alg_id: []const u8 }, s);357 const v = deserialize(struct { alg_id: []const u8 }, s);
353 try std.testing.expectError(Error.InvalidEncoding, v);358 try std.testing.expectError(Error.InvalidEncoding, v);
354}359}
355360
356test "phc format - hash without salt" {361test "phc format - hash without salt" {
362 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
363
357 const s = "$scrypt";364 const s = "$scrypt";
358 const v = deserialize(struct { alg_id: []const u8, hash: BinValue(16) }, s);365 const v = deserialize(struct { alg_id: []const u8, hash: BinValue(16) }, s);
359 try std.testing.expectError(Error.InvalidEncoding, v);366 try std.testing.expectError(Error.InvalidEncoding, v);
360}367}
361368
362test "phc format - calcSize" {369test "phc format - calcSize" {
370 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
371
363 const s = "$scrypt$v=1$ln=15,r=8,p=1$c2FsdHNhbHQ$dGVzdHBhc3M";372 const s = "$scrypt$v=1$ln=15,r=8,p=1$c2FsdHNhbHQ$dGVzdHBhc3M";
364 const v = try deserialize(struct {373 const v = try deserialize(struct {
365 alg_id: []const u8,374 alg_id: []const u8,
lib/std/crypto/poly1305.zig+2
...@@ -196,6 +196,8 @@ pub const Poly1305 = struct {...@@ -196,6 +196,8 @@ pub const Poly1305 = struct {
196};196};
197197
198test "poly1305 rfc7439 vector1" {198test "poly1305 rfc7439 vector1" {
199 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
200
199 const expected_mac = "\xa8\x06\x1d\xc1\x30\x51\x36\xc6\xc2\x2b\x8b\xaf\x0c\x01\x27\xa9";201 const expected_mac = "\xa8\x06\x1d\xc1\x30\x51\x36\xc6\xc2\x2b\x8b\xaf\x0c\x01\x27\xa9";
200202
201 const msg = "Cryptographic Forum Research Group";203 const msg = "Cryptographic Forum Research Group";
lib/std/crypto/salsa20.zig+12
...@@ -555,6 +555,8 @@ pub const SealedBox = struct {...@@ -555,6 +555,8 @@ pub const SealedBox = struct {
555const htest = @import("test.zig");555const htest = @import("test.zig");
556556
557test "(x)salsa20" {557test "(x)salsa20" {
558 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
559
558 const key = [_]u8{0x69} ** 32;560 const key = [_]u8{0x69} ** 32;
559 const nonce = [_]u8{0x42} ** 8;561 const nonce = [_]u8{0x42} ** 8;
560 const msg = [_]u8{0} ** 20;562 const msg = [_]u8{0} ** 20;
...@@ -569,6 +571,8 @@ test "(x)salsa20" {...@@ -569,6 +571,8 @@ test "(x)salsa20" {
569}571}
570572
571test "xsalsa20poly1305" {573test "xsalsa20poly1305" {
574 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
575
572 var msg: [100]u8 = undefined;576 var msg: [100]u8 = undefined;
573 var msg2: [msg.len]u8 = undefined;577 var msg2: [msg.len]u8 = undefined;
574 var c: [msg.len]u8 = undefined;578 var c: [msg.len]u8 = undefined;
...@@ -584,6 +588,8 @@ test "xsalsa20poly1305" {...@@ -584,6 +588,8 @@ test "xsalsa20poly1305" {
584}588}
585589
586test "xsalsa20poly1305 secretbox" {590test "xsalsa20poly1305 secretbox" {
591 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
592
587 var msg: [100]u8 = undefined;593 var msg: [100]u8 = undefined;
588 var msg2: [msg.len]u8 = undefined;594 var msg2: [msg.len]u8 = undefined;
589 var key: [XSalsa20Poly1305.key_length]u8 = undefined;595 var key: [XSalsa20Poly1305.key_length]u8 = undefined;
...@@ -598,6 +604,8 @@ test "xsalsa20poly1305 secretbox" {...@@ -598,6 +604,8 @@ test "xsalsa20poly1305 secretbox" {
598}604}
599605
600test "xsalsa20poly1305 box" {606test "xsalsa20poly1305 box" {
607 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
608
601 var msg: [100]u8 = undefined;609 var msg: [100]u8 = undefined;
602 var msg2: [msg.len]u8 = undefined;610 var msg2: [msg.len]u8 = undefined;
603 var nonce: [Box.nonce_length]u8 = undefined;611 var nonce: [Box.nonce_length]u8 = undefined;
...@@ -612,6 +620,8 @@ test "xsalsa20poly1305 box" {...@@ -612,6 +620,8 @@ test "xsalsa20poly1305 box" {
612}620}
613621
614test "xsalsa20poly1305 sealedbox" {622test "xsalsa20poly1305 sealedbox" {
623 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
624
615 var msg: [100]u8 = undefined;625 var msg: [100]u8 = undefined;
616 var msg2: [msg.len]u8 = undefined;626 var msg2: [msg.len]u8 = undefined;
617 var boxed: [msg.len + SealedBox.seal_length]u8 = undefined;627 var boxed: [msg.len + SealedBox.seal_length]u8 = undefined;
...@@ -623,6 +633,8 @@ test "xsalsa20poly1305 sealedbox" {...@@ -623,6 +633,8 @@ test "xsalsa20poly1305 sealedbox" {
623}633}
624634
625test "secretbox twoblocks" {635test "secretbox twoblocks" {
636 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
637
626 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 };638 const key = [_]u8{ 0xc9, 0xc9, 0x4d, 0xcf, 0x68, 0xbe, 0x00, 0xe4, 0x7f, 0xe6, 0x13, 0x26, 0xfc, 0xc4, 0x2f, 0xd0, 0xdb, 0x93, 0x91, 0x1c, 0x09, 0x94, 0x89, 0xe1, 0x1b, 0x88, 0x63, 0x18, 0x86, 0x64, 0x8b, 0x7b };
627 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 };639 const nonce = [_]u8{ 0xa4, 0x33, 0xe9, 0x0a, 0x07, 0x68, 0x6e, 0x9a, 0x2b, 0x6d, 0xd4, 0x59, 0x04, 0x72, 0x3e, 0xd3, 0x8a, 0x67, 0x55, 0xc7, 0x9e, 0x3e, 0x77, 0xdc };
628 const msg = [_]u8{'a'} ** 97;640 const msg = [_]u8{'a'} ** 97;
lib/std/crypto/scrypt.zig+5
...@@ -3,6 +3,7 @@...@@ -3,6 +3,7 @@
3// https://github.com/Tarsnap/scrypt3// https://github.com/Tarsnap/scrypt
44
5const std = @import("std");5const std = @import("std");
6const builtin = @import("builtin");
6const crypto = std.crypto;7const crypto = std.crypto;
7const fmt = std.fmt;8const fmt = std.fmt;
8const io = std.io;9const io = std.io;
...@@ -683,6 +684,8 @@ test "unix-scrypt" {...@@ -683,6 +684,8 @@ test "unix-scrypt" {
683}684}
684685
685test "crypt format" {686test "crypt format" {
687 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
688
686 const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D";689 const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D";
687 const params = try crypt_format.deserialize(crypt_format.HashResult(32), str);690 const params = try crypt_format.deserialize(crypt_format.HashResult(32), str);
688 var buf: [str.len]u8 = undefined;691 var buf: [str.len]u8 = undefined;
...@@ -691,6 +694,8 @@ test "crypt format" {...@@ -691,6 +694,8 @@ test "crypt format" {
691}694}
692695
693test "kdf fast" {696test "kdf fast" {
697 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
698
694 const TestVector = struct {699 const TestVector = struct {
695 password: []const u8,700 password: []const u8,
696 salt: []const u8,701 salt: []const u8,
lib/std/crypto/sha2.zig+11-1
...@@ -238,7 +238,7 @@ fn Sha2x32(comptime params: Sha2Params32) type {...@@ -238,7 +238,7 @@ fn Sha2x32(comptime params: Sha2Params32) type {
238 return;238 return;
239 },239 },
240 // C backend doesn't currently support passing vectors to inline asm.240 // C backend doesn't currently support passing vectors to inline asm.
241 .x86_64 => if (builtin.zig_backend != .stage2_c and comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .sha, .avx2 })) {241 .x86_64 => if (builtin.zig_backend != .stage2_c and builtin.zig_backend != .stage2_x86_64 and comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .sha, .avx2 })) {
242 var x: v4u32 = [_]u32{ d.s[5], d.s[4], d.s[1], d.s[0] };242 var x: v4u32 = [_]u32{ d.s[5], d.s[4], d.s[1], d.s[0] };
243 var y: v4u32 = [_]u32{ d.s[7], d.s[6], d.s[3], d.s[2] };243 var y: v4u32 = [_]u32{ d.s[7], d.s[6], d.s[3], d.s[2] };
244 const s_v = @as(*[16]v4u32, @ptrCast(&s));244 const s_v = @as(*[16]v4u32, @ptrCast(&s));
...@@ -406,12 +406,16 @@ fn Sha2x32(comptime params: Sha2Params32) type {...@@ -406,12 +406,16 @@ fn Sha2x32(comptime params: Sha2Params32) type {
406}406}
407407
408test "sha224 single" {408test "sha224 single" {
409 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
410
409 try htest.assertEqualHash(Sha224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", "");411 try htest.assertEqualHash(Sha224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", "");
410 try htest.assertEqualHash(Sha224, "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc");412 try htest.assertEqualHash(Sha224, "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc");
411 try htest.assertEqualHash(Sha224, "c97ca9a559850ce97a04a96def6d99a9e0e0e2ab14e6b8df265fc0b3", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");413 try htest.assertEqualHash(Sha224, "c97ca9a559850ce97a04a96def6d99a9e0e0e2ab14e6b8df265fc0b3", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
412}414}
413415
414test "sha224 streaming" {416test "sha224 streaming" {
417 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
418
415 var h = Sha224.init(.{});419 var h = Sha224.init(.{});
416 var out: [28]u8 = undefined;420 var out: [28]u8 = undefined;
417421
...@@ -432,12 +436,16 @@ test "sha224 streaming" {...@@ -432,12 +436,16 @@ test "sha224 streaming" {
432}436}
433437
434test "sha256 single" {438test "sha256 single" {
439 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
440
435 try htest.assertEqualHash(Sha256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "");441 try htest.assertEqualHash(Sha256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "");
436 try htest.assertEqualHash(Sha256, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc");442 try htest.assertEqualHash(Sha256, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc");
437 try htest.assertEqualHash(Sha256, "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");443 try htest.assertEqualHash(Sha256, "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
438}444}
439445
440test "sha256 streaming" {446test "sha256 streaming" {
447 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
448
441 var h = Sha256.init(.{});449 var h = Sha256.init(.{});
442 var out: [32]u8 = undefined;450 var out: [32]u8 = undefined;
443451
...@@ -458,6 +466,8 @@ test "sha256 streaming" {...@@ -458,6 +466,8 @@ test "sha256 streaming" {
458}466}
459467
460test "sha256 aligned final" {468test "sha256 aligned final" {
469 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
470
461 var block = [_]u8{0} ** Sha256.block_length;471 var block = [_]u8{0} ** Sha256.block_length;
462 var out: [Sha256.digest_length]u8 = undefined;472 var out: [Sha256.digest_length]u8 = undefined;
463473
lib/std/crypto/utils.zig+2
...@@ -149,6 +149,8 @@ test "crypto.utils.timingSafeEql" {...@@ -149,6 +149,8 @@ test "crypto.utils.timingSafeEql" {
149}149}
150150
151test "crypto.utils.timingSafeEql (vectors)" {151test "crypto.utils.timingSafeEql (vectors)" {
152 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
153
152 var a: [100]u8 = undefined;154 var a: [100]u8 = undefined;
153 var b: [100]u8 = undefined;155 var b: [100]u8 = undefined;
154 random.bytes(a[0..]);156 random.bytes(a[0..]);
lib/std/debug.zig+2
...@@ -2513,6 +2513,8 @@ pub fn dumpStackPointerAddr(prefix: []const u8) void {...@@ -2513,6 +2513,8 @@ pub fn dumpStackPointerAddr(prefix: []const u8) void {
2513}2513}
25142514
2515test "manage resources correctly" {2515test "manage resources correctly" {
2516 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2517
2516 if (builtin.os.tag == .wasi) return error.SkipZigTest;2518 if (builtin.os.tag == .wasi) return error.SkipZigTest;
25172519
2518 if (builtin.os.tag == .windows) {2520 if (builtin.os.tag == .windows) {
lib/std/dwarf/expressions.zig+2
...@@ -1054,6 +1054,8 @@ fn isOpcodeRegisterLocation(opcode: u8) bool {...@@ -1054,6 +1054,8 @@ fn isOpcodeRegisterLocation(opcode: u8) bool {
10541054
1055const testing = std.testing;1055const testing = std.testing;
1056test "DWARF expressions" {1056test "DWARF expressions" {
1057 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1058
1057 const allocator = std.testing.allocator;1059 const allocator = std.testing.allocator;
10581060
1059 const options = ExpressionOptions{};1061 const options = ExpressionOptions{};
lib/std/fifo.zig+2
...@@ -505,6 +505,8 @@ test "LinearFifo(u8, .Dynamic)" {...@@ -505,6 +505,8 @@ test "LinearFifo(u8, .Dynamic)" {
505}505}
506506
507test "LinearFifo" {507test "LinearFifo" {
508 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
509
508 inline for ([_]type{ u1, u8, u16, u64 }) |T| {510 inline for ([_]type{ u1, u8, u16, u64 }) |T| {
509 inline for ([_]LinearFifoBufferType{ LinearFifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| {511 inline for ([_]LinearFifoBufferType{ LinearFifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| {
510 const FifoType = LinearFifo(T, bt);512 const FifoType = LinearFifo(T, bt);
lib/std/fmt.zig+24
...@@ -2129,6 +2129,8 @@ test "int.small" {...@@ -2129,6 +2129,8 @@ test "int.small" {
2129}2129}
21302130
2131test "int.specifier" {2131test "int.specifier" {
2132 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2133
2132 {2134 {
2133 const value: u8 = 'a';2135 const value: u8 = 'a';
2134 try expectFmt("u8: a\n", "u8: {c}\n", .{value});2136 try expectFmt("u8: a\n", "u8: {c}\n", .{value});
...@@ -2179,6 +2181,8 @@ test "int.padded" {...@@ -2179,6 +2181,8 @@ test "int.padded" {
2179}2181}
21802182
2181test "buffer" {2183test "buffer" {
2184 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2185
2182 {2186 {
2183 var buf1: [32]u8 = undefined;2187 var buf1: [32]u8 = undefined;
2184 var fbs = std.io.fixedBufferStream(&buf1);2188 var fbs = std.io.fixedBufferStream(&buf1);
...@@ -2375,6 +2379,8 @@ test "float.scientific" {...@@ -2375,6 +2379,8 @@ test "float.scientific" {
2375}2379}
23762380
2377test "float.scientific.precision" {2381test "float.scientific.precision" {
2382 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2383
2378 try expectFmt("f64: 1.40971e-42", "f64: {e:.5}", .{@as(f64, 1.409706e-42)});2384 try expectFmt("f64: 1.40971e-42", "f64: {e:.5}", .{@as(f64, 1.409706e-42)});
2379 try expectFmt("f64: 1.00000e-09", "f64: {e:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 814313563))))});2385 try expectFmt("f64: 1.00000e-09", "f64: {e:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 814313563))))});
2380 try expectFmt("f64: 7.81250e-03", "f64: {e:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 1006632960))))});2386 try expectFmt("f64: 7.81250e-03", "f64: {e:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 1006632960))))});
...@@ -2435,6 +2441,8 @@ test "float.hexadecimal" {...@@ -2435,6 +2441,8 @@ test "float.hexadecimal" {
2435}2441}
24362442
2437test "float.hexadecimal.precision" {2443test "float.hexadecimal.precision" {
2444 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2445
2438 try expectFmt("f16: 0x1.5p-2", "f16: {x:.1}", .{@as(f16, 1.0 / 3.0)});2446 try expectFmt("f16: 0x1.5p-2", "f16: {x:.1}", .{@as(f16, 1.0 / 3.0)});
2439 try expectFmt("f32: 0x1.555p-2", "f32: {x:.3}", .{@as(f32, 1.0 / 3.0)});2447 try expectFmt("f32: 0x1.555p-2", "f32: {x:.3}", .{@as(f32, 1.0 / 3.0)});
2440 try expectFmt("f64: 0x1.55555p-2", "f64: {x:.5}", .{@as(f64, 1.0 / 3.0)});2448 try expectFmt("f64: 0x1.55555p-2", "f64: {x:.5}", .{@as(f64, 1.0 / 3.0)});
...@@ -2449,6 +2457,8 @@ test "float.hexadecimal.precision" {...@@ -2449,6 +2457,8 @@ test "float.hexadecimal.precision" {
2449}2457}
24502458
2451test "float.decimal" {2459test "float.decimal" {
2460 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2461
2452 try expectFmt("f64: 152314000000000000000000000000", "f64: {d}", .{@as(f64, 1.52314e+29)});2462 try expectFmt("f64: 152314000000000000000000000000", "f64: {d}", .{@as(f64, 1.52314e+29)});
2453 try expectFmt("f32: 0", "f32: {d}", .{@as(f32, 0.0)});2463 try expectFmt("f32: 0", "f32: {d}", .{@as(f32, 0.0)});
2454 try expectFmt("f32: 0", "f32: {d:.0}", .{@as(f32, 0.0)});2464 try expectFmt("f32: 0", "f32: {d:.0}", .{@as(f32, 0.0)});
...@@ -2472,6 +2482,8 @@ test "float.decimal" {...@@ -2472,6 +2482,8 @@ test "float.decimal" {
2472}2482}
24732483
2474test "float.libc.sanity" {2484test "float.libc.sanity" {
2485 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2486
2475 try expectFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 916964781))))});2487 try expectFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 916964781))))});
2476 try expectFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 925353389))))});2488 try expectFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 925353389))))});
2477 try expectFmt("f64: 0.10000", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 1036831278))))});2489 try expectFmt("f64: 0.10000", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 1036831278))))});
...@@ -2491,6 +2503,8 @@ test "float.libc.sanity" {...@@ -2491,6 +2503,8 @@ test "float.libc.sanity" {
2491}2503}
24922504
2493test "custom" {2505test "custom" {
2506 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2507
2494 const Vec2 = struct {2508 const Vec2 = struct {
2495 const SelfType = @This();2509 const SelfType = @This();
2496 x: f32,2510 x: f32,
...@@ -2669,6 +2683,8 @@ test "formatFloatValue with comptime_float" {...@@ -2669,6 +2683,8 @@ test "formatFloatValue with comptime_float" {
2669}2683}
26702684
2671test "formatType max_depth" {2685test "formatType max_depth" {
2686 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2687
2672 const Vec2 = struct {2688 const Vec2 = struct {
2673 const SelfType = @This();2689 const SelfType = @This();
2674 x: f32,2690 x: f32,
...@@ -2735,6 +2751,8 @@ test "formatType max_depth" {...@@ -2735,6 +2751,8 @@ test "formatType max_depth" {
2735}2751}
27362752
2737test "positional" {2753test "positional" {
2754 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2755
2738 try expectFmt("2 1 0", "{2} {1} {0}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });2756 try expectFmt("2 1 0", "{2} {1} {0}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
2739 try expectFmt("2 1 0", "{2} {1} {}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });2757 try expectFmt("2 1 0", "{2} {1} {}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
2740 try expectFmt("0 0", "{0} {0}", .{@as(usize, 0)});2758 try expectFmt("0 0", "{0} {0}", .{@as(usize, 0)});
...@@ -2743,14 +2761,20 @@ test "positional" {...@@ -2743,14 +2761,20 @@ test "positional" {
2743}2761}
27442762
2745test "positional with specifier" {2763test "positional with specifier" {
2764 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2765
2746 try expectFmt("10.0", "{0d:.1}", .{@as(f64, 9.999)});2766 try expectFmt("10.0", "{0d:.1}", .{@as(f64, 9.999)});
2747}2767}
27482768
2749test "positional/alignment/width/precision" {2769test "positional/alignment/width/precision" {
2770 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2771
2750 try expectFmt("10.0", "{0d: >3.1}", .{@as(f64, 9.999)});2772 try expectFmt("10.0", "{0d: >3.1}", .{@as(f64, 9.999)});
2751}2773}
27522774
2753test "vector" {2775test "vector" {
2776 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2777
2754 if (builtin.target.cpu.arch == .riscv64) {2778 if (builtin.target.cpu.arch == .riscv64) {
2755 // https://github.com/ziglang/zig/issues/44862779 // https://github.com/ziglang/zig/issues/4486
2756 return error.SkipZigTest;2780 return error.SkipZigTest;
lib/std/fmt/parse_float.zig+17-1
...@@ -1,8 +1,8 @@...@@ -1,8 +1,8 @@
1pub const parseFloat = @import("parse_float/parse_float.zig").parseFloat;1pub const parseFloat = @import("parse_float/parse_float.zig").parseFloat;
2pub const ParseFloatError = @import("parse_float/parse_float.zig").ParseFloatError;2pub const ParseFloatError = @import("parse_float/parse_float.zig").ParseFloatError;
33
4const builtin = @import("builtin");
5const std = @import("std");4const std = @import("std");
5const builtin = @import("builtin");
6const math = std.math;6const math = std.math;
7const testing = std.testing;7const testing = std.testing;
8const expect = testing.expect;8const expect = testing.expect;
...@@ -14,6 +14,8 @@ const epsilon = 1e-7;...@@ -14,6 +14,8 @@ const epsilon = 1e-7;
14// See https://github.com/tiehuis/parse-number-fxx-test-data for a wider-selection of test-data.14// See https://github.com/tiehuis/parse-number-fxx-test-data for a wider-selection of test-data.
1515
16test "fmt.parseFloat" {16test "fmt.parseFloat" {
17 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
18
17 inline for ([_]type{ f16, f32, f64, f128 }) |T| {19 inline for ([_]type{ f16, f32, f64, f128 }) |T| {
18 try testing.expectError(error.InvalidCharacter, parseFloat(T, ""));20 try testing.expectError(error.InvalidCharacter, parseFloat(T, ""));
19 try testing.expectError(error.InvalidCharacter, parseFloat(T, " 1"));21 try testing.expectError(error.InvalidCharacter, parseFloat(T, " 1"));
...@@ -70,6 +72,8 @@ test "fmt.parseFloat" {...@@ -70,6 +72,8 @@ test "fmt.parseFloat" {
70}72}
7173
72test "fmt.parseFloat nan and inf" {74test "fmt.parseFloat nan and inf" {
75 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
76
73 inline for ([_]type{ f16, f32, f64, f128 }) |T| {77 inline for ([_]type{ f16, f32, f64, f128 }) |T| {
74 const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);78 const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
7579
...@@ -80,16 +84,22 @@ test "fmt.parseFloat nan and inf" {...@@ -80,16 +84,22 @@ test "fmt.parseFloat nan and inf" {
80}84}
8185
82test "fmt.parseFloat #11169" {86test "fmt.parseFloat #11169" {
87 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
88
83 try expectEqual(try parseFloat(f128, "9007199254740993.0"), 9007199254740993.0);89 try expectEqual(try parseFloat(f128, "9007199254740993.0"), 9007199254740993.0);
84}90}
8591
86test "fmt.parseFloat hex.special" {92test "fmt.parseFloat hex.special" {
93 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
94
87 try testing.expect(math.isNan(try parseFloat(f32, "nAn")));95 try testing.expect(math.isNan(try parseFloat(f32, "nAn")));
88 try testing.expect(math.isPositiveInf(try parseFloat(f32, "iNf")));96 try testing.expect(math.isPositiveInf(try parseFloat(f32, "iNf")));
89 try testing.expect(math.isPositiveInf(try parseFloat(f32, "+Inf")));97 try testing.expect(math.isPositiveInf(try parseFloat(f32, "+Inf")));
90 try testing.expect(math.isNegativeInf(try parseFloat(f32, "-iNf")));98 try testing.expect(math.isNegativeInf(try parseFloat(f32, "-iNf")));
91}99}
92test "fmt.parseFloat hex.zero" {100test "fmt.parseFloat hex.zero" {
101 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
102
93 try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0"));103 try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0"));
94 try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "-0x0"));104 try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "-0x0"));
95 try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0p42"));105 try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0p42"));
...@@ -98,6 +108,8 @@ test "fmt.parseFloat hex.zero" {...@@ -98,6 +108,8 @@ test "fmt.parseFloat hex.zero" {
98}108}
99109
100test "fmt.parseFloat hex.f16" {110test "fmt.parseFloat hex.f16" {
111 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
112
101 try testing.expectEqual(try parseFloat(f16, "0x1p0"), 1.0);113 try testing.expectEqual(try parseFloat(f16, "0x1p0"), 1.0);
102 try testing.expectEqual(try parseFloat(f16, "-0x1p-1"), -0.5);114 try testing.expectEqual(try parseFloat(f16, "-0x1p-1"), -0.5);
103 try testing.expectEqual(try parseFloat(f16, "0x10p+10"), 16384.0);115 try testing.expectEqual(try parseFloat(f16, "0x10p+10"), 16384.0);
...@@ -114,6 +126,8 @@ test "fmt.parseFloat hex.f16" {...@@ -114,6 +126,8 @@ test "fmt.parseFloat hex.f16" {
114}126}
115127
116test "fmt.parseFloat hex.f32" {128test "fmt.parseFloat hex.f32" {
129 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
130
117 try testing.expectError(error.InvalidCharacter, parseFloat(f32, "0x"));131 try testing.expectError(error.InvalidCharacter, parseFloat(f32, "0x"));
118 try testing.expectEqual(try parseFloat(f32, "0x1p0"), 1.0);132 try testing.expectEqual(try parseFloat(f32, "0x1p0"), 1.0);
119 try testing.expectEqual(try parseFloat(f32, "-0x1p-1"), -0.5);133 try testing.expectEqual(try parseFloat(f32, "-0x1p-1"), -0.5);
...@@ -148,6 +162,8 @@ test "fmt.parseFloat hex.f64" {...@@ -148,6 +162,8 @@ test "fmt.parseFloat hex.f64" {
148 try testing.expectEqual(try parseFloat(f64, "-0x1p-1074"), -math.floatTrueMin(f64));162 try testing.expectEqual(try parseFloat(f64, "-0x1p-1074"), -math.floatTrueMin(f64));
149}163}
150test "fmt.parseFloat hex.f128" {164test "fmt.parseFloat hex.f128" {
165 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
166
151 try testing.expectEqual(try parseFloat(f128, "0x1p0"), 1.0);167 try testing.expectEqual(try parseFloat(f128, "0x1p0"), 1.0);
152 try testing.expectEqual(try parseFloat(f128, "-0x1p-1"), -0.5);168 try testing.expectEqual(try parseFloat(f128, "-0x1p-1"), -0.5);
153 try testing.expectEqual(try parseFloat(f128, "0x10p+10"), 16384.0);169 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...@@ -3244,13 +3244,15 @@ fn copy_file(fd_in: os.fd_t, fd_out: os.fd_t, maybe_size: ?u64) CopyFileRawError
3244}3244}
32453245
3246test {3246test {
3247 if (builtin.os.tag != .wasi) {3247 if (builtin.zig_backend != .stage2_x86_64) {
3248 _ = &makeDirAbsolute;3248 if (builtin.os.tag != .wasi) {
3249 _ = &makeDirAbsoluteZ;3249 _ = &makeDirAbsolute;
3250 _ = &copyFileAbsolute;3250 _ = &makeDirAbsoluteZ;
3251 _ = &updateFileAbsolute;3251 _ = &copyFileAbsolute;
3252 _ = &updateFileAbsolute;
3253 }
3254 _ = &Dir.copyFile;
3252 }3255 }
3253 _ = &Dir.copyFile;
3254 _ = @import("fs/test.zig");3256 _ = @import("fs/test.zig");
3255 _ = @import("fs/path.zig");3257 _ = @import("fs/path.zig");
3256 _ = @import("fs/file.zig");3258 _ = @import("fs/file.zig");
lib/std/fs/test.zig+104
...@@ -124,6 +124,8 @@ fn testWithAllSupportedPathTypes(test_func: anytype) !void {...@@ -124,6 +124,8 @@ fn testWithAllSupportedPathTypes(test_func: anytype) !void {
124}124}
125125
126test "Dir.readLink" {126test "Dir.readLink" {
127 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
128
127 try testWithAllSupportedPathTypes(struct {129 try testWithAllSupportedPathTypes(struct {
128 fn impl(ctx: *TestContext) !void {130 fn impl(ctx: *TestContext) !void {
129 // Create some targets131 // Create some targets
...@@ -161,6 +163,8 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo...@@ -161,6 +163,8 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo
161}163}
162164
163test "relative symlink to parent directory" {165test "relative symlink to parent directory" {
166 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
167
164 var tmp = tmpDir(.{});168 var tmp = tmpDir(.{});
165 defer tmp.cleanup();169 defer tmp.cleanup();
166170
...@@ -178,6 +182,8 @@ test "relative symlink to parent directory" {...@@ -178,6 +182,8 @@ test "relative symlink to parent directory" {
178}182}
179183
180test "openDir" {184test "openDir" {
185 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
186
181 try testWithAllSupportedPathTypes(struct {187 try testWithAllSupportedPathTypes(struct {
182 fn impl(ctx: *TestContext) !void {188 fn impl(ctx: *TestContext) !void {
183 const allocator = ctx.arena.allocator();189 const allocator = ctx.arena.allocator();
...@@ -196,6 +202,8 @@ test "openDir" {...@@ -196,6 +202,8 @@ test "openDir" {
196test "accessAbsolute" {202test "accessAbsolute" {
197 if (builtin.os.tag == .wasi) return error.SkipZigTest;203 if (builtin.os.tag == .wasi) return error.SkipZigTest;
198204
205 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
206
199 var tmp = tmpDir(.{});207 var tmp = tmpDir(.{});
200 defer tmp.cleanup();208 defer tmp.cleanup();
201209
...@@ -214,6 +222,8 @@ test "accessAbsolute" {...@@ -214,6 +222,8 @@ test "accessAbsolute" {
214test "openDirAbsolute" {222test "openDirAbsolute" {
215 if (builtin.os.tag == .wasi) return error.SkipZigTest;223 if (builtin.os.tag == .wasi) return error.SkipZigTest;
216224
225 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
226
217 var tmp = tmpDir(.{});227 var tmp = tmpDir(.{});
218 defer tmp.cleanup();228 defer tmp.cleanup();
219229
...@@ -252,6 +262,8 @@ test "openDir non-cwd parent .." {...@@ -252,6 +262,8 @@ test "openDir non-cwd parent .." {
252 else => {},262 else => {},
253 }263 }
254264
265 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
266
255 var tmp = tmpDir(.{});267 var tmp = tmpDir(.{});
256 defer tmp.cleanup();268 defer tmp.cleanup();
257269
...@@ -273,6 +285,8 @@ test "openDir non-cwd parent .." {...@@ -273,6 +285,8 @@ test "openDir non-cwd parent .." {
273test "readLinkAbsolute" {285test "readLinkAbsolute" {
274 if (builtin.os.tag == .wasi) return error.SkipZigTest;286 if (builtin.os.tag == .wasi) return error.SkipZigTest;
275287
288 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
289
276 var tmp = tmpDir(.{});290 var tmp = tmpDir(.{});
277 defer tmp.cleanup();291 defer tmp.cleanup();
278292
...@@ -323,6 +337,8 @@ fn testReadLinkAbsolute(target_path: []const u8, symlink_path: []const u8) !void...@@ -323,6 +337,8 @@ fn testReadLinkAbsolute(target_path: []const u8, symlink_path: []const u8) !void
323}337}
324338
325test "Dir.Iterator" {339test "Dir.Iterator" {
340 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
341
326 var tmp_dir = tmpIterableDir(.{});342 var tmp_dir = tmpIterableDir(.{});
327 defer tmp_dir.cleanup();343 defer tmp_dir.cleanup();
328344
...@@ -353,6 +369,8 @@ test "Dir.Iterator" {...@@ -353,6 +369,8 @@ test "Dir.Iterator" {
353}369}
354370
355test "Dir.Iterator many entries" {371test "Dir.Iterator many entries" {
372 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
373
356 var tmp_dir = tmpIterableDir(.{});374 var tmp_dir = tmpIterableDir(.{});
357 defer tmp_dir.cleanup();375 defer tmp_dir.cleanup();
358376
...@@ -388,6 +406,8 @@ test "Dir.Iterator many entries" {...@@ -388,6 +406,8 @@ test "Dir.Iterator many entries" {
388}406}
389407
390test "Dir.Iterator twice" {408test "Dir.Iterator twice" {
409 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
410
391 var tmp_dir = tmpIterableDir(.{});411 var tmp_dir = tmpIterableDir(.{});
392 defer tmp_dir.cleanup();412 defer tmp_dir.cleanup();
393413
...@@ -421,6 +441,8 @@ test "Dir.Iterator twice" {...@@ -421,6 +441,8 @@ test "Dir.Iterator twice" {
421}441}
422442
423test "Dir.Iterator reset" {443test "Dir.Iterator reset" {
444 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
445
424 var tmp_dir = tmpIterableDir(.{});446 var tmp_dir = tmpIterableDir(.{});
425 defer tmp_dir.cleanup();447 defer tmp_dir.cleanup();
426448
...@@ -457,6 +479,8 @@ test "Dir.Iterator reset" {...@@ -457,6 +479,8 @@ test "Dir.Iterator reset" {
457}479}
458480
459test "Dir.Iterator but dir is deleted during iteration" {481test "Dir.Iterator but dir is deleted during iteration" {
482 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
483
460 var tmp = std.testing.tmpDir(.{});484 var tmp = std.testing.tmpDir(.{});
461 defer tmp.cleanup();485 defer tmp.cleanup();
462486
...@@ -499,6 +523,8 @@ fn contains(entries: *const std.ArrayList(IterableDir.Entry), el: IterableDir.En...@@ -499,6 +523,8 @@ fn contains(entries: *const std.ArrayList(IterableDir.Entry), el: IterableDir.En
499test "Dir.realpath smoke test" {523test "Dir.realpath smoke test" {
500 if (!comptime std.os.isGetFdPathSupportedOnTarget(builtin.os)) return error.SkipZigTest;524 if (!comptime std.os.isGetFdPathSupportedOnTarget(builtin.os)) return error.SkipZigTest;
501525
526 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
527
502 try testWithAllSupportedPathTypes(struct {528 try testWithAllSupportedPathTypes(struct {
503 fn impl(ctx: *TestContext) !void {529 fn impl(ctx: *TestContext) !void {
504 const allocator = ctx.arena.allocator();530 const allocator = ctx.arena.allocator();
...@@ -549,6 +575,8 @@ test "Dir.realpath smoke test" {...@@ -549,6 +575,8 @@ test "Dir.realpath smoke test" {
549}575}
550576
551test "readAllAlloc" {577test "readAllAlloc" {
578 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
579
552 var tmp_dir = tmpDir(.{});580 var tmp_dir = tmpDir(.{});
553 defer tmp_dir.cleanup();581 defer tmp_dir.cleanup();
554582
...@@ -585,6 +613,8 @@ test "Dir.statFile" {...@@ -585,6 +613,8 @@ test "Dir.statFile" {
585 // TODO: Re-enable once https://github.com/ziglang/zig/issues/17034 is solved613 // TODO: Re-enable once https://github.com/ziglang/zig/issues/17034 is solved
586 if (builtin.os.tag == .linux and builtin.link_libc and builtin.abi == .gnu) return error.SkipZigTest;614 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
588 try testWithAllSupportedPathTypes(struct {618 try testWithAllSupportedPathTypes(struct {
589 fn impl(ctx: *TestContext) !void {619 fn impl(ctx: *TestContext) !void {
590 const test_file_name = try ctx.transformPath("test_file");620 const test_file_name = try ctx.transformPath("test_file");
...@@ -600,6 +630,8 @@ test "Dir.statFile" {...@@ -600,6 +630,8 @@ test "Dir.statFile" {
600}630}
601631
602test "directory operations on files" {632test "directory operations on files" {
633 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
634
603 try testWithAllSupportedPathTypes(struct {635 try testWithAllSupportedPathTypes(struct {
604 fn impl(ctx: *TestContext) !void {636 fn impl(ctx: *TestContext) !void {
605 const test_file_name = try ctx.transformPath("test_file");637 const test_file_name = try ctx.transformPath("test_file");
...@@ -629,6 +661,8 @@ test "file operations on directories" {...@@ -629,6 +661,8 @@ test "file operations on directories" {
629 // TODO: fix this test on FreeBSD. https://github.com/ziglang/zig/issues/1759661 // TODO: fix this test on FreeBSD. https://github.com/ziglang/zig/issues/1759
630 if (builtin.os.tag == .freebsd) return error.SkipZigTest;662 if (builtin.os.tag == .freebsd) return error.SkipZigTest;
631663
664 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
665
632 try testWithAllSupportedPathTypes(struct {666 try testWithAllSupportedPathTypes(struct {
633 fn impl(ctx: *TestContext) !void {667 fn impl(ctx: *TestContext) !void {
634 const test_dir_name = try ctx.transformPath("test_dir");668 const test_dir_name = try ctx.transformPath("test_dir");
...@@ -676,6 +710,8 @@ test "makeOpenPath parent dirs do not exist" {...@@ -676,6 +710,8 @@ test "makeOpenPath parent dirs do not exist" {
676}710}
677711
678test "deleteDir" {712test "deleteDir" {
713 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
714
679 try testWithAllSupportedPathTypes(struct {715 try testWithAllSupportedPathTypes(struct {
680 fn impl(ctx: *TestContext) !void {716 fn impl(ctx: *TestContext) !void {
681 const test_dir_path = try ctx.transformPath("test_dir");717 const test_dir_path = try ctx.transformPath("test_dir");
...@@ -697,6 +733,8 @@ test "deleteDir" {...@@ -697,6 +733,8 @@ test "deleteDir" {
697}733}
698734
699test "Dir.rename files" {735test "Dir.rename files" {
736 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
737
700 try testWithAllSupportedPathTypes(struct {738 try testWithAllSupportedPathTypes(struct {
701 fn impl(ctx: *TestContext) !void {739 fn impl(ctx: *TestContext) !void {
702 // Rename on Windows can hit intermittent AccessDenied errors740 // Rename on Windows can hit intermittent AccessDenied errors
...@@ -739,6 +777,8 @@ test "Dir.rename files" {...@@ -739,6 +777,8 @@ test "Dir.rename files" {
739}777}
740778
741test "Dir.rename directories" {779test "Dir.rename directories" {
780 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
781
742 try testWithAllSupportedPathTypes(struct {782 try testWithAllSupportedPathTypes(struct {
743 fn impl(ctx: *TestContext) !void {783 fn impl(ctx: *TestContext) !void {
744 // Rename on Windows can hit intermittent AccessDenied errors784 // Rename on Windows can hit intermittent AccessDenied errors
...@@ -780,6 +820,8 @@ test "Dir.rename directory onto empty dir" {...@@ -780,6 +820,8 @@ test "Dir.rename directory onto empty dir" {
780 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364820 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
781 if (builtin.os.tag == .windows) return error.SkipZigTest;821 if (builtin.os.tag == .windows) return error.SkipZigTest;
782822
823 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
824
783 try testWithAllSupportedPathTypes(struct {825 try testWithAllSupportedPathTypes(struct {
784 fn impl(ctx: *TestContext) !void {826 fn impl(ctx: *TestContext) !void {
785 const test_dir_path = try ctx.transformPath("test_dir");827 const test_dir_path = try ctx.transformPath("test_dir");
...@@ -801,6 +843,8 @@ test "Dir.rename directory onto non-empty dir" {...@@ -801,6 +843,8 @@ test "Dir.rename directory onto non-empty dir" {
801 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364843 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
802 if (builtin.os.tag == .windows) return error.SkipZigTest;844 if (builtin.os.tag == .windows) return error.SkipZigTest;
803845
846 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
847
804 try testWithAllSupportedPathTypes(struct {848 try testWithAllSupportedPathTypes(struct {
805 fn impl(ctx: *TestContext) !void {849 fn impl(ctx: *TestContext) !void {
806 const test_dir_path = try ctx.transformPath("test_dir");850 const test_dir_path = try ctx.transformPath("test_dir");
...@@ -827,6 +871,8 @@ test "Dir.rename file <-> dir" {...@@ -827,6 +871,8 @@ test "Dir.rename file <-> dir" {
827 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364871 // TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
828 if (builtin.os.tag == .windows) return error.SkipZigTest;872 if (builtin.os.tag == .windows) return error.SkipZigTest;
829873
874 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
875
830 try testWithAllSupportedPathTypes(struct {876 try testWithAllSupportedPathTypes(struct {
831 fn impl(ctx: *TestContext) !void {877 fn impl(ctx: *TestContext) !void {
832 const test_file_path = try ctx.transformPath("test_file");878 const test_file_path = try ctx.transformPath("test_file");
...@@ -842,6 +888,8 @@ test "Dir.rename file <-> dir" {...@@ -842,6 +888,8 @@ test "Dir.rename file <-> dir" {
842}888}
843889
844test "rename" {890test "rename" {
891 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
892
845 var tmp_dir1 = tmpDir(.{});893 var tmp_dir1 = tmpDir(.{});
846 defer tmp_dir1.cleanup();894 defer tmp_dir1.cleanup();
847895
...@@ -864,6 +912,8 @@ test "rename" {...@@ -864,6 +912,8 @@ test "rename" {
864test "renameAbsolute" {912test "renameAbsolute" {
865 if (builtin.os.tag == .wasi) return error.SkipZigTest;913 if (builtin.os.tag == .wasi) return error.SkipZigTest;
866914
915 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
916
867 var tmp_dir = tmpDir(.{});917 var tmp_dir = tmpDir(.{});
868 defer tmp_dir.cleanup();918 defer tmp_dir.cleanup();
869919
...@@ -922,6 +972,8 @@ test "openSelfExe" {...@@ -922,6 +972,8 @@ test "openSelfExe" {
922}972}
923973
924test "makePath, put some files in it, deleteTree" {974test "makePath, put some files in it, deleteTree" {
975 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
976
925 try testWithAllSupportedPathTypes(struct {977 try testWithAllSupportedPathTypes(struct {
926 fn impl(ctx: *TestContext) !void {978 fn impl(ctx: *TestContext) !void {
927 const allocator = ctx.arena.allocator();979 const allocator = ctx.arena.allocator();
...@@ -938,6 +990,8 @@ test "makePath, put some files in it, deleteTree" {...@@ -938,6 +990,8 @@ test "makePath, put some files in it, deleteTree" {
938}990}
939991
940test "makePath, put some files in it, deleteTreeMinStackSize" {992test "makePath, put some files in it, deleteTreeMinStackSize" {
993 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
994
941 try testWithAllSupportedPathTypes(struct {995 try testWithAllSupportedPathTypes(struct {
942 fn impl(ctx: *TestContext) !void {996 fn impl(ctx: *TestContext) !void {
943 const allocator = ctx.arena.allocator();997 const allocator = ctx.arena.allocator();
...@@ -956,6 +1010,8 @@ test "makePath, put some files in it, deleteTreeMinStackSize" {...@@ -956,6 +1010,8 @@ test "makePath, put some files in it, deleteTreeMinStackSize" {
956test "makePath in a directory that no longer exists" {1010test "makePath in a directory that no longer exists" {
957 if (builtin.os.tag == .windows) return error.SkipZigTest; // Windows returns FileBusy if attempting to remove an open dir1011 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
959 var tmp = tmpDir(.{});1015 var tmp = tmpDir(.{});
960 defer tmp.cleanup();1016 defer tmp.cleanup();
961 try tmp.parent_dir.deleteTree(&tmp.sub_path);1017 try tmp.parent_dir.deleteTree(&tmp.sub_path);
...@@ -987,6 +1043,8 @@ fn testFilenameLimits(iterable_dir: IterableDir, maxed_filename: []const u8) !vo...@@ -987,6 +1043,8 @@ fn testFilenameLimits(iterable_dir: IterableDir, maxed_filename: []const u8) !vo
987}1043}
9881044
989test "max file name component lengths" {1045test "max file name component lengths" {
1046 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1047
990 var tmp = tmpIterableDir(.{});1048 var tmp = tmpIterableDir(.{});
991 defer tmp.cleanup();1049 defer tmp.cleanup();
9921050
...@@ -1008,6 +1066,8 @@ test "max file name component lengths" {...@@ -1008,6 +1066,8 @@ test "max file name component lengths" {
1008}1066}
10091067
1010test "writev, readv" {1068test "writev, readv" {
1069 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1070
1011 var tmp = tmpDir(.{});1071 var tmp = tmpDir(.{});
1012 defer tmp.cleanup();1072 defer tmp.cleanup();
10131073
...@@ -1050,6 +1110,8 @@ test "writev, readv" {...@@ -1050,6 +1110,8 @@ test "writev, readv" {
1050}1110}
10511111
1052test "pwritev, preadv" {1112test "pwritev, preadv" {
1113 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1114
1053 var tmp = tmpDir(.{});1115 var tmp = tmpDir(.{});
1054 defer tmp.cleanup();1116 defer tmp.cleanup();
10551117
...@@ -1091,6 +1153,8 @@ test "pwritev, preadv" {...@@ -1091,6 +1153,8 @@ test "pwritev, preadv" {
1091}1153}
10921154
1093test "access file" {1155test "access file" {
1156 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1157
1094 try testWithAllSupportedPathTypes(struct {1158 try testWithAllSupportedPathTypes(struct {
1095 fn impl(ctx: *TestContext) !void {1159 fn impl(ctx: *TestContext) !void {
1096 const dir_path = try ctx.transformPath("os_test_tmp");1160 const dir_path = try ctx.transformPath("os_test_tmp");
...@@ -1107,6 +1171,8 @@ test "access file" {...@@ -1107,6 +1171,8 @@ test "access file" {
1107}1171}
11081172
1109test "sendfile" {1173test "sendfile" {
1174 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1175
1110 var tmp = tmpDir(.{});1176 var tmp = tmpDir(.{});
1111 defer tmp.cleanup();1177 defer tmp.cleanup();
11121178
...@@ -1172,6 +1238,8 @@ test "sendfile" {...@@ -1172,6 +1238,8 @@ test "sendfile" {
1172}1238}
11731239
1174test "copyRangeAll" {1240test "copyRangeAll" {
1241 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1242
1175 var tmp = tmpDir(.{});1243 var tmp = tmpDir(.{});
1176 defer tmp.cleanup();1244 defer tmp.cleanup();
11771245
...@@ -1198,6 +1266,8 @@ test "copyRangeAll" {...@@ -1198,6 +1266,8 @@ test "copyRangeAll" {
1198}1266}
11991267
1200test "copyFile" {1268test "copyFile" {
1269 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1270
1201 try testWithAllSupportedPathTypes(struct {1271 try testWithAllSupportedPathTypes(struct {
1202 fn impl(ctx: *TestContext) !void {1272 fn impl(ctx: *TestContext) !void {
1203 const data = "u6wj+JmdF3qHsFPE BUlH2g4gJCmEz0PP";1273 const data = "u6wj+JmdF3qHsFPE BUlH2g4gJCmEz0PP";
...@@ -1228,6 +1298,8 @@ fn expectFileContents(dir: Dir, file_path: []const u8, data: []const u8) !void {...@@ -1228,6 +1298,8 @@ fn expectFileContents(dir: Dir, file_path: []const u8, data: []const u8) !void {
1228}1298}
12291299
1230test "AtomicFile" {1300test "AtomicFile" {
1301 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1302
1231 try testWithAllSupportedPathTypes(struct {1303 try testWithAllSupportedPathTypes(struct {
1232 fn impl(ctx: *TestContext) !void {1304 fn impl(ctx: *TestContext) !void {
1233 const allocator = ctx.arena.allocator();1305 const allocator = ctx.arena.allocator();
...@@ -1254,6 +1326,8 @@ test "AtomicFile" {...@@ -1254,6 +1326,8 @@ test "AtomicFile" {
1254test "open file with exclusive nonblocking lock twice" {1326test "open file with exclusive nonblocking lock twice" {
1255 if (builtin.os.tag == .wasi) return error.SkipZigTest;1327 if (builtin.os.tag == .wasi) return error.SkipZigTest;
12561328
1329 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1330
1257 try testWithAllSupportedPathTypes(struct {1331 try testWithAllSupportedPathTypes(struct {
1258 fn impl(ctx: *TestContext) !void {1332 fn impl(ctx: *TestContext) !void {
1259 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");1333 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
...@@ -1270,6 +1344,8 @@ test "open file with exclusive nonblocking lock twice" {...@@ -1270,6 +1344,8 @@ test "open file with exclusive nonblocking lock twice" {
1270test "open file with shared and exclusive nonblocking lock" {1344test "open file with shared and exclusive nonblocking lock" {
1271 if (builtin.os.tag == .wasi) return error.SkipZigTest;1345 if (builtin.os.tag == .wasi) return error.SkipZigTest;
12721346
1347 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1348
1273 try testWithAllSupportedPathTypes(struct {1349 try testWithAllSupportedPathTypes(struct {
1274 fn impl(ctx: *TestContext) !void {1350 fn impl(ctx: *TestContext) !void {
1275 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");1351 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
...@@ -1286,6 +1362,8 @@ test "open file with shared and exclusive nonblocking lock" {...@@ -1286,6 +1362,8 @@ test "open file with shared and exclusive nonblocking lock" {
1286test "open file with exclusive and shared nonblocking lock" {1362test "open file with exclusive and shared nonblocking lock" {
1287 if (builtin.os.tag == .wasi) return error.SkipZigTest;1363 if (builtin.os.tag == .wasi) return error.SkipZigTest;
12881364
1365 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1366
1289 try testWithAllSupportedPathTypes(struct {1367 try testWithAllSupportedPathTypes(struct {
1290 fn impl(ctx: *TestContext) !void {1368 fn impl(ctx: *TestContext) !void {
1291 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");1369 const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
...@@ -1300,6 +1378,8 @@ test "open file with exclusive and shared nonblocking lock" {...@@ -1300,6 +1378,8 @@ test "open file with exclusive and shared nonblocking lock" {
1300}1378}
13011379
1302test "open file with exclusive lock twice, make sure second lock waits" {1380test "open file with exclusive lock twice, make sure second lock waits" {
1381 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1382
1303 if (builtin.single_threaded) return error.SkipZigTest;1383 if (builtin.single_threaded) return error.SkipZigTest;
13041384
1305 if (std.io.is_async) {1385 if (std.io.is_async) {
...@@ -1350,6 +1430,8 @@ test "open file with exclusive lock twice, make sure second lock waits" {...@@ -1350,6 +1430,8 @@ test "open file with exclusive lock twice, make sure second lock waits" {
1350test "open file with exclusive nonblocking lock twice (absolute paths)" {1430test "open file with exclusive nonblocking lock twice (absolute paths)" {
1351 if (builtin.os.tag == .wasi) return error.SkipZigTest;1431 if (builtin.os.tag == .wasi) return error.SkipZigTest;
13521432
1433 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1434
1353 var random_bytes: [12]u8 = undefined;1435 var random_bytes: [12]u8 = undefined;
1354 std.crypto.random.bytes(&random_bytes);1436 std.crypto.random.bytes(&random_bytes);
13551437
...@@ -1384,6 +1466,8 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" {...@@ -1384,6 +1466,8 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" {
1384test "walker" {1466test "walker" {
1385 if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;1467 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
1387 var tmp = tmpIterableDir(.{});1471 var tmp = tmpIterableDir(.{});
1388 defer tmp.cleanup();1472 defer tmp.cleanup();
13891473
...@@ -1437,6 +1521,8 @@ test "walker" {...@@ -1437,6 +1521,8 @@ test "walker" {
1437test "walker without fully iterating" {1521test "walker without fully iterating" {
1438 if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;1522 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
1440 var tmp = tmpIterableDir(.{});1526 var tmp = tmpIterableDir(.{});
1441 defer tmp.cleanup();1527 defer tmp.cleanup();
14421528
...@@ -1460,6 +1546,8 @@ test "walker without fully iterating" {...@@ -1460,6 +1546,8 @@ test "walker without fully iterating" {
1460test ". and .. in fs.Dir functions" {1546test ". and .. in fs.Dir functions" {
1461 if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;1547 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
1463 if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64) {1551 if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64) {
1464 // https://github.com/ziglang/zig/issues/171341552 // https://github.com/ziglang/zig/issues/17134
1465 return error.SkipZigTest;1553 return error.SkipZigTest;
...@@ -1500,6 +1588,8 @@ test ". and .. in fs.Dir functions" {...@@ -1500,6 +1588,8 @@ test ". and .. in fs.Dir functions" {
1500test ". and .. in absolute functions" {1588test ". and .. in absolute functions" {
1501 if (builtin.os.tag == .wasi) return error.SkipZigTest;1589 if (builtin.os.tag == .wasi) return error.SkipZigTest;
15021590
1591 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1592
1503 var tmp = tmpDir(.{});1593 var tmp = tmpDir(.{});
1504 defer tmp.cleanup();1594 defer tmp.cleanup();
15051595
...@@ -1545,6 +1635,8 @@ test "chmod" {...@@ -1545,6 +1635,8 @@ test "chmod" {
1545 if (builtin.os.tag == .windows or builtin.os.tag == .wasi)1635 if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
1546 return error.SkipZigTest;1636 return error.SkipZigTest;
15471637
1638 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1639
1548 var tmp = tmpDir(.{});1640 var tmp = tmpDir(.{});
1549 defer tmp.cleanup();1641 defer tmp.cleanup();
15501642
...@@ -1567,6 +1659,8 @@ test "chown" {...@@ -1567,6 +1659,8 @@ test "chown" {
1567 if (builtin.os.tag == .windows or builtin.os.tag == .wasi)1659 if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
1568 return error.SkipZigTest;1660 return error.SkipZigTest;
15691661
1662 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1663
1570 var tmp = tmpDir(.{});1664 var tmp = tmpDir(.{});
1571 defer tmp.cleanup();1665 defer tmp.cleanup();
15721666
...@@ -1582,6 +1676,8 @@ test "chown" {...@@ -1582,6 +1676,8 @@ test "chown" {
1582}1676}
15831677
1584test "File.Metadata" {1678test "File.Metadata" {
1679 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1680
1585 var tmp = tmpDir(.{});1681 var tmp = tmpDir(.{});
1586 defer tmp.cleanup();1682 defer tmp.cleanup();
15871683
...@@ -1600,6 +1696,8 @@ test "File.Permissions" {...@@ -1600,6 +1696,8 @@ test "File.Permissions" {
1600 if (builtin.os.tag == .wasi)1696 if (builtin.os.tag == .wasi)
1601 return error.SkipZigTest;1697 return error.SkipZigTest;
16021698
1699 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1700
1603 var tmp = tmpDir(.{});1701 var tmp = tmpDir(.{});
1604 defer tmp.cleanup();1702 defer tmp.cleanup();
16051703
...@@ -1626,6 +1724,8 @@ test "File.PermissionsUnix" {...@@ -1626,6 +1724,8 @@ test "File.PermissionsUnix" {
1626 if (builtin.os.tag == .windows or builtin.os.tag == .wasi)1724 if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
1627 return error.SkipZigTest;1725 return error.SkipZigTest;
16281726
1727 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1728
1629 var tmp = tmpDir(.{});1729 var tmp = tmpDir(.{});
1630 defer tmp.cleanup();1730 defer tmp.cleanup();
16311731
...@@ -1661,6 +1761,8 @@ test "delete a read-only file on windows" {...@@ -1661,6 +1761,8 @@ test "delete a read-only file on windows" {
1661 if (builtin.os.tag != .windows)1761 if (builtin.os.tag != .windows)
1662 return error.SkipZigTest;1762 return error.SkipZigTest;
16631763
1764 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1765
1664 var tmp = testing.tmpDir(.{});1766 var tmp = testing.tmpDir(.{});
1665 defer tmp.cleanup();1767 defer tmp.cleanup();
16661768
...@@ -1691,6 +1793,8 @@ test "delete a read-only file on windows" {...@@ -1691,6 +1793,8 @@ test "delete a read-only file on windows" {
1691test "delete a setAsCwd directory on Windows" {1793test "delete a setAsCwd directory on Windows" {
1692 if (builtin.os.tag != .windows) return error.SkipZigTest;1794 if (builtin.os.tag != .windows) return error.SkipZigTest;
16931795
1796 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1797
1694 var tmp = tmpDir(.{});1798 var tmp = tmpDir(.{});
1695 // Set tmp dir as current working directory.1799 // Set tmp dir as current working directory.
1696 try tmp.dir.setAsCwd();1800 try tmp.dir.setAsCwd();
lib/std/hash/auto_hash.zig+21
...@@ -1,5 +1,6 @@...@@ -1,5 +1,6 @@
1const std = @import("std");1const std = @import("std");
2const assert = std.debug.assert;2const assert = std.debug.assert;
3const builtin = @import("builtin");
3const mem = std.mem;4const mem = std.mem;
4const meta = std.meta;5const meta = std.meta;
56
...@@ -252,6 +253,8 @@ test "typeContainsSlice" {...@@ -252,6 +253,8 @@ test "typeContainsSlice" {
252}253}
253254
254test "hash pointer" {255test "hash pointer" {
256 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
257
255 const array = [_]u32{ 123, 123, 123 };258 const array = [_]u32{ 123, 123, 123 };
256 const a = &array[0];259 const a = &array[0];
257 const b = &array[1];260 const b = &array[1];
...@@ -272,6 +275,8 @@ test "hash pointer" {...@@ -272,6 +275,8 @@ test "hash pointer" {
272}275}
273276
274test "hash slice shallow" {277test "hash slice shallow" {
278 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
279
275 // Allocate one array dynamically so that we're assured it is not merged280 // Allocate one array dynamically so that we're assured it is not merged
276 // with the other by the optimization passes.281 // with the other by the optimization passes.
277 const array1 = try std.testing.allocator.create([6]u32);282 const array1 = try std.testing.allocator.create([6]u32);
...@@ -290,6 +295,8 @@ test "hash slice shallow" {...@@ -290,6 +295,8 @@ test "hash slice shallow" {
290}295}
291296
292test "hash slice deep" {297test "hash slice deep" {
298 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
299
293 // Allocate one array dynamically so that we're assured it is not merged300 // Allocate one array dynamically so that we're assured it is not merged
294 // with the other by the optimization passes.301 // with the other by the optimization passes.
295 const array1 = try std.testing.allocator.create([6]u32);302 const array1 = try std.testing.allocator.create([6]u32);
...@@ -306,6 +313,8 @@ test "hash slice deep" {...@@ -306,6 +313,8 @@ test "hash slice deep" {
306}313}
307314
308test "hash struct deep" {315test "hash struct deep" {
316 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
317
309 const Foo = struct {318 const Foo = struct {
310 a: u32,319 a: u32,
311 b: u16,320 b: u16,
...@@ -345,6 +354,8 @@ test "hash struct deep" {...@@ -345,6 +354,8 @@ test "hash struct deep" {
345}354}
346355
347test "testHash optional" {356test "testHash optional" {
357 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
358
348 const a: ?u32 = 123;359 const a: ?u32 = 123;
349 const b: ?u32 = null;360 const b: ?u32 = null;
350 try testing.expectEqual(testHash(a), testHash(@as(u32, 123)));361 try testing.expectEqual(testHash(a), testHash(@as(u32, 123)));
...@@ -353,6 +364,8 @@ test "testHash optional" {...@@ -353,6 +364,8 @@ test "testHash optional" {
353}364}
354365
355test "testHash array" {366test "testHash array" {
367 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
368
356 const a = [_]u32{ 1, 2, 3 };369 const a = [_]u32{ 1, 2, 3 };
357 const h = testHash(a);370 const h = testHash(a);
358 var hasher = Wyhash.init(0);371 var hasher = Wyhash.init(0);
...@@ -369,6 +382,8 @@ test "testHash multi-dimensional array" {...@@ -369,6 +382,8 @@ test "testHash multi-dimensional array" {
369}382}
370383
371test "testHash struct" {384test "testHash struct" {
385 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
386
372 const Foo = struct {387 const Foo = struct {
373 a: u32 = 1,388 a: u32 = 1,
374 b: u32 = 2,389 b: u32 = 2,
...@@ -384,6 +399,8 @@ test "testHash struct" {...@@ -384,6 +399,8 @@ test "testHash struct" {
384}399}
385400
386test "testHash union" {401test "testHash union" {
402 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
403
387 const Foo = union(enum) {404 const Foo = union(enum) {
388 A: u32,405 A: u32,
389 B: bool,406 B: bool,
...@@ -408,6 +425,8 @@ test "testHash union" {...@@ -408,6 +425,8 @@ test "testHash union" {
408}425}
409426
410test "testHash vector" {427test "testHash vector" {
428 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
429
411 const a: @Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };430 const a: @Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };
412 const b: @Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };431 const b: @Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };
413 try testing.expect(testHash(a) == testHash(a));432 try testing.expect(testHash(a) == testHash(a));
...@@ -420,6 +439,8 @@ test "testHash vector" {...@@ -420,6 +439,8 @@ test "testHash vector" {
420}439}
421440
422test "testHash error union" {441test "testHash error union" {
442 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
443
423 const Errors = error{Test};444 const Errors = error{Test};
424 const Foo = struct {445 const Foo = struct {
425 a: u32 = 1,446 a: u32 = 1,
lib/std/hash/wyhash.zig+2
...@@ -242,6 +242,8 @@ test "smhasher" {...@@ -242,6 +242,8 @@ test "smhasher" {
242}242}
243243
244test "iterative api" {244test "iterative api" {
245 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
246
245 const Test = struct {247 const Test = struct {
246 fn do() !void {248 fn do() !void {
247 try verify.iterativeApi(Wyhash);249 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)...@@ -803,6 +803,8 @@ fn testExpect(comptime H: type, seed: anytype, input: []const u8, expected: u64)
803}803}
804804
805test "xxhash3" {805test "xxhash3" {
806 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
807
806 const H = XxHash3;808 const H = XxHash3;
807 // Non-Seeded Tests809 // Non-Seeded Tests
808 try testExpect(H, 0, "", 0x2d06800538d394c2);810 try testExpect(H, 0, "", 0x2d06800538d394c2);
...@@ -834,6 +836,8 @@ test "xxhash3" {...@@ -834,6 +836,8 @@ test "xxhash3" {
834}836}
835837
836test "xxhash3 smhasher" {838test "xxhash3 smhasher" {
839 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
840
837 const Test = struct {841 const Test = struct {
838 fn do() !void {842 fn do() !void {
839 try expectEqual(verify.smhasher(XxHash3.hash), 0x9a636405);843 try expectEqual(verify.smhasher(XxHash3.hash), 0x9a636405);
...@@ -845,6 +849,8 @@ test "xxhash3 smhasher" {...@@ -845,6 +849,8 @@ test "xxhash3 smhasher" {
845}849}
846850
847test "xxhash3 iterative api" {851test "xxhash3 iterative api" {
852 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
853
848 const Test = struct {854 const Test = struct {
849 fn do() !void {855 fn do() !void {
850 try verify.iterativeApi(XxHash3);856 try verify.iterativeApi(XxHash3);
...@@ -856,6 +862,8 @@ test "xxhash3 iterative api" {...@@ -856,6 +862,8 @@ test "xxhash3 iterative api" {
856}862}
857863
858test "xxhash64" {864test "xxhash64" {
865 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
866
859 const H = XxHash64;867 const H = XxHash64;
860 try testExpect(H, 0, "", 0xef46db3751d8e999);868 try testExpect(H, 0, "", 0xef46db3751d8e999);
861 try testExpect(H, 0, "a", 0xd24ec4f1a98c6e5b);869 try testExpect(H, 0, "a", 0xd24ec4f1a98c6e5b);
...@@ -867,6 +875,8 @@ test "xxhash64" {...@@ -867,6 +875,8 @@ test "xxhash64" {
867}875}
868876
869test "xxhash64 smhasher" {877test "xxhash64 smhasher" {
878 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
879
870 const Test = struct {880 const Test = struct {
871 fn do() !void {881 fn do() !void {
872 try expectEqual(verify.smhasher(XxHash64.hash), 0x024B7CF4);882 try expectEqual(verify.smhasher(XxHash64.hash), 0x024B7CF4);
...@@ -878,6 +888,8 @@ test "xxhash64 smhasher" {...@@ -878,6 +888,8 @@ test "xxhash64 smhasher" {
878}888}
879889
880test "xxhash64 iterative api" {890test "xxhash64 iterative api" {
891 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
892
881 const Test = struct {893 const Test = struct {
882 fn do() !void {894 fn do() !void {
883 try verify.iterativeApi(XxHash64);895 try verify.iterativeApi(XxHash64);
...@@ -889,6 +901,8 @@ test "xxhash64 iterative api" {...@@ -889,6 +901,8 @@ test "xxhash64 iterative api" {
889}901}
890902
891test "xxhash32" {903test "xxhash32" {
904 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
905
892 const H = XxHash32;906 const H = XxHash32;
893907
894 try testExpect(H, 0, "", 0x02cc5d05);908 try testExpect(H, 0, "", 0x02cc5d05);
...@@ -901,6 +915,8 @@ test "xxhash32" {...@@ -901,6 +915,8 @@ test "xxhash32" {
901}915}
902916
903test "xxhash32 smhasher" {917test "xxhash32 smhasher" {
918 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
919
904 const Test = struct {920 const Test = struct {
905 fn do() !void {921 fn do() !void {
906 try expectEqual(verify.smhasher(XxHash32.hash), 0xBA88B743);922 try expectEqual(verify.smhasher(XxHash32.hash), 0xBA88B743);
...@@ -912,6 +928,8 @@ test "xxhash32 smhasher" {...@@ -912,6 +928,8 @@ test "xxhash32 smhasher" {
912}928}
913929
914test "xxhash32 iterative api" {930test "xxhash32 iterative api" {
931 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
932
915 const Test = struct {933 const Test = struct {
916 fn do() !void {934 fn do() !void {
917 try verify.iterativeApi(XxHash32);935 try verify.iterativeApi(XxHash32);
lib/std/hash_map.zig+2
...@@ -1873,6 +1873,8 @@ test "std.hash_map multiple removes on same metadata" {...@@ -1873,6 +1873,8 @@ test "std.hash_map multiple removes on same metadata" {
1873}1873}
18741874
1875test "std.hash_map put and remove loop in random order" {1875test "std.hash_map put and remove loop in random order" {
1876 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1877
1876 var map = AutoHashMap(u32, u32).init(std.testing.allocator);1878 var map = AutoHashMap(u32, u32).init(std.testing.allocator);
1877 defer map.deinit();1879 defer map.deinit();
18781880
lib/std/heap/general_purpose_allocator.zig+4
...@@ -1042,6 +1042,8 @@ const TraceKind = enum {...@@ -1042,6 +1042,8 @@ const TraceKind = enum {
1042const test_config = Config{};1042const test_config = Config{};
10431043
1044test "small allocations - free in same order" {1044test "small allocations - free in same order" {
1045 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1046
1045 var gpa = GeneralPurposeAllocator(test_config){};1047 var gpa = GeneralPurposeAllocator(test_config){};
1046 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");1048 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
1047 const allocator = gpa.allocator();1049 const allocator = gpa.allocator();
...@@ -1061,6 +1063,8 @@ test "small allocations - free in same order" {...@@ -1061,6 +1063,8 @@ test "small allocations - free in same order" {
1061}1063}
10621064
1063test "small allocations - free in reverse order" {1065test "small allocations - free in reverse order" {
1066 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1067
1064 var gpa = GeneralPurposeAllocator(test_config){};1068 var gpa = GeneralPurposeAllocator(test_config){};
1065 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");1069 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
1066 const allocator = gpa.allocator();1070 const allocator = gpa.allocator();
lib/std/http/Client.zig+6-2
...@@ -1,6 +1,7 @@...@@ -1,6 +1,7 @@
1//! Connecting and opening requests are threadsafe. Individual requests are not.1//! Connecting and opening requests are threadsafe. Individual requests are not.
22
3const std = @import("../std.zig");3const std = @import("../std.zig");
4const builtin = @import("builtin");
4const testing = std.testing;5const testing = std.testing;
5const http = std.http;6const http = std.http;
6const mem = std.mem;7const mem = std.mem;
...@@ -427,6 +428,8 @@ pub const Response = struct {...@@ -427,6 +428,8 @@ pub const Response = struct {
427 }428 }
428429
429 test parseInt3 {430 test parseInt3 {
431 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
432
430 const expectEqual = testing.expectEqual;433 const expectEqual = testing.expectEqual;
431 try expectEqual(@as(u10, 0), parseInt3("000".*));434 try expectEqual(@as(u10, 0), parseInt3("000".*));
432 try expectEqual(@as(u10, 418), parseInt3("418".*));435 try expectEqual(@as(u10, 418), parseInt3("418".*));
...@@ -585,7 +588,7 @@ pub const Request = struct {...@@ -585,7 +588,7 @@ pub const Request = struct {
585588
586 if (!req.headers.contains("user-agent")) {589 if (!req.headers.contains("user-agent")) {
587 try w.writeAll("User-Agent: zig/");590 try w.writeAll("User-Agent: zig/");
588 try w.writeAll(@import("builtin").zig_version_string);591 try w.writeAll(builtin.zig_version_string);
589 try w.writeAll(" (std.http)\r\n");592 try w.writeAll(" (std.http)\r\n");
590 }593 }
591594
...@@ -1249,7 +1252,6 @@ pub fn fetch(client: *Client, allocator: Allocator, options: FetchOptions) !Fetc...@@ -1249,7 +1252,6 @@ pub fn fetch(client: *Client, allocator: Allocator, options: FetchOptions) !Fetc
1249}1252}
12501253
1251test {1254test {
1252 const builtin = @import("builtin");
1253 const native_endian = comptime builtin.cpu.arch.endian();1255 const native_endian = comptime builtin.cpu.arch.endian();
1254 if (builtin.zig_backend == .stage2_llvm and native_endian == .Big) {1256 if (builtin.zig_backend == .stage2_llvm and native_endian == .Big) {
1255 // https://github.com/ziglang/zig/issues/137821257 // https://github.com/ziglang/zig/issues/13782
...@@ -1258,5 +1260,7 @@ test {...@@ -1258,5 +1260,7 @@ test {
12581260
1259 if (builtin.os.tag == .wasi) return error.SkipZigTest;1261 if (builtin.os.tag == .wasi) return error.SkipZigTest;
12601262
1263 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1264
1261 std.testing.refAllDecls(@This());1265 std.testing.refAllDecls(@This());
1262}1266}
lib/std/http/Server.zig+2
...@@ -725,6 +725,8 @@ test "HTTP server handles a chunked transfer coding request" {...@@ -725,6 +725,8 @@ test "HTTP server handles a chunked transfer coding request" {
725 return error.SkipZigTest;725 return error.SkipZigTest;
726 }726 }
727727
728 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
729
728 const native_endian = comptime builtin.cpu.arch.endian();730 const native_endian = comptime builtin.cpu.arch.endian();
729 if (builtin.zig_backend == .stage2_llvm and native_endian == .Big) {731 if (builtin.zig_backend == .stage2_llvm and native_endian == .Big) {
730 // https://github.com/ziglang/zig/issues/13782732 // https://github.com/ziglang/zig/issues/13782
lib/std/io/bit_reader.zig+2
...@@ -164,6 +164,8 @@ pub fn bitReader(...@@ -164,6 +164,8 @@ pub fn bitReader(
164}164}
165165
166test "api coverage" {166test "api coverage" {
167 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
168
167 const mem_be = [_]u8{ 0b11001101, 0b00001011 };169 const mem_be = [_]u8{ 0b11001101, 0b00001011 };
168 const mem_le = [_]u8{ 0b00011101, 0b10010101 };170 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)) {...@@ -36,6 +36,7 @@ pub fn multiWriter(streams: anytype) MultiWriter(@TypeOf(streams)) {
36const testing = std.testing;36const testing = std.testing;
3737
38test "MultiWriter" {38test "MultiWriter" {
39 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
39 var tmp = testing.tmpDir(.{});40 var tmp = testing.tmpDir(.{});
40 defer tmp.cleanup();41 defer tmp.cleanup();
41 var f = try tmp.dir.createFile("t.txt", .{});42 var f = try tmp.dir.createFile("t.txt", .{});
lib/std/io/test.zig+10
...@@ -15,6 +15,8 @@ const native_endian = builtin.target.cpu.arch.endian();...@@ -15,6 +15,8 @@ const native_endian = builtin.target.cpu.arch.endian();
15const tmpDir = std.testing.tmpDir;15const tmpDir = std.testing.tmpDir;
1616
17test "write a file, read it, then delete it" {17test "write a file, read it, then delete it" {
18 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
19
18 var tmp = tmpDir(.{});20 var tmp = tmpDir(.{});
19 defer tmp.cleanup();21 defer tmp.cleanup();
2022
...@@ -61,6 +63,8 @@ test "write a file, read it, then delete it" {...@@ -61,6 +63,8 @@ test "write a file, read it, then delete it" {
61}63}
6264
63test "BitStreams with File Stream" {65test "BitStreams with File Stream" {
66 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
67
64 var tmp = tmpDir(.{});68 var tmp = tmpDir(.{});
65 defer tmp.cleanup();69 defer tmp.cleanup();
6670
...@@ -106,6 +110,8 @@ test "BitStreams with File Stream" {...@@ -106,6 +110,8 @@ test "BitStreams with File Stream" {
106}110}
107111
108test "File seek ops" {112test "File seek ops" {
113 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
114
109 var tmp = tmpDir(.{});115 var tmp = tmpDir(.{});
110 defer tmp.cleanup();116 defer tmp.cleanup();
111117
...@@ -133,6 +139,8 @@ test "File seek ops" {...@@ -133,6 +139,8 @@ test "File seek ops" {
133}139}
134140
135test "setEndPos" {141test "setEndPos" {
142 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
143
136 var tmp = tmpDir(.{});144 var tmp = tmpDir(.{});
137 defer tmp.cleanup();145 defer tmp.cleanup();
138146
...@@ -159,6 +167,8 @@ test "setEndPos" {...@@ -159,6 +167,8 @@ test "setEndPos" {
159}167}
160168
161test "updateTimes" {169test "updateTimes" {
170 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
171
162 var tmp = tmpDir(.{});172 var tmp = tmpDir(.{});
163 defer tmp.cleanup();173 defer tmp.cleanup();
164174
lib/std/json.zig+9
...@@ -9,6 +9,7 @@...@@ -9,6 +9,7 @@
9//! The low-level `writeStream` emits syntax-conformant JSON tokens to a `std.io.Writer`.9//! The low-level `writeStream` emits syntax-conformant JSON tokens to a `std.io.Writer`.
10//! The high-level `stringify` serializes a Zig or `Value` type into JSON.10//! The high-level `stringify` serializes a Zig or `Value` type into JSON.
1111
12const builtin = @import("builtin");
12const testing = @import("std").testing;13const testing = @import("std").testing;
13const ArrayList = @import("std").ArrayList;14const ArrayList = @import("std").ArrayList;
1415
...@@ -23,6 +24,8 @@ test Scanner {...@@ -23,6 +24,8 @@ test Scanner {
23}24}
2425
25test parseFromSlice {26test parseFromSlice {
27 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
28
26 var parsed_str = try parseFromSlice([]const u8, testing.allocator, "\"a\\u0020b\"", .{});29 var parsed_str = try parseFromSlice([]const u8, testing.allocator, "\"a\\u0020b\"", .{});
27 defer parsed_str.deinit();30 defer parsed_str.deinit();
28 try testing.expectEqualSlices(u8, "a b", parsed_str.value);31 try testing.expectEqualSlices(u8, "a b", parsed_str.value);
...@@ -35,12 +38,16 @@ test parseFromSlice {...@@ -35,12 +38,16 @@ test parseFromSlice {
35}38}
3639
37test Value {40test Value {
41 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
42
38 var parsed = try parseFromSlice(Value, testing.allocator, "{\"anything\": \"goes\"}", .{});43 var parsed = try parseFromSlice(Value, testing.allocator, "{\"anything\": \"goes\"}", .{});
39 defer parsed.deinit();44 defer parsed.deinit();
40 try testing.expectEqualSlices(u8, "goes", parsed.value.object.get("anything").?.string);45 try testing.expectEqualSlices(u8, "goes", parsed.value.object.get("anything").?.string);
41}46}
4247
43test writeStream {48test writeStream {
49 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
50
44 var out = ArrayList(u8).init(testing.allocator);51 var out = ArrayList(u8).init(testing.allocator);
45 defer out.deinit();52 defer out.deinit();
46 var write_stream = writeStream(out.writer(), .{ .whitespace = .indent_2 });53 var write_stream = writeStream(out.writer(), .{ .whitespace = .indent_2 });
...@@ -58,6 +65,8 @@ test writeStream {...@@ -58,6 +65,8 @@ test writeStream {
58}65}
5966
60test stringify {67test stringify {
68 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
69
61 var out = ArrayList(u8).init(testing.allocator);70 var out = ArrayList(u8).init(testing.allocator);
62 defer out.deinit();71 defer out.deinit();
6372
lib/std/json/JSONTestSuite_test.zig+72
...@@ -104,6 +104,8 @@ test "i_string_utf16LE_no_BOM.json" {...@@ -104,6 +104,8 @@ test "i_string_utf16LE_no_BOM.json" {
104 try any("[\x00\"\x00\xe9\x00\"\x00]\x00");104 try any("[\x00\"\x00\xe9\x00\"\x00]\x00");
105}105}
106test "i_structure_500_nested_arrays.json" {106test "i_structure_500_nested_arrays.json" {
107 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
108
107 try any("[" ** 500 ++ "]" ** 500);109 try any("[" ** 500 ++ "]" ** 500);
108}110}
109test "i_structure_UTF-8_BOM_empty_object.json" {111test "i_structure_UTF-8_BOM_empty_object.json" {
...@@ -359,15 +361,21 @@ test "n_object_bracket_key.json" {...@@ -359,15 +361,21 @@ test "n_object_bracket_key.json" {
359 try err("{[: \"x\"}\n");361 try err("{[: \"x\"}\n");
360}362}
361test "n_object_comma_instead_of_colon.json" {363test "n_object_comma_instead_of_colon.json" {
364 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
365
362 try err("{\"x\", null}");366 try err("{\"x\", null}");
363}367}
364test "n_object_double_colon.json" {368test "n_object_double_colon.json" {
369 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
370
365 try err("{\"x\"::\"b\"}");371 try err("{\"x\"::\"b\"}");
366}372}
367test "n_object_emoji.json" {373test "n_object_emoji.json" {
368 try err("{\xf0\x9f\x87\xa8\xf0\x9f\x87\xad}");374 try err("{\xf0\x9f\x87\xa8\xf0\x9f\x87\xad}");
369}375}
370test "n_object_garbage_at_end.json" {376test "n_object_garbage_at_end.json" {
377 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
378
371 try err("{\"a\":\"a\" 123}");379 try err("{\"a\":\"a\" 123}");
372}380}
373test "n_object_key_with_single_quotes.json" {381test "n_object_key_with_single_quotes.json" {
...@@ -377,18 +385,26 @@ test "n_object_lone_continuation_byte_in_key_and_trailing_comma.json" {...@@ -377,18 +385,26 @@ test "n_object_lone_continuation_byte_in_key_and_trailing_comma.json" {
377 try err("{\"\xb9\":\"0\",}");385 try err("{\"\xb9\":\"0\",}");
378}386}
379test "n_object_missing_colon.json" {387test "n_object_missing_colon.json" {
388 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
389
380 try err("{\"a\" b}");390 try err("{\"a\" b}");
381}391}
382test "n_object_missing_key.json" {392test "n_object_missing_key.json" {
383 try err("{:\"b\"}");393 try err("{:\"b\"}");
384}394}
385test "n_object_missing_semicolon.json" {395test "n_object_missing_semicolon.json" {
396 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
397
386 try err("{\"a\" \"b\"}");398 try err("{\"a\" \"b\"}");
387}399}
388test "n_object_missing_value.json" {400test "n_object_missing_value.json" {
401 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
402
389 try err("{\"a\":");403 try err("{\"a\":");
390}404}
391test "n_object_no-colon.json" {405test "n_object_no-colon.json" {
406 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
407
392 try err("{\"a\"");408 try err("{\"a\"");
393}409}
394test "n_object_non_string_key.json" {410test "n_object_non_string_key.json" {
...@@ -401,39 +417,59 @@ test "n_object_repeated_null_null.json" {...@@ -401,39 +417,59 @@ test "n_object_repeated_null_null.json" {
401 try err("{null:null,null:null}");417 try err("{null:null,null:null}");
402}418}
403test "n_object_several_trailing_commas.json" {419test "n_object_several_trailing_commas.json" {
420 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
421
404 try err("{\"id\":0,,,,,}");422 try err("{\"id\":0,,,,,}");
405}423}
406test "n_object_single_quote.json" {424test "n_object_single_quote.json" {
407 try err("{'a':0}");425 try err("{'a':0}");
408}426}
409test "n_object_trailing_comma.json" {427test "n_object_trailing_comma.json" {
428 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
429
410 try err("{\"id\":0,}");430 try err("{\"id\":0,}");
411}431}
412test "n_object_trailing_comment.json" {432test "n_object_trailing_comment.json" {
433 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
434
413 try err("{\"a\":\"b\"}/**/");435 try err("{\"a\":\"b\"}/**/");
414}436}
415test "n_object_trailing_comment_open.json" {437test "n_object_trailing_comment_open.json" {
438 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
439
416 try err("{\"a\":\"b\"}/**//");440 try err("{\"a\":\"b\"}/**//");
417}441}
418test "n_object_trailing_comment_slash_open.json" {442test "n_object_trailing_comment_slash_open.json" {
443 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
444
419 try err("{\"a\":\"b\"}//");445 try err("{\"a\":\"b\"}//");
420}446}
421test "n_object_trailing_comment_slash_open_incomplete.json" {447test "n_object_trailing_comment_slash_open_incomplete.json" {
448 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
449
422 try err("{\"a\":\"b\"}/");450 try err("{\"a\":\"b\"}/");
423}451}
424test "n_object_two_commas_in_a_row.json" {452test "n_object_two_commas_in_a_row.json" {
453 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
454
425 try err("{\"a\":\"b\",,\"c\":\"d\"}");455 try err("{\"a\":\"b\",,\"c\":\"d\"}");
426}456}
427test "n_object_unquoted_key.json" {457test "n_object_unquoted_key.json" {
428 try err("{a: \"b\"}");458 try err("{a: \"b\"}");
429}459}
430test "n_object_unterminated-value.json" {460test "n_object_unterminated-value.json" {
461 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
462
431 try err("{\"a\":\"a");463 try err("{\"a\":\"a");
432}464}
433test "n_object_with_single_string.json" {465test "n_object_with_single_string.json" {
466 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
467
434 try err("{ \"foo\" : \"bar\", \"a\" }");468 try err("{ \"foo\" : \"bar\", \"a\" }");
435}469}
436test "n_object_with_trailing_garbage.json" {470test "n_object_with_trailing_garbage.json" {
471 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
472
437 try err("{\"a\":\"b\"}#");473 try err("{\"a\":\"b\"}#");
438}474}
439test "n_single_space.json" {475test "n_single_space.json" {
...@@ -560,6 +596,8 @@ test "n_structure_close_unopened_array.json" {...@@ -560,6 +596,8 @@ test "n_structure_close_unopened_array.json" {
560 try err("1]");596 try err("1]");
561}597}
562test "n_structure_comma_instead_of_closing_brace.json" {598test "n_structure_comma_instead_of_closing_brace.json" {
599 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
600
563 try err("{\"x\": true,");601 try err("{\"x\": true,");
564}602}
565test "n_structure_double_array.json" {603test "n_structure_double_array.json" {
...@@ -590,12 +628,18 @@ test "n_structure_object_followed_by_closing_object.json" {...@@ -590,12 +628,18 @@ test "n_structure_object_followed_by_closing_object.json" {
590 try err("{}}");628 try err("{}}");
591}629}
592test "n_structure_object_unclosed_no_value.json" {630test "n_structure_object_unclosed_no_value.json" {
631 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
632
593 try err("{\"\":");633 try err("{\"\":");
594}634}
595test "n_structure_object_with_comment.json" {635test "n_structure_object_with_comment.json" {
636 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
637
596 try err("{\"a\":/*comment*/\"b\"}");638 try err("{\"a\":/*comment*/\"b\"}");
597}639}
598test "n_structure_object_with_trailing_garbage.json" {640test "n_structure_object_with_trailing_garbage.json" {
641 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
642
599 try err("{\"a\": true} \"x\"");643 try err("{\"a\": true} \"x\"");
600}644}
601test "n_structure_open_array_apostrophe.json" {645test "n_structure_open_array_apostrophe.json" {
...@@ -605,6 +649,8 @@ test "n_structure_open_array_comma.json" {...@@ -605,6 +649,8 @@ test "n_structure_open_array_comma.json" {
605 try err("[,");649 try err("[,");
606}650}
607test "n_structure_open_array_object.json" {651test "n_structure_open_array_object.json" {
652 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
608 try err("[{\"\":" ** 50000 ++ "\n");654 try err("[{\"\":" ** 50000 ++ "\n");
609}655}
610test "n_structure_open_array_open_object.json" {656test "n_structure_open_array_open_object.json" {
...@@ -644,6 +690,8 @@ test "n_structure_single_star.json" {...@@ -644,6 +690,8 @@ test "n_structure_single_star.json" {
644 try err("*");690 try err("*");
645}691}
646test "n_structure_trailing_#.json" {692test "n_structure_trailing_#.json" {
693 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
694
647 try err("{\"a\":\"b\"}#{}");695 try err("{\"a\":\"b\"}#{}");
648}696}
649test "n_structure_uescaped_LF_before_string.json" {697test "n_structure_uescaped_LF_before_string.json" {
...@@ -662,6 +710,8 @@ test "n_structure_unclosed_array_unfinished_true.json" {...@@ -662,6 +710,8 @@ test "n_structure_unclosed_array_unfinished_true.json" {
662 try err("[ false, tru");710 try err("[ false, tru");
663}711}
664test "n_structure_unclosed_object.json" {712test "n_structure_unclosed_object.json" {
713 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
714
665 try err("{\"asd\":\"asd\"");715 try err("{\"asd\":\"asd\"");
666}716}
667test "n_structure_unicode-identifier.json" {717test "n_structure_unicode-identifier.json" {
...@@ -764,39 +814,61 @@ test "y_number_simple_real.json" {...@@ -764,39 +814,61 @@ test "y_number_simple_real.json" {
764 try ok("[123.456789]");814 try ok("[123.456789]");
765}815}
766test "y_object.json" {816test "y_object.json" {
817 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
818
767 try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");819 try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");
768}820}
769test "y_object_basic.json" {821test "y_object_basic.json" {
822 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
823
770 try ok("{\"asd\":\"sdf\"}");824 try ok("{\"asd\":\"sdf\"}");
771}825}
772test "y_object_duplicated_key.json" {826test "y_object_duplicated_key.json" {
827 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
828
773 try ok("{\"a\":\"b\",\"a\":\"c\"}");829 try ok("{\"a\":\"b\",\"a\":\"c\"}");
774}830}
775test "y_object_duplicated_key_and_value.json" {831test "y_object_duplicated_key_and_value.json" {
832 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
833
776 try ok("{\"a\":\"b\",\"a\":\"b\"}");834 try ok("{\"a\":\"b\",\"a\":\"b\"}");
777}835}
778test "y_object_empty.json" {836test "y_object_empty.json" {
779 try ok("{}");837 try ok("{}");
780}838}
781test "y_object_empty_key.json" {839test "y_object_empty_key.json" {
840 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
841
782 try ok("{\"\":0}");842 try ok("{\"\":0}");
783}843}
784test "y_object_escaped_null_in_key.json" {844test "y_object_escaped_null_in_key.json" {
845 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
846
785 try ok("{\"foo\\u0000bar\": 42}");847 try ok("{\"foo\\u0000bar\": 42}");
786}848}
787test "y_object_extreme_numbers.json" {849test "y_object_extreme_numbers.json" {
850 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
851
788 try ok("{ \"min\": -1.0e+28, \"max\": 1.0e+28 }");852 try ok("{ \"min\": -1.0e+28, \"max\": 1.0e+28 }");
789}853}
790test "y_object_long_strings.json" {854test "y_object_long_strings.json" {
855 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
856
791 try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");857 try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");
792}858}
793test "y_object_simple.json" {859test "y_object_simple.json" {
860 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
861
794 try ok("{\"a\":[]}");862 try ok("{\"a\":[]}");
795}863}
796test "y_object_string_unicode.json" {864test "y_object_string_unicode.json" {
865 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
866
797 try ok("{\"title\":\"\\u041f\\u043e\\u043b\\u0442\\u043e\\u0440\\u0430 \\u0417\\u0435\\u043c\\u043b\\u0435\\u043a\\u043e\\u043f\\u0430\" }");867 try ok("{\"title\":\"\\u041f\\u043e\\u043b\\u0442\\u043e\\u0440\\u0430 \\u0417\\u0435\\u043c\\u043b\\u0435\\u043a\\u043e\\u043f\\u0430\" }");
798}868}
799test "y_object_with_newlines.json" {869test "y_object_with_newlines.json" {
870 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
871
800 try ok("{\n\"a\": \"b\"\n}");872 try ok("{\n\"a\": \"b\"\n}");
801}873}
802test "y_string_1_2_3_bytes_UTF-8_sequences.json" {874test "y_string_1_2_3_bytes_UTF-8_sequences.json" {
lib/std/json/dynamic_test.zig+25
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const mem = std.mem;3const mem = std.mem;
3const testing = std.testing;4const testing = std.testing;
4const ArenaAllocator = std.heap.ArenaAllocator;5const ArenaAllocator = std.heap.ArenaAllocator;
...@@ -18,6 +19,8 @@ const jsonReader = @import("scanner.zig").reader;...@@ -18,6 +19,8 @@ const jsonReader = @import("scanner.zig").reader;
18const JsonReader = @import("scanner.zig").Reader;19const JsonReader = @import("scanner.zig").Reader;
1920
20test "json.parser.dynamic" {21test "json.parser.dynamic" {
22 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
23
21 const s =24 const s =
22 \\{25 \\{
23 \\ "Image": {26 \\ "Image": {
...@@ -72,6 +75,8 @@ test "json.parser.dynamic" {...@@ -72,6 +75,8 @@ test "json.parser.dynamic" {
7275
73const writeStream = @import("./stringify.zig").writeStream;76const writeStream = @import("./stringify.zig").writeStream;
74test "write json then parse it" {77test "write json then parse it" {
78 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
79
75 var out_buffer: [1000]u8 = undefined;80 var out_buffer: [1000]u8 = undefined;
7681
77 var fixed_buffer_stream = std.io.fixedBufferStream(&out_buffer);82 var fixed_buffer_stream = std.io.fixedBufferStream(&out_buffer);
...@@ -120,12 +125,16 @@ fn testParse(allocator: std.mem.Allocator, json_str: []const u8) !Value {...@@ -120,12 +125,16 @@ fn testParse(allocator: std.mem.Allocator, json_str: []const u8) !Value {
120}125}
121126
122test "parsing empty string gives appropriate error" {127test "parsing empty string gives appropriate error" {
128 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
129
123 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);130 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
124 defer arena_allocator.deinit();131 defer arena_allocator.deinit();
125 try testing.expectError(error.UnexpectedEndOfInput, testParse(arena_allocator.allocator(), ""));132 try testing.expectError(error.UnexpectedEndOfInput, testParse(arena_allocator.allocator(), ""));
126}133}
127134
128test "Value.array allocator should still be usable after parsing" {135test "Value.array allocator should still be usable after parsing" {
136 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
137
129 var parsed = try parseFromSlice(Value, std.testing.allocator, "[]", .{});138 var parsed = try parseFromSlice(Value, std.testing.allocator, "[]", .{});
130 defer parsed.deinit();139 defer parsed.deinit();
131140
...@@ -138,6 +147,8 @@ test "Value.array allocator should still be usable after parsing" {...@@ -138,6 +147,8 @@ test "Value.array allocator should still be usable after parsing" {
138}147}
139148
140test "integer after float has proper type" {149test "integer after float has proper type" {
150 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
151
141 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);152 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
142 defer arena_allocator.deinit();153 defer arena_allocator.deinit();
143 const parsed = try testParse(arena_allocator.allocator(),154 const parsed = try testParse(arena_allocator.allocator(),
...@@ -150,6 +161,8 @@ test "integer after float has proper type" {...@@ -150,6 +161,8 @@ test "integer after float has proper type" {
150}161}
151162
152test "escaped characters" {163test "escaped characters" {
164 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
165
153 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);166 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
154 defer arena_allocator.deinit();167 defer arena_allocator.deinit();
155 const input =168 const input =
...@@ -182,6 +195,8 @@ test "escaped characters" {...@@ -182,6 +195,8 @@ test "escaped characters" {
182}195}
183196
184test "Value.jsonStringify" {197test "Value.jsonStringify" {
198 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
199
185 var vals = [_]Value{200 var vals = [_]Value{
186 .{ .integer = 1 },201 .{ .integer = 1 },
187 .{ .integer = 2 },202 .{ .integer = 2 },
...@@ -229,6 +244,8 @@ test "Value.jsonStringify" {...@@ -229,6 +244,8 @@ test "Value.jsonStringify" {
229}244}
230245
231test "parseFromValue(std.json.Value,...)" {246test "parseFromValue(std.json.Value,...)" {
247 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
248
232 const str =249 const str =
233 \\{250 \\{
234 \\ "int": 32,251 \\ "int": 32,
...@@ -246,6 +263,8 @@ test "parseFromValue(std.json.Value,...)" {...@@ -246,6 +263,8 @@ test "parseFromValue(std.json.Value,...)" {
246}263}
247264
248test "polymorphic parsing" {265test "polymorphic parsing" {
266 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
267
249 if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108268 if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108
250 const doc =269 const doc =
251 \\{ "type": "div",270 \\{ "type": "div",
...@@ -291,6 +310,8 @@ test "polymorphic parsing" {...@@ -291,6 +310,8 @@ test "polymorphic parsing" {
291}310}
292311
293test "long object value" {312test "long object value" {
313 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
314
294 const value = "01234567890123456789";315 const value = "01234567890123456789";
295 const doc = "{\"key\":\"" ++ value ++ "\"}";316 const doc = "{\"key\":\"" ++ value ++ "\"}";
296 var fbs = std.io.fixedBufferStream(doc);317 var fbs = std.io.fixedBufferStream(doc);
...@@ -303,6 +324,8 @@ test "long object value" {...@@ -303,6 +324,8 @@ test "long object value" {
303}324}
304325
305test "ParseOptions.max_value_len" {326test "ParseOptions.max_value_len" {
327 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
328
306 var arena = ArenaAllocator.init(testing.allocator);329 var arena = ArenaAllocator.init(testing.allocator);
307 defer arena.deinit();330 defer arena.deinit();
308331
...@@ -317,6 +340,8 @@ test "ParseOptions.max_value_len" {...@@ -317,6 +340,8 @@ test "ParseOptions.max_value_len" {
317}340}
318341
319test "many object keys" {342test "many object keys" {
343 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
344
320 const doc =345 const doc =
321 \\{346 \\{
322 \\ "k1": "v1",347 \\ "k1": "v1",
lib/std/json/hashmap_test.zig+13
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const testing = std.testing;3const testing = std.testing;
34
4const ArrayHashMap = @import("hashmap.zig").ArrayHashMap;5const ArrayHashMap = @import("hashmap.zig").ArrayHashMap;
...@@ -18,6 +19,8 @@ const T = struct {...@@ -18,6 +19,8 @@ const T = struct {
18};19};
1920
20test "parse json hashmap" {21test "parse json hashmap" {
22 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
23
21 const doc =24 const doc =
22 \\{25 \\{
23 \\ "abc": {"i": 0, "s": "d"},26 \\ "abc": {"i": 0, "s": "d"},
...@@ -33,6 +36,8 @@ test "parse json hashmap" {...@@ -33,6 +36,8 @@ test "parse json hashmap" {
33}36}
3437
35test "parse json hashmap while streaming" {38test "parse json hashmap while streaming" {
39 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
40
36 const doc =41 const doc =
37 \\{42 \\{
38 \\ "abc": {"i": 0, "s": "d"},43 \\ "abc": {"i": 0, "s": "d"},
...@@ -58,6 +63,8 @@ test "parse json hashmap while streaming" {...@@ -58,6 +63,8 @@ test "parse json hashmap while streaming" {
58}63}
5964
60test "parse json hashmap duplicate fields" {65test "parse json hashmap duplicate fields" {
66 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
67
61 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);68 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
62 defer arena.deinit();69 defer arena.deinit();
6370
...@@ -86,6 +93,8 @@ test "parse json hashmap duplicate fields" {...@@ -86,6 +93,8 @@ test "parse json hashmap duplicate fields" {
86}93}
8794
88test "stringify json hashmap" {95test "stringify json hashmap" {
96 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
97
89 var value = ArrayHashMap(T){};98 var value = ArrayHashMap(T){};
90 defer value.deinit(testing.allocator);99 defer value.deinit(testing.allocator);
91 {100 {
...@@ -123,6 +132,8 @@ test "stringify json hashmap" {...@@ -123,6 +132,8 @@ test "stringify json hashmap" {
123}132}
124133
125test "stringify json hashmap whitespace" {134test "stringify json hashmap whitespace" {
135 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
136
126 var value = ArrayHashMap(T){};137 var value = ArrayHashMap(T){};
127 defer value.deinit(testing.allocator);138 defer value.deinit(testing.allocator);
128 try value.map.put(testing.allocator, "abc", .{ .i = 0, .s = "d" });139 try value.map.put(testing.allocator, "abc", .{ .i = 0, .s = "d" });
...@@ -147,6 +158,8 @@ test "stringify json hashmap whitespace" {...@@ -147,6 +158,8 @@ test "stringify json hashmap whitespace" {
147}158}
148159
149test "json parse from value hashmap" {160test "json parse from value hashmap" {
161 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
162
150 const doc =163 const doc =
151 \\{164 \\{
152 \\ "abc": {"i": 0, "s": "d"},165 \\ "abc": {"i": 0, "s": "d"},
lib/std/json/static_test.zig+49
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const testing = std.testing;3const testing = std.testing;
3const ArenaAllocator = std.heap.ArenaAllocator;4const ArenaAllocator = std.heap.ArenaAllocator;
4const Allocator = std.mem.Allocator;5const Allocator = std.mem.Allocator;
...@@ -371,6 +372,8 @@ test "test all types" {...@@ -371,6 +372,8 @@ test "test all types" {
371}372}
372373
373test "parse" {374test "parse" {
375 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
376
374 try testing.expectEqual(false, try parseFromSliceLeaky(bool, testing.allocator, "false", .{}));377 try testing.expectEqual(false, try parseFromSliceLeaky(bool, testing.allocator, "false", .{}));
375 try testing.expectEqual(true, try parseFromSliceLeaky(bool, testing.allocator, "true", .{}));378 try testing.expectEqual(true, try parseFromSliceLeaky(bool, testing.allocator, "true", .{}));
376 try testing.expectEqual(@as(u1, 1), try parseFromSliceLeaky(u1, testing.allocator, "1", .{}));379 try testing.expectEqual(@as(u1, 1), try parseFromSliceLeaky(u1, testing.allocator, "1", .{}));
...@@ -389,6 +392,8 @@ test "parse" {...@@ -389,6 +392,8 @@ test "parse" {
389}392}
390393
391test "parse into enum" {394test "parse into enum" {
395 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
396
392 const T = enum(u32) {397 const T = enum(u32) {
393 Foo = 42,398 Foo = 42,
394 Bar,399 Bar,
...@@ -402,6 +407,8 @@ test "parse into enum" {...@@ -402,6 +407,8 @@ test "parse into enum" {
402}407}
403408
404test "parse into that allocates a slice" {409test "parse into that allocates a slice" {
410 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
411
405 {412 {
406 // string as string413 // string as string
407 const parsed = try parseFromSlice([]u8, testing.allocator, "\"foo\"", .{});414 const parsed = try parseFromSlice([]u8, testing.allocator, "\"foo\"", .{});
...@@ -422,12 +429,16 @@ test "parse into that allocates a slice" {...@@ -422,12 +429,16 @@ test "parse into that allocates a slice" {
422}429}
423430
424test "parse into sentinel slice" {431test "parse into sentinel slice" {
432 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
433
425 const parsed = try parseFromSlice([:0]const u8, testing.allocator, "\"\\n\"", .{});434 const parsed = try parseFromSlice([:0]const u8, testing.allocator, "\"\\n\"", .{});
426 defer parsed.deinit();435 defer parsed.deinit();
427 try testing.expect(std.mem.eql(u8, parsed.value, "\n"));436 try testing.expect(std.mem.eql(u8, parsed.value, "\n"));
428}437}
429438
430test "parse into tagged union" {439test "parse into tagged union" {
440 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
441
431 const T = union(enum) {442 const T = union(enum) {
432 nothing,443 nothing,
433 int: i32,444 int: i32,
...@@ -443,6 +454,8 @@ test "parse into tagged union" {...@@ -443,6 +454,8 @@ test "parse into tagged union" {
443}454}
444455
445test "parse into tagged union errors" {456test "parse into tagged union errors" {
457 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
458
446 const T = union(enum) {459 const T = union(enum) {
447 nothing,460 nothing,
448 int: i32,461 int: i32,
...@@ -465,6 +478,8 @@ test "parse into tagged union errors" {...@@ -465,6 +478,8 @@ test "parse into tagged union errors" {
465}478}
466479
467test "parse into struct with no fields" {480test "parse into struct with no fields" {
481 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
482
468 const T = struct {};483 const T = struct {};
469 const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});484 const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});
470 defer parsed.deinit();485 defer parsed.deinit();
...@@ -474,6 +489,8 @@ test "parse into struct with no fields" {...@@ -474,6 +489,8 @@ test "parse into struct with no fields" {
474const test_const_value: usize = 123;489const test_const_value: usize = 123;
475490
476test "parse into struct with default const pointer field" {491test "parse into struct with default const pointer field" {
492 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
493
477 const T = struct { a: *const usize = &test_const_value };494 const T = struct { a: *const usize = &test_const_value };
478 const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});495 const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});
479 defer parsed.deinit();496 defer parsed.deinit();
...@@ -489,6 +506,8 @@ const test_default_str_slice: [2][]const u8 = [_][]const u8{...@@ -489,6 +506,8 @@ const test_default_str_slice: [2][]const u8 = [_][]const u8{
489};506};
490507
491test "freeing parsed structs with pointers to default values" {508test "freeing parsed structs with pointers to default values" {
509 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
510
492 const T = struct {511 const T = struct {
493 int: *const usize = &test_default_usize,512 int: *const usize = &test_default_usize,
494 int_ptr: *allowzero align(1) const usize = test_default_usize_ptr,513 int_ptr: *allowzero align(1) const usize = test_default_usize_ptr,
...@@ -502,11 +521,15 @@ test "freeing parsed structs with pointers to default values" {...@@ -502,11 +521,15 @@ test "freeing parsed structs with pointers to default values" {
502}521}
503522
504test "parse into struct where destination and source lengths mismatch" {523test "parse into struct where destination and source lengths mismatch" {
524 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
525
505 const T = struct { a: [2]u8 };526 const T = struct { a: [2]u8 };
506 try testing.expectError(error.LengthMismatch, parseFromSlice(T, testing.allocator, "{\"a\": \"bbb\"}", .{}));527 try testing.expectError(error.LengthMismatch, parseFromSlice(T, testing.allocator, "{\"a\": \"bbb\"}", .{}));
507}528}
508529
509test "parse into struct with misc fields" {530test "parse into struct with misc fields" {
531 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
532
510 const T = struct {533 const T = struct {
511 int: i64,534 int: i64,
512 float: f64,535 float: f64,
...@@ -582,6 +605,8 @@ test "parse into struct with misc fields" {...@@ -582,6 +605,8 @@ test "parse into struct with misc fields" {
582}605}
583606
584test "parse into struct with strings and arrays with sentinels" {607test "parse into struct with strings and arrays with sentinels" {
608 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
609
585 const T = struct {610 const T = struct {
586 language: [:0]const u8,611 language: [:0]const u8,
587 language_without_sentinel: []const u8,612 language_without_sentinel: []const u8,
...@@ -610,6 +635,8 @@ test "parse into struct with strings and arrays with sentinels" {...@@ -610,6 +635,8 @@ test "parse into struct with strings and arrays with sentinels" {
610}635}
611636
612test "parse into struct with duplicate field" {637test "parse into struct with duplicate field" {
638 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
639
613 const options_first = ParseOptions{ .duplicate_field_behavior = .use_first };640 const options_first = ParseOptions{ .duplicate_field_behavior = .use_first };
614 const options_last = ParseOptions{ .duplicate_field_behavior = .use_last };641 const options_last = ParseOptions{ .duplicate_field_behavior = .use_last };
615642
...@@ -629,6 +656,8 @@ test "parse into struct with duplicate field" {...@@ -629,6 +656,8 @@ test "parse into struct with duplicate field" {
629}656}
630657
631test "parse into struct ignoring unknown fields" {658test "parse into struct ignoring unknown fields" {
659 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
660
632 const T = struct {661 const T = struct {
633 int: i64,662 int: i64,
634 language: []const u8,663 language: []const u8,
...@@ -667,6 +696,8 @@ test "parse into struct ignoring unknown fields" {...@@ -667,6 +696,8 @@ test "parse into struct ignoring unknown fields" {
667}696}
668697
669test "parse into tuple" {698test "parse into tuple" {
699 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
700
670 const Union = union(enum) {701 const Union = union(enum) {
671 char: u8,702 char: u8,
672 float: f64,703 float: f64,
...@@ -722,6 +753,8 @@ const ParseIntoRecursiveUnionDefinitionValue = union(enum) {...@@ -722,6 +753,8 @@ const ParseIntoRecursiveUnionDefinitionValue = union(enum) {
722};753};
723754
724test "parse into recursive union definition" {755test "parse into recursive union definition" {
756 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
757
725 const T = struct {758 const T = struct {
726 values: ParseIntoRecursiveUnionDefinitionValue,759 values: ParseIntoRecursiveUnionDefinitionValue,
727 };760 };
...@@ -743,6 +776,8 @@ const ParseIntoDoubleRecursiveUnionValueSecond = union(enum) {...@@ -743,6 +776,8 @@ const ParseIntoDoubleRecursiveUnionValueSecond = union(enum) {
743};776};
744777
745test "parse into double recursive union definition" {778test "parse into double recursive union definition" {
779 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
780
746 const T = struct {781 const T = struct {
747 values: ParseIntoDoubleRecursiveUnionValueFirst,782 values: ParseIntoDoubleRecursiveUnionValueFirst,
748 };783 };
...@@ -754,6 +789,8 @@ test "parse into double recursive union definition" {...@@ -754,6 +789,8 @@ test "parse into double recursive union definition" {
754}789}
755790
756test "parse exponential into int" {791test "parse exponential into int" {
792 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
793
757 const T = struct { int: i64 };794 const T = struct { int: i64 };
758 const r = try parseFromSliceLeaky(T, testing.allocator, "{ \"int\": 4.2e2 }", .{});795 const r = try parseFromSliceLeaky(T, testing.allocator, "{ \"int\": 4.2e2 }", .{});
759 try testing.expectEqual(@as(i64, 420), r.int);796 try testing.expectEqual(@as(i64, 420), r.int);
...@@ -762,6 +799,8 @@ test "parse exponential into int" {...@@ -762,6 +799,8 @@ test "parse exponential into int" {
762}799}
763800
764test "parseFromTokenSource" {801test "parseFromTokenSource" {
802 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
803
765 {804 {
766 var scanner = JsonScanner.initCompleteInput(testing.allocator, "123");805 var scanner = JsonScanner.initCompleteInput(testing.allocator, "123");
767 defer scanner.deinit();806 defer scanner.deinit();
...@@ -781,10 +820,14 @@ test "parseFromTokenSource" {...@@ -781,10 +820,14 @@ test "parseFromTokenSource" {
781}820}
782821
783test "max_value_len" {822test "max_value_len" {
823 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
824
784 try testing.expectError(error.ValueTooLong, parseFromSlice([]u8, testing.allocator, "\"0123456789\"", .{ .max_value_len = 5 }));825 try testing.expectError(error.ValueTooLong, parseFromSlice([]u8, testing.allocator, "\"0123456789\"", .{ .max_value_len = 5 }));
785}826}
786827
787test "parse into vector" {828test "parse into vector" {
829 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
830
788 const T = struct {831 const T = struct {
789 vec_i32: @Vector(4, i32),832 vec_i32: @Vector(4, i32),
790 vec_f32: @Vector(2, f32),833 vec_f32: @Vector(2, f32),
...@@ -817,6 +860,8 @@ fn assertKey(...@@ -817,6 +860,8 @@ fn assertKey(
817 }860 }
818}861}
819test "json parse partial" {862test "json parse partial" {
863 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
864
820 const Inner = struct {865 const Inner = struct {
821 num: u32,866 num: u32,
822 yes: bool,867 yes: bool,
...@@ -872,6 +917,8 @@ test "json parse partial" {...@@ -872,6 +917,8 @@ test "json parse partial" {
872}917}
873918
874test "json parse allocate when streaming" {919test "json parse allocate when streaming" {
920 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
921
875 const T = struct {922 const T = struct {
876 not_const: []u8,923 not_const: []u8,
877 is_const: []const u8,924 is_const: []const u8,
...@@ -902,6 +949,8 @@ test "json parse allocate when streaming" {...@@ -902,6 +949,8 @@ test "json parse allocate when streaming" {
902}949}
903950
904test "parse at comptime" {951test "parse at comptime" {
952 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
953
905 const doc =954 const doc =
906 \\{955 \\{
907 \\ "vals": {956 \\ "vals": {
lib/std/json/stringify_test.zig+41
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const mem = std.mem;3const mem = std.mem;
3const testing = std.testing;4const testing = std.testing;
45
...@@ -15,6 +16,8 @@ const writeStreamMaxDepth = @import("stringify.zig").writeStreamMaxDepth;...@@ -15,6 +16,8 @@ const writeStreamMaxDepth = @import("stringify.zig").writeStreamMaxDepth;
15const writeStreamArbitraryDepth = @import("stringify.zig").writeStreamArbitraryDepth;16const writeStreamArbitraryDepth = @import("stringify.zig").writeStreamArbitraryDepth;
1617
17test "json write stream" {18test "json write stream" {
19 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
20
18 var out_buf: [1024]u8 = undefined;21 var out_buf: [1024]u8 = undefined;
19 var slice_stream = std.io.fixedBufferStream(&out_buf);22 var slice_stream = std.io.fixedBufferStream(&out_buf);
20 const out = slice_stream.writer();23 const out = slice_stream.writer();
...@@ -97,6 +100,8 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value {...@@ -97,6 +100,8 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value {
97}100}
98101
99test "stringify null optional fields" {102test "stringify null optional fields" {
103 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
104
100 const MyStruct = struct {105 const MyStruct = struct {
101 optional: ?[]const u8 = null,106 optional: ?[]const u8 = null,
102 required: []const u8 = "something",107 required: []const u8 = "something",
...@@ -118,6 +123,8 @@ test "stringify null optional fields" {...@@ -118,6 +123,8 @@ test "stringify null optional fields" {
118}123}
119124
120test "stringify basic types" {125test "stringify basic types" {
126 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
127
121 try testStringify("false", false, .{});128 try testStringify("false", false, .{});
122 try testStringify("true", true, .{});129 try testStringify("true", true, .{});
123 try testStringify("null", @as(?u8, null), .{});130 try testStringify("null", @as(?u8, null), .{});
...@@ -134,6 +141,8 @@ test "stringify basic types" {...@@ -134,6 +141,8 @@ test "stringify basic types" {
134}141}
135142
136test "stringify string" {143test "stringify string" {
144 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
145
137 try testStringify("\"hello\"", "hello", .{});146 try testStringify("\"hello\"", "hello", .{});
138 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{});147 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{});
139 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true });148 try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true });
...@@ -158,12 +167,16 @@ test "stringify string" {...@@ -158,12 +167,16 @@ test "stringify string" {
158}167}
159168
160test "stringify many-item sentinel-terminated string" {169test "stringify many-item sentinel-terminated string" {
170 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
171
161 try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{});172 try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{});
162 try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true });173 try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true });
163 try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true });174 try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true });
164}175}
165176
166test "stringify enums" {177test "stringify enums" {
178 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
179
167 const E = enum {180 const E = enum {
168 foo,181 foo,
169 bar,182 bar,
...@@ -173,11 +186,15 @@ test "stringify enums" {...@@ -173,11 +186,15 @@ test "stringify enums" {
173}186}
174187
175test "stringify enum literals" {188test "stringify enum literals" {
189 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
190
176 try testStringify("\"foo\"", .foo, .{});191 try testStringify("\"foo\"", .foo, .{});
177 try testStringify("\"bar\"", .bar, .{});192 try testStringify("\"bar\"", .bar, .{});
178}193}
179194
180test "stringify tagged unions" {195test "stringify tagged unions" {
196 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
197
181 const T = union(enum) {198 const T = union(enum) {
182 nothing,199 nothing,
183 foo: u32,200 foo: u32,
...@@ -189,12 +206,16 @@ test "stringify tagged unions" {...@@ -189,12 +206,16 @@ test "stringify tagged unions" {
189}206}
190207
191test "stringify struct" {208test "stringify struct" {
209 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
210
192 try testStringify("{\"foo\":42}", struct {211 try testStringify("{\"foo\":42}", struct {
193 foo: u32,212 foo: u32,
194 }{ .foo = 42 }, .{});213 }{ .foo = 42 }, .{});
195}214}
196215
197test "emit_strings_as_arrays" {216test "emit_strings_as_arrays" {
217 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
218
198 // Should only affect string values, not object keys.219 // Should only affect string values, not object keys.
199 try testStringify("{\"foo\":\"bar\"}", .{ .foo = "bar" }, .{});220 try testStringify("{\"foo\":\"bar\"}", .{ .foo = "bar" }, .{});
200 try testStringify("{\"foo\":[98,97,114]}", .{ .foo = "bar" }, .{ .emit_strings_as_arrays = true });221 try testStringify("{\"foo\":[98,97,114]}", .{ .foo = "bar" }, .{ .emit_strings_as_arrays = true });
...@@ -209,6 +230,8 @@ test "emit_strings_as_arrays" {...@@ -209,6 +230,8 @@ test "emit_strings_as_arrays" {
209}230}
210231
211test "stringify struct with indentation" {232test "stringify struct with indentation" {
233 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
234
212 try testStringify(235 try testStringify(
213 \\{236 \\{
214 \\ "foo": 42,237 \\ "foo": 42,
...@@ -254,6 +277,8 @@ test "stringify struct with indentation" {...@@ -254,6 +277,8 @@ test "stringify struct with indentation" {
254}277}
255278
256test "stringify struct with void field" {279test "stringify struct with void field" {
280 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
281
257 try testStringify("{\"foo\":42}", struct {282 try testStringify("{\"foo\":42}", struct {
258 foo: u32,283 foo: u32,
259 bar: void = {},284 bar: void = {},
...@@ -261,6 +286,8 @@ test "stringify struct with void field" {...@@ -261,6 +286,8 @@ test "stringify struct with void field" {
261}286}
262287
263test "stringify array of structs" {288test "stringify array of structs" {
289 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
290
264 const MyStruct = struct {291 const MyStruct = struct {
265 foo: u32,292 foo: u32,
266 };293 };
...@@ -272,6 +299,8 @@ test "stringify array of structs" {...@@ -272,6 +299,8 @@ test "stringify array of structs" {
272}299}
273300
274test "stringify struct with custom stringifier" {301test "stringify struct with custom stringifier" {
302 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
303
275 try testStringify("[\"something special\",42]", struct {304 try testStringify("[\"something special\",42]", struct {
276 foo: u32,305 foo: u32,
277 const Self = @This();306 const Self = @This();
...@@ -286,12 +315,16 @@ test "stringify struct with custom stringifier" {...@@ -286,12 +315,16 @@ test "stringify struct with custom stringifier" {
286}315}
287316
288test "stringify vector" {317test "stringify vector" {
318 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
319
289 try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{});320 try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{});
290 try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{});321 try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{});
291 try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true });322 try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true });
292}323}
293324
294test "stringify tuple" {325test "stringify tuple" {
326 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
327
295 try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{});328 try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{});
296}329}
297330
...@@ -378,6 +411,8 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St...@@ -378,6 +411,8 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St
378}411}
379412
380test "stringify alloc" {413test "stringify alloc" {
414 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
415
381 const allocator = std.testing.allocator;416 const allocator = std.testing.allocator;
382 const expected =417 const expected =
383 \\{"foo":"bar","answer":42,"my_friend":"sammy"}418 \\{"foo":"bar","answer":42,"my_friend":"sammy"}
...@@ -389,6 +424,8 @@ test "stringify alloc" {...@@ -389,6 +424,8 @@ test "stringify alloc" {
389}424}
390425
391test "comptime stringify" {426test "comptime stringify" {
427 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
428
392 comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable;429 comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable;
393 comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable;430 comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable;
394 comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable;431 comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable;
...@@ -409,6 +446,8 @@ test "comptime stringify" {...@@ -409,6 +446,8 @@ test "comptime stringify" {
409}446}
410447
411test "print" {448test "print" {
449 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
450
412 var out_buf: [1024]u8 = undefined;451 var out_buf: [1024]u8 = undefined;
413 var slice_stream = std.io.fixedBufferStream(&out_buf);452 var slice_stream = std.io.fixedBufferStream(&out_buf);
414 const out = slice_stream.writer();453 const out = slice_stream.writer();
...@@ -440,6 +479,8 @@ test "print" {...@@ -440,6 +479,8 @@ test "print" {
440}479}
441480
442test "nonportable numbers" {481test "nonportable numbers" {
482 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
483
443 try testStringify("9999999999999999", 9999999999999999, .{});484 try testStringify("9999999999999999", 9999999999999999, .{});
444 try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true });485 try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true });
445}486}
lib/std/json/test.zig+5
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const testing = std.testing;3const testing = std.testing;
3const parseFromSlice = @import("./static.zig").parseFromSlice;4const parseFromSlice = @import("./static.zig").parseFromSlice;
4const validate = @import("./scanner.zig").validate;5const validate = @import("./scanner.zig").validate;
...@@ -34,11 +35,15 @@ fn testHighLevelDynamicParser(s: []const u8) !void {...@@ -34,11 +35,15 @@ fn testHighLevelDynamicParser(s: []const u8) !void {
3435
35// Additional tests not part of test JSONTestSuite.36// Additional tests not part of test JSONTestSuite.
36test "y_trailing_comma_after_empty" {37test "y_trailing_comma_after_empty" {
38 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
39
37 try roundTrip(40 try roundTrip(
38 \\{"1":[],"2":{},"3":"4"}41 \\{"1":[],"2":{},"3":"4"}
39 );42 );
40}43}
41test "n_object_closed_missing_value" {44test "n_object_closed_missing_value" {
45 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
46
42 try err(47 try err(
43 \\{"a":}48 \\{"a":}
44 );49 );
lib/std/leb128.zig+4
...@@ -215,6 +215,8 @@ fn test_read_uleb128_seq(comptime T: type, comptime N: usize, encoded: []const u...@@ -215,6 +215,8 @@ fn test_read_uleb128_seq(comptime T: type, comptime N: usize, encoded: []const u
215}215}
216216
217test "deserialize signed LEB128" {217test "deserialize signed LEB128" {
218 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
219
218 // Truncated220 // Truncated
219 try testing.expectError(error.EndOfStream, test_read_stream_ileb128(i64, "\x80"));221 try testing.expectError(error.EndOfStream, test_read_stream_ileb128(i64, "\x80"));
220222
...@@ -361,6 +363,8 @@ test "serialize unsigned LEB128" {...@@ -361,6 +363,8 @@ test "serialize unsigned LEB128" {
361}363}
362364
363test "serialize signed LEB128" {365test "serialize signed LEB128" {
366 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
367
364 // explicitly test i0 because starting `t` at 0368 // explicitly test i0 because starting `t` at 0
365 // will break the while loop369 // will break the while loop
366 try test_write_leb128(@as(i0, 0));370 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 {...@@ -492,10 +492,13 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T {
492}492}
493493
494test "shl" {494test "shl" {
495 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
496
495 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {497 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
496 // https://github.com/ziglang/zig/issues/12012498 // https://github.com/ziglang/zig/issues/12012
497 return error.SkipZigTest;499 return error.SkipZigTest;
498 }500 }
501
499 try testing.expect(shl(u8, 0b11111111, @as(usize, 3)) == 0b11111000);502 try testing.expect(shl(u8, 0b11111111, @as(usize, 3)) == 0b11111000);
500 try testing.expect(shl(u8, 0b11111111, @as(usize, 8)) == 0);503 try testing.expect(shl(u8, 0b11111111, @as(usize, 8)) == 0);
501 try testing.expect(shl(u8, 0b11111111, @as(usize, 9)) == 0);504 try testing.expect(shl(u8, 0b11111111, @as(usize, 9)) == 0);
...@@ -536,10 +539,13 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T {...@@ -536,10 +539,13 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T {
536}539}
537540
538test "shr" {541test "shr" {
542 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
543
539 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {544 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
540 // https://github.com/ziglang/zig/issues/12012545 // https://github.com/ziglang/zig/issues/12012
541 return error.SkipZigTest;546 return error.SkipZigTest;
542 }547 }
548
543 try testing.expect(shr(u8, 0b11111111, @as(usize, 3)) == 0b00011111);549 try testing.expect(shr(u8, 0b11111111, @as(usize, 3)) == 0b00011111);
544 try testing.expect(shr(u8, 0b11111111, @as(usize, 8)) == 0);550 try testing.expect(shr(u8, 0b11111111, @as(usize, 8)) == 0);
545 try testing.expect(shr(u8, 0b11111111, @as(usize, 9)) == 0);551 try testing.expect(shr(u8, 0b11111111, @as(usize, 9)) == 0);
...@@ -581,10 +587,13 @@ pub fn rotr(comptime T: type, x: T, r: anytype) T {...@@ -581,10 +587,13 @@ pub fn rotr(comptime T: type, x: T, r: anytype) T {
581}587}
582588
583test "rotr" {589test "rotr" {
590 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
591
584 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {592 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
585 // https://github.com/ziglang/zig/issues/12012593 // https://github.com/ziglang/zig/issues/12012
586 return error.SkipZigTest;594 return error.SkipZigTest;
587 }595 }
596
588 try testing.expect(rotr(u0, 0b0, @as(usize, 3)) == 0b0);597 try testing.expect(rotr(u0, 0b0, @as(usize, 3)) == 0b0);
589 try testing.expect(rotr(u5, 0b00001, @as(usize, 0)) == 0b00001);598 try testing.expect(rotr(u5, 0b00001, @as(usize, 0)) == 0b00001);
590 try testing.expect(rotr(u6, 0b000001, @as(usize, 7)) == 0b100000);599 try testing.expect(rotr(u6, 0b000001, @as(usize, 7)) == 0b100000);
...@@ -625,10 +634,13 @@ pub fn rotl(comptime T: type, x: T, r: anytype) T {...@@ -625,10 +634,13 @@ pub fn rotl(comptime T: type, x: T, r: anytype) T {
625}634}
626635
627test "rotl" {636test "rotl" {
637 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
638
628 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {639 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
629 // https://github.com/ziglang/zig/issues/12012640 // https://github.com/ziglang/zig/issues/12012
630 return error.SkipZigTest;641 return error.SkipZigTest;
631 }642 }
643
632 try testing.expect(rotl(u0, 0b0, @as(usize, 3)) == 0b0);644 try testing.expect(rotl(u0, 0b0, @as(usize, 3)) == 0b0);
633 try testing.expect(rotl(u5, 0b00001, @as(usize, 0)) == 0b00001);645 try testing.expect(rotl(u5, 0b00001, @as(usize, 0)) == 0b00001);
634 try testing.expect(rotl(u6, 0b000001, @as(usize, 7)) == 0b000010);646 try testing.expect(rotl(u6, 0b000001, @as(usize, 7)) == 0b000010);
...@@ -752,6 +764,8 @@ pub fn divTrunc(comptime T: type, numerator: T, denominator: T) !T {...@@ -752,6 +764,8 @@ pub fn divTrunc(comptime T: type, numerator: T, denominator: T) !T {
752}764}
753765
754test "divTrunc" {766test "divTrunc" {
767 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
768
755 try testDivTrunc();769 try testDivTrunc();
756 try comptime testDivTrunc();770 try comptime testDivTrunc();
757}771}
...@@ -776,6 +790,8 @@ pub fn divFloor(comptime T: type, numerator: T, denominator: T) !T {...@@ -776,6 +790,8 @@ pub fn divFloor(comptime T: type, numerator: T, denominator: T) !T {
776}790}
777791
778test "divFloor" {792test "divFloor" {
793 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
794
779 try testDivFloor();795 try testDivFloor();
780 try comptime testDivFloor();796 try comptime testDivFloor();
781}797}
...@@ -813,6 +829,8 @@ pub fn divCeil(comptime T: type, numerator: T, denominator: T) !T {...@@ -813,6 +829,8 @@ pub fn divCeil(comptime T: type, numerator: T, denominator: T) !T {
813}829}
814830
815test "divCeil" {831test "divCeil" {
832 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
833
816 try testDivCeil();834 try testDivCeil();
817 try comptime testDivCeil();835 try comptime testDivCeil();
818}836}
...@@ -857,6 +875,8 @@ pub fn divExact(comptime T: type, numerator: T, denominator: T) !T {...@@ -857,6 +875,8 @@ pub fn divExact(comptime T: type, numerator: T, denominator: T) !T {
857}875}
858876
859test "divExact" {877test "divExact" {
878 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
879
860 try testDivExact();880 try testDivExact();
861 try comptime testDivExact();881 try comptime testDivExact();
862}882}
...@@ -887,6 +907,8 @@ test "mod" {...@@ -887,6 +907,8 @@ test "mod" {
887 try comptime testMod();907 try comptime testMod();
888}908}
889fn testMod() !void {909fn testMod() !void {
910 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
911
890 try testing.expect((mod(i32, -5, 3) catch unreachable) == 1);912 try testing.expect((mod(i32, -5, 3) catch unreachable) == 1);
891 try testing.expect((mod(i32, 5, 3) catch unreachable) == 2);913 try testing.expect((mod(i32, 5, 3) catch unreachable) == 2);
892 try testing.expectError(error.NegativeDenominator, mod(i32, 10, -1));914 try testing.expectError(error.NegativeDenominator, mod(i32, 10, -1));
...@@ -909,6 +931,8 @@ pub fn rem(comptime T: type, numerator: T, denominator: T) !T {...@@ -909,6 +931,8 @@ pub fn rem(comptime T: type, numerator: T, denominator: T) !T {
909}931}
910932
911test "rem" {933test "rem" {
934 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
935
912 try testRem();936 try testRem();
913 try comptime testRem();937 try comptime testRem();
914}938}
...@@ -1261,6 +1285,8 @@ pub fn lerp(a: anytype, b: anytype, t: anytype) @TypeOf(a, b, t) {...@@ -1261,6 +1285,8 @@ pub fn lerp(a: anytype, b: anytype, t: anytype) @TypeOf(a, b, t) {
1261}1285}
12621286
1263test "lerp" {1287test "lerp" {
1288 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1289
1264 try testing.expectEqual(@as(f64, 75), lerp(50, 100, 0.5));1290 try testing.expectEqual(@as(f64, 75), lerp(50, 100, 0.5));
1265 try testing.expectEqual(@as(f32, 43.75), lerp(50, 25, 0.25));1291 try testing.expectEqual(@as(f32, 43.75), lerp(50, 25, 0.25));
1266 try testing.expectEqual(@as(f64, -31.25), lerp(-50, 25, 0.25));1292 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" {...@@ -71,6 +71,8 @@ test "big.int set negative minimum" {
71}71}
7272
73test "big.int set double-width maximum then zero" {73test "big.int set double-width maximum then zero" {
74 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
75
74 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));76 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));
75 defer a.deinit();77 defer a.deinit();
76 try a.set(@as(DoubleLimb, 0));78 try a.set(@as(DoubleLimb, 0));
...@@ -244,6 +246,8 @@ test "big.int fits" {...@@ -244,6 +246,8 @@ test "big.int fits" {
244}246}
245247
246test "big.int string set" {248test "big.int string set" {
249 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
250
247 var a = try Managed.init(testing.allocator);251 var a = try Managed.init(testing.allocator);
248 defer a.deinit();252 defer a.deinit();
249253
...@@ -260,6 +264,8 @@ test "big.int string negative" {...@@ -260,6 +264,8 @@ test "big.int string negative" {
260}264}
261265
262test "big.int string set number with underscores" {266test "big.int string set number with underscores" {
267 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
268
263 var a = try Managed.init(testing.allocator);269 var a = try Managed.init(testing.allocator);
264 defer a.deinit();270 defer a.deinit();
265271
...@@ -268,6 +274,8 @@ test "big.int string set number with underscores" {...@@ -268,6 +274,8 @@ test "big.int string set number with underscores" {
268}274}
269275
270test "big.int string set case insensitive number" {276test "big.int string set case insensitive number" {
277 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
278
271 var a = try Managed.init(testing.allocator);279 var a = try Managed.init(testing.allocator);
272 defer a.deinit();280 defer a.deinit();
273281
...@@ -318,6 +326,8 @@ test "big.int twos complement limit set" {...@@ -318,6 +326,8 @@ test "big.int twos complement limit set" {
318}326}
319327
320test "big.int string to" {328test "big.int string to" {
329 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
330
321 var a = try Managed.initSet(testing.allocator, 120317241209124781241290847124);331 var a = try Managed.initSet(testing.allocator, 120317241209124781241290847124);
322 defer a.deinit();332 defer a.deinit();
323333
...@@ -358,6 +368,8 @@ test "big.int string to base 16" {...@@ -358,6 +368,8 @@ test "big.int string to base 16" {
358}368}
359369
360test "big.int neg string to" {370test "big.int neg string to" {
371 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
372
361 var a = try Managed.initSet(testing.allocator, -123907434);373 var a = try Managed.initSet(testing.allocator, -123907434);
362 defer a.deinit();374 defer a.deinit();
363375
...@@ -380,6 +392,8 @@ test "big.int zero string to" {...@@ -380,6 +392,8 @@ test "big.int zero string to" {
380}392}
381393
382test "big.int clone" {394test "big.int clone" {
395 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
396
383 var a = try Managed.initSet(testing.allocator, 1234);397 var a = try Managed.initSet(testing.allocator, 1234);
384 defer a.deinit();398 defer a.deinit();
385 var b = try a.clone();399 var b = try a.clone();
...@@ -517,6 +531,8 @@ test "big.int add multi-single" {...@@ -517,6 +531,8 @@ test "big.int add multi-single" {
517}531}
518532
519test "big.int add multi-multi" {533test "big.int add multi-multi" {
534 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
535
520 var op1: u128 = 0xefefefef7f7f7f7f;536 var op1: u128 = 0xefefefef7f7f7f7f;
521 var op2: u128 = 0xfefefefe9f9f9f9f;537 var op2: u128 = 0xfefefefe9f9f9f9f;
522 var a = try Managed.initSet(testing.allocator, op1);538 var a = try Managed.initSet(testing.allocator, op1);
...@@ -618,6 +634,8 @@ test "big.int addWrap single-single, unsigned" {...@@ -618,6 +634,8 @@ test "big.int addWrap single-single, unsigned" {
618}634}
619635
620test "big.int subWrap single-single, unsigned" {636test "big.int subWrap single-single, unsigned" {
637 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
638
621 var a = try Managed.initSet(testing.allocator, 0);639 var a = try Managed.initSet(testing.allocator, 0);
622 defer a.deinit();640 defer a.deinit();
623641
...@@ -631,6 +649,8 @@ test "big.int subWrap single-single, unsigned" {...@@ -631,6 +649,8 @@ test "big.int subWrap single-single, unsigned" {
631}649}
632650
633test "big.int addWrap multi-multi, unsigned, limb aligned" {651test "big.int addWrap multi-multi, unsigned, limb aligned" {
652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
634 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));654 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));
635 defer a.deinit();655 defer a.deinit();
636656
...@@ -683,6 +703,8 @@ test "big.int subWrap single-single, signed" {...@@ -683,6 +703,8 @@ test "big.int subWrap single-single, signed" {
683}703}
684704
685test "big.int addWrap multi-multi, signed, limb aligned" {705test "big.int addWrap multi-multi, signed, limb aligned" {
706 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
707
686 var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb));708 var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb));
687 defer a.deinit();709 defer a.deinit();
688710
...@@ -733,6 +755,8 @@ test "big.int subSat single-single, unsigned" {...@@ -733,6 +755,8 @@ test "big.int subSat single-single, unsigned" {
733}755}
734756
735test "big.int addSat multi-multi, unsigned, limb aligned" {757test "big.int addSat multi-multi, unsigned, limb aligned" {
758 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
759
736 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));760 var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));
737 defer a.deinit();761 defer a.deinit();
738762
...@@ -818,6 +842,8 @@ test "big.int sub single-single" {...@@ -818,6 +842,8 @@ test "big.int sub single-single" {
818}842}
819843
820test "big.int sub multi-single" {844test "big.int sub multi-single" {
845 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
846
821 var a = try Managed.initSet(testing.allocator, maxInt(Limb) + 1);847 var a = try Managed.initSet(testing.allocator, maxInt(Limb) + 1);
822 defer a.deinit();848 defer a.deinit();
823 var b = try Managed.initSet(testing.allocator, 1);849 var b = try Managed.initSet(testing.allocator, 1);
...@@ -831,6 +857,8 @@ test "big.int sub multi-single" {...@@ -831,6 +857,8 @@ test "big.int sub multi-single" {
831}857}
832858
833test "big.int sub multi-multi" {859test "big.int sub multi-multi" {
860 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
861
834 var op1: u128 = 0xefefefefefefefefefefefef;862 var op1: u128 = 0xefefefefefefefefefefefef;
835 var op2: u128 = 0xabababababababababababab;863 var op2: u128 = 0xabababababababababababab;
836864
...@@ -915,7 +943,10 @@ test "big.int mul multi-single" {...@@ -915,7 +943,10 @@ test "big.int mul multi-single" {
915}943}
916944
917test "big.int mul multi-multi" {945test "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
920 var op1: u256 = 0x998888efefefefefefefef;951 var op1: u256 = 0x998888efefefefefefefef;
921 var op2: u256 = 0x333000abababababababab;952 var op2: u256 = 0x333000abababababababab;
...@@ -932,6 +963,8 @@ test "big.int mul multi-multi" {...@@ -932,6 +963,8 @@ test "big.int mul multi-multi" {
932}963}
933964
934test "big.int mul alias r with a" {965test "big.int mul alias r with a" {
966 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
967
935 var a = try Managed.initSet(testing.allocator, maxInt(Limb));968 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
936 defer a.deinit();969 defer a.deinit();
937 var b = try Managed.initSet(testing.allocator, 2);970 var b = try Managed.initSet(testing.allocator, 2);
...@@ -943,6 +976,8 @@ test "big.int mul alias r with a" {...@@ -943,6 +976,8 @@ test "big.int mul alias r with a" {
943}976}
944977
945test "big.int mul alias r with b" {978test "big.int mul alias r with b" {
979 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
980
946 var a = try Managed.initSet(testing.allocator, maxInt(Limb));981 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
947 defer a.deinit();982 defer a.deinit();
948 var b = try Managed.initSet(testing.allocator, 2);983 var b = try Managed.initSet(testing.allocator, 2);
...@@ -954,6 +989,8 @@ test "big.int mul alias r with b" {...@@ -954,6 +989,8 @@ test "big.int mul alias r with b" {
954}989}
955990
956test "big.int mul alias r with a and b" {991test "big.int mul alias r with a and b" {
992 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
993
957 var a = try Managed.initSet(testing.allocator, maxInt(Limb));994 var a = try Managed.initSet(testing.allocator, maxInt(Limb));
958 defer a.deinit();995 defer a.deinit();
959996
...@@ -989,6 +1026,8 @@ test "big.int mul 0*0" {...@@ -989,6 +1026,8 @@ test "big.int mul 0*0" {
989}1026}
9901027
991test "big.int mul large" {1028test "big.int mul large" {
1029 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1030
992 var a = try Managed.initCapacity(testing.allocator, 50);1031 var a = try Managed.initCapacity(testing.allocator, 50);
993 defer a.deinit();1032 defer a.deinit();
994 var b = try Managed.initCapacity(testing.allocator, 100);1033 var b = try Managed.initCapacity(testing.allocator, 100);
...@@ -1036,7 +1075,10 @@ test "big.int mulWrap single-single signed" {...@@ -1036,7 +1075,10 @@ test "big.int mulWrap single-single signed" {
1036}1075}
10371076
1038test "big.int mulWrap multi-multi unsigned" {1077test "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
1041 var op1: u256 = 0x998888efefefefefefefef;1083 var op1: u256 = 0x998888efefefefefefefef;
1042 var op2: u256 = 0x333000abababababababab;1084 var op2: u256 = 0x333000abababababababab;
...@@ -1053,7 +1095,10 @@ test "big.int mulWrap multi-multi unsigned" {...@@ -1053,7 +1095,10 @@ test "big.int mulWrap multi-multi unsigned" {
1053}1095}
10541096
1055test "big.int mulWrap multi-multi signed" {1097test "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
1058 var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb) - 1);1103 var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb) - 1);
1059 defer a.deinit();1104 defer a.deinit();
...@@ -1068,6 +1113,8 @@ test "big.int mulWrap multi-multi signed" {...@@ -1068,6 +1113,8 @@ test "big.int mulWrap multi-multi signed" {
1068}1113}
10691114
1070test "big.int mulWrap large" {1115test "big.int mulWrap large" {
1116 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1117
1071 var a = try Managed.initCapacity(testing.allocator, 50);1118 var a = try Managed.initCapacity(testing.allocator, 50);
1072 defer a.deinit();1119 defer a.deinit();
1073 var b = try Managed.initCapacity(testing.allocator, 100);1120 var b = try Managed.initCapacity(testing.allocator, 100);
...@@ -1124,6 +1171,8 @@ test "big.int div single-half with rem" {...@@ -1124,6 +1171,8 @@ test "big.int div single-half with rem" {
1124}1171}
11251172
1126test "big.int div single-single no rem" {1173test "big.int div single-single no rem" {
1174 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1175
1127 // assumes usize is <= 64 bits.1176 // assumes usize is <= 64 bits.
1128 var a = try Managed.initSet(testing.allocator, 1 << 52);1177 var a = try Managed.initSet(testing.allocator, 1 << 52);
1129 defer a.deinit();1178 defer a.deinit();
...@@ -1141,6 +1190,8 @@ test "big.int div single-single no rem" {...@@ -1141,6 +1190,8 @@ test "big.int div single-single no rem" {
1141}1190}
11421191
1143test "big.int div single-single with rem" {1192test "big.int div single-single with rem" {
1193 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1194
1144 var a = try Managed.initSet(testing.allocator, (1 << 52) | (1 << 33));1195 var a = try Managed.initSet(testing.allocator, (1 << 52) | (1 << 33));
1145 defer a.deinit();1196 defer a.deinit();
1146 var b = try Managed.initSet(testing.allocator, (1 << 35));1197 var b = try Managed.initSet(testing.allocator, (1 << 35));
...@@ -1157,6 +1208,8 @@ test "big.int div single-single with rem" {...@@ -1157,6 +1208,8 @@ test "big.int div single-single with rem" {
1157}1208}
11581209
1159test "big.int div multi-single no rem" {1210test "big.int div multi-single no rem" {
1211 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1212
1160 var op1: u128 = 0xffffeeeeddddcccc;1213 var op1: u128 = 0xffffeeeeddddcccc;
1161 var op2: u128 = 34;1214 var op2: u128 = 34;
11621215
...@@ -1176,6 +1229,8 @@ test "big.int div multi-single no rem" {...@@ -1176,6 +1229,8 @@ test "big.int div multi-single no rem" {
1176}1229}
11771230
1178test "big.int div multi-single with rem" {1231test "big.int div multi-single with rem" {
1232 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1233
1179 var op1: u128 = 0xffffeeeeddddcccf;1234 var op1: u128 = 0xffffeeeeddddcccf;
1180 var op2: u128 = 34;1235 var op2: u128 = 34;
11811236
...@@ -1195,6 +1250,8 @@ test "big.int div multi-single with rem" {...@@ -1195,6 +1250,8 @@ test "big.int div multi-single with rem" {
1195}1250}
11961251
1197test "big.int div multi>2-single" {1252test "big.int div multi>2-single" {
1253 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1254
1198 var op1: u128 = 0xfefefefefefefefefefefefefefefefe;1255 var op1: u128 = 0xfefefefefefefefefefefefefefefefe;
1199 var op2: u128 = 0xefab8;1256 var op2: u128 = 0xefab8;
12001257
...@@ -1214,6 +1271,8 @@ test "big.int div multi>2-single" {...@@ -1214,6 +1271,8 @@ test "big.int div multi>2-single" {
1214}1271}
12151272
1216test "big.int div single-single q < r" {1273test "big.int div single-single q < r" {
1274 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1275
1217 var a = try Managed.initSet(testing.allocator, 0x0078f432);1276 var a = try Managed.initSet(testing.allocator, 0x0078f432);
1218 defer a.deinit();1277 defer a.deinit();
1219 var b = try Managed.initSet(testing.allocator, 0x01000000);1278 var b = try Managed.initSet(testing.allocator, 0x01000000);
...@@ -1258,7 +1317,10 @@ test "big.int div q=0 alias" {...@@ -1258,7 +1317,10 @@ test "big.int div q=0 alias" {
1258}1317}
12591318
1260test "big.int div multi-multi q < r" {1319test "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
1263 const op1 = 0x1ffffffff0078f432;1325 const op1 = 0x1ffffffff0078f432;
1264 const op2 = 0x1ffffffff01000000;1326 const op2 = 0x1ffffffff01000000;
...@@ -1374,6 +1436,8 @@ test "big.int div trunc single-single -/-" {...@@ -1374,6 +1436,8 @@ test "big.int div trunc single-single -/-" {
1374}1436}
13751437
1376test "big.int divTrunc #15535" {1438test "big.int divTrunc #15535" {
1439 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1440
1377 var one = try Managed.initSet(testing.allocator, 1);1441 var one = try Managed.initSet(testing.allocator, 1);
1378 defer one.deinit();1442 defer one.deinit();
1379 var x = try Managed.initSet(testing.allocator, std.math.pow(u128, 2, 64));1443 var x = try Managed.initSet(testing.allocator, std.math.pow(u128, 2, 64));
...@@ -1387,6 +1451,8 @@ test "big.int divTrunc #15535" {...@@ -1387,6 +1451,8 @@ test "big.int divTrunc #15535" {
1387}1451}
13881452
1389test "big.int divFloor #10932" {1453test "big.int divFloor #10932" {
1454 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1455
1390 var a = try Managed.init(testing.allocator);1456 var a = try Managed.init(testing.allocator);
1391 defer a.deinit();1457 defer a.deinit();
13921458
...@@ -1411,6 +1477,8 @@ test "big.int divFloor #10932" {...@@ -1411,6 +1477,8 @@ test "big.int divFloor #10932" {
1411}1477}
14121478
1413test "big.int divFloor #11166" {1479test "big.int divFloor #11166" {
1480 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1481
1414 var a = try Managed.init(testing.allocator);1482 var a = try Managed.init(testing.allocator);
1415 defer a.deinit();1483 defer a.deinit();
14161484
...@@ -1438,6 +1506,8 @@ test "big.int divFloor #11166" {...@@ -1438,6 +1506,8 @@ test "big.int divFloor #11166" {
1438}1506}
14391507
1440test "big.int gcd #10932" {1508test "big.int gcd #10932" {
1509 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1510
1441 var a = try Managed.init(testing.allocator);1511 var a = try Managed.init(testing.allocator);
1442 defer a.deinit();1512 defer a.deinit();
14431513
...@@ -1572,6 +1642,8 @@ test "big.int div floor single-single -/-" {...@@ -1572,6 +1642,8 @@ test "big.int div floor single-single -/-" {
1572}1642}
15731643
1574test "big.int div floor no remainder negative quotient" {1644test "big.int div floor no remainder negative quotient" {
1645 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1646
1575 const u: i32 = -0x80000000;1647 const u: i32 = -0x80000000;
1576 const v: i32 = 1;1648 const v: i32 = 1;
15771649
...@@ -1629,7 +1701,10 @@ test "big.int div floor positive close to zero" {...@@ -1629,7 +1701,10 @@ test "big.int div floor positive close to zero" {
1629}1701}
16301702
1631test "big.int div multi-multi with rem" {1703test "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
1634 var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeeddddccccbbbbaaaa9999);1709 var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeeddddccccbbbbaaaa9999);
1635 defer a.deinit();1710 defer a.deinit();
...@@ -1647,7 +1722,10 @@ test "big.int div multi-multi with rem" {...@@ -1647,7 +1722,10 @@ test "big.int div multi-multi with rem" {
1647}1722}
16481723
1649test "big.int div multi-multi no rem" {1724test "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
1652 var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeedb4fec200ee3a4286361);1730 var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeedb4fec200ee3a4286361);
1653 defer a.deinit();1731 defer a.deinit();
...@@ -1665,7 +1743,10 @@ test "big.int div multi-multi no rem" {...@@ -1665,7 +1743,10 @@ test "big.int div multi-multi no rem" {
1665}1743}
16661744
1667test "big.int div multi-multi (2 branch)" {1745test "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
1670 var a = try Managed.initSet(testing.allocator, 0x866666665555555588888887777777761111111111111111);1751 var a = try Managed.initSet(testing.allocator, 0x866666665555555588888887777777761111111111111111);
1671 defer a.deinit();1752 defer a.deinit();
...@@ -1683,7 +1764,10 @@ test "big.int div multi-multi (2 branch)" {...@@ -1683,7 +1764,10 @@ test "big.int div multi-multi (2 branch)" {
1683}1764}
16841765
1685test "big.int div multi-multi (3.1/3.3 branch)" {1766test "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
1688 var a = try Managed.initSet(testing.allocator, 0x11111111111111111111111111111111111111111111111111111111111111);1772 var a = try Managed.initSet(testing.allocator, 0x11111111111111111111111111111111111111111111111111111111111111);
1689 defer a.deinit();1773 defer a.deinit();
...@@ -1701,7 +1785,10 @@ test "big.int div multi-multi (3.1/3.3 branch)" {...@@ -1701,7 +1785,10 @@ test "big.int div multi-multi (3.1/3.3 branch)" {
1701}1785}
17021786
1703test "big.int div multi-single zero-limb trailing" {1787test "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
1706 var a = try Managed.initSet(testing.allocator, 0x60000000000000000000000000000000000000000000000000000000000000000);1793 var a = try Managed.initSet(testing.allocator, 0x60000000000000000000000000000000000000000000000000000000000000000);
1707 defer a.deinit();1794 defer a.deinit();
...@@ -1721,7 +1808,10 @@ test "big.int div multi-single zero-limb trailing" {...@@ -1721,7 +1808,10 @@ test "big.int div multi-single zero-limb trailing" {
1721}1808}
17221809
1723test "big.int div multi-multi zero-limb trailing (with rem)" {1810test "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
1726 var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);1816 var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);
1727 defer a.deinit();1817 defer a.deinit();
...@@ -1742,7 +1832,10 @@ test "big.int div multi-multi zero-limb trailing (with rem)" {...@@ -1742,7 +1832,10 @@ test "big.int div multi-multi zero-limb trailing (with rem)" {
1742}1832}
17431833
1744test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count > divisor zero-limb count" {1834test "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
1747 var a = try Managed.initSet(testing.allocator, 0x8666666655555555888888877777777611111111111111110000000000000000);1840 var a = try Managed.initSet(testing.allocator, 0x8666666655555555888888877777777611111111111111110000000000000000);
1748 defer a.deinit();1841 defer a.deinit();
...@@ -1763,7 +1856,10 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li...@@ -1763,7 +1856,10 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li
1763}1856}
17641857
1765test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count < divisor zero-limb count" {1858test "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
1768 var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);1864 var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);
1769 defer a.deinit();1865 defer a.deinit();
...@@ -1786,6 +1882,8 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li...@@ -1786,6 +1882,8 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li
1786}1882}
17871883
1788test "big.int div multi-multi fuzz case #1" {1884test "big.int div multi-multi fuzz case #1" {
1885 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1886
1789 var a = try Managed.init(testing.allocator);1887 var a = try Managed.init(testing.allocator);
1790 defer a.deinit();1888 defer a.deinit();
1791 var b = try Managed.init(testing.allocator);1889 var b = try Managed.init(testing.allocator);
...@@ -1810,6 +1908,8 @@ test "big.int div multi-multi fuzz case #1" {...@@ -1810,6 +1908,8 @@ test "big.int div multi-multi fuzz case #1" {
1810}1908}
18111909
1812test "big.int div multi-multi fuzz case #2" {1910test "big.int div multi-multi fuzz case #2" {
1911 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1912
1813 var a = try Managed.init(testing.allocator);1913 var a = try Managed.init(testing.allocator);
1814 defer a.deinit();1914 defer a.deinit();
1815 var b = try Managed.init(testing.allocator);1915 var b = try Managed.init(testing.allocator);
...@@ -1882,6 +1982,8 @@ test "big.int truncate multi to multi unsigned" {...@@ -1882,6 +1982,8 @@ test "big.int truncate multi to multi unsigned" {
1882}1982}
18831983
1884test "big.int truncate multi to multi signed" {1984test "big.int truncate multi to multi signed" {
1985 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1986
1885 var a = try Managed.initSet(testing.allocator, 3 << @bitSizeOf(Limb));1987 var a = try Managed.initSet(testing.allocator, 3 << @bitSizeOf(Limb));
1886 defer a.deinit();1988 defer a.deinit();
18871989
...@@ -1891,6 +1993,8 @@ test "big.int truncate multi to multi signed" {...@@ -1891,6 +1993,8 @@ test "big.int truncate multi to multi signed" {
1891}1993}
18921994
1893test "big.int truncate negative multi to single" {1995test "big.int truncate negative multi to single" {
1996 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1997
1894 var a = try Managed.initSet(testing.allocator, -@as(SignedDoubleLimb, maxInt(Limb) + 1));1998 var a = try Managed.initSet(testing.allocator, -@as(SignedDoubleLimb, maxInt(Limb) + 1));
1895 defer a.deinit();1999 defer a.deinit();
18962000
...@@ -1997,6 +2101,8 @@ test "big.int shift-right multi" {...@@ -1997,6 +2101,8 @@ test "big.int shift-right multi" {
1997}2101}
19982102
1999test "big.int shift-left single" {2103test "big.int shift-left single" {
2104 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2105
2000 var a = try Managed.initSet(testing.allocator, 0xffff);2106 var a = try Managed.initSet(testing.allocator, 0xffff);
2001 defer a.deinit();2107 defer a.deinit();
2002 try a.shiftLeft(&a, 16);2108 try a.shiftLeft(&a, 16);
...@@ -2041,6 +2147,8 @@ test "big.int sat shift-left simple unsigned" {...@@ -2041,6 +2147,8 @@ test "big.int sat shift-left simple unsigned" {
2041}2147}
20422148
2043test "big.int sat shift-left simple unsigned no sat" {2149test "big.int sat shift-left simple unsigned no sat" {
2150 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2151
2044 var a = try Managed.initSet(testing.allocator, 1);2152 var a = try Managed.initSet(testing.allocator, 1);
2045 defer a.deinit();2153 defer a.deinit();
2046 try a.shiftLeftSat(&a, 16, .unsigned, 21);2154 try a.shiftLeftSat(&a, 16, .unsigned, 21);
...@@ -2097,6 +2205,8 @@ test "big.int sat shift-left signed simple positive" {...@@ -2097,6 +2205,8 @@ test "big.int sat shift-left signed simple positive" {
2097}2205}
20982206
2099test "big.int sat shift-left signed multi positive" {2207test "big.int sat shift-left signed multi positive" {
2208 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2209
2100 var x: SignedDoubleLimb = 1;2210 var x: SignedDoubleLimb = 1;
2101 const shift = @bitSizeOf(SignedDoubleLimb) - 1;2211 const shift = @bitSizeOf(SignedDoubleLimb) - 1;
21022212
...@@ -2108,6 +2218,8 @@ test "big.int sat shift-left signed multi positive" {...@@ -2108,6 +2218,8 @@ test "big.int sat shift-left signed multi positive" {
2108}2218}
21092219
2110test "big.int sat shift-left signed multi negative" {2220test "big.int sat shift-left signed multi negative" {
2221 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2222
2111 var x: SignedDoubleLimb = -1;2223 var x: SignedDoubleLimb = -1;
2112 const shift = @bitSizeOf(SignedDoubleLimb) - 1;2224 const shift = @bitSizeOf(SignedDoubleLimb) - 1;
21132225
...@@ -2294,6 +2406,8 @@ test "big.int bitwise xor simple" {...@@ -2294,6 +2406,8 @@ test "big.int bitwise xor simple" {
2294}2406}
22952407
2296test "big.int bitwise xor multi-limb" {2408test "big.int bitwise xor multi-limb" {
2409 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2410
2297 var x: DoubleLimb = maxInt(Limb) + 1;2411 var x: DoubleLimb = maxInt(Limb) + 1;
2298 var y: DoubleLimb = maxInt(Limb);2412 var y: DoubleLimb = maxInt(Limb);
2299 var a = try Managed.initSet(testing.allocator, x);2413 var a = try Managed.initSet(testing.allocator, x);
...@@ -2468,6 +2582,8 @@ test "big.int var args" {...@@ -2468,6 +2582,8 @@ test "big.int var args" {
2468}2582}
24692583
2470test "big.int gcd non-one small" {2584test "big.int gcd non-one small" {
2585 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2586
2471 var a = try Managed.initSet(testing.allocator, 17);2587 var a = try Managed.initSet(testing.allocator, 17);
2472 defer a.deinit();2588 defer a.deinit();
2473 var b = try Managed.initSet(testing.allocator, 97);2589 var b = try Managed.initSet(testing.allocator, 97);
...@@ -2481,6 +2597,8 @@ test "big.int gcd non-one small" {...@@ -2481,6 +2597,8 @@ test "big.int gcd non-one small" {
2481}2597}
24822598
2483test "big.int gcd non-one medium" {2599test "big.int gcd non-one medium" {
2600 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2601
2484 var a = try Managed.initSet(testing.allocator, 4864);2602 var a = try Managed.initSet(testing.allocator, 4864);
2485 defer a.deinit();2603 defer a.deinit();
2486 var b = try Managed.initSet(testing.allocator, 3458);2604 var b = try Managed.initSet(testing.allocator, 3458);
...@@ -2494,6 +2612,8 @@ test "big.int gcd non-one medium" {...@@ -2494,6 +2612,8 @@ test "big.int gcd non-one medium" {
2494}2612}
24952613
2496test "big.int gcd non-one large" {2614test "big.int gcd non-one large" {
2615 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2616
2497 var a = try Managed.initSet(testing.allocator, 0xffffffffffffffff);2617 var a = try Managed.initSet(testing.allocator, 0xffffffffffffffff);
2498 defer a.deinit();2618 defer a.deinit();
2499 var b = try Managed.initSet(testing.allocator, 0xffffffffffffffff7777);2619 var b = try Managed.initSet(testing.allocator, 0xffffffffffffffff7777);
...@@ -2507,7 +2627,10 @@ test "big.int gcd non-one large" {...@@ -2507,7 +2627,10 @@ test "big.int gcd non-one large" {
2507}2627}
25082628
2509test "big.int gcd large multi-limb result" {2629test "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
2512 var a = try Managed.initSet(testing.allocator, 0x12345678123456781234567812345678123456781234567812345678);2635 var a = try Managed.initSet(testing.allocator, 0x12345678123456781234567812345678123456781234567812345678);
2513 defer a.deinit();2636 defer a.deinit();
...@@ -2523,6 +2646,8 @@ test "big.int gcd large multi-limb result" {...@@ -2523,6 +2646,8 @@ test "big.int gcd large multi-limb result" {
2523}2646}
25242647
2525test "big.int gcd one large" {2648test "big.int gcd one large" {
2649 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2650
2526 var a = try Managed.initSet(testing.allocator, 1897056385327307);2651 var a = try Managed.initSet(testing.allocator, 1897056385327307);
2527 defer a.deinit();2652 defer a.deinit();
2528 var b = try Managed.initSet(testing.allocator, 2251799813685248);2653 var b = try Managed.initSet(testing.allocator, 2251799813685248);
...@@ -2547,6 +2672,8 @@ test "big.int mutable to managed" {...@@ -2547,6 +2672,8 @@ test "big.int mutable to managed" {
2547}2672}
25482673
2549test "big.int const to managed" {2674test "big.int const to managed" {
2675 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2676
2550 var a = try Managed.initSet(testing.allocator, 123423453456);2677 var a = try Managed.initSet(testing.allocator, 123423453456);
2551 defer a.deinit();2678 defer a.deinit();
25522679
...@@ -2557,6 +2684,8 @@ test "big.int const to managed" {...@@ -2557,6 +2684,8 @@ test "big.int const to managed" {
2557}2684}
25582685
2559test "big.int pow" {2686test "big.int pow" {
2687 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2688
2560 {2689 {
2561 var a = try Managed.initSet(testing.allocator, -3);2690 var a = try Managed.initSet(testing.allocator, -3);
2562 defer a.deinit();2691 defer a.deinit();
...@@ -2612,6 +2741,8 @@ test "big.int pow" {...@@ -2612,6 +2741,8 @@ test "big.int pow" {
2612}2741}
26132742
2614test "big.int sqrt" {2743test "big.int sqrt" {
2744 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2745
2615 var r = try Managed.init(testing.allocator);2746 var r = try Managed.init(testing.allocator);
2616 defer r.deinit();2747 defer r.deinit();
2617 var a = try Managed.init(testing.allocator);2748 var a = try Managed.init(testing.allocator);
...@@ -2642,6 +2773,8 @@ test "big.int sqrt" {...@@ -2642,6 +2773,8 @@ test "big.int sqrt" {
2642}2773}
26432774
2644test "big.int regression test for 1 limb overflow with alias" {2775test "big.int regression test for 1 limb overflow with alias" {
2776 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2777
2645 // Note these happen to be two consecutive Fibonacci sequence numbers, the2778 // Note these happen to be two consecutive Fibonacci sequence numbers, the
2646 // first two whose sum exceeds 2**64.2779 // first two whose sum exceeds 2**64.
2647 var a = try Managed.initSet(testing.allocator, 7540113804746346429);2780 var a = try Managed.initSet(testing.allocator, 7540113804746346429);
...@@ -2656,6 +2789,8 @@ test "big.int regression test for 1 limb overflow with alias" {...@@ -2656,6 +2789,8 @@ test "big.int regression test for 1 limb overflow with alias" {
2656}2789}
26572790
2658test "big.int regression test for realloc with alias" {2791test "big.int regression test for realloc with alias" {
2792 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2793
2659 // Note these happen to be two consecutive Fibonacci sequence numbers, the2794 // Note these happen to be two consecutive Fibonacci sequence numbers, the
2660 // second of which is the first such number to exceed 2**192.2795 // second of which is the first such number to exceed 2**192.
2661 var a = try Managed.initSet(testing.allocator, 5611500259351924431073312796924978741056961814867751431689);2796 var a = try Managed.initSet(testing.allocator, 5611500259351924431073312796924978741056961814867751431689);
...@@ -2670,6 +2805,8 @@ test "big.int regression test for realloc with alias" {...@@ -2670,6 +2805,8 @@ test "big.int regression test for realloc with alias" {
2670}2805}
26712806
2672test "big int popcount" {2807test "big int popcount" {
2808 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2809
2673 var a = try Managed.init(testing.allocator);2810 var a = try Managed.init(testing.allocator);
2674 defer a.deinit();2811 defer a.deinit();
26752812
...@@ -2750,6 +2887,8 @@ fn popCountTest(val: *const Managed, bit_count: usize, expected: usize) !void {...@@ -2750,6 +2887,8 @@ fn popCountTest(val: *const Managed, bit_count: usize, expected: usize) !void {
2750}2887}
27512888
2752test "big int conversion read/write twos complement" {2889test "big int conversion read/write twos complement" {
2890 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2891
2753 var a = try Managed.initSet(testing.allocator, (1 << 493) - 1);2892 var a = try Managed.initSet(testing.allocator, (1 << 493) - 1);
2754 defer a.deinit();2893 defer a.deinit();
2755 var b = try Managed.initSet(testing.allocator, (1 << 493) - 1);2894 var b = try Managed.initSet(testing.allocator, (1 << 493) - 1);
...@@ -2848,6 +2987,8 @@ test "big int write twos complement +/- zero" {...@@ -2848,6 +2987,8 @@ test "big int write twos complement +/- zero" {
2848}2987}
28492988
2850test "big int conversion write twos complement with padding" {2989test "big int conversion write twos complement with padding" {
2990 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2991
2851 var a = try Managed.initSet(testing.allocator, 0x01_ffffffff_ffffffff_ffffffff);2992 var a = try Managed.initSet(testing.allocator, 0x01_ffffffff_ffffffff_ffffffff);
2852 defer a.deinit();2993 defer a.deinit();
28532994
...@@ -3031,6 +3172,8 @@ fn byteSwapTest(comptime T: type, comptime input: comptime_int, comptime expecte...@@ -3031,6 +3172,8 @@ fn byteSwapTest(comptime T: type, comptime input: comptime_int, comptime expecte
3031}3172}
30323173
3033test "big int byte swap" {3174test "big int byte swap" {
3175 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
3176
3034 var a = try Managed.initSet(testing.allocator, 0x01_ffffffff_ffffffff_ffffffff);3177 var a = try Managed.initSet(testing.allocator, 0x01_ffffffff_ffffffff_ffffffff);
3035 defer a.deinit();3178 defer a.deinit();
30363179
...@@ -3075,6 +3218,8 @@ test "big int byte swap" {...@@ -3075,6 +3218,8 @@ test "big int byte swap" {
3075}3218}
30763219
3077test "big.int mul multi-multi alias r with a and b" {3220test "big.int mul multi-multi alias r with a and b" {
3221 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
3222
3078 var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb));3223 var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb));
3079 defer a.deinit();3224 defer a.deinit();
30803225
...@@ -3091,6 +3236,8 @@ test "big.int mul multi-multi alias r with a and b" {...@@ -3091,6 +3236,8 @@ test "big.int mul multi-multi alias r with a and b" {
3091}3236}
30923237
3093test "big.int sqr multi alias r with a" {3238test "big.int sqr multi alias r with a" {
3239 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
3240
3094 var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb));3241 var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb));
3095 defer a.deinit();3242 defer a.deinit();
30963243
lib/std/math/big/rational.zig+35
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("../../std.zig");1const std = @import("../../std.zig");
2const builtin = @import("builtin");
2const debug = std.debug;3const debug = std.debug;
3const math = std.math;4const math = std.math;
4const mem = std.mem;5const mem = std.mem;
...@@ -493,6 +494,8 @@ fn extractLowBits(a: Int, comptime T: type) T {...@@ -493,6 +494,8 @@ fn extractLowBits(a: Int, comptime T: type) T {
493}494}
494495
495test "big.rational extractLowBits" {496test "big.rational extractLowBits" {
497 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
498
496 var a = try Int.initSet(testing.allocator, 0x11112222333344441234567887654321);499 var a = try Int.initSet(testing.allocator, 0x11112222333344441234567887654321);
497 defer a.deinit();500 defer a.deinit();
498501
...@@ -513,6 +516,8 @@ test "big.rational extractLowBits" {...@@ -513,6 +516,8 @@ test "big.rational extractLowBits" {
513}516}
514517
515test "big.rational set" {518test "big.rational set" {
519 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
520
516 var a = try Rational.init(testing.allocator);521 var a = try Rational.init(testing.allocator);
517 defer a.deinit();522 defer a.deinit();
518523
...@@ -542,6 +547,8 @@ test "big.rational set" {...@@ -542,6 +547,8 @@ test "big.rational set" {
542}547}
543548
544test "big.rational setFloat" {549test "big.rational setFloat" {
550 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
551
545 var a = try Rational.init(testing.allocator);552 var a = try Rational.init(testing.allocator);
546 defer a.deinit();553 defer a.deinit();
547554
...@@ -567,6 +574,8 @@ test "big.rational setFloat" {...@@ -567,6 +574,8 @@ test "big.rational setFloat" {
567}574}
568575
569test "big.rational setFloatString" {576test "big.rational setFloatString" {
577 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
578
570 var a = try Rational.init(testing.allocator);579 var a = try Rational.init(testing.allocator);
571 defer a.deinit();580 defer a.deinit();
572581
...@@ -578,6 +587,8 @@ test "big.rational setFloatString" {...@@ -578,6 +587,8 @@ test "big.rational setFloatString" {
578}587}
579588
580test "big.rational toFloat" {589test "big.rational toFloat" {
590 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
591
581 var a = try Rational.init(testing.allocator);592 var a = try Rational.init(testing.allocator);
582 defer a.deinit();593 defer a.deinit();
583594
...@@ -591,6 +602,8 @@ test "big.rational toFloat" {...@@ -591,6 +602,8 @@ test "big.rational toFloat" {
591}602}
592603
593test "big.rational set/to Float round-trip" {604test "big.rational set/to Float round-trip" {
605 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
606
594 var a = try Rational.init(testing.allocator);607 var a = try Rational.init(testing.allocator);
595 defer a.deinit();608 defer a.deinit();
596 var prng = std.rand.DefaultPrng.init(0x5EED);609 var prng = std.rand.DefaultPrng.init(0x5EED);
...@@ -604,6 +617,8 @@ test "big.rational set/to Float round-trip" {...@@ -604,6 +617,8 @@ test "big.rational set/to Float round-trip" {
604}617}
605618
606test "big.rational copy" {619test "big.rational copy" {
620 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
621
607 var a = try Rational.init(testing.allocator);622 var a = try Rational.init(testing.allocator);
608 defer a.deinit();623 defer a.deinit();
609624
...@@ -634,6 +649,8 @@ test "big.rational copy" {...@@ -634,6 +649,8 @@ test "big.rational copy" {
634}649}
635650
636test "big.rational negate" {651test "big.rational negate" {
652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
653
637 var a = try Rational.init(testing.allocator);654 var a = try Rational.init(testing.allocator);
638 defer a.deinit();655 defer a.deinit();
639656
...@@ -651,6 +668,8 @@ test "big.rational negate" {...@@ -651,6 +668,8 @@ test "big.rational negate" {
651}668}
652669
653test "big.rational abs" {670test "big.rational abs" {
671 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
672
654 var a = try Rational.init(testing.allocator);673 var a = try Rational.init(testing.allocator);
655 defer a.deinit();674 defer a.deinit();
656675
...@@ -668,6 +687,8 @@ test "big.rational abs" {...@@ -668,6 +687,8 @@ test "big.rational abs" {
668}687}
669688
670test "big.rational swap" {689test "big.rational swap" {
690 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
691
671 var a = try Rational.init(testing.allocator);692 var a = try Rational.init(testing.allocator);
672 defer a.deinit();693 defer a.deinit();
673 var b = try Rational.init(testing.allocator);694 var b = try Rational.init(testing.allocator);
...@@ -692,6 +713,8 @@ test "big.rational swap" {...@@ -692,6 +713,8 @@ test "big.rational swap" {
692}713}
693714
694test "big.rational order" {715test "big.rational order" {
716 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
717
695 var a = try Rational.init(testing.allocator);718 var a = try Rational.init(testing.allocator);
696 defer a.deinit();719 defer a.deinit();
697 var b = try Rational.init(testing.allocator);720 var b = try Rational.init(testing.allocator);
...@@ -707,6 +730,8 @@ test "big.rational order" {...@@ -707,6 +730,8 @@ test "big.rational order" {
707}730}
708731
709test "big.rational order/orderAbs with negative" {732test "big.rational order/orderAbs with negative" {
733 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
734
710 var a = try Rational.init(testing.allocator);735 var a = try Rational.init(testing.allocator);
711 defer a.deinit();736 defer a.deinit();
712 var b = try Rational.init(testing.allocator);737 var b = try Rational.init(testing.allocator);
...@@ -719,6 +744,8 @@ test "big.rational order/orderAbs with negative" {...@@ -719,6 +744,8 @@ test "big.rational order/orderAbs with negative" {
719}744}
720745
721test "big.rational add single-limb" {746test "big.rational add single-limb" {
747 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
748
722 var a = try Rational.init(testing.allocator);749 var a = try Rational.init(testing.allocator);
723 defer a.deinit();750 defer a.deinit();
724 var b = try Rational.init(testing.allocator);751 var b = try Rational.init(testing.allocator);
...@@ -734,6 +761,8 @@ test "big.rational add single-limb" {...@@ -734,6 +761,8 @@ test "big.rational add single-limb" {
734}761}
735762
736test "big.rational add" {763test "big.rational add" {
764 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
765
737 var a = try Rational.init(testing.allocator);766 var a = try Rational.init(testing.allocator);
738 defer a.deinit();767 defer a.deinit();
739 var b = try Rational.init(testing.allocator);768 var b = try Rational.init(testing.allocator);
...@@ -750,6 +779,8 @@ test "big.rational add" {...@@ -750,6 +779,8 @@ test "big.rational add" {
750}779}
751780
752test "big.rational sub" {781test "big.rational sub" {
782 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
783
753 var a = try Rational.init(testing.allocator);784 var a = try Rational.init(testing.allocator);
754 defer a.deinit();785 defer a.deinit();
755 var b = try Rational.init(testing.allocator);786 var b = try Rational.init(testing.allocator);
...@@ -766,6 +797,8 @@ test "big.rational sub" {...@@ -766,6 +797,8 @@ test "big.rational sub" {
766}797}
767798
768test "big.rational mul" {799test "big.rational mul" {
800 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
801
769 var a = try Rational.init(testing.allocator);802 var a = try Rational.init(testing.allocator);
770 defer a.deinit();803 defer a.deinit();
771 var b = try Rational.init(testing.allocator);804 var b = try Rational.init(testing.allocator);
...@@ -782,6 +815,8 @@ test "big.rational mul" {...@@ -782,6 +815,8 @@ test "big.rational mul" {
782}815}
783816
784test "big.rational div" {817test "big.rational div" {
818 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
819
785 {820 {
786 var a = try Rational.init(testing.allocator);821 var a = try Rational.init(testing.allocator);
787 defer a.deinit();822 defer a.deinit();
lib/std/math/ilogb.zig+9
...@@ -6,6 +6,7 @@...@@ -6,6 +6,7 @@
6// https://git.musl-libc.org/cgit/musl/tree/src/math/ilogb.c6// https://git.musl-libc.org/cgit/musl/tree/src/math/ilogb.c
77
8const std = @import("../std.zig");8const std = @import("../std.zig");
9const builtin = @import("builtin");
9const math = std.math;10const math = std.math;
10const expect = std.testing.expect;11const expect = std.testing.expect;
11const maxInt = std.math.maxInt;12const maxInt = std.math.maxInt;
...@@ -108,6 +109,8 @@ test "64" {...@@ -108,6 +109,8 @@ test "64" {
108}109}
109110
110test "80" {111test "80" {
112 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
113
111 try expect(ilogbX(f80, 0.0) == fp_ilogb0);114 try expect(ilogbX(f80, 0.0) == fp_ilogb0);
112 try expect(ilogbX(f80, 0.5) == -1);115 try expect(ilogbX(f80, 0.5) == -1);
113 try expect(ilogbX(f80, 0.8923) == -1);116 try expect(ilogbX(f80, 0.8923) == -1);
...@@ -122,6 +125,8 @@ test "80" {...@@ -122,6 +125,8 @@ test "80" {
122}125}
123126
124test "128" {127test "128" {
128 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
129
125 try expect(ilogbX(f128, 0.0) == fp_ilogb0);130 try expect(ilogbX(f128, 0.0) == fp_ilogb0);
126 try expect(ilogbX(f128, 0.5) == -1);131 try expect(ilogbX(f128, 0.5) == -1);
127 try expect(ilogbX(f128, 0.8923) == -1);132 try expect(ilogbX(f128, 0.8923) == -1);
...@@ -157,6 +162,8 @@ test "64 special" {...@@ -157,6 +162,8 @@ test "64 special" {
157}162}
158163
159test "80 special" {164test "80 special" {
165 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
166
160 try expect(ilogbX(f80, math.inf(f80)) == maxInt(i32));167 try expect(ilogbX(f80, math.inf(f80)) == maxInt(i32));
161 try expect(ilogbX(f80, -math.inf(f80)) == maxInt(i32));168 try expect(ilogbX(f80, -math.inf(f80)) == maxInt(i32));
162 try expect(ilogbX(f80, 0.0) == minInt(i32));169 try expect(ilogbX(f80, 0.0) == minInt(i32));
...@@ -164,6 +171,8 @@ test "80 special" {...@@ -164,6 +171,8 @@ test "80 special" {
164}171}
165172
166test "128 special" {173test "128 special" {
174 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
175
167 try expect(ilogbX(f128, math.inf(f128)) == maxInt(i32));176 try expect(ilogbX(f128, math.inf(f128)) == maxInt(i32));
168 try expect(ilogbX(f128, -math.inf(f128)) == maxInt(i32));177 try expect(ilogbX(f128, -math.inf(f128)) == maxInt(i32));
169 try expect(ilogbX(f128, 0.0) == minInt(i32));178 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) {...@@ -67,6 +67,7 @@ pub fn ldexp(x: anytype, n: i32) @TypeOf(x) {
67}67}
6868
69test "math.ldexp" {69test "math.ldexp" {
70 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
7071
71 // subnormals72 // subnormals
72 try expect(ldexp(@as(f16, 0x1.1FFp14), -14 - 9 - 15) == math.floatTrueMin(f16));73 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" {...@@ -170,11 +170,11 @@ test "log10_int vs old implementation" {
170test "log10_int close to powers of 10" {170test "log10_int close to powers of 10" {
171 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO171 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
172 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO172 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
173 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
174 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO173 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
175 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO174 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
176 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO175 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
177 if (builtin.zig_backend == .stage2_llvm and comptime builtin.target.isWasm()) return error.SkipZigTest; // TODO176 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
179 const int_types = .{ u8, u16, u32, u64, u128, u256, u512 };179 const int_types = .{ u8, u16, u32, u64, u128, u256, u512 };
180 const max_log_values: [7]usize = .{ 2, 4, 9, 19, 38, 77, 154 };180 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) {...@@ -56,6 +56,8 @@ pub fn log_int(comptime T: type, base: T, x: T) Log2Int(T) {
56}56}
5757
58test "math.log_int" {58test "math.log_int" {
59 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
60
59 // Test all unsigned integers with 2, 3, ..., 64 bits.61 // Test all unsigned integers with 2, 3, ..., 64 bits.
60 // We cannot test 0 or 1 bits since base must be > 1.62 // We cannot test 0 or 1 bits since base must be > 1.
61 inline for (2..64 + 1) |bits| {63 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 {...@@ -103,6 +103,8 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T {
103}103}
104104
105test "math.nextAfter.int" {105test "math.nextAfter.int" {
106 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
107
106 try expect(nextAfter(i0, 0, 0) == 0);108 try expect(nextAfter(i0, 0, 0) == 0);
107 try expect(nextAfter(u0, 0, 0) == 0);109 try expect(nextAfter(u0, 0, 0) == 0);
108 try expect(nextAfter(i1, 0, 0) == 0);110 try expect(nextAfter(i1, 0, 0) == 0);
lib/std/math/scalbn.zig+2
...@@ -7,6 +7,8 @@ const expect = std.testing.expect;...@@ -7,6 +7,8 @@ const expect = std.testing.expect;
7pub const scalbn = @import("ldexp.zig").ldexp;7pub const scalbn = @import("ldexp.zig").ldexp;
88
9test "math.scalbn" {9test "math.scalbn" {
10 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
11
10 // Verify we are using base 2.12 // Verify we are using base 2.
11 try expect(scalbn(@as(f16, 1.5), 4) == 24.0);13 try expect(scalbn(@as(f16, 1.5), 4) == 24.0);
12 try expect(scalbn(@as(f32, 1.5), 4) == 24.0);14 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 {...@@ -315,6 +315,8 @@ pub fn zeroes(comptime T: type) T {
315}315}
316316
317test "zeroes" {317test "zeroes" {
318 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
319
318 const C_struct = extern struct {320 const C_struct = extern struct {
319 x: u32,321 x: u32,
320 y: u32 align(128),322 y: u32 align(128),
...@@ -1023,6 +1025,8 @@ pub fn indexOfSentinel(comptime T: type, comptime sentinel: T, p: [*:sentinel]co...@@ -1023,6 +1025,8 @@ pub fn indexOfSentinel(comptime T: type, comptime sentinel: T, p: [*:sentinel]co
1023}1025}
10241026
1025test "indexOfSentinel vector paths" {1027test "indexOfSentinel vector paths" {
1028 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1029
1026 const Types = [_]type{ u8, u16, u32, u64 };1030 const Types = [_]type{ u8, u16, u32, u64 };
1027 const allocator = std.testing.allocator;1031 const allocator = std.testing.allocator;
10281032
...@@ -1737,6 +1741,8 @@ pub fn readIntSlice(comptime T: type, bytes: []const u8, endian: Endian) T {...@@ -1737,6 +1741,8 @@ pub fn readIntSlice(comptime T: type, bytes: []const u8, endian: Endian) T {
1737}1741}
17381742
1739test "comptime read/write int" {1743test "comptime read/write int" {
1744 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
1745
1740 comptime {1746 comptime {
1741 var bytes: [2]u8 = undefined;1747 var bytes: [2]u8 = undefined;
1742 writeIntLittle(u16, &bytes, 0x1234);1748 writeIntLittle(u16, &bytes, 0x1234);
...@@ -1752,7 +1758,10 @@ test "comptime read/write int" {...@@ -1752,7 +1758,10 @@ test "comptime read/write int" {
1752}1758}
17531759
1754test "readIntBig and readIntLittle" {1760test "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
1757 try testing.expect(readIntSliceBig(u0, &[_]u8{}) == 0x0);1766 try testing.expect(readIntSliceBig(u0, &[_]u8{}) == 0x0);
1758 try testing.expect(readIntSliceLittle(u0, &[_]u8{}) == 0x0);1767 try testing.expect(readIntSliceLittle(u0, &[_]u8{}) == 0x0);
...@@ -2053,7 +2062,10 @@ pub fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value...@@ -2053,7 +2062,10 @@ pub fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value
2053}2062}
20542063
2055test "writeIntBig and writeIntLittle" {2064test "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
2058 var buf0: [0]u8 = undefined;2070 var buf0: [0]u8 = undefined;
2059 var buf1: [1]u8 = undefined;2071 var buf1: [1]u8 = undefined;
...@@ -3297,6 +3309,8 @@ test "testStringEquality" {...@@ -3297,6 +3309,8 @@ test "testStringEquality" {
3297}3309}
32983310
3299test "testReadInt" {3311test "testReadInt" {
3312 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
3313
3300 try testReadIntImpl();3314 try testReadIntImpl();
3301 try comptime testReadIntImpl();3315 try comptime testReadIntImpl();
3302}3316}
...@@ -4650,8 +4664,10 @@ pub fn alignInSlice(slice: anytype, comptime new_alignment: usize) ?AlignedSlice...@@ -4650,8 +4664,10 @@ pub fn alignInSlice(slice: anytype, comptime new_alignment: usize) ?AlignedSlice
4650}4664}
46514665
4652test "read/write(Var)PackedInt" {4666test "read/write(Var)PackedInt" {
4653 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;4667 switch (builtin.zig_backend) {
46544668 .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
4669 else => {},
4670 }
4655 switch (builtin.cpu.arch) {4671 switch (builtin.cpu.arch) {
4656 // This test generates too much code to execute on WASI.4672 // This test generates too much code to execute on WASI.
4657 // LLVM backend fails with "too many locals: locals exceed maximum"4673 // LLVM backend fails with "too many locals: locals exceed maximum"
lib/std/multi_array_list.zig+16
...@@ -583,6 +583,8 @@ pub fn MultiArrayList(comptime T: type) type {...@@ -583,6 +583,8 @@ pub fn MultiArrayList(comptime T: type) type {
583}583}
584584
585test "basic usage" {585test "basic usage" {
586 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
587
586 const ally = testing.allocator;588 const ally = testing.allocator;
587589
588 const Foo = struct {590 const Foo = struct {
...@@ -677,6 +679,8 @@ test "basic usage" {...@@ -677,6 +679,8 @@ test "basic usage" {
677// This was observed to fail on aarch64 with LLVM 11, when the capacityInBytes679// This was observed to fail on aarch64 with LLVM 11, when the capacityInBytes
678// function used the @reduce code path.680// function used the @reduce code path.
679test "regression test for @reduce bug" {681test "regression test for @reduce bug" {
682 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
683
680 const ally = testing.allocator;684 const ally = testing.allocator;
681 var list = MultiArrayList(struct {685 var list = MultiArrayList(struct {
682 tag: std.zig.Token.Tag,686 tag: std.zig.Token.Tag,
...@@ -754,6 +758,8 @@ test "regression test for @reduce bug" {...@@ -754,6 +758,8 @@ test "regression test for @reduce bug" {
754}758}
755759
756test "ensure capacity on empty list" {760test "ensure capacity on empty list" {
761 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
762
757 const ally = testing.allocator;763 const ally = testing.allocator;
758764
759 const Foo = struct {765 const Foo = struct {
...@@ -789,6 +795,8 @@ test "ensure capacity on empty list" {...@@ -789,6 +795,8 @@ test "ensure capacity on empty list" {
789}795}
790796
791test "insert elements" {797test "insert elements" {
798 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
799
792 const ally = testing.allocator;800 const ally = testing.allocator;
793801
794 const Foo = struct {802 const Foo = struct {
...@@ -808,6 +816,8 @@ test "insert elements" {...@@ -808,6 +816,8 @@ test "insert elements" {
808}816}
809817
810test "union" {818test "union" {
819 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
820
811 const ally = testing.allocator;821 const ally = testing.allocator;
812822
813 const Foo = union(enum) {823 const Foo = union(enum) {
...@@ -863,6 +873,8 @@ test "union" {...@@ -863,6 +873,8 @@ test "union" {
863}873}
864874
865test "sorting a span" {875test "sorting a span" {
876 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
877
866 var list: MultiArrayList(struct { score: u32, chr: u8 }) = .{};878 var list: MultiArrayList(struct { score: u32, chr: u8 }) = .{};
867 defer list.deinit(testing.allocator);879 defer list.deinit(testing.allocator);
868880
...@@ -903,6 +915,8 @@ test "sorting a span" {...@@ -903,6 +915,8 @@ test "sorting a span" {
903}915}
904916
905test "0 sized struct field" {917test "0 sized struct field" {
918 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
919
906 const ally = testing.allocator;920 const ally = testing.allocator;
907921
908 const Foo = struct {922 const Foo = struct {
...@@ -930,6 +944,8 @@ test "0 sized struct field" {...@@ -930,6 +944,8 @@ test "0 sized struct field" {
930}944}
931945
932test "0 sized struct" {946test "0 sized struct" {
947 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
948
933 const ally = testing.allocator;949 const ally = testing.allocator;
934950
935 const Foo = struct {951 const Foo = struct {
lib/std/net/test.zig+6
...@@ -5,6 +5,7 @@ const mem = std.mem;...@@ -5,6 +5,7 @@ const mem = std.mem;
5const testing = std.testing;5const testing = std.testing;
66
7test "parse and render IPv6 addresses" {7test "parse and render IPv6 addresses" {
8 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
8 if (builtin.os.tag == .wasi) return error.SkipZigTest;9 if (builtin.os.tag == .wasi) return error.SkipZigTest;
910
10 var buffer: [100]u8 = undefined;11 var buffer: [100]u8 = undefined;
...@@ -70,6 +71,7 @@ test "invalid but parseable IPv6 scope ids" {...@@ -70,6 +71,7 @@ test "invalid but parseable IPv6 scope ids" {
70}71}
7172
72test "parse and render IPv4 addresses" {73test "parse and render IPv4 addresses" {
74 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
73 if (builtin.os.tag == .wasi) return error.SkipZigTest;75 if (builtin.os.tag == .wasi) return error.SkipZigTest;
7476
75 var buffer: [18]u8 = undefined;77 var buffer: [18]u8 = undefined;
...@@ -109,6 +111,8 @@ test "parse and render UNIX addresses" {...@@ -109,6 +111,8 @@ test "parse and render UNIX addresses" {
109test "resolve DNS" {111test "resolve DNS" {
110 if (builtin.os.tag == .wasi) return error.SkipZigTest;112 if (builtin.os.tag == .wasi) return error.SkipZigTest;
111113
114 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
115
112 if (builtin.os.tag == .windows) {116 if (builtin.os.tag == .windows) {
113 _ = try std.os.windows.WSAStartup(2, 2);117 _ = try std.os.windows.WSAStartup(2, 2);
114 }118 }
...@@ -291,6 +295,8 @@ test "listen on a unix socket, send bytes, receive bytes" {...@@ -291,6 +295,8 @@ test "listen on a unix socket, send bytes, receive bytes" {
291 if (builtin.single_threaded) return error.SkipZigTest;295 if (builtin.single_threaded) return error.SkipZigTest;
292 if (!net.has_unix_sockets) return error.SkipZigTest;296 if (!net.has_unix_sockets) return error.SkipZigTest;
293297
298 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
299
294 if (builtin.os.tag == .windows) {300 if (builtin.os.tag == .windows) {
295 _ = try std.os.windows.WSAStartup(2, 2);301 _ = try std.os.windows.WSAStartup(2, 2);
296 }302 }
lib/std/once.zig+2
...@@ -46,6 +46,8 @@ fn incr() void {...@@ -46,6 +46,8 @@ fn incr() void {
46}46}
4747
48test "Once executes its function just once" {48test "Once executes its function just once" {
49 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
50
49 if (builtin.single_threaded) {51 if (builtin.single_threaded) {
50 global_once.call();52 global_once.call();
51 global_once.call();53 global_once.call();
lib/std/os/linux/io_uring.zig+30
...@@ -1741,6 +1741,8 @@ test "readv" {...@@ -1741,6 +1741,8 @@ test "readv" {
1741test "writev/fsync/readv" {1741test "writev/fsync/readv" {
1742 if (builtin.os.tag != .linux) return error.SkipZigTest;1742 if (builtin.os.tag != .linux) return error.SkipZigTest;
17431743
1744 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1745
1744 var ring = IO_Uring.init(4, 0) catch |err| switch (err) {1746 var ring = IO_Uring.init(4, 0) catch |err| switch (err) {
1745 error.SystemOutdated => return error.SkipZigTest,1747 error.SystemOutdated => return error.SkipZigTest,
1746 error.PermissionDenied => return error.SkipZigTest,1748 error.PermissionDenied => return error.SkipZigTest,
...@@ -1811,6 +1813,8 @@ test "writev/fsync/readv" {...@@ -1811,6 +1813,8 @@ test "writev/fsync/readv" {
1811test "write/read" {1813test "write/read" {
1812 if (builtin.os.tag != .linux) return error.SkipZigTest;1814 if (builtin.os.tag != .linux) return error.SkipZigTest;
18131815
1816 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1817
1814 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {1818 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
1815 error.SystemOutdated => return error.SkipZigTest,1819 error.SystemOutdated => return error.SkipZigTest,
1816 error.PermissionDenied => return error.SkipZigTest,1820 error.PermissionDenied => return error.SkipZigTest,
...@@ -1858,6 +1862,8 @@ test "write/read" {...@@ -1858,6 +1862,8 @@ test "write/read" {
1858test "splice/read" {1862test "splice/read" {
1859 if (builtin.os.tag != .linux) return error.SkipZigTest;1863 if (builtin.os.tag != .linux) return error.SkipZigTest;
18601864
1865 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1866
1861 var ring = IO_Uring.init(4, 0) catch |err| switch (err) {1867 var ring = IO_Uring.init(4, 0) catch |err| switch (err) {
1862 error.SystemOutdated => return error.SkipZigTest,1868 error.SystemOutdated => return error.SkipZigTest,
1863 error.PermissionDenied => return error.SkipZigTest,1869 error.PermissionDenied => return error.SkipZigTest,
...@@ -1929,6 +1935,8 @@ test "splice/read" {...@@ -1929,6 +1935,8 @@ test "splice/read" {
1929test "write_fixed/read_fixed" {1935test "write_fixed/read_fixed" {
1930 if (builtin.os.tag != .linux) return error.SkipZigTest;1936 if (builtin.os.tag != .linux) return error.SkipZigTest;
19311937
1938 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1939
1932 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {1940 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
1933 error.SystemOutdated => return error.SkipZigTest,1941 error.SystemOutdated => return error.SkipZigTest,
1934 error.PermissionDenied => return error.SkipZigTest,1942 error.PermissionDenied => return error.SkipZigTest,
...@@ -1994,6 +2002,8 @@ test "write_fixed/read_fixed" {...@@ -1994,6 +2002,8 @@ test "write_fixed/read_fixed" {
1994test "openat" {2002test "openat" {
1995 if (builtin.os.tag != .linux) return error.SkipZigTest;2003 if (builtin.os.tag != .linux) return error.SkipZigTest;
19962004
2005 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2006
1997 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2007 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
1998 error.SystemOutdated => return error.SkipZigTest,2008 error.SystemOutdated => return error.SkipZigTest,
1999 error.PermissionDenied => return error.SkipZigTest,2009 error.PermissionDenied => return error.SkipZigTest,
...@@ -2045,6 +2055,8 @@ test "openat" {...@@ -2045,6 +2055,8 @@ test "openat" {
2045test "close" {2055test "close" {
2046 if (builtin.os.tag != .linux) return error.SkipZigTest;2056 if (builtin.os.tag != .linux) return error.SkipZigTest;
20472057
2058 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2059
2048 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2060 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2049 error.SystemOutdated => return error.SkipZigTest,2061 error.SystemOutdated => return error.SkipZigTest,
2050 error.PermissionDenied => return error.SkipZigTest,2062 error.PermissionDenied => return error.SkipZigTest,
...@@ -2204,6 +2216,8 @@ test "sendmsg/recvmsg" {...@@ -2204,6 +2216,8 @@ test "sendmsg/recvmsg" {
2204test "timeout (after a relative time)" {2216test "timeout (after a relative time)" {
2205 if (builtin.os.tag != .linux) return error.SkipZigTest;2217 if (builtin.os.tag != .linux) return error.SkipZigTest;
22062218
2219 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2220
2207 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2221 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2208 error.SystemOutdated => return error.SkipZigTest,2222 error.SystemOutdated => return error.SkipZigTest,
2209 error.PermissionDenied => return error.SkipZigTest,2223 error.PermissionDenied => return error.SkipZigTest,
...@@ -2268,6 +2282,8 @@ test "timeout (after a number of completions)" {...@@ -2268,6 +2282,8 @@ test "timeout (after a number of completions)" {
2268test "timeout_remove" {2282test "timeout_remove" {
2269 if (builtin.os.tag != .linux) return error.SkipZigTest;2283 if (builtin.os.tag != .linux) return error.SkipZigTest;
22702284
2285 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2286
2271 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {2287 var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
2272 error.SystemOutdated => return error.SkipZigTest,2288 error.SystemOutdated => return error.SkipZigTest,
2273 error.PermissionDenied => return error.SkipZigTest,2289 error.PermissionDenied => return error.SkipZigTest,
...@@ -2376,6 +2392,8 @@ test "accept/connect/recv/link_timeout" {...@@ -2376,6 +2392,8 @@ test "accept/connect/recv/link_timeout" {
2376test "fallocate" {2392test "fallocate" {
2377 if (builtin.os.tag != .linux) return error.SkipZigTest;2393 if (builtin.os.tag != .linux) return error.SkipZigTest;
23782394
2395 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2396
2379 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2397 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2380 error.SystemOutdated => return error.SkipZigTest,2398 error.SystemOutdated => return error.SkipZigTest,
2381 error.PermissionDenied => return error.SkipZigTest,2399 error.PermissionDenied => return error.SkipZigTest,
...@@ -2422,6 +2440,8 @@ test "fallocate" {...@@ -2422,6 +2440,8 @@ test "fallocate" {
2422test "statx" {2440test "statx" {
2423 if (builtin.os.tag != .linux) return error.SkipZigTest;2441 if (builtin.os.tag != .linux) return error.SkipZigTest;
24242442
2443 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2444
2425 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2445 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2426 error.SystemOutdated => return error.SkipZigTest,2446 error.SystemOutdated => return error.SkipZigTest,
2427 error.PermissionDenied => return error.SkipZigTest,2447 error.PermissionDenied => return error.SkipZigTest,
...@@ -2678,6 +2698,8 @@ test "shutdown" {...@@ -2678,6 +2698,8 @@ test "shutdown" {
2678test "renameat" {2698test "renameat" {
2679 if (builtin.os.tag != .linux) return error.SkipZigTest;2699 if (builtin.os.tag != .linux) return error.SkipZigTest;
26802700
2701 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2702
2681 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2703 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2682 error.SystemOutdated => return error.SkipZigTest,2704 error.SystemOutdated => return error.SkipZigTest,
2683 error.PermissionDenied => return error.SkipZigTest,2705 error.PermissionDenied => return error.SkipZigTest,
...@@ -2747,6 +2769,8 @@ test "renameat" {...@@ -2747,6 +2769,8 @@ test "renameat" {
2747test "unlinkat" {2769test "unlinkat" {
2748 if (builtin.os.tag != .linux) return error.SkipZigTest;2770 if (builtin.os.tag != .linux) return error.SkipZigTest;
27492771
2772 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2773
2750 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2774 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2751 error.SystemOutdated => return error.SkipZigTest,2775 error.SystemOutdated => return error.SkipZigTest,
2752 error.PermissionDenied => return error.SkipZigTest,2776 error.PermissionDenied => return error.SkipZigTest,
...@@ -2799,6 +2823,8 @@ test "unlinkat" {...@@ -2799,6 +2823,8 @@ test "unlinkat" {
2799test "mkdirat" {2823test "mkdirat" {
2800 if (builtin.os.tag != .linux) return error.SkipZigTest;2824 if (builtin.os.tag != .linux) return error.SkipZigTest;
28012825
2826 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2827
2802 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2828 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2803 error.SystemOutdated => return error.SkipZigTest,2829 error.SystemOutdated => return error.SkipZigTest,
2804 error.PermissionDenied => return error.SkipZigTest,2830 error.PermissionDenied => return error.SkipZigTest,
...@@ -2843,6 +2869,8 @@ test "mkdirat" {...@@ -2843,6 +2869,8 @@ test "mkdirat" {
2843test "symlinkat" {2869test "symlinkat" {
2844 if (builtin.os.tag != .linux) return error.SkipZigTest;2870 if (builtin.os.tag != .linux) return error.SkipZigTest;
28452871
2872 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2873
2846 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2874 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2847 error.SystemOutdated => return error.SkipZigTest,2875 error.SystemOutdated => return error.SkipZigTest,
2848 error.PermissionDenied => return error.SkipZigTest,2876 error.PermissionDenied => return error.SkipZigTest,
...@@ -2891,6 +2919,8 @@ test "symlinkat" {...@@ -2891,6 +2919,8 @@ test "symlinkat" {
2891test "linkat" {2919test "linkat" {
2892 if (builtin.os.tag != .linux) return error.SkipZigTest;2920 if (builtin.os.tag != .linux) return error.SkipZigTest;
28932921
2922 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2923
2894 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {2924 var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
2895 error.SystemOutdated => return error.SkipZigTest,2925 error.SystemOutdated => return error.SkipZigTest,
2896 error.PermissionDenied => return error.SkipZigTest,2926 error.PermissionDenied => return error.SkipZigTest,
lib/std/os/linux/test.zig+6
...@@ -8,6 +8,8 @@ const expectEqual = std.testing.expectEqual;...@@ -8,6 +8,8 @@ const expectEqual = std.testing.expectEqual;
8const fs = std.fs;8const fs = std.fs;
99
10test "fallocate" {10test "fallocate" {
11 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
12
11 var tmp = std.testing.tmpDir(.{});13 var tmp = std.testing.tmpDir(.{});
12 defer tmp.cleanup();14 defer tmp.cleanup();
1315
...@@ -69,6 +71,8 @@ test "timer" {...@@ -69,6 +71,8 @@ test "timer" {
69}71}
7072
71test "statx" {73test "statx" {
74 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
75
72 var tmp = std.testing.tmpDir(.{});76 var tmp = std.testing.tmpDir(.{});
73 defer tmp.cleanup();77 defer tmp.cleanup();
7478
...@@ -107,6 +111,8 @@ test "user and group ids" {...@@ -107,6 +111,8 @@ test "user and group ids" {
107}111}
108112
109test "fadvise" {113test "fadvise" {
114 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
115
110 var tmp = std.testing.tmpDir(.{});116 var tmp = std.testing.tmpDir(.{});
111 defer tmp.cleanup();117 defer tmp.cleanup();
112118
lib/std/os/test.zig+51
...@@ -88,6 +88,8 @@ test "chdir smoke test" {...@@ -88,6 +88,8 @@ test "chdir smoke test" {
88test "open smoke test" {88test "open smoke test" {
89 if (native_os == .wasi) return error.SkipZigTest;89 if (native_os == .wasi) return error.SkipZigTest;
9090
91 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
92
91 // TODO verify file attributes using `fstat`93 // TODO verify file attributes using `fstat`
9294
93 var tmp = tmpDir(.{});95 var tmp = tmpDir(.{});
...@@ -142,6 +144,8 @@ test "open smoke test" {...@@ -142,6 +144,8 @@ test "open smoke test" {
142test "openat smoke test" {144test "openat smoke test" {
143 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;145 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
144146
147 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
148
145 // TODO verify file attributes using `fstatat`149 // TODO verify file attributes using `fstatat`
146150
147 var tmp = tmpDir(.{});151 var tmp = tmpDir(.{});
...@@ -276,6 +280,8 @@ test "link with relative paths" {...@@ -276,6 +280,8 @@ test "link with relative paths" {
276test "linkat with different directories" {280test "linkat with different directories" {
277 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;281 if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
278282
283 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
284
279 switch (native_os) {285 switch (native_os) {
280 .wasi, .linux, .solaris, .illumos => {},286 .wasi, .linux, .solaris, .illumos => {},
281 else => return error.SkipZigTest,287 else => return error.SkipZigTest,
...@@ -321,6 +327,8 @@ test "fstatat" {...@@ -321,6 +327,8 @@ test "fstatat" {
321 // enable when `fstat` and `fstatat` are implemented on Windows327 // enable when `fstat` and `fstatat` are implemented on Windows
322 if (native_os == .windows) return error.SkipZigTest;328 if (native_os == .windows) return error.SkipZigTest;
323329
330 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
331
324 var tmp = tmpDir(.{});332 var tmp = tmpDir(.{});
325 defer tmp.cleanup();333 defer tmp.cleanup();
326334
...@@ -340,6 +348,8 @@ test "fstatat" {...@@ -340,6 +348,8 @@ test "fstatat" {
340}348}
341349
342test "readlinkat" {350test "readlinkat" {
351 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
352
343 var tmp = tmpDir(.{});353 var tmp = tmpDir(.{});
344 defer tmp.cleanup();354 defer tmp.cleanup();
345355
...@@ -375,6 +385,8 @@ fn testThreadIdFn(thread_id: *Thread.Id) void {...@@ -375,6 +385,8 @@ fn testThreadIdFn(thread_id: *Thread.Id) void {
375test "std.Thread.getCurrentId" {385test "std.Thread.getCurrentId" {
376 if (builtin.single_threaded) return error.SkipZigTest;386 if (builtin.single_threaded) return error.SkipZigTest;
377387
388 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
389
378 var thread_current_id: Thread.Id = undefined;390 var thread_current_id: Thread.Id = undefined;
379 const thread = try Thread.spawn(.{}, testThreadIdFn, .{&thread_current_id});391 const thread = try Thread.spawn(.{}, testThreadIdFn, .{&thread_current_id});
380 thread.join();392 thread.join();
...@@ -417,6 +429,9 @@ test "cpu count" {...@@ -417,6 +429,9 @@ test "cpu count" {
417429
418test "thread local storage" {430test "thread local storage" {
419 if (builtin.single_threaded) return error.SkipZigTest;431 if (builtin.single_threaded) return error.SkipZigTest;
432
433 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
434
420 const thread1 = try Thread.spawn(.{}, testTls, .{});435 const thread1 = try Thread.spawn(.{}, testTls, .{});
421 const thread2 = try Thread.spawn(.{}, testTls, .{});436 const thread2 = try Thread.spawn(.{}, testTls, .{});
422 try testTls();437 try testTls();
...@@ -504,6 +519,8 @@ fn iter_fn(info: *dl_phdr_info, size: usize, counter: *usize) IterFnError!void {...@@ -504,6 +519,8 @@ fn iter_fn(info: *dl_phdr_info, size: usize, counter: *usize) IterFnError!void {
504test "dl_iterate_phdr" {519test "dl_iterate_phdr" {
505 if (builtin.object_format != .elf) return error.SkipZigTest;520 if (builtin.object_format != .elf) return error.SkipZigTest;
506521
522 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
523
507 var counter: usize = 0;524 var counter: usize = 0;
508 try os.dl_iterate_phdr(&counter, IterFnError, iter_fn);525 try os.dl_iterate_phdr(&counter, IterFnError, iter_fn);
509 try expect(counter != 0);526 try expect(counter != 0);
...@@ -566,6 +583,8 @@ test "mmap" {...@@ -566,6 +583,8 @@ test "mmap" {
566 if (native_os == .windows or native_os == .wasi)583 if (native_os == .windows or native_os == .wasi)
567 return error.SkipZigTest;584 return error.SkipZigTest;
568585
586 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
587
569 var tmp = tmpDir(.{});588 var tmp = tmpDir(.{});
570 defer tmp.cleanup();589 defer tmp.cleanup();
571590
...@@ -676,6 +695,8 @@ test "fcntl" {...@@ -676,6 +695,8 @@ test "fcntl" {
676 if (native_os == .windows or native_os == .wasi)695 if (native_os == .windows or native_os == .wasi)
677 return error.SkipZigTest;696 return error.SkipZigTest;
678697
698 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
699
679 var tmp = tmpDir(.{});700 var tmp = tmpDir(.{});
680 defer tmp.cleanup();701 defer tmp.cleanup();
681702
...@@ -716,6 +737,8 @@ test "sync" {...@@ -716,6 +737,8 @@ test "sync" {
716 if (native_os != .linux)737 if (native_os != .linux)
717 return error.SkipZigTest;738 return error.SkipZigTest;
718739
740 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
741
719 var tmp = tmpDir(.{});742 var tmp = tmpDir(.{});
720 defer tmp.cleanup();743 defer tmp.cleanup();
721744
...@@ -736,6 +759,8 @@ test "fsync" {...@@ -736,6 +759,8 @@ test "fsync" {
736 else => return error.SkipZigTest,759 else => return error.SkipZigTest,
737 }760 }
738761
762 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
763
739 var tmp = tmpDir(.{});764 var tmp = tmpDir(.{});
740 defer tmp.cleanup();765 defer tmp.cleanup();
741766
...@@ -755,6 +780,8 @@ test "getrlimit and setrlimit" {...@@ -755,6 +780,8 @@ test "getrlimit and setrlimit" {
755 return error.SkipZigTest;780 return error.SkipZigTest;
756 }781 }
757782
783 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
784
758 inline for (std.meta.fields(os.rlimit_resource)) |field| {785 inline for (std.meta.fields(os.rlimit_resource)) |field| {
759 const resource = @as(os.rlimit_resource, @enumFromInt(field.value));786 const resource = @as(os.rlimit_resource, @enumFromInt(field.value));
760 const limit = try os.getrlimit(resource);787 const limit = try os.getrlimit(resource);
...@@ -797,6 +824,8 @@ test "sigaction" {...@@ -797,6 +824,8 @@ test "sigaction" {
797 if (native_os == .wasi or native_os == .windows)824 if (native_os == .wasi or native_os == .windows)
798 return error.SkipZigTest;825 return error.SkipZigTest;
799826
827 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
828
800 // https://github.com/ziglang/zig/issues/7427829 // https://github.com/ziglang/zig/issues/7427
801 if (native_os == .linux and builtin.target.cpu.arch == .x86)830 if (native_os == .linux and builtin.target.cpu.arch == .x86)
802 return error.SkipZigTest;831 return error.SkipZigTest;
...@@ -874,6 +903,8 @@ test "dup & dup2" {...@@ -874,6 +903,8 @@ test "dup & dup2" {
874 else => return error.SkipZigTest,903 else => return error.SkipZigTest,
875 }904 }
876905
906 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
907
877 var tmp = tmpDir(.{});908 var tmp = tmpDir(.{});
878 defer tmp.cleanup();909 defer tmp.cleanup();
879910
...@@ -903,6 +934,8 @@ test "dup & dup2" {...@@ -903,6 +934,8 @@ test "dup & dup2" {
903test "writev longer than IOV_MAX" {934test "writev longer than IOV_MAX" {
904 if (native_os == .windows or native_os == .wasi) return error.SkipZigTest;935 if (native_os == .windows or native_os == .wasi) return error.SkipZigTest;
905936
937 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
938
906 var tmp = tmpDir(.{});939 var tmp = tmpDir(.{});
907 defer tmp.cleanup();940 defer tmp.cleanup();
908941
...@@ -920,6 +953,8 @@ test "POSIX file locking with fcntl" {...@@ -920,6 +953,8 @@ test "POSIX file locking with fcntl" {
920 return error.SkipZigTest;953 return error.SkipZigTest;
921 }954 }
922955
956 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
957
923 if (true) {958 if (true) {
924 // https://github.com/ziglang/zig/issues/11074959 // https://github.com/ziglang/zig/issues/11074
925 return error.SkipZigTest;960 return error.SkipZigTest;
...@@ -982,6 +1017,8 @@ test "POSIX file locking with fcntl" {...@@ -982,6 +1017,8 @@ test "POSIX file locking with fcntl" {
982test "rename smoke test" {1017test "rename smoke test" {
983 if (native_os == .wasi) return error.SkipZigTest;1018 if (native_os == .wasi) return error.SkipZigTest;
9841019
1020 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1021
985 var tmp = tmpDir(.{});1022 var tmp = tmpDir(.{});
986 defer tmp.cleanup();1023 defer tmp.cleanup();
9871024
...@@ -1038,6 +1075,8 @@ test "rename smoke test" {...@@ -1038,6 +1075,8 @@ test "rename smoke test" {
1038test "access smoke test" {1075test "access smoke test" {
1039 if (native_os == .wasi) return error.SkipZigTest;1076 if (native_os == .wasi) return error.SkipZigTest;
10401077
1078 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1079
1041 var tmp = tmpDir(.{});1080 var tmp = tmpDir(.{});
1042 defer tmp.cleanup();1081 defer tmp.cleanup();
10431082
...@@ -1102,6 +1141,8 @@ test "timerfd" {...@@ -1102,6 +1141,8 @@ test "timerfd" {
1102}1141}
11031142
1104test "isatty" {1143test "isatty" {
1144 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1145
1105 var tmp = tmpDir(.{});1146 var tmp = tmpDir(.{});
1106 defer tmp.cleanup();1147 defer tmp.cleanup();
11071148
...@@ -1114,6 +1155,8 @@ test "isatty" {...@@ -1114,6 +1155,8 @@ test "isatty" {
1114test "read with empty buffer" {1155test "read with empty buffer" {
1115 if (native_os == .wasi) return error.SkipZigTest;1156 if (native_os == .wasi) return error.SkipZigTest;
11161157
1158 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1159
1117 var tmp = tmpDir(.{});1160 var tmp = tmpDir(.{});
1118 defer tmp.cleanup();1161 defer tmp.cleanup();
11191162
...@@ -1139,6 +1182,8 @@ test "read with empty buffer" {...@@ -1139,6 +1182,8 @@ test "read with empty buffer" {
1139test "pread with empty buffer" {1182test "pread with empty buffer" {
1140 if (native_os == .wasi) return error.SkipZigTest;1183 if (native_os == .wasi) return error.SkipZigTest;
11411184
1185 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1186
1142 var tmp = tmpDir(.{});1187 var tmp = tmpDir(.{});
1143 defer tmp.cleanup();1188 defer tmp.cleanup();
11441189
...@@ -1164,6 +1209,8 @@ test "pread with empty buffer" {...@@ -1164,6 +1209,8 @@ test "pread with empty buffer" {
1164test "write with empty buffer" {1209test "write with empty buffer" {
1165 if (native_os == .wasi) return error.SkipZigTest;1210 if (native_os == .wasi) return error.SkipZigTest;
11661211
1212 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1213
1167 var tmp = tmpDir(.{});1214 var tmp = tmpDir(.{});
1168 defer tmp.cleanup();1215 defer tmp.cleanup();
11691216
...@@ -1189,6 +1236,8 @@ test "write with empty buffer" {...@@ -1189,6 +1236,8 @@ test "write with empty buffer" {
1189test "pwrite with empty buffer" {1236test "pwrite with empty buffer" {
1190 if (native_os == .wasi) return error.SkipZigTest;1237 if (native_os == .wasi) return error.SkipZigTest;
11911238
1239 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1240
1192 var tmp = tmpDir(.{});1241 var tmp = tmpDir(.{});
1193 defer tmp.cleanup();1242 defer tmp.cleanup();
11941243
...@@ -1214,6 +1263,8 @@ test "pwrite with empty buffer" {...@@ -1214,6 +1263,8 @@ test "pwrite with empty buffer" {
1214test "fchmodat smoke test" {1263test "fchmodat smoke test" {
1215 if (!std.fs.has_executable_bit) return error.SkipZigTest;1264 if (!std.fs.has_executable_bit) return error.SkipZigTest;
12161265
1266 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1267
1217 var tmp = tmpDir(.{});1268 var tmp = tmpDir(.{});
1218 defer tmp.cleanup();1269 defer tmp.cleanup();
12191270
lib/std/os/windows.zig+2
...@@ -2491,6 +2491,8 @@ pub fn ntToWin32Namespace(path: []const u16) !PathSpace {...@@ -2491,6 +2491,8 @@ pub fn ntToWin32Namespace(path: []const u16) !PathSpace {
2491}2491}
24922492
2493test "ntToWin32Namespace" {2493test "ntToWin32Namespace" {
2494 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2495
2494 const L = std.unicode.utf8ToUtf16LeStringLiteral;2496 const L = std.unicode.utf8ToUtf16LeStringLiteral;
24952497
2496 try testNtToWin32Namespace(L("UNC"), L("\\??\\UNC"));2498 try testNtToWin32Namespace(L("UNC"), L("\\??\\UNC"));
lib/std/priority_dequeue.zig+2
...@@ -705,6 +705,8 @@ test "std.PriorityDequeue: fromOwnedSlice trivial case 1" {...@@ -705,6 +705,8 @@ test "std.PriorityDequeue: fromOwnedSlice trivial case 1" {
705}705}
706706
707test "std.PriorityDequeue: fromOwnedSlice" {707test "std.PriorityDequeue: fromOwnedSlice" {
708 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
709
708 const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 };710 const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 };
709 const queue_items = try testing.allocator.dupe(u32, items[0..]);711 const queue_items = try testing.allocator.dupe(u32, items[0..]);
710 var queue = PDQ.fromOwnedSlice(testing.allocator, queue_items[0..], {});712 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" {...@@ -385,6 +385,8 @@ test "std.PriorityQueue: fromOwnedSlice trivial case 1" {
385}385}
386386
387test "std.PriorityQueue: fromOwnedSlice" {387test "std.PriorityQueue: fromOwnedSlice" {
388 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
389
388 const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 };390 const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 };
389 const heap_items = try testing.allocator.dupe(u32, items[0..]);391 const heap_items = try testing.allocator.dupe(u32, items[0..]);
390 var queue = PQlt.fromOwnedSlice(testing.allocator, heap_items[0..], {});392 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 {...@@ -90,7 +90,10 @@ pub fn fill(self: *Xoshiro256, buf: []u8) void {
90}90}
9191
92test "xoroshiro sequence" {92test "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
95 var r = Xoshiro256.init(0);98 var r = Xoshiro256.init(0);
9699
lib/std/rand/test.zig+11
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("../std.zig");1const std = @import("../std.zig");
2const builtin = @import("builtin");
2const math = std.math;3const math = std.math;
3const DefaultPrng = std.rand.DefaultPrng;4const DefaultPrng = std.rand.DefaultPrng;
4const Random = std.rand.Random;5const Random = std.rand.Random;
...@@ -157,6 +158,8 @@ fn testRandomEnumValue() !void {...@@ -157,6 +158,8 @@ fn testRandomEnumValue() !void {
157}158}
158159
159test "Random intLessThan" {160test "Random intLessThan" {
161 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
162
160 @setEvalBranchQuota(10000);163 @setEvalBranchQuota(10000);
161 try testRandomIntLessThan();164 try testRandomIntLessThan();
162 try comptime testRandomIntLessThan();165 try comptime testRandomIntLessThan();
...@@ -199,6 +202,8 @@ fn testRandomIntLessThan() !void {...@@ -199,6 +202,8 @@ fn testRandomIntLessThan() !void {
199}202}
200203
201test "Random intAtMost" {204test "Random intAtMost" {
205 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
206
202 @setEvalBranchQuota(10000);207 @setEvalBranchQuota(10000);
203 try testRandomIntAtMost();208 try testRandomIntAtMost();
204 try comptime testRandomIntAtMost();209 try comptime testRandomIntAtMost();
...@@ -239,6 +244,8 @@ fn testRandomIntAtMost() !void {...@@ -239,6 +244,8 @@ fn testRandomIntAtMost() !void {
239}244}
240245
241test "Random Biased" {246test "Random Biased" {
247 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
248
242 var prng = DefaultPrng.init(0);249 var prng = DefaultPrng.init(0);
243 const random = prng.random();250 const random = prng.random();
244 // Not thoroughly checking the logic here.251 // Not thoroughly checking the logic here.
...@@ -436,6 +443,8 @@ fn testRangeBias(r: Random, start: i8, end: i8, biased: bool) !void {...@@ -436,6 +443,8 @@ fn testRangeBias(r: Random, start: i8, end: i8, biased: bool) !void {
436}443}
437444
438test "CSPRNG" {445test "CSPRNG" {
446 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
447
439 var secret_seed: [DefaultCsprng.secret_seed_length]u8 = undefined;448 var secret_seed: [DefaultCsprng.secret_seed_length]u8 = undefined;
440 std.crypto.random.bytes(&secret_seed);449 std.crypto.random.bytes(&secret_seed);
441 var csprng = DefaultCsprng.init(secret_seed);450 var csprng = DefaultCsprng.init(secret_seed);
...@@ -447,6 +456,8 @@ test "CSPRNG" {...@@ -447,6 +456,8 @@ test "CSPRNG" {
447}456}
448457
449test "Random weightedIndex" {458test "Random weightedIndex" {
459 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
460
450 // Make sure weightedIndex works for various integers and floats461 // Make sure weightedIndex works for various integers and floats
451 inline for (.{ u64, i4, f32, f64 }) |T| {462 inline for (.{ u64, i4, f32, f64 }) |T| {
452 var prng = DefaultPrng.init(0);463 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...@@ -409,6 +409,8 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type
409}409}
410410
411test "SegmentedList basic usage" {411test "SegmentedList basic usage" {
412 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
413
412 try testSegmentedList(0);414 try testSegmentedList(0);
413 try testSegmentedList(1);415 try testSegmentedList(1);
414 try testSegmentedList(2);416 try testSegmentedList(2);
lib/std/simd.zig+9
...@@ -196,10 +196,13 @@ pub fn extract(...@@ -196,10 +196,13 @@ pub fn extract(
196}196}
197197
198test "vector patterns" {198test "vector patterns" {
199 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
200
199 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {201 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
200 // https://github.com/ziglang/zig/issues/12012202 // https://github.com/ziglang/zig/issues/12012
201 return error.SkipZigTest;203 return error.SkipZigTest;
202 }204 }
205
203 const base = @Vector(4, u32){ 10, 20, 30, 40 };206 const base = @Vector(4, u32){ 10, 20, 30, 40 };
204 const other_base = @Vector(4, u32){ 55, 66, 77, 88 };207 const other_base = @Vector(4, u32){ 55, 66, 77, 88 };
205208
...@@ -269,6 +272,8 @@ pub fn reverseOrder(vec: anytype) @TypeOf(vec) {...@@ -269,6 +272,8 @@ pub fn reverseOrder(vec: anytype) @TypeOf(vec) {
269}272}
270273
271test "vector shifting" {274test "vector shifting" {
275 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
276
272 const base = @Vector(4, u32){ 10, 20, 30, 40 };277 const base = @Vector(4, u32){ 10, 20, 30, 40 };
273278
274 try std.testing.expectEqual([4]u32{ 30, 40, 999, 999 }, shiftElementsLeft(base, 2, 999));279 try std.testing.expectEqual([4]u32{ 30, 40, 999, 999 }, shiftElementsLeft(base, 2, 999));
...@@ -333,6 +338,8 @@ pub fn countElementsWithValue(vec: anytype, value: std.meta.Child(@TypeOf(vec)))...@@ -333,6 +338,8 @@ pub fn countElementsWithValue(vec: anytype, value: std.meta.Child(@TypeOf(vec)))
333}338}
334339
335test "vector searching" {340test "vector searching" {
341 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
342
336 const base = @Vector(8, u32){ 6, 4, 7, 4, 4, 2, 3, 7 };343 const base = @Vector(8, u32){ 6, 4, 7, 4, 4, 2, 3, 7 };
337344
338 try std.testing.expectEqual(@as(?u3, 1), firstIndexOfValue(base, 4));345 try std.testing.expectEqual(@as(?u3, 1), firstIndexOfValue(base, 4));
...@@ -424,6 +431,8 @@ pub fn prefixScan(comptime op: std.builtin.ReduceOp, comptime hop: isize, vec: a...@@ -424,6 +431,8 @@ pub fn prefixScan(comptime op: std.builtin.ReduceOp, comptime hop: isize, vec: a
424}431}
425432
426test "vector prefix scan" {433test "vector prefix scan" {
434 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
435
427 if (comptime builtin.cpu.arch.isMIPS()) {436 if (comptime builtin.cpu.arch.isMIPS()) {
428 return error.SkipZigTest;437 return error.SkipZigTest;
429 }438 }
lib/std/sort.zig+11
...@@ -1,5 +1,6 @@...@@ -1,5 +1,6 @@
1const std = @import("std.zig");1const std = @import("std.zig");
2const assert = std.debug.assert;2const assert = std.debug.assert;
3const builtin = @import("builtin");
3const testing = std.testing;4const testing = std.testing;
4const mem = std.mem;5const mem = std.mem;
5const math = std.math;6const math = std.math;
...@@ -176,6 +177,8 @@ const IdAndValue = struct {...@@ -176,6 +177,8 @@ const IdAndValue = struct {
176};177};
177178
178test "stable sort" {179test "stable sort" {
180 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
181
179 const expected = [_]IdAndValue{182 const expected = [_]IdAndValue{
180 IdAndValue{ .id = 0, .value = 0 },183 IdAndValue{ .id = 0, .value = 0 },
181 IdAndValue{ .id = 1, .value = 0 },184 IdAndValue{ .id = 1, .value = 0 },
...@@ -223,6 +226,8 @@ test "stable sort" {...@@ -223,6 +226,8 @@ test "stable sort" {
223}226}
224227
225test "sort" {228test "sort" {
229 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
230
226 const u8cases = [_][]const []const u8{231 const u8cases = [_][]const []const u8{
227 &[_][]const u8{232 &[_][]const u8{
228 "",233 "",
...@@ -301,6 +306,8 @@ test "sort" {...@@ -301,6 +306,8 @@ test "sort" {
301}306}
302307
303test "sort descending" {308test "sort descending" {
309 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
310
304 const rev_cases = [_][]const []const i32{311 const rev_cases = [_][]const []const i32{
305 &[_][]const i32{312 &[_][]const i32{
306 &[_]i32{},313 &[_]i32{},
...@@ -340,6 +347,8 @@ test "sort descending" {...@@ -340,6 +347,8 @@ test "sort descending" {
340}347}
341348
342test "sort with context in the middle of a slice" {349test "sort with context in the middle of a slice" {
350 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
351
343 const Context = struct {352 const Context = struct {
344 items: []i32,353 items: []i32,
345354
...@@ -379,6 +388,8 @@ test "sort with context in the middle of a slice" {...@@ -379,6 +388,8 @@ test "sort with context in the middle of a slice" {
379}388}
380389
381test "sort fuzz testing" {390test "sort fuzz testing" {
391 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
392
382 var prng = std.rand.DefaultPrng.init(0x12345678);393 var prng = std.rand.DefaultPrng.init(0x12345678);
383 const random = prng.random();394 const random = prng.random();
384 const test_case_count = 10;395 const test_case_count = 10;
lib/std/time.zig+4
...@@ -122,6 +122,8 @@ pub fn nanoTimestamp() i128 {...@@ -122,6 +122,8 @@ pub fn nanoTimestamp() i128 {
122}122}
123123
124test "timestamp" {124test "timestamp" {
125 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
126
125 const margin = ns_per_ms * 50;127 const margin = ns_per_ms * 50;
126128
127 const time_0 = milliTimestamp();129 const time_0 = milliTimestamp();
...@@ -319,6 +321,8 @@ pub const Timer = struct {...@@ -319,6 +321,8 @@ pub const Timer = struct {
319};321};
320322
321test "Timer + Instant" {323test "Timer + Instant" {
324 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
325
322 const margin = ns_per_ms * 150;326 const margin = ns_per_ms * 150;
323327
324 var timer = try Timer.start();328 var timer = try Timer.start();
lib/std/treap.zig+2
...@@ -350,6 +350,8 @@ const TestTreap = Treap(u64, std.math.order);...@@ -350,6 +350,8 @@ const TestTreap = Treap(u64, std.math.order);
350const TestNode = TestTreap.Node;350const TestNode = TestTreap.Node;
351351
352test "std.Treap: insert, find, replace, remove" {352test "std.Treap: insert, find, replace, remove" {
353 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
354
353 var treap = TestTreap{};355 var treap = TestTreap{};
354 var nodes: [10]TestNode = undefined;356 var nodes: [10]TestNode = undefined;
355357
lib/std/unicode.zig+41
...@@ -1,5 +1,6 @@...@@ -1,5 +1,6 @@
1const std = @import("./std.zig");1const std = @import("./std.zig");
2const assert = std.debug.assert;2const assert = std.debug.assert;
3const builtin = @import("builtin");
3const testing = std.testing;4const testing = std.testing;
4const mem = std.mem;5const mem = std.mem;
56
...@@ -496,11 +497,15 @@ fn testUtf16CountCodepoints() !void {...@@ -496,11 +497,15 @@ fn testUtf16CountCodepoints() !void {
496}497}
497498
498test "utf16 count codepoints" {499test "utf16 count codepoints" {
500 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
501
499 try testUtf16CountCodepoints();502 try testUtf16CountCodepoints();
500 try comptime testUtf16CountCodepoints();503 try comptime testUtf16CountCodepoints();
501}504}
502505
503test "utf8 encode" {506test "utf8 encode" {
507 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
508
504 try comptime testUtf8Encode();509 try comptime testUtf8Encode();
505 try testUtf8Encode();510 try testUtf8Encode();
506}511}
...@@ -527,6 +532,8 @@ fn testUtf8Encode() !void {...@@ -527,6 +532,8 @@ fn testUtf8Encode() !void {
527}532}
528533
529test "utf8 encode error" {534test "utf8 encode error" {
535 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
536
530 try comptime testUtf8EncodeError();537 try comptime testUtf8EncodeError();
531 try testUtf8EncodeError();538 try testUtf8EncodeError();
532}539}
...@@ -543,6 +550,8 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void {...@@ -543,6 +550,8 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void {
543}550}
544551
545test "utf8 iterator on ascii" {552test "utf8 iterator on ascii" {
553 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
554
546 try comptime testUtf8IteratorOnAscii();555 try comptime testUtf8IteratorOnAscii();
547 try testUtf8IteratorOnAscii();556 try testUtf8IteratorOnAscii();
548}557}
...@@ -563,6 +572,8 @@ fn testUtf8IteratorOnAscii() !void {...@@ -563,6 +572,8 @@ fn testUtf8IteratorOnAscii() !void {
563}572}
564573
565test "utf8 view bad" {574test "utf8 view bad" {
575 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
576
566 try comptime testUtf8ViewBad();577 try comptime testUtf8ViewBad();
567 try testUtf8ViewBad();578 try testUtf8ViewBad();
568}579}
...@@ -573,6 +584,8 @@ fn testUtf8ViewBad() !void {...@@ -573,6 +584,8 @@ fn testUtf8ViewBad() !void {
573}584}
574585
575test "utf8 view ok" {586test "utf8 view ok" {
587 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
588
576 try comptime testUtf8ViewOk();589 try comptime testUtf8ViewOk();
577 try testUtf8ViewOk();590 try testUtf8ViewOk();
578}591}
...@@ -593,6 +606,8 @@ fn testUtf8ViewOk() !void {...@@ -593,6 +606,8 @@ fn testUtf8ViewOk() !void {
593}606}
594607
595test "validate slice" {608test "validate slice" {
609 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
610
596 try comptime testValidateSlice();611 try comptime testValidateSlice();
597 try testValidateSlice();612 try testValidateSlice();
598613
...@@ -633,6 +648,8 @@ fn testValidateSlice() !void {...@@ -633,6 +648,8 @@ fn testValidateSlice() !void {
633}648}
634649
635test "valid utf8" {650test "valid utf8" {
651 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
652
636 try comptime testValidUtf8();653 try comptime testValidUtf8();
637 try testValidUtf8();654 try testValidUtf8();
638}655}
...@@ -652,6 +669,8 @@ fn testValidUtf8() !void {...@@ -652,6 +669,8 @@ fn testValidUtf8() !void {
652}669}
653670
654test "invalid utf8 continuation bytes" {671test "invalid utf8 continuation bytes" {
672 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
673
655 try comptime testInvalidUtf8ContinuationBytes();674 try comptime testInvalidUtf8ContinuationBytes();
656 try testInvalidUtf8ContinuationBytes();675 try testInvalidUtf8ContinuationBytes();
657}676}
...@@ -684,6 +703,8 @@ fn testInvalidUtf8ContinuationBytes() !void {...@@ -684,6 +703,8 @@ fn testInvalidUtf8ContinuationBytes() !void {
684}703}
685704
686test "overlong utf8 codepoint" {705test "overlong utf8 codepoint" {
706 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
707
687 try comptime testOverlongUtf8Codepoint();708 try comptime testOverlongUtf8Codepoint();
688 try testOverlongUtf8Codepoint();709 try testOverlongUtf8Codepoint();
689}710}
...@@ -697,6 +718,8 @@ fn testOverlongUtf8Codepoint() !void {...@@ -697,6 +718,8 @@ fn testOverlongUtf8Codepoint() !void {
697}718}
698719
699test "misc invalid utf8" {720test "misc invalid utf8" {
721 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
722
700 try comptime testMiscInvalidUtf8();723 try comptime testMiscInvalidUtf8();
701 try testMiscInvalidUtf8();724 try testMiscInvalidUtf8();
702}725}
...@@ -712,6 +735,8 @@ fn testMiscInvalidUtf8() !void {...@@ -712,6 +735,8 @@ fn testMiscInvalidUtf8() !void {
712}735}
713736
714test "utf8 iterator peeking" {737test "utf8 iterator peeking" {
738 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
739
715 try comptime testUtf8Peeking();740 try comptime testUtf8Peeking();
716 try testUtf8Peeking();741 try testUtf8Peeking();
717}742}
...@@ -796,6 +821,8 @@ pub fn utf16leToUtf8(utf8: []u8, utf16le: []const u16) !usize {...@@ -796,6 +821,8 @@ pub fn utf16leToUtf8(utf8: []u8, utf16le: []const u16) !usize {
796}821}
797822
798test "utf16leToUtf8" {823test "utf16leToUtf8" {
824 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
825
799 var utf16le: [2]u16 = undefined;826 var utf16le: [2]u16 = undefined;
800 const utf16le_as_bytes = mem.sliceAsBytes(utf16le[0..]);827 const utf16le_as_bytes = mem.sliceAsBytes(utf16le[0..]);
801828
...@@ -908,6 +935,8 @@ pub fn utf8ToUtf16Le(utf16le: []u16, utf8: []const u8) !usize {...@@ -908,6 +935,8 @@ pub fn utf8ToUtf16Le(utf16le: []u16, utf8: []const u8) !usize {
908}935}
909936
910test "utf8ToUtf16Le" {937test "utf8ToUtf16Le" {
938 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
939
911 var utf16le: [2]u16 = [_]u16{0} ** 2;940 var utf16le: [2]u16 = [_]u16{0} ** 2;
912 {941 {
913 const length = try utf8ToUtf16Le(utf16le[0..], "𐐷");942 const length = try utf8ToUtf16Le(utf16le[0..], "𐐷");
...@@ -926,6 +955,8 @@ test "utf8ToUtf16Le" {...@@ -926,6 +955,8 @@ test "utf8ToUtf16Le" {
926}955}
927956
928test "utf8ToUtf16LeWithNull" {957test "utf8ToUtf16LeWithNull" {
958 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
959
929 {960 {
930 const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "𐐷");961 const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "𐐷");
931 defer testing.allocator.free(utf16);962 defer testing.allocator.free(utf16);
...@@ -984,6 +1015,8 @@ fn testCalcUtf16LeLen() !void {...@@ -984,6 +1015,8 @@ fn testCalcUtf16LeLen() !void {
984}1015}
9851016
986test "calculate utf16 string length of given utf8 string in u16" {1017test "calculate utf16 string length of given utf8 string in u16" {
1018 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1019
987 try testCalcUtf16LeLen();1020 try testCalcUtf16LeLen();
988 try comptime testCalcUtf16LeLen();1021 try comptime testCalcUtf16LeLen();
989}1022}
...@@ -1017,6 +1050,8 @@ pub fn fmtUtf16le(utf16le: []const u16) std.fmt.Formatter(formatUtf16le) {...@@ -1017,6 +1050,8 @@ pub fn fmtUtf16le(utf16le: []const u16) std.fmt.Formatter(formatUtf16le) {
1017}1050}
10181051
1019test "fmtUtf16le" {1052test "fmtUtf16le" {
1053 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1054
1020 const expectFmt = std.testing.expectFmt;1055 const expectFmt = std.testing.expectFmt;
1021 try expectFmt("", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral(""))});1056 try expectFmt("", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral(""))});
1022 try expectFmt("foo", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral("foo"))});1057 try expectFmt("foo", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral("foo"))});
...@@ -1030,6 +1065,8 @@ test "fmtUtf16le" {...@@ -1030,6 +1065,8 @@ test "fmtUtf16le" {
1030}1065}
10311066
1032test "utf8ToUtf16LeStringLiteral" {1067test "utf8ToUtf16LeStringLiteral" {
1068 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1069
1033 {1070 {
1034 const bytes = [_:0]u16{1071 const bytes = [_:0]u16{
1035 mem.nativeToLittle(u16, 0x41),1072 mem.nativeToLittle(u16, 0x41),
...@@ -1090,6 +1127,8 @@ fn testUtf8CountCodepoints() !void {...@@ -1090,6 +1127,8 @@ fn testUtf8CountCodepoints() !void {
1090}1127}
10911128
1092test "utf8 count codepoints" {1129test "utf8 count codepoints" {
1130 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1131
1093 try testUtf8CountCodepoints();1132 try testUtf8CountCodepoints();
1094 try comptime testUtf8CountCodepoints();1133 try comptime testUtf8CountCodepoints();
1095}1134}
...@@ -1106,6 +1145,8 @@ fn testUtf8ValidCodepoint() !void {...@@ -1106,6 +1145,8 @@ fn testUtf8ValidCodepoint() !void {
1106}1145}
11071146
1108test "utf8 valid codepoint" {1147test "utf8 valid codepoint" {
1148 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1149
1109 try testUtf8ValidCodepoint();1150 try testUtf8ValidCodepoint();
1110 try comptime testUtf8ValidCodepoint();1151 try comptime testUtf8ValidCodepoint();
1111}1152}
lib/std/zig/CrossTarget.zig+2
...@@ -785,6 +785,8 @@ fn parseOs(result: *CrossTarget, diags: *ParseOptions.Diagnostics, text: []const...@@ -785,6 +785,8 @@ fn parseOs(result: *CrossTarget, diags: *ParseOptions.Diagnostics, text: []const
785}785}
786786
787test "CrossTarget.parse" {787test "CrossTarget.parse" {
788 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
789
788 if (builtin.target.isGnuLibC()) {790 if (builtin.target.isGnuLibC()) {
789 var cross_target = try CrossTarget.parse(.{});791 var cross_target = try CrossTarget.parse(.{});
790 cross_target.setGnuLibCVersion(2, 1, 1);792 cross_target.setGnuLibCVersion(2, 1, 1);
lib/std/zig/Parse.zig+2
...@@ -4102,5 +4102,7 @@ const TokenIndex = Ast.TokenIndex;...@@ -4102,5 +4102,7 @@ const TokenIndex = Ast.TokenIndex;
4102const Token = std.zig.Token;4102const Token = std.zig.Token;
41034103
4104test {4104test {
4105 if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
4106
4105 _ = @import("parser_test.zig");4107 _ = @import("parser_test.zig");
4106}4108}
lib/std/zig/fmt.zig+3
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const mem = std.mem;3const mem = std.mem;
34
4/// Print the string as a Zig identifier escaping it with @"" syntax if needed.5/// 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) {...@@ -95,6 +96,8 @@ pub fn fmtEscapes(bytes: []const u8) std.fmt.Formatter(stringEscape) {
95}96}
9697
97test "escape invalid identifiers" {98test "escape invalid identifiers" {
99 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
100
98 const expectFmt = std.testing.expectFmt;101 const expectFmt = std.testing.expectFmt;
99 try expectFmt("@\"while\"", "{}", .{fmtId("while")});102 try expectFmt("@\"while\"", "{}", .{fmtId("while")});
100 try expectFmt("hello", "{}", .{fmtId("hello")});103 try expectFmt("hello", "{}", .{fmtId("hello")});
lib/std/zig/tokenizer.zig+11
...@@ -1,4 +1,5 @@...@@ -1,4 +1,5 @@
1const std = @import("../std.zig");1const std = @import("../std.zig");
2const builtin = @import("builtin");
23
3pub const Token = struct {4pub const Token = struct {
4 tag: Tag,5 tag: Tag,
...@@ -1449,6 +1450,8 @@ test "chars" {...@@ -1449,6 +1450,8 @@ test "chars" {
1449}1450}
14501451
1451test "invalid token characters" {1452test "invalid token characters" {
1453 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1454
1452 try testTokenize("#", &.{.invalid});1455 try testTokenize("#", &.{.invalid});
1453 try testTokenize("`", &.{.invalid});1456 try testTokenize("`", &.{.invalid});
1454 try testTokenize("'c", &.{.invalid});1457 try testTokenize("'c", &.{.invalid});
...@@ -1478,6 +1481,8 @@ test "utf8" {...@@ -1478,6 +1481,8 @@ test "utf8" {
1478}1481}
14791482
1480test "invalid utf8" {1483test "invalid utf8" {
1484 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1485
1481 try testTokenize("//\x80", &.{1486 try testTokenize("//\x80", &.{
1482 .invalid,1487 .invalid,
1483 });1488 });
...@@ -1568,6 +1573,8 @@ test "pipe and then invalid" {...@@ -1568,6 +1573,8 @@ test "pipe and then invalid" {
1568}1573}
15691574
1570test "line comment and doc comment" {1575test "line comment and doc comment" {
1576 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1577
1571 try testTokenize("//", &.{});1578 try testTokenize("//", &.{});
1572 try testTokenize("// a / b", &.{});1579 try testTokenize("// a / b", &.{});
1573 try testTokenize("// /", &.{});1580 try testTokenize("// /", &.{});
...@@ -1642,6 +1649,8 @@ test "range literals" {...@@ -1642,6 +1649,8 @@ test "range literals" {
1642}1649}
16431650
1644test "number literals decimal" {1651test "number literals decimal" {
1652 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1653
1645 try testTokenize("0", &.{.number_literal});1654 try testTokenize("0", &.{.number_literal});
1646 try testTokenize("1", &.{.number_literal});1655 try testTokenize("1", &.{.number_literal});
1647 try testTokenize("2", &.{.number_literal});1656 try testTokenize("2", &.{.number_literal});
...@@ -1890,6 +1899,8 @@ test "invalid token with unfinished escape right before eof" {...@@ -1890,6 +1899,8 @@ test "invalid token with unfinished escape right before eof" {
1890}1899}
18911900
1892test "saturating operators" {1901test "saturating operators" {
1902 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1903
1893 try testTokenize("<<", &.{.angle_bracket_angle_bracket_left});1904 try testTokenize("<<", &.{.angle_bracket_angle_bracket_left});
1894 try testTokenize("<<|", &.{.angle_bracket_angle_bracket_left_pipe});1905 try testTokenize("<<|", &.{.angle_bracket_angle_bracket_left_pipe});
1895 try testTokenize("<<|=", &.{.angle_bracket_angle_bracket_left_pipe_equal});1906 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 {...@@ -2895,13 +2895,16 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void {
2895 }.signedness;2895 }.signedness;
28962896
2897 const src_mcv = try self.resolveInst(ty_op.operand);2897 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) {
2899 .register, .register_offset => 64,2899 .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),
2901 else => src_int_info.bits,2902 else => src_int_info.bits,
2902 };2903 };
29032904
2904 const dst_mcv = if (dst_int_info.bits <= src_storage_bits and2905 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
2905 self.reuseOperand(inst, ty_op.operand, 0, src_mcv)) src_mcv else dst: {2908 self.reuseOperand(inst, ty_op.operand, 0, src_mcv)) src_mcv else dst: {
2906 const dst_mcv = try self.allocRegOrMem(inst, true);2909 const dst_mcv = try self.allocRegOrMem(inst, true);
2907 try self.genCopy(min_ty, dst_mcv, src_mcv);2910 try self.genCopy(min_ty, dst_mcv, src_mcv);
...@@ -2976,8 +2979,21 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {...@@ -2976,8 +2979,21 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {
29762979
2977 const dst_mcv = if (src_mcv.isRegister() and self.reuseOperand(inst, ty_op.operand, 0, src_mcv))2980 const dst_mcv = if (src_mcv.isRegister() and self.reuseOperand(inst, ty_op.operand, 0, src_mcv))
2978 src_mcv2981 src_mcv
2979 else2982 else if (dst_abi_size <= 8)
2980 try self.copyToRegisterWithInstTracking(inst, dst_ty, src_mcv);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
2982 if (dst_ty.zigTypeTag(mod) == .Vector) {2998 if (dst_ty.zigTypeTag(mod) == .Vector) {
2983 assert(src_ty.zigTypeTag(mod) == .Vector and dst_ty.vectorLen(mod) == src_ty.vectorLen(mod));2999 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 {...@@ -3048,14 +3064,15 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {
3048 break :result dst_mcv;3064 break :result dst_mcv;
3049 }3065 }
30503066
3051 if (dst_abi_size > 8) {
3052 return self.fail("TODO implement trunc for abi sizes larger than 8", .{});
3053 }
3054
3055 // when truncating a `u16` to `u5`, for example, those top 3 bits in the result3067 // when truncating a `u16` to `u5`, for example, those top 3 bits in the result
3056 // have to be removed. this only happens if the dst if not a power-of-two size.3068 // have to be removed. this only happens if the dst if not a power-of-two size.
3057 if (self.regExtraBits(dst_ty) > 0)3069 if (dst_abi_size <= 8) {
3058 try self.truncateRegister(dst_ty, dst_mcv.register.to64());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
3060 break :result dst_mcv;3077 break :result dst_mcv;
3061 };3078 };
...@@ -3378,7 +3395,7 @@ fn airMulSat(self: *Self, inst: Air.Inst.Index) !void {...@@ -3378,7 +3395,7 @@ fn airMulSat(self: *Self, inst: Air.Inst.Index) !void {
3378 const cc: Condition = if (ty.isSignedInt(mod)) cc: {3395 const cc: Condition = if (ty.isSignedInt(mod)) cc: {
3379 try self.genSetReg(limit_reg, ty, lhs_mcv);3396 try self.genSetReg(limit_reg, ty, lhs_mcv);
3380 try self.genBinOpMir(.{ ._, .xor }, ty, limit_mcv, rhs_mcv);3397 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 });
3382 try self.genBinOpMir(.{ ._, .xor }, ty, limit_mcv, .{3399 try self.genBinOpMir(.{ ._, .xor }, ty, limit_mcv, .{
3383 .immediate = (@as(u64, 1) << @intCast(reg_bits - 1)) - 1,3400 .immediate = (@as(u64, 1) << @intCast(reg_bits - 1)) - 1,
3384 });3401 });
...@@ -3646,7 +3663,10 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {...@@ -3646,7 +3663,10 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
3646 },3663 },
3647 else => {3664 else => {
3648 // For now, this is the only supported multiply that doesn't fit in a register.3665 // 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
3651 const frame_index =3671 const frame_index =
3652 try self.allocFrameIndex(FrameAlloc.initType(tuple_ty, mod));3672 try self.allocFrameIndex(FrameAlloc.initType(tuple_ty, mod));
...@@ -3798,11 +3818,13 @@ fn airShlSat(self: *Self, inst: Air.Inst.Index) !void {...@@ -3798,11 +3818,13 @@ fn airShlSat(self: *Self, inst: Air.Inst.Index) !void {
3798}3818}
37993819
3800fn airOptionalPayload(self: *Self, inst: Air.Inst.Index) !void {3820fn airOptionalPayload(self: *Self, inst: Air.Inst.Index) !void {
3821 const mod = self.bin_file.options.module.?;
3801 const ty_op = self.air.instructions.items(.data)[inst].ty_op;3822 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
3802 const result: MCValue = result: {3823 const result: MCValue = result: {
3803 const pl_ty = self.typeOfIndex(inst);3824 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);
3806 if (self.reuseOperand(inst, ty_op.operand, 0, opt_mcv)) {3828 if (self.reuseOperand(inst, ty_op.operand, 0, opt_mcv)) {
3807 switch (opt_mcv) {3829 switch (opt_mcv) {
3808 .register => |reg| try self.truncateRegister(pl_ty, reg),3830 .register => |reg| try self.truncateRegister(pl_ty, reg),
...@@ -4422,42 +4444,46 @@ fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void {...@@ -4422,42 +4444,46 @@ fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void {
4422 // this is identical to the `airPtrElemPtr` codegen expect here an4444 // this is identical to the `airPtrElemPtr` codegen expect here an
4423 // additional `mov` is needed at the end to get the actual value4445 // additional `mov` is needed at the end to get the actual value
44244446
4425 const elem_ty = ptr_ty.elemType2(mod);4447 const result = result: {
4426 const elem_abi_size: u32 = @intCast(elem_ty.abiSize(mod));4448 const elem_ty = ptr_ty.elemType2(mod);
4427 const index_ty = self.typeOf(bin_op.rhs);4449 if (!elem_ty.hasRuntimeBitsIgnoreComptime(mod)) break :result .none;
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);
44344450
4435 const offset_reg = try self.elemOffset(index_ty, index_mcv, elem_abi_size);4451 const elem_abi_size: u32 = @intCast(elem_ty.abiSize(mod));
4436 const offset_lock = self.register_manager.lockRegAssumeUnused(offset_reg);4452 const index_ty = self.typeOf(bin_op.rhs);
4437 defer self.register_manager.unlockReg(offset_lock);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);4460 const offset_reg = try self.elemOffset(index_ty, index_mcv, elem_abi_size);
4440 const elem_ptr_reg = if (ptr_mcv.isRegister() and self.liveness.operandDies(inst, 0))4461 const offset_lock = self.register_manager.lockRegAssumeUnused(offset_reg);
4441 ptr_mcv.register4462 defer self.register_manager.unlockReg(offset_lock);
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 );
44514463
4452 const dst_mcv = try self.allocRegOrMem(inst, true);4464 const ptr_mcv = try self.resolveInst(bin_op.lhs);
4453 const dst_lock = switch (dst_mcv) {4465 const elem_ptr_reg = if (ptr_mcv.isRegister() and self.liveness.operandDies(inst, 0))
4454 .register => |reg| self.register_manager.lockRegAssumeUnused(reg),4466 ptr_mcv.register
4455 else => null,4467 else
4456 };4468 try self.copyToTmpRegister(ptr_ty, ptr_mcv);
4457 defer if (dst_lock) |lock| self.register_manager.unlockReg(lock);4469 const elem_ptr_lock = self.register_manager.lockRegAssumeUnused(elem_ptr_reg);
4458 try self.load(dst_mcv, ptr_ty, .{ .register = 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 });
4461}4487}
44624488
4463fn airPtrElemPtr(self: *Self, inst: Air.Inst.Index) !void {4489fn 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...@@ -4937,7 +4963,7 @@ fn byteSwap(self: *Self, inst: Air.Inst.Index, src_ty: Type, src_mcv: MCValue, m
4937 const mod = self.bin_file.options.module.?;4963 const mod = self.bin_file.options.module.?;
4938 const ty_op = self.air.instructions.items(.data)[inst].ty_op;4964 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(
4941 "TODO implement byteSwap for {}",4967 "TODO implement byteSwap for {}",
4942 .{src_ty.fmt(mod)},4968 .{src_ty.fmt(mod)},
4943 );4969 );
...@@ -5788,15 +5814,17 @@ fn packedLoad(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) Inn...@@ -5788,15 +5814,17 @@ fn packedLoad(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) Inn
5788 const ptr_info = ptr_ty.ptrInfo(mod);5814 const ptr_info = ptr_ty.ptrInfo(mod);
57895815
5790 const val_ty = ptr_info.child.toType();5816 const val_ty = ptr_info.child.toType();
5817 if (!val_ty.hasRuntimeBitsIgnoreComptime(mod)) return;
5791 const val_abi_size: u32 = @intCast(val_ty.abiSize(mod));5818 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
5792 const limb_abi_size: u32 = @min(val_abi_size, 8);5822 const limb_abi_size: u32 = @min(val_abi_size, 8);
5793 const limb_abi_bits = limb_abi_size * 8;5823 const limb_abi_bits = limb_abi_size * 8;
5794 const val_byte_off: i32 = @intCast(ptr_info.packed_offset.bit_offset / limb_abi_bits * limb_abi_size);5824 const val_byte_off: i32 = @intCast(ptr_info.packed_offset.bit_offset / limb_abi_bits * limb_abi_size);
5795 const val_bit_off = ptr_info.packed_offset.bit_offset % limb_abi_bits;5825 const val_bit_off = ptr_info.packed_offset.bit_offset % limb_abi_bits;
5796 const val_extra_bits = self.regExtraBits(val_ty);5826 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
5800 const ptr_reg = try self.copyToTmpRegister(ptr_ty, ptr_mcv);5828 const ptr_reg = try self.copyToTmpRegister(ptr_ty, ptr_mcv);
5801 const ptr_lock = self.register_manager.lockRegAssumeUnused(ptr_reg);5829 const ptr_lock = self.register_manager.lockRegAssumeUnused(ptr_reg);
5802 defer self.register_manager.unlockReg(ptr_lock);5830 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...@@ -5859,6 +5887,7 @@ fn packedLoad(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) Inn
5859fn load(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerError!void {5887fn load(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerError!void {
5860 const mod = self.bin_file.options.module.?;5888 const mod = self.bin_file.options.module.?;
5861 const dst_ty = ptr_ty.childType(mod);5889 const dst_ty = ptr_ty.childType(mod);
5890 if (!dst_ty.hasRuntimeBitsIgnoreComptime(mod)) return;
5862 switch (ptr_mcv) {5891 switch (ptr_mcv) {
5863 .none,5892 .none,
5864 .unreach,5893 .unreach,
...@@ -5935,6 +5964,7 @@ fn packedStore(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) In...@@ -5935,6 +5964,7 @@ fn packedStore(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) In
5935 const mod = self.bin_file.options.module.?;5964 const mod = self.bin_file.options.module.?;
5936 const ptr_info = ptr_ty.ptrInfo(mod);5965 const ptr_info = ptr_ty.ptrInfo(mod);
5937 const src_ty = ptr_ty.childType(mod);5966 const src_ty = ptr_ty.childType(mod);
5967 if (!src_ty.hasRuntimeBitsIgnoreComptime(mod)) return;
59385968
5939 const limb_abi_size: u16 = @min(ptr_info.packed_offset.host_size, 8);5969 const limb_abi_size: u16 = @min(ptr_info.packed_offset.host_size, 8);
5940 const limb_abi_bits = limb_abi_size * 8;5970 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...@@ -6006,6 +6036,7 @@ fn packedStore(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) In
6006fn store(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerError!void {6036fn store(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerError!void {
6007 const mod = self.bin_file.options.module.?;6037 const mod = self.bin_file.options.module.?;
6008 const src_ty = ptr_ty.childType(mod);6038 const src_ty = ptr_ty.childType(mod);
6039 if (!src_ty.hasRuntimeBitsIgnoreComptime(mod)) return;
6009 switch (ptr_mcv) {6040 switch (ptr_mcv) {
6010 .none,6041 .none,
6011 .unreach,6042 .unreach,
...@@ -10476,39 +10507,44 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -10476,39 +10507,44 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
10476 },10507 },
10477 else => return self.fail("invalid constraint: '{s}'", .{constraint}),10508 else => return self.fail("invalid constraint: '{s}'", .{constraint}),
10478 };10509 };
10479 const arg_maybe_reg: ?Register = if (mem.eql(u8, constraint[1..], "r"))10510 const arg_mcv: MCValue = arg_mcv: {
10480 self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse10511 const arg_maybe_reg: ?Register = if (mem.eql(u8, constraint[1..], "r"))
10481 return self.fail("ran out of registers lowering inline asm", .{})10512 self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse
10482 else if (mem.eql(u8, constraint[1..], "m"))10513 return self.fail("ran out of registers lowering inline asm", .{})
10483 if (output != .none) null else return self.fail(10514 else if (mem.eql(u8, constraint[1..], "m"))
10484 "memory constraint unsupported for asm result: '{s}'",10515 if (output != .none) null else return self.fail(
10485 .{constraint},10516 "memory constraint unsupported for asm result: '{s}'",
10486 )10517 .{constraint},
10487 else if (mem.eql(u8, constraint[1..], "g") or10518 )
10488 mem.eql(u8, constraint[1..], "rm") or mem.eql(u8, constraint[1..], "mr") or10519 else if (mem.eql(u8, constraint[1..], "g") or
10489 mem.eql(u8, constraint[1..], "r,m") or mem.eql(u8, constraint[1..], "m,r"))10520 mem.eql(u8, constraint[1..], "rm") or mem.eql(u8, constraint[1..], "mr") or
10490 self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse10521 mem.eql(u8, constraint[1..], "r,m") or mem.eql(u8, constraint[1..], "m,r"))
10491 if (output != .none)10522 self.register_manager.tryAllocReg(maybe_inst, self.regClassForType(ty)) orelse
10492 null10523 if (output != .none)
10493 else10524 null
10494 return self.fail("ran out of registers lowering inline asm", .{})10525 else
10495 else if (mem.startsWith(u8, constraint[1..], "{") and mem.endsWith(u8, constraint[1..], "}"))10526 return self.fail("ran out of registers lowering inline asm", .{})
10496 parseRegName(constraint[1 + "{".len .. constraint.len - "}".len]) orelse10527 else if (mem.startsWith(u8, constraint[1..], "{") and mem.endsWith(u8, constraint[1..], "}"))
10497 return self.fail("invalid register constraint: '{s}'", .{constraint})10528 parseRegName(constraint[1 + "{".len .. constraint.len - "}".len]) orelse
10498 else10529 return self.fail("invalid register constraint: '{s}'", .{constraint})
10499 return self.fail("invalid constraint: '{s}'", .{constraint});10530 else if (constraint.len == 2 and std.ascii.isDigit(constraint[1])) {
10500 const arg_mcv: MCValue = if (arg_maybe_reg) |reg| .{ .register = reg } else arg: {10531 const index = std.fmt.charToDigit(constraint[0], 10) catch unreachable;
10501 const ptr_mcv = try self.resolveInst(output);10532 if (index >= args.items.len) return self.fail("constraint out of bounds: '{s}'", .{constraint});
10502 switch (ptr_mcv) {10533 break :arg_mcv args.items[index];
10503 .immediate => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |_|10534 } else return self.fail("invalid constraint: '{s}'", .{constraint});
10504 break :arg ptr_mcv.deref(),10535 break :arg_mcv if (arg_maybe_reg) |reg| .{ .register = reg } else arg: {
10505 .register, .register_offset, .lea_frame => break :arg ptr_mcv.deref(),10536 const ptr_mcv = try self.resolveInst(output);
10506 else => {},10537 switch (ptr_mcv) {
10507 }10538 .immediate => |addr| if (math.cast(i32, @as(i64, @bitCast(addr)))) |_|
10508 break :arg .{ .indirect = .{ .reg = try self.copyToTmpRegister(Type.usize, ptr_mcv) } };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 };
10509 };10545 };
10510 if (arg_mcv.getReg()) |reg| if (RegisterManager.indexOfRegIntoTracked(reg)) |_| {10546 if (arg_mcv.getReg()) |reg| if (RegisterManager.indexOfRegIntoTracked(reg)) |_| {
10511 _ = self.register_manager.lockRegAssumeUnused(reg);10547 _ = self.register_manager.lockReg(reg);
10512 };10548 };
10513 if (!mem.eql(u8, name, "_"))10549 if (!mem.eql(u8, name, "_"))
10514 arg_map.putAssumeCapacityNoClobber(name, @intCast(args.items.len));10550 arg_map.putAssumeCapacityNoClobber(name, @intCast(args.items.len));
...@@ -10570,6 +10606,10 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -10570,6 +10606,10 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
10570 try self.register_manager.getReg(reg, null);10606 try self.register_manager.getReg(reg, null);
10571 try self.genSetReg(reg, ty, input_mcv);10607 try self.genSetReg(reg, ty, input_mcv);
10572 break :arg .{ .register = reg };10608 break :arg .{ .register = reg };
10609 } else if (constraint.len == 1 and std.ascii.isDigit(constraint[0])) arg: {
10610 const index = std.fmt.charToDigit(constraint[0], 10) catch unreachable;
10611 if (index >= args.items.len) return self.fail("constraint out of bounds: '{s}'", .{constraint});
10612 break :arg args.items[index];
10573 } else return self.fail("invalid constraint: '{s}'", .{constraint});10613 } else return self.fail("invalid constraint: '{s}'", .{constraint});
10574 if (arg_mcv.getReg()) |reg| if (RegisterManager.indexOfRegIntoTracked(reg)) |_| {10614 if (arg_mcv.getReg()) |reg| if (RegisterManager.indexOfRegIntoTracked(reg)) |_| {
10575 _ = self.register_manager.lockReg(reg);10615 _ = self.register_manager.lockReg(reg);
...@@ -10695,7 +10735,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -10695,7 +10735,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
10695 mnem_name[mnem_prefix.len .. mnem_name.len - mnem_suffix.len],10735 mnem_name[mnem_prefix.len .. mnem_name.len - mnem_suffix.len],
10696 ) orelse continue };10736 ) orelse continue };
10697 } else {10737 } else {
10698 assert(prefix != .none);10738 assert(prefix != .none); // no combination of fixes produced a known mnemonic
10699 return self.fail("invalid prefix for mnemonic: '{s} {s}'", .{10739 return self.fail("invalid prefix for mnemonic: '{s} {s}'", .{
10700 @tagName(prefix), mnem_str,10740 @tagName(prefix), mnem_str,
10701 });10741 });
...@@ -10926,6 +10966,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -10926,6 +10966,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
1092610966
10927 if (output == .none) continue;10967 if (output == .none) continue;
10928 if (arg_mcv != .register) continue;10968 if (arg_mcv != .register) continue;
10969 if (constraint.len == 2 and std.ascii.isDigit(constraint[1])) continue;
10929 try self.store(self.typeOf(output), .{ .air_ref = output }, arg_mcv);10970 try self.store(self.typeOf(output), .{ .air_ref = output }, arg_mcv);
10930 }10971 }
1093110972
...@@ -11019,6 +11060,7 @@ fn moveStrategy(self: *Self, ty: Type, aligned: bool) !MoveStrategy {...@@ -11019,6 +11060,7 @@ fn moveStrategy(self: *Self, ty: Type, aligned: bool) !MoveStrategy {
11019 else => {},11060 else => {},
11020 },11061 },
11021 .Vector => switch (ty.childType(mod).zigTypeTag(mod)) {11062 .Vector => switch (ty.childType(mod).zigTypeTag(mod)) {
11063 .Bool => return .{ .move = .{ ._, .mov } },
11022 .Int => switch (ty.childType(mod).intInfo(mod).bits) {11064 .Int => switch (ty.childType(mod).intInfo(mod).bits) {
11023 8 => switch (ty.vectorLen(mod)) {11065 8 => switch (ty.vectorLen(mod)) {
11024 1 => if (self.hasFeature(.avx)) return .{ .vex_insert_extract = .{11066 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...@@ -11284,7 +11326,6 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr
11284 .none,11326 .none,
11285 .unreach,11327 .unreach,
11286 .dead,11328 .dead,
11287 .register_pair,
11288 .register_overflow,11329 .register_overflow,
11289 .reserved_frame,11330 .reserved_frame,
11290 => unreachable,11331 => unreachable,
...@@ -11388,6 +11429,7 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr...@@ -11388,6 +11429,7 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr
11388 },11429 },
11389 .x87, .mmx => unreachable,11430 .x87, .mmx => unreachable,
11390 },11431 },
11432 .register_pair => |src_regs| try self.genSetReg(dst_reg, ty, .{ .register = src_regs[0] }),
11391 .register_offset,11433 .register_offset,
11392 .indirect,11434 .indirect,
11393 .load_frame,11435 .load_frame,
...@@ -11521,10 +11563,13 @@ fn genSetMem(self: *Self, base: Memory.Base, disp: i32, ty: Type, src_mcv: MCVal...@@ -11521,10 +11563,13 @@ fn genSetMem(self: *Self, base: Memory.Base, disp: i32, ty: Type, src_mcv: MCVal
11521 .undef => {},11563 .undef => {},
11522 .immediate => |imm| switch (abi_size) {11564 .immediate => |imm| switch (abi_size) {
11523 1, 2, 4 => {11565 1, 2, 4 => {
11524 const immediate = if (ty.isSignedInt(mod))11566 const immediate = switch (if (ty.isAbiInt(mod))
11525 Immediate.s(@truncate(@as(i64, @bitCast(imm))))11567 ty.intInfo(mod).signedness
11526 else11568 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 };
11528 try self.asmMemoryImmediate(11573 try self.asmMemoryImmediate(
11529 .{ ._, .mov },11574 .{ ._, .mov },
11530 Memory.sib(Memory.PtrSize.fromSize(abi_size), .{ .base = base, .disp = disp }),11575 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...@@ -11586,19 +11631,35 @@ fn genSetMem(self: *Self, base: Memory.Base, disp: i32, ty: Type, src_mcv: MCVal
11586 .{ .base = base, .disp = disp + @as(i32, @intCast(src_reg_i * 8)) },11631 .{ .base = base, .disp = disp + @as(i32, @intCast(src_reg_i * 8)) },
11587 ), registerAlias(src_reg, part_size));11632 ), registerAlias(src_reg, part_size));
11588 },11633 },
11589 .register_overflow => |ro| {11634 .register_overflow => |ro| switch (ty.zigTypeTag(mod)) {
11590 try self.genSetMem(11635 .Struct => {
11591 base,11636 try self.genSetMem(
11592 disp + @as(i32, @intCast(ty.structFieldOffset(0, mod))),11637 base,
11593 ty.structFieldType(0, mod),11638 disp + @as(i32, @intCast(ty.structFieldOffset(0, mod))),
11594 .{ .register = ro.reg },11639 ty.structFieldType(0, mod),
11595 );11640 .{ .register = ro.reg },
11596 try self.genSetMem(11641 );
11597 base,11642 try self.genSetMem(
11598 disp + @as(i32, @intCast(ty.structFieldOffset(1, mod))),11643 base,
11599 ty.structFieldType(1, mod),11644 disp + @as(i32, @intCast(ty.structFieldOffset(1, mod))),
11600 .{ .eflags = ro.eflags },11645 ty.structFieldType(1, mod),
11601 );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 }),
11602 },11663 },
11603 .register_offset,11664 .register_offset,
11604 .memory,11665 .memory,
src/arch/x86_64/Encoding.zig+3-3
...@@ -232,7 +232,7 @@ pub const Mnemonic = enum {...@@ -232,7 +232,7 @@ pub const Mnemonic = enum {
232 cmp,232 cmp,
233 cmps, cmpsb, cmpsd, cmpsq, cmpsw,233 cmps, cmpsb, cmpsd, cmpsq, cmpsw,
234 cmpxchg, cmpxchg8b, cmpxchg16b,234 cmpxchg, cmpxchg8b, cmpxchg16b,
235 cqo, cwd, cwde,235 cpuid, cqo, cwd, cwde,
236 div,236 div,
237 idiv, imul, int3,237 idiv, imul, int3,
238 ja, jae, jb, jbe, jc, jrcxz, je, jg, jge, jl, jle, jna, jnae, jnb, jnbe,238 ja, jae, jb, jbe, jc, jrcxz, je, jg, jge, jl, jle, jna, jnae, jnb, jnbe,
...@@ -246,7 +246,7 @@ pub const Mnemonic = enum {...@@ -246,7 +246,7 @@ pub const Mnemonic = enum {
246 movsx, movsxd, movzx, mul,246 movsx, movsxd, movzx, mul,
247 neg, nop, not,247 neg, nop, not,
248 @"or",248 @"or",
249 pop, popcnt, push,249 pause, pop, popcnt, push,
250 rcl, rcr, ret, rol, ror,250 rcl, rcr, ret, rol, ror,
251 sal, sar, sbb,251 sal, sar, sbb,
252 scas, scasb, scasd, scasq, scasw,252 scas, scasb, scasd, scasq, scasw,
...@@ -258,7 +258,7 @@ pub const Mnemonic = enum {...@@ -258,7 +258,7 @@ pub const Mnemonic = enum {
258 stos, stosb, stosd, stosq, stosw,258 stos, stosb, stosd, stosq, stosw,
259 @"test", tzcnt,259 @"test", tzcnt,
260 ud2,260 ud2,
261 xadd, xchg, xor,261 xadd, xchg, xgetbv, xor,
262 // X87262 // X87
263 fabs, fchs, ffree, fisttp, fld, fst, fstp,263 fabs, fchs, ffree, fisttp, fld, fst, fstp,
264 // MMX264 // MMX
src/arch/x86_64/Mir.zig+6
...@@ -327,6 +327,8 @@ pub const Inst = struct {...@@ -327,6 +327,8 @@ pub const Inst = struct {
327 /// Compare and exchange327 /// Compare and exchange
328 /// Compare and exchange bytes328 /// Compare and exchange bytes
329 cmpxchg,329 cmpxchg,
330 /// CPU identification
331 cpuid,
330 /// Convert doubleword to quadword332 /// Convert doubleword to quadword
331 cqo,333 cqo,
332 /// Convert word to doubleword334 /// Convert word to doubleword
...@@ -386,6 +388,8 @@ pub const Inst = struct {...@@ -386,6 +388,8 @@ pub const Inst = struct {
386 /// Bitwise logical or of packed single-precision floating-point values388 /// Bitwise logical or of packed single-precision floating-point values
387 /// Bitwise logical or of packed double-precision floating-point values389 /// Bitwise logical or of packed double-precision floating-point values
388 @"or",390 @"or",
391 /// Spin loop hint
392 pause,
389 /// Pop393 /// Pop
390 pop,394 pop,
391 /// Return the count of number of bits set to 1395 /// Return the count of number of bits set to 1
...@@ -437,6 +441,8 @@ pub const Inst = struct {...@@ -437,6 +441,8 @@ pub const Inst = struct {
437 xadd,441 xadd,
438 /// Exchange register/memory with register442 /// Exchange register/memory with register
439 xchg,443 xchg,
444 /// Get value of extended control register
445 xgetbv,
440 /// Logical exclusive-or446 /// Logical exclusive-or
441 /// Bitwise logical xor of packed single-precision floating-point values447 /// Bitwise logical xor of packed single-precision floating-point values
442 /// Bitwise logical xor of packed double-precision floating-point values448 /// Bitwise logical xor of packed double-precision floating-point values
src/arch/x86_64/encodings.zig+6
...@@ -266,6 +266,8 @@ pub const table = [_]Entry{...@@ -266,6 +266,8 @@ pub const table = [_]Entry{
266 .{ .cmpxchg8b, .m, &.{ .m64 }, &.{ 0x0f, 0xc7 }, 1, .none, .none },266 .{ .cmpxchg8b, .m, &.{ .m64 }, &.{ 0x0f, 0xc7 }, 1, .none, .none },
267 .{ .cmpxchg16b, .m, &.{ .m128 }, &.{ 0x0f, 0xc7 }, 1, .long, .none },267 .{ .cmpxchg16b, .m, &.{ .m128 }, &.{ 0x0f, 0xc7 }, 1, .long, .none },
268268
269 .{ .cpuid, .np, &.{}, &.{ 0x0f, 0xa2 }, 0, .none, .none },
270
269 .{ .div, .m, &.{ .rm8 }, &.{ 0xf6 }, 6, .none, .none },271 .{ .div, .m, &.{ .rm8 }, &.{ 0xf6 }, 6, .none, .none },
270 .{ .div, .m, &.{ .rm8 }, &.{ 0xf6 }, 6, .rex, .none },272 .{ .div, .m, &.{ .rm8 }, &.{ 0xf6 }, 6, .rex, .none },
271 .{ .div, .m, &.{ .rm16 }, &.{ 0xf7 }, 6, .short, .none },273 .{ .div, .m, &.{ .rm16 }, &.{ 0xf7 }, 6, .short, .none },
...@@ -469,6 +471,8 @@ pub const table = [_]Entry{...@@ -469,6 +471,8 @@ pub const table = [_]Entry{
469 .{ .@"or", .rm, &.{ .r32, .rm32 }, &.{ 0x0b }, 0, .none, .none },471 .{ .@"or", .rm, &.{ .r32, .rm32 }, &.{ 0x0b }, 0, .none, .none },
470 .{ .@"or", .rm, &.{ .r64, .rm64 }, &.{ 0x0b }, 0, .long, .none },472 .{ .@"or", .rm, &.{ .r64, .rm64 }, &.{ 0x0b }, 0, .long, .none },
471473
474 .{ .pause, .np, &.{}, &.{ 0xf3, 0x90 }, 0, .none, .none },
475
472 .{ .pop, .o, &.{ .r16 }, &.{ 0x58 }, 0, .short, .none },476 .{ .pop, .o, &.{ .r16 }, &.{ 0x58 }, 0, .short, .none },
473 .{ .pop, .o, &.{ .r64 }, &.{ 0x58 }, 0, .none, .none },477 .{ .pop, .o, &.{ .r64 }, &.{ 0x58 }, 0, .none, .none },
474 .{ .pop, .m, &.{ .rm16 }, &.{ 0x8f }, 0, .short, .none },478 .{ .pop, .m, &.{ .rm16 }, &.{ 0x8f }, 0, .short, .none },
...@@ -805,6 +809,8 @@ pub const table = [_]Entry{...@@ -805,6 +809,8 @@ pub const table = [_]Entry{
805 .{ .xchg, .rm, &.{ .r32, .rm32 }, &.{ 0x87 }, 0, .none, .none },809 .{ .xchg, .rm, &.{ .r32, .rm32 }, &.{ 0x87 }, 0, .none, .none },
806 .{ .xchg, .rm, &.{ .r64, .rm64 }, &.{ 0x87 }, 0, .long, .none },810 .{ .xchg, .rm, &.{ .r64, .rm64 }, &.{ 0x87 }, 0, .long, .none },
807811
812 .{ .xgetbv, .np, &.{}, &.{ 0x0f, 0x01 }, 0, .none, .none },
813
808 .{ .xor, .zi, &.{ .al, .imm8 }, &.{ 0x34 }, 0, .none, .none },814 .{ .xor, .zi, &.{ .al, .imm8 }, &.{ 0x34 }, 0, .none, .none },
809 .{ .xor, .zi, &.{ .ax, .imm16 }, &.{ 0x35 }, 0, .short, .none },815 .{ .xor, .zi, &.{ .ax, .imm16 }, &.{ 0x35 }, 0, .short, .none },
810 .{ .xor, .zi, &.{ .eax, .imm32 }, &.{ 0x35 }, 0, .none, .none },816 .{ .xor, .zi, &.{ .eax, .imm32 }, &.{ 0x35 }, 0, .none, .none },
src/codegen.zig+2-2
...@@ -545,7 +545,7 @@ pub fn generateSymbol(...@@ -545,7 +545,7 @@ pub fn generateSymbol(
545545
546 if (layout.payload_size == 0) {546 if (layout.payload_size == 0) {
547 return generateSymbol(bin_file, src_loc, .{547 return generateSymbol(bin_file, src_loc, .{
548 .ty = typed_value.ty.unionTagType(mod).?,548 .ty = typed_value.ty.unionTagTypeSafety(mod).?,
549 .val = un.tag.toValue(),549 .val = un.tag.toValue(),
550 }, code, debug_output, reloc_info);550 }, code, debug_output, reloc_info);
551 }551 }
...@@ -553,7 +553,7 @@ pub fn generateSymbol(...@@ -553,7 +553,7 @@ pub fn generateSymbol(
553 // Check if we should store the tag first.553 // Check if we should store the tag first.
554 if (layout.tag_size > 0 and layout.tag_align.compare(.gte, layout.payload_align)) {554 if (layout.tag_size > 0 and layout.tag_align.compare(.gte, layout.payload_align)) {
555 switch (try generateSymbol(bin_file, src_loc, .{555 switch (try generateSymbol(bin_file, src_loc, .{
556 .ty = typed_value.ty.unionTagType(mod).?,556 .ty = typed_value.ty.unionTagTypeSafety(mod).?,
557 .val = un.tag.toValue(),557 .val = un.tag.toValue(),
558 }, code, debug_output, reloc_info)) {558 }, code, debug_output, reloc_info)) {
559 .ok => {},559 .ok => {},
test/behavior/basic.zig+1-1
...@@ -745,12 +745,12 @@ test "auto created variables have correct alignment" {...@@ -745,12 +745,12 @@ test "auto created variables have correct alignment" {
745745
746test "extern variable with non-pointer opaque type" {746test "extern variable with non-pointer opaque type" {
747 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO747 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
748 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
749 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO748 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
750 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO749 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
751 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO750 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
752 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO751 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
753 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;752 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
755 @export(var_to_export, .{ .name = "opaque_extern_var" });755 @export(var_to_export, .{ .name = "opaque_extern_var" });
756 try expect(@as(*align(1) u32, @ptrCast(&opaque_extern_var)).* == 42);756 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" {...@@ -411,8 +411,9 @@ test "bitcast nan float does not modify signaling bit" {
411 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO411 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
412 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO412 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
413 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO413 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
414 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
415 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;414 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
415 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
416
416 // TODO: https://github.com/ziglang/zig/issues/14366417 // TODO: https://github.com/ziglang/zig/issues/14366
417 if (builtin.zig_backend == .stage2_llvm and comptime builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;418 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 {...@@ -64,11 +64,11 @@ pub const JournalHeader = packed struct {
64test "fixed" {64test "fixed" {
65 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO65 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
66 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO66 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
67 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
68 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO67 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
69 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO68 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
70 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO69 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
71 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;70 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
73 var buffer align(@alignOf(JournalHeader)) = [_]u8{0} ** 65536;73 var buffer align(@alignOf(JournalHeader)) = [_]u8{0} ** 65536;
74 var entry = std.mem.bytesAsValue(JournalHeader, buffer[0..@sizeOf(JournalHeader)]);74 var entry = std.mem.bytesAsValue(JournalHeader, buffer[0..@sizeOf(JournalHeader)]);
test/behavior/bugs/920.zig+1-1
...@@ -57,11 +57,11 @@ const NormalDist = blk: {...@@ -57,11 +57,11 @@ const NormalDist = blk: {
57};57};
5858
59test "bug 920 fixed" {59test "bug 920 fixed" {
60 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
61 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO60 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
62 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO61 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
63 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO62 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
64 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;63 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
64 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
6565
66 const NormalDist1 = blk: {66 const NormalDist1 = blk: {
67 break :blk ZigTableGen(true, norm_r, norm_v, norm_f, norm_f_inv, norm_zero_case);67 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"...@@ -1606,8 +1606,8 @@ test "peer type resolution: const sentinel slice and mutable non-sentinel slice"
1606test "peer type resolution: float and comptime-known fixed-width integer" {1606test "peer type resolution: float and comptime-known fixed-width integer" {
1607 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO1607 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1608 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO1608 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1609 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
1610 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1609 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
1612 const i: u8 = 100;1612 const i: u8 = 100;
1613 var f: f32 = 1.234;1613 var f: f32 = 1.234;
...@@ -2372,7 +2372,7 @@ test "@intFromBool on vector" {...@@ -2372,7 +2372,7 @@ test "@intFromBool on vector" {
2372}2372}
23732373
2374test "numeric coercions with undefined" {2374test "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
2377 const from: i32 = undefined;2377 const from: i32 = undefined;
2378 var to: f32 = from;2378 var to: f32 = from;
...@@ -2383,7 +2383,6 @@ test "numeric coercions with undefined" {...@@ -2383,7 +2383,6 @@ test "numeric coercions with undefined" {
23832383
2384test "15-bit int to float" {2384test "15-bit int to float" {
2385 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;2385 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
2386 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
23872386
2388 var a: u15 = 42;2387 var a: u15 = 42;
2389 var b: f32 = @floatFromInt(a);2388 var b: f32 = @floatFromInt(a);
...@@ -2391,11 +2390,11 @@ test "15-bit int to float" {...@@ -2391,11 +2390,11 @@ test "15-bit int to float" {
2391}2390}
23922391
2393test "@as does not corrupt values with incompatible representations" {2392test "@as does not corrupt values with incompatible representations" {
2394 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
2395 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO2393 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
2396 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO2394 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
2397 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO2395 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
2398 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;2396 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
2397 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
23992398
2400 const x: f32 = @as(f16, blk: {2399 const x: f32 = @as(f16, blk: {
2401 if (false) {2400 if (false) {
test/behavior/cast_int.zig-1
...@@ -199,7 +199,6 @@ test "load non byte-sized value in union" {...@@ -199,7 +199,6 @@ test "load non byte-sized value in union" {
199 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;199 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
200 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;200 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;
201 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;201 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
202 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
203 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;202 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
204203
205 // note: this bug is triggered by the == operator, expectEqual will hide it204 // 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" {...@@ -425,8 +425,8 @@ test "implicit cast function to function ptr" {
425 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO425 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
426 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO426 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
427 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO427 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
428 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
429 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;428 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
431 const S1 = struct {431 const S1 = struct {
432 export fn someFunctionThatReturnsAValue() c_int {432 export fn someFunctionThatReturnsAValue() c_int {
test/behavior/int128.zig-1
...@@ -66,7 +66,6 @@ test "int128" {...@@ -66,7 +66,6 @@ test "int128" {
6666
67test "truncate int128" {67test "truncate int128" {
68 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO68 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
69 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
70 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO69 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
71 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO70 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
72 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO71 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
test/behavior/packed-struct.zig+2-2
...@@ -659,12 +659,12 @@ test "optional pointer in packed struct" {...@@ -659,12 +659,12 @@ test "optional pointer in packed struct" {
659test "nested packed struct field access test" {659test "nested packed struct field access test" {
660 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO660 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
661 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO packed structs larger than 64 bits661 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO packed structs larger than 64 bits
662 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
663 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO662 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
664 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO663 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
665 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO664 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
666 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;665 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
667 //666 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
667
668 const Vec2 = packed struct {668 const Vec2 = packed struct {
669 x: f32,669 x: f32,
670 y: f32,670 y: f32,
test/behavior/translate_c_macros.zig+1-1
...@@ -151,11 +151,11 @@ test "string and char literals that are not UTF-8 encoded. Issue #12784" {...@@ -151,11 +151,11 @@ test "string and char literals that are not UTF-8 encoded. Issue #12784" {
151151
152test "Macro that uses division operator. Issue #13162" {152test "Macro that uses division operator. Issue #13162" {
153 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO153 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
154 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
155 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO154 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
156 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO155 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
157 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO156 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
158 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;157 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
158 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
159159
160 try expectEqual(@as(c_int, 42), h.DIVIDE_CONSTANT(@as(c_int, 42_000)));160 try expectEqual(@as(c_int, 42), h.DIVIDE_CONSTANT(@as(c_int, 42_000)));
161 try expectEqual(@as(c_uint, 42), h.DIVIDE_CONSTANT(@as(c_uint, 42_000)));161 try expectEqual(@as(c_uint, 42), h.DIVIDE_CONSTANT(@as(c_uint, 42_000)));
test/behavior/tuple.zig+1-1
...@@ -370,8 +370,8 @@ test "tuple initialized with a runtime known value" {...@@ -370,8 +370,8 @@ test "tuple initialized with a runtime known value" {
370test "tuple of struct concatenation and coercion to array" {370test "tuple of struct concatenation and coercion to array" {
371 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;371 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
372 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;372 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
373 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
374 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO373 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
376 const StructWithDefault = struct { value: f32 = 42 };376 const StructWithDefault = struct { value: f32 = 42 };
377 const SomeStruct = struct { array: [4]StructWithDefault };377 const SomeStruct = struct { array: [4]StructWithDefault };
test/behavior/vector.zig+1-1
...@@ -1329,8 +1329,8 @@ test "store to vector in slice" {...@@ -1329,8 +1329,8 @@ test "store to vector in slice" {
1329 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO1329 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1330 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO1330 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1331 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO1331 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
1332 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
1333 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1332 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
1335 var v = [_]@Vector(3, f32){1335 var v = [_]@Vector(3, f32){
1336 .{ 1, 1, 1 },1336 .{ 1, 1, 1 },
test/tests.zig+7-3
...@@ -985,7 +985,9 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {...@@ -985,7 +985,9 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
985 continue;985 continue;
986986
987 // TODO get compiler-rt tests passing for self-hosted backends.987 // 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"))
989 continue;991 continue;
990992
991 // TODO get compiler-rt tests passing for wasm32-wasi993 // TODO get compiler-rt tests passing for wasm32-wasi
...@@ -1002,8 +1004,10 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {...@@ -1002,8 +1004,10 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
1002 test_target.use_llvm == false and mem.eql(u8, options.name, "universal-libc"))1004 test_target.use_llvm == false and mem.eql(u8, options.name, "universal-libc"))
1003 continue;1005 continue;
10041006
1005 // TODO get std lib tests passing for self-hosted backends.1007 // TODO get std lib tests passing for other self-hosted backends.
1006 if (test_target.use_llvm == false and mem.eql(u8, options.name, "std"))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"))
1007 continue;1011 continue;
10081012
1009 const want_this_mode = for (options.optimize_modes) |m| {1013 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:...@@ -355,17 +355,28 @@ class Module_Decl__Module_Decl_Index_SynthProvider:
355 def __init__(self, value, _=None): self.value = value355 def __init__(self, value, _=None): self.value = value
356 def update(self):356 def update(self):
357 try:357 try:
358 for frame in self.value.thread:358 ip = InternPool_Find(self.value.thread)
359 mod = frame.FindVariable('mod') or frame.FindVariable('module')359 if not ip: return
360 if mod: break360 self.ptr = ip.GetChildMemberWithName('allocated_decls').GetChildAtIndex(self.value.unsigned).address_of.Clone('decl')
361 else: return
362 self.ptr = mod.GetChildMemberWithName('allocated_decls').GetChildAtIndex(self.value.unsigned).address_of.Clone('decl')
363 except: pass361 except: pass
364 def has_children(self): return True362 def has_children(self): return True
365 def num_children(self): return 1363 def num_children(self): return 1
366 def get_child_index(self, name): return 0 if name == 'decl' else -1364 def get_child_index(self, name): return 0 if name == 'decl' else -1
367 def get_child_at_index(self, index): return self.ptr if index == 0 else None365 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
369class TagOrPayloadPtr_SynthProvider:380class TagOrPayloadPtr_SynthProvider:
370 def __init__(self, value, _=None): self.value = value381 def __init__(self, value, _=None): self.value = value
371 def update(self):382 def update(self):
...@@ -440,10 +451,9 @@ class InternPool_Index_SynthProvider:...@@ -440,10 +451,9 @@ class InternPool_Index_SynthProvider:
440 for encoding_field in encoding_type.fields:451 for encoding_field in encoding_type.fields:
441 if encoding_field.name == 'data':452 if encoding_field.name == 'data':
442 if encoding_field.type.IsPointerType():453 if encoding_field.type.IsPointerType():
443 data_type = encoding_field.type.GetPointeeType()
444 extra_index = data.unsigned454 extra_index = data.unsigned
445 self.data = extra.GetChildAtIndex(extra_index).Cast(data_type).Clone('data')455 self.data = extra.GetChildAtIndex(extra_index).address_of.Cast(encoding_field.type).deref.Clone('data')
446 extra_index += data_type.num_fields456 extra_index += encoding_field.type.GetPointeeType().num_fields
447 else:457 else:
448 self.data = data.Cast(encoding_field.type).Clone('data')458 self.data = data.Cast(encoding_field.type).Clone('data')
449 elif encoding_field.name == 'trailing':459 elif encoding_field.name == 'trailing':
...@@ -700,6 +710,7 @@ def __lldb_init_module(debugger, _=None):...@@ -700,6 +710,7 @@ def __lldb_init_module(debugger, _=None):
700 add(debugger, category='zig.stage2', regex=True, type=MultiArrayList_Entry('Air\\.Inst'), identifier='TagAndPayload', synth=True, inline_children=True, summary=True)710 add(debugger, category='zig.stage2', regex=True, type=MultiArrayList_Entry('Air\\.Inst'), identifier='TagAndPayload', synth=True, inline_children=True, summary=True)
701 add(debugger, category='zig.stage2', regex=True, type='^Air\\.Inst\\.Data\\.Data__struct_[1-9][0-9]*$', inline_children=True, summary=True)711 add(debugger, category='zig.stage2', regex=True, type='^Air\\.Inst\\.Data\\.Data__struct_[1-9][0-9]*$', inline_children=True, summary=True)
702 add(debugger, category='zig.stage2', type='Module.Decl::Module.Decl.Index', synth=True)712 add(debugger, category='zig.stage2', type='Module.Decl::Module.Decl.Index', synth=True)
713 add(debugger, category='zig.stage2', type='Module.Namespace::Module.Namespace.Index', synth=True)
703 add(debugger, category='zig.stage2', type='Module.LazySrcLoc', identifier='zig_TaggedUnion', synth=True)714 add(debugger, category='zig.stage2', type='Module.LazySrcLoc', identifier='zig_TaggedUnion', synth=True)
704 add(debugger, category='zig.stage2', type='InternPool.Index', synth=True)715 add(debugger, category='zig.stage2', type='InternPool.Index', synth=True)
705 add(debugger, category='zig.stage2', type='InternPool.NullTerminatedString', summary=True)716 add(debugger, category='zig.stage2', type='InternPool.NullTerminatedString', summary=True)