aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/compiler_rt/addf3_test.zig8
-rw-r--r--lib/compiler_rt/addoti4_test.zig2
-rw-r--r--lib/compiler_rt/comparef.zig2
-rw-r--r--lib/compiler_rt/cos.zig4
-rw-r--r--lib/compiler_rt/divtf3_test.zig4
-rw-r--r--lib/compiler_rt/divxf3_test.zig2
-rw-r--r--lib/compiler_rt/float_from_int_test.zig22
-rw-r--r--lib/compiler_rt/fma.zig3
-rw-r--r--lib/compiler_rt/fmodx_test.zig4
-rw-r--r--lib/compiler_rt/int.zig2
-rw-r--r--lib/compiler_rt/int_from_float_test.zig37
-rw-r--r--lib/compiler_rt/mulf3_test.zig4
-rw-r--r--lib/compiler_rt/negti2_test.zig4
-rw-r--r--lib/compiler_rt/powiXf2_test.zig13
-rw-r--r--lib/compiler_rt/sin.zig2
-rw-r--r--lib/compiler_rt/suboti4_test.zig2
-rw-r--r--lib/compiler_rt/tan.zig4
-rw-r--r--lib/compiler_rt/udivmodei4.zig5
-rw-r--r--lib/docs/main.js7
-rw-r--r--lib/std/Build.zig10
-rw-r--r--lib/std/Build/Cache.zig10
-rw-r--r--lib/std/Build/Step.zig2
-rw-r--r--lib/std/Build/Step/Compile.zig8
-rw-r--r--lib/std/Build/Step/Options.zig2
-rw-r--r--lib/std/Build/Step/Run.zig2
-rw-r--r--lib/std/RingBuffer.zig93
-rw-r--r--lib/std/Thread/Condition.zig6
-rw-r--r--lib/std/Thread/Mutex.zig2
-rw-r--r--lib/std/Thread/RwLock.zig2
-rw-r--r--lib/std/Uri.zig2
-rw-r--r--lib/std/array_hash_map.zig15
-rw-r--r--lib/std/array_list.zig11
-rw-r--r--lib/std/atomic/Atomic.zig4
-rw-r--r--lib/std/atomic/queue.zig2
-rw-r--r--lib/std/base64.zig7
-rw-r--r--lib/std/bit_set.zig15
-rw-r--r--lib/std/child_process.zig14
-rw-r--r--lib/std/compress/deflate/compressor.zig2
-rw-r--r--lib/std/compress/deflate/compressor_test.zig18
-rw-r--r--lib/std/compress/deflate/deflate_fast.zig2
-rw-r--r--lib/std/compress/deflate/deflate_fast_test.zig5
-rw-r--r--lib/std/compress/deflate/huffman_bit_writer.zig6
-rw-r--r--lib/std/compress/deflate/huffman_code.zig2
-rw-r--r--lib/std/compress/gzip.zig2
-rw-r--r--lib/std/compress/lzma/test.zig17
-rw-r--r--lib/std/compress/lzma/vec2d.zig2
-rw-r--r--lib/std/compress/xz/test.zig2
-rw-r--r--lib/std/compress/zlib.zig4
-rw-r--r--lib/std/compress/zstandard.zig6
-rw-r--r--lib/std/compress/zstandard/decode/block.zig8
-rw-r--r--lib/std/crypto.zig2
-rw-r--r--lib/std/crypto/25519/curve25519.zig5
-rw-r--r--lib/std/crypto/25519/ed25519.zig16
-rw-r--r--lib/std/crypto/25519/edwards25519.zig11
-rw-r--r--lib/std/crypto/25519/ristretto255.zig2
-rw-r--r--lib/std/crypto/25519/x25519.zig15
-rw-r--r--lib/std/crypto/Certificate.zig6
-rw-r--r--lib/std/crypto/Certificate/Bundle.zig2
-rw-r--r--lib/std/crypto/aegis.zig15
-rw-r--r--lib/std/crypto/aes.zig10
-rw-r--r--lib/std/crypto/aes_gcm.zig9
-rw-r--r--lib/std/crypto/aes_ocb.zig20
-rw-r--r--lib/std/crypto/argon2.zig14
-rw-r--r--lib/std/crypto/bcrypt.zig7
-rw-r--r--lib/std/crypto/blake3.zig4
-rw-r--r--lib/std/crypto/chacha20.zig22
-rw-r--r--lib/std/crypto/cmac.zig9
-rw-r--r--lib/std/crypto/ecdsa.zig30
-rw-r--r--lib/std/crypto/ff.zig5
-rw-r--r--lib/std/crypto/ghash_polyval.zig6
-rw-r--r--lib/std/crypto/hash_composition.zig2
-rw-r--r--lib/std/crypto/hkdf.zig2
-rw-r--r--lib/std/crypto/kyber_d00.zig28
-rw-r--r--lib/std/crypto/pbkdf2.zig15
-rw-r--r--lib/std/crypto/pcurves/p256.zig2
-rw-r--r--lib/std/crypto/pcurves/p384.zig5
-rw-r--r--lib/std/crypto/pcurves/secp256k1.zig5
-rw-r--r--lib/std/crypto/phc_encoding.zig9
-rw-r--r--lib/std/crypto/poly1305.zig2
-rw-r--r--lib/std/crypto/salsa20.zig12
-rw-r--r--lib/std/crypto/scrypt.zig5
-rw-r--r--lib/std/crypto/sha2.zig12
-rw-r--r--lib/std/crypto/utils.zig2
-rw-r--r--lib/std/debug.zig2
-rw-r--r--lib/std/dwarf/expressions.zig2
-rw-r--r--lib/std/fifo.zig2
-rw-r--r--lib/std/fmt.zig24
-rw-r--r--lib/std/fmt/parse_float.zig18
-rw-r--r--lib/std/fs.zig117
-rw-r--r--lib/std/fs/path.zig28
-rw-r--r--lib/std/fs/test.zig118
-rw-r--r--lib/std/hash/auto_hash.zig21
-rw-r--r--lib/std/hash/wyhash.zig2
-rw-r--r--lib/std/hash/xxhash.zig18
-rw-r--r--lib/std/hash_map.zig2
-rw-r--r--lib/std/heap/general_purpose_allocator.zig4
-rw-r--r--lib/std/http/Client.zig8
-rw-r--r--lib/std/http/Server.zig2
-rw-r--r--lib/std/io/bit_reader.zig2
-rw-r--r--lib/std/io/multi_writer.zig1
-rw-r--r--lib/std/io/test.zig10
-rw-r--r--lib/std/json.zig9
-rw-r--r--lib/std/json/JSONTestSuite_test.zig72
-rw-r--r--lib/std/json/dynamic_test.zig25
-rw-r--r--lib/std/json/hashmap_test.zig13
-rw-r--r--lib/std/json/static_test.zig49
-rw-r--r--lib/std/json/stringify_test.zig41
-rw-r--r--lib/std/json/test.zig5
-rw-r--r--lib/std/leb128.zig4
-rw-r--r--lib/std/math.zig26
-rw-r--r--lib/std/math/big/int_test.zig173
-rw-r--r--lib/std/math/big/rational.zig35
-rw-r--r--lib/std/math/ilogb.zig9
-rw-r--r--lib/std/math/ldexp.zig1
-rw-r--r--lib/std/math/log10.zig2
-rw-r--r--lib/std/math/log_int.zig2
-rw-r--r--lib/std/math/nextafter.zig2
-rw-r--r--lib/std/math/scalbn.zig2
-rw-r--r--lib/std/mem.zig24
-rw-r--r--lib/std/multi_array_list.zig16
-rw-r--r--lib/std/net/test.zig6
-rw-r--r--lib/std/once.zig2
-rw-r--r--lib/std/os/linux/io_uring.zig30
-rw-r--r--lib/std/os/linux/test.zig6
-rw-r--r--lib/std/os/test.zig51
-rw-r--r--lib/std/os/windows.zig2
-rw-r--r--lib/std/priority_dequeue.zig2
-rw-r--r--lib/std/priority_queue.zig2
-rw-r--r--lib/std/rand/Xoshiro256.zig5
-rw-r--r--lib/std/rand/test.zig11
-rw-r--r--lib/std/segmented_list.zig2
-rw-r--r--lib/std/simd.zig9
-rw-r--r--lib/std/sort.zig11
-rw-r--r--lib/std/time.zig4
-rw-r--r--lib/std/treap.zig2
-rw-r--r--lib/std/unicode.zig60
-rw-r--r--lib/std/zig/CrossTarget.zig2
-rw-r--r--lib/std/zig/Parse.zig2
-rw-r--r--lib/std/zig/fmt.zig3
-rw-r--r--lib/std/zig/system/darwin.zig4
-rw-r--r--lib/std/zig/tokenizer.zig11
141 files changed, 1729 insertions, 114 deletions
diff --git a/lib/compiler_rt/addf3_test.zig b/lib/compiler_rt/addf3_test.zig
index 1d046fbf7b..2644bec558 100644
--- a/lib/compiler_rt/addf3_test.zig
+++ b/lib/compiler_rt/addf3_test.zig
@@ -4,6 +4,7 @@
// https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/test/builtins/Unit/subtf3_test.c
const std = @import("std");
+const builtin = @import("builtin");
const math = std.math;
const qnan128: f128 = @bitCast(@as(u128, 0x7fff800000000000) << 64);
@@ -34,6 +35,8 @@ fn test__addtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {
}
test "addtf3" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__addtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
// NaN + any = NaN
@@ -73,6 +76,9 @@ fn test__subtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {
}
test "subtf3" {
+ if (builtin.zig_backend == .stage2_x86_64 and
+ !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
+
// qNaN - any = qNaN
try test__subtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
@@ -103,6 +109,8 @@ fn test__addxf3(a: f80, b: f80, expected: u80) !void {
}
test "addxf3" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// NaN + any = NaN
try test__addxf3(qnan80, 0x1.23456789abcdefp+5, @as(u80, @bitCast(qnan80)));
try test__addxf3(@as(f80, @bitCast(@as(u80, 0x7fff_8000_8000_3000_0000))), 0x1.23456789abcdefp+5, @as(u80, @bitCast(qnan80)));
diff --git a/lib/compiler_rt/addoti4_test.zig b/lib/compiler_rt/addoti4_test.zig
index dd0f4e3d3c..ee9c58518b 100644
--- a/lib/compiler_rt/addoti4_test.zig
+++ b/lib/compiler_rt/addoti4_test.zig
@@ -23,6 +23,8 @@ fn simple_addoti4(a: i128, b: i128, overflow: *c_int) i128 {
}
test "addoti4" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const min: i128 = math.minInt(i128);
const max: i128 = math.maxInt(i128);
var i: i128 = 1;
diff --git a/lib/compiler_rt/comparef.zig b/lib/compiler_rt/comparef.zig
index 25b5401911..bfb3c2248c 100644
--- a/lib/compiler_rt/comparef.zig
+++ b/lib/compiler_rt/comparef.zig
@@ -98,6 +98,8 @@ pub inline fn cmp_f80(comptime RT: type, a: f80, b: f80) RT {
}
test "cmp_f80" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
inline for (.{ LE, GE }) |RT| {
try std.testing.expect(cmp_f80(RT, 1.0, 1.0) == RT.Equal);
try std.testing.expect(cmp_f80(RT, 0.0, -0.0) == RT.Equal);
diff --git a/lib/compiler_rt/cos.zig b/lib/compiler_rt/cos.zig
index d299e682d7..b3dbcc21f5 100644
--- a/lib/compiler_rt/cos.zig
+++ b/lib/compiler_rt/cos.zig
@@ -1,6 +1,4 @@
const std = @import("std");
-const builtin = @import("builtin");
-const arch = builtin.cpu.arch;
const math = std.math;
const expect = std.testing.expect;
const common = @import("common.zig");
@@ -136,6 +134,8 @@ pub fn cosl(x: c_longdouble) callconv(.C) c_longdouble {
}
test "cos32" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const epsilon = 0.00001;
try expect(math.approxEqAbs(f32, cosf(0.0), 1.0, epsilon));
diff --git a/lib/compiler_rt/divtf3_test.zig b/lib/compiler_rt/divtf3_test.zig
index 7639c7219d..921ac93650 100644
--- a/lib/compiler_rt/divtf3_test.zig
+++ b/lib/compiler_rt/divtf3_test.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const math = std.math;
const testing = std.testing;
@@ -30,6 +31,9 @@ fn test__divtf3(a: f128, b: f128, expectedHi: u64, expectedLo: u64) !void {
}
test "divtf3" {
+ if (builtin.zig_backend == .stage2_x86_64 and
+ !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
+
// NaN / any = NaN
try test__divtf3(math.nan(f128), 0x1.23456789abcdefp+5, 0x7fff800000000000, 0);
// inf / any(except inf and nan) = inf
diff --git a/lib/compiler_rt/divxf3_test.zig b/lib/compiler_rt/divxf3_test.zig
index 0aec97b54d..81a68a389d 100644
--- a/lib/compiler_rt/divxf3_test.zig
+++ b/lib/compiler_rt/divxf3_test.zig
@@ -39,6 +39,8 @@ fn test__divxf3(a: f80, b: f80) !void {
}
test "divxf3" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// NaN / any = NaN
try expect__divxf3_result(math.nan(f80), 0x1.23456789abcdefp+5, 0x7fffC000000000000000);
// inf / any(except inf and nan) = inf
diff --git a/lib/compiler_rt/float_from_int_test.zig b/lib/compiler_rt/float_from_int_test.zig
index a06ba3a04e..413d73f1e0 100644
--- a/lib/compiler_rt/float_from_int_test.zig
+++ b/lib/compiler_rt/float_from_int_test.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const testing = std.testing;
const math = std.math;
@@ -125,6 +126,9 @@ fn test__floatuntisf(a: u128, expected: f32) !void {
}
test "floattisf" {
+ if (builtin.zig_backend == .stage2_x86_64 and
+ !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
+
try test__floattisf(0, 0.0);
try test__floattisf(1, 1.0);
@@ -171,6 +175,9 @@ test "floattisf" {
}
test "floatuntisf" {
+ if (builtin.zig_backend == .stage2_x86_64 and
+ !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
+
try test__floatuntisf(0, 0.0);
try test__floatuntisf(1, 1.0);
@@ -367,6 +374,9 @@ fn test__floatuntidf(a: u128, expected: f64) !void {
}
test "floattidf" {
+ if (builtin.zig_backend == .stage2_x86_64 and
+ !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
+
try test__floattidf(0, 0.0);
try test__floattidf(1, 1.0);
@@ -437,6 +447,9 @@ test "floattidf" {
}
test "floatuntidf" {
+ if (builtin.zig_backend == .stage2_x86_64 and
+ !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
+
try test__floatuntidf(0, 0.0);
try test__floatuntidf(1, 1.0);
@@ -582,6 +595,9 @@ test "floatditf" {
}
test "floatunditf" {
+ if (builtin.zig_backend == .stage2_x86_64 and
+ !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
+
try test__floatunditf(0xffffffffffffffff, 0x403effffffffffff, 0xfffe000000000000);
try test__floatunditf(0xfffffffffffffffe, 0x403effffffffffff, 0xfffc000000000000);
try test__floatunditf(0x8000000000000000, 0x403e000000000000, 0x0);
@@ -603,6 +619,9 @@ fn test__floatuntitf(a: u128, expected: f128) !void {
}
test "floattitf" {
+ if (builtin.zig_backend == .stage2_x86_64 and
+ !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
+
try test__floattitf(0, 0.0);
try test__floattitf(1, 1.0);
@@ -685,6 +704,9 @@ test "floattitf" {
}
test "floatuntitf" {
+ if (builtin.zig_backend == .stage2_x86_64 and
+ !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
+
try test__floatuntitf(0, 0.0);
try test__floatuntitf(1, 1.0);
diff --git a/lib/compiler_rt/fma.zig b/lib/compiler_rt/fma.zig
index 5cda7e0a4d..9580f94fcb 100644
--- a/lib/compiler_rt/fma.zig
+++ b/lib/compiler_rt/fma.zig
@@ -343,6 +343,9 @@ test "64" {
}
test "128" {
+ if (builtin.zig_backend == .stage2_x86_64 and
+ !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
+
const epsilon = 0.000001;
try expect(math.approxEqAbs(f128, fmaq(0.0, 5.0, 9.124), 9.124, epsilon));
diff --git a/lib/compiler_rt/fmodx_test.zig b/lib/compiler_rt/fmodx_test.zig
index 4bb1b5654a..d7020a50f2 100644
--- a/lib/compiler_rt/fmodx_test.zig
+++ b/lib/compiler_rt/fmodx_test.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const fmod = @import("fmod.zig");
const testing = std.testing;
@@ -22,6 +23,9 @@ fn test_fmodx_infs() !void {
}
test "fmodx" {
+ if (builtin.zig_backend == .stage2_x86_64 and
+ !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
+
try test_fmodx(6.4, 4.0, 2.4);
try test_fmodx(6.4, -4.0, 2.4);
try test_fmodx(-6.4, 4.0, -2.4);
diff --git a/lib/compiler_rt/int.zig b/lib/compiler_rt/int.zig
index c100b815a5..39ea914daf 100644
--- a/lib/compiler_rt/int.zig
+++ b/lib/compiler_rt/int.zig
@@ -42,6 +42,8 @@ pub fn __divmodti4(a: i128, b: i128, rem: *i128) callconv(.C) i128 {
}
test "test_divmodti4" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const cases = [_][4]i128{
[_]i128{ 0, 1, 0, 0 },
[_]i128{ 0, -1, 0, 0 },
diff --git a/lib/compiler_rt/int_from_float_test.zig b/lib/compiler_rt/int_from_float_test.zig
index 676c12e914..7ea5cfae83 100644
--- a/lib/compiler_rt/int_from_float_test.zig
+++ b/lib/compiler_rt/int_from_float_test.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const testing = std.testing;
const math = std.math;
@@ -40,6 +41,8 @@ fn test__fixunssfsi(a: f32, expected: u32) !void {
}
test "fixsfsi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixsfsi(-math.floatMax(f32), math.minInt(i32));
try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
@@ -103,6 +106,8 @@ test "fixsfsi" {
}
test "fixunssfsi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixunssfsi(0.0, 0);
try test__fixunssfsi(0.5, 0);
@@ -142,6 +147,8 @@ fn test__fixunssfdi(a: f32, expected: u64) !void {
}
test "fixsfdi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixsfdi(-math.floatMax(f32), math.minInt(i64));
try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
@@ -197,6 +204,8 @@ test "fixsfdi" {
}
test "fixunssfdi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixunssfdi(0.0, 0);
try test__fixunssfdi(0.5, 0);
@@ -235,6 +244,8 @@ fn test__fixunssfti(a: f32, expected: u128) !void {
}
test "fixsfti" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixsfti(-math.floatMax(f32), math.minInt(i128));
try test__fixsfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
@@ -306,6 +317,8 @@ test "fixsfti" {
}
test "fixunssfti" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixunssfti(0.0, 0);
try test__fixunssfti(0.5, 0);
@@ -352,6 +365,8 @@ fn test__fixunsdfsi(a: f64, expected: u32) !void {
}
test "fixdfsi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixdfsi(-math.floatMax(f64), math.minInt(i32));
try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
@@ -413,6 +428,8 @@ test "fixdfsi" {
}
test "fixunsdfsi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixunsdfsi(0.0, 0);
try test__fixunsdfsi(0.5, 0);
@@ -455,6 +472,8 @@ fn test__fixunsdfdi(a: f64, expected: u64) !void {
}
test "fixdfdi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixdfdi(-math.floatMax(f64), math.minInt(i64));
try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
@@ -508,6 +527,8 @@ test "fixdfdi" {
}
test "fixunsdfdi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixunsdfdi(0.0, 0);
try test__fixunsdfdi(0.5, 0);
try test__fixunsdfdi(0.99, 0);
@@ -550,6 +571,8 @@ fn test__fixunsdfti(a: f64, expected: u128) !void {
}
test "fixdfti" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixdfti(-math.floatMax(f64), math.minInt(i128));
try test__fixdfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
@@ -603,6 +626,8 @@ test "fixdfti" {
}
test "fixunsdfti" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixunsdfti(0.0, 0);
try test__fixunsdfti(0.5, 0);
@@ -652,6 +677,8 @@ fn test__fixunstfsi(a: f128, expected: u32) !void {
}
test "fixtfsi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixtfsi(-math.floatMax(f128), math.minInt(i32));
try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
@@ -715,6 +742,8 @@ test "fixtfsi" {
}
test "fixunstfsi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixunstfsi(math.inf(f128), 0xffffffff);
try test__fixunstfsi(0, 0x0);
try test__fixunstfsi(0x1.23456789abcdefp+5, 0x24);
@@ -738,6 +767,8 @@ fn test__fixunstfdi(a: f128, expected: u64) !void {
}
test "fixtfdi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixtfdi(-math.floatMax(f128), math.minInt(i64));
try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64));
@@ -801,6 +832,8 @@ test "fixtfdi" {
}
test "fixunstfdi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixunstfdi(0.0, 0);
try test__fixunstfdi(0.5, 0);
@@ -853,6 +886,8 @@ fn test__fixunstfti(a: f128, expected: u128) !void {
}
test "fixtfti" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixtfti(-math.floatMax(f128), math.minInt(i128));
try test__fixtfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128));
@@ -934,6 +969,8 @@ fn test__fixunshfti(a: f16, expected: u128) !void {
}
test "fixunshfti for f16" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try test__fixunshfti(math.inf(f16), math.maxInt(u128));
try test__fixunshfti(math.floatMax(f16), 65504);
}
diff --git a/lib/compiler_rt/mulf3_test.zig b/lib/compiler_rt/mulf3_test.zig
index e770ecaefc..224e79e231 100644
--- a/lib/compiler_rt/mulf3_test.zig
+++ b/lib/compiler_rt/mulf3_test.zig
@@ -3,6 +3,7 @@
// https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/test/builtins/Unit/multf3_test.c
const std = @import("std");
+const builtin = @import("builtin");
const math = std.math;
const qnan128: f128 = @bitCast(@as(u128, 0x7fff800000000000) << 64);
const inf128: f128 = @bitCast(@as(u128, 0x7fff000000000000) << 64);
@@ -48,6 +49,9 @@ fn makeNaN128(rand: u64) f128 {
return @bitCast(int_result);
}
test "multf3" {
+ if (builtin.zig_backend == .stage2_x86_64 and
+ !comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .bmi, .lzcnt })) return error.SkipZigTest;
+
// qNaN * any = qNaN
try test__multf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
diff --git a/lib/compiler_rt/negti2_test.zig b/lib/compiler_rt/negti2_test.zig
index 014043b992..a4f9a9a11f 100644
--- a/lib/compiler_rt/negti2_test.zig
+++ b/lib/compiler_rt/negti2_test.zig
@@ -6,7 +6,9 @@ fn test__negti2(a: i128, expected: i128) !void {
try testing.expectEqual(expected, result);
}
-test "negdi2" {
+test "negti2" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// TODO ensuring that math.minInt(i128); returns error
try test__negti2(-3, 3);
diff --git a/lib/compiler_rt/powiXf2_test.zig b/lib/compiler_rt/powiXf2_test.zig
index 7014d2a227..50c8023e66 100644
--- a/lib/compiler_rt/powiXf2_test.zig
+++ b/lib/compiler_rt/powiXf2_test.zig
@@ -3,8 +3,10 @@
// powihf2 adapted from powisf2 tests
const powiXf2 = @import("powiXf2.zig");
-const testing = @import("std").testing;
-const math = @import("std").math;
+const std = @import("std");
+const builtin = @import("builtin");
+const testing = std.testing;
+const math = std.math;
fn test__powihf2(a: f16, b: i32, expected: f16) !void {
var result = powiXf2.__powihf2(a, b);
@@ -32,6 +34,9 @@ fn test__powixf2(a: f80, b: i32, expected: f80) !void {
}
test "powihf2" {
+ if (builtin.zig_backend == .stage2_x86_64 and
+ !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .f16c)) return error.SkipZigTest;
+
const inf_f16 = math.inf(f16);
try test__powisf2(0, 0, 1);
try test__powihf2(1, 0, 1);
@@ -351,6 +356,8 @@ test "powidf2" {
}
test "powitf2" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const inf_f128 = math.inf(f128);
try test__powitf2(0, 0, 1);
try test__powitf2(1, 0, 1);
@@ -456,6 +463,8 @@ test "powitf2" {
}
test "powixf2" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const inf_f80 = math.inf(f80);
try test__powixf2(0, 0, 1);
try test__powixf2(1, 0, 1);
diff --git a/lib/compiler_rt/sin.zig b/lib/compiler_rt/sin.zig
index b0180953e0..6da5231792 100644
--- a/lib/compiler_rt/sin.zig
+++ b/lib/compiler_rt/sin.zig
@@ -140,6 +140,8 @@ pub fn sinl(x: c_longdouble) callconv(.C) c_longdouble {
}
test "sin32" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const epsilon = 0.00001;
try expect(math.approxEqAbs(f32, sinf(0.0), 0.0, epsilon));
diff --git a/lib/compiler_rt/suboti4_test.zig b/lib/compiler_rt/suboti4_test.zig
index f42fe3edce..9b80a6cbb6 100644
--- a/lib/compiler_rt/suboti4_test.zig
+++ b/lib/compiler_rt/suboti4_test.zig
@@ -27,6 +27,8 @@ pub fn simple_suboti4(a: i128, b: i128, overflow: *c_int) i128 {
}
test "suboti3" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const min: i128 = math.minInt(i128);
const max: i128 = math.maxInt(i128);
var i: i128 = 1;
diff --git a/lib/compiler_rt/tan.zig b/lib/compiler_rt/tan.zig
index 367883754f..3b4e732841 100644
--- a/lib/compiler_rt/tan.zig
+++ b/lib/compiler_rt/tan.zig
@@ -131,6 +131,8 @@ test "tan" {
}
test "tan32" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const epsilon = 0.00001;
try expect(math.approxEqAbs(f32, tanf(0.0), 0.0, epsilon));
@@ -142,6 +144,8 @@ test "tan32" {
}
test "tan64" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const epsilon = 0.000001;
try expect(math.approxEqAbs(f64, tan(0.0), 0.0, epsilon));
diff --git a/lib/compiler_rt/udivmodei4.zig b/lib/compiler_rt/udivmodei4.zig
index f222c13a4c..26b9a501fa 100644
--- a/lib/compiler_rt/udivmodei4.zig
+++ b/lib/compiler_rt/udivmodei4.zig
@@ -129,7 +129,10 @@ pub fn __umodei4(r_p: [*]u32, u_p: [*]const u32, v_p: [*]const u32, bits: usize)
}
test "__udivei4/__umodei4" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
const RndGen = std.rand.DefaultPrng;
var rnd = RndGen.init(42);
diff --git a/lib/docs/main.js b/lib/docs/main.js
index 8932674f8d..e0f9b93ed9 100644
--- a/lib/docs/main.js
+++ b/lib/docs/main.js
@@ -3539,6 +3539,13 @@ Happy writing!
}
domSectTests.classList.remove("hidden");
}
+
+ if (container.kind !== typeKinds.Struct || containerNode.fields.length > 0) {
+ domHdrName.innerHTML = "<pre class='inline'>" +
+ zigAnalysis.typeKinds[container.kind] +
+ "</pre>";
+ domHdrName.classList.remove("hidden");
+ }
}
function operatorCompare(a, b) {
diff --git a/lib/std/Build.zig b/lib/std/Build.zig
index c67f8ac0e5..5316f405ae 100644
--- a/lib/std/Build.zig
+++ b/lib/std/Build.zig
@@ -172,7 +172,7 @@ const InitializedDepContext = struct {
}
};
-pub const ExecError = error{
+pub const RunError = error{
ReadFailure,
ExitCodeFailure,
ProcessTerminated,
@@ -1627,12 +1627,12 @@ pub fn findProgram(self: *Build, names: []const []const u8, paths: []const []con
return error.FileNotFound;
}
-pub fn execAllowFail(
+pub fn runAllowFail(
self: *Build,
argv: []const []const u8,
out_code: *u8,
stderr_behavior: std.ChildProcess.StdIo,
-) ExecError![]u8 {
+) RunError![]u8 {
assert(argv.len != 0);
if (!process.can_spawn)
@@ -1671,7 +1671,7 @@ pub fn execAllowFail(
/// This is a helper function to be called from build.zig scripts, *not* from
/// inside step make() functions. If any errors occur, it fails the build with
/// a helpful message.
-pub fn exec(b: *Build, argv: []const []const u8) []u8 {
+pub fn run(b: *Build, argv: []const []const u8) []u8 {
if (!process.can_spawn) {
std.debug.print("unable to spawn the following command: cannot spawn child process\n{s}\n", .{
try allocPrintCmd(b.allocator, null, argv),
@@ -1680,7 +1680,7 @@ pub fn exec(b: *Build, argv: []const []const u8) []u8 {
}
var code: u8 = undefined;
- return b.execAllowFail(argv, &code, .Inherit) catch |err| {
+ return b.runAllowFail(argv, &code, .Inherit) catch |err| {
const printed_cmd = allocPrintCmd(b.allocator, null, argv) catch @panic("OOM");
std.debug.print("unable to spawn the following command: {s}\n{s}\n", .{
@errorName(err), printed_cmd,
diff --git a/lib/std/Build/Cache.zig b/lib/std/Build/Cache.zig
index b1ceaa1b09..5dcdeca079 100644
--- a/lib/std/Build/Cache.zig
+++ b/lib/std/Build/Cache.zig
@@ -1007,6 +1007,8 @@ test "cache file and then recall it" {
return error.SkipZigTest;
}
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = testing.tmpDir(.{});
defer tmp.cleanup();
@@ -1072,6 +1074,9 @@ test "check that changing a file makes cache fail" {
// https://github.com/ziglang/zig/issues/5437
return error.SkipZigTest;
}
+
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = testing.tmpDir(.{});
defer tmp.cleanup();
@@ -1146,6 +1151,8 @@ test "no file inputs" {
return error.SkipZigTest;
}
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = testing.tmpDir(.{});
defer tmp.cleanup();
@@ -1193,6 +1200,9 @@ test "Manifest with files added after initial hash work" {
// https://github.com/ziglang/zig/issues/5437
return error.SkipZigTest;
}
+
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = testing.tmpDir(.{});
defer tmp.cleanup();
diff --git a/lib/std/Build/Step.zig b/lib/std/Build/Step.zig
index 865573ad9c..0f28dac378 100644
--- a/lib/std/Build/Step.zig
+++ b/lib/std/Build/Step.zig
@@ -273,7 +273,7 @@ pub fn evalChildProcess(s: *Step, argv: []const []const u8) !void {
try handleChildProcUnsupported(s, null, argv);
try handleVerbose(s.owner, null, argv);
- const result = std.ChildProcess.exec(.{
+ const result = std.ChildProcess.run(.{
.allocator = arena,
.argv = argv,
}) catch |err| return s.fail("unable to spawn {s}: {s}", .{ argv[0], @errorName(err) });
diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig
index 2dfa21fc10..fa5d66780e 100644
--- a/lib/std/Build/Step/Compile.zig
+++ b/lib/std/Build/Step/Compile.zig
@@ -14,7 +14,7 @@ const NativeTargetInfo = std.zig.system.NativeTargetInfo;
const LazyPath = std.Build.LazyPath;
const PkgConfigPkg = std.Build.PkgConfigPkg;
const PkgConfigError = std.Build.PkgConfigError;
-const ExecError = std.Build.ExecError;
+const RunError = std.Build.RunError;
const Module = std.Build.Module;
const VcpkgRoot = std.Build.VcpkgRoot;
const InstallDir = std.Build.InstallDir;
@@ -854,7 +854,7 @@ fn runPkgConfig(self: *Compile, lib_name: []const u8) ![]const []const u8 {
};
var code: u8 = undefined;
- const stdout = if (b.execAllowFail(&[_][]const u8{
+ const stdout = if (b.runAllowFail(&[_][]const u8{
"pkg-config",
pkg_name,
"--cflags",
@@ -2263,8 +2263,8 @@ pub fn doAtomicSymLinks(
};
}
-fn execPkgConfigList(self: *std.Build, out_code: *u8) (PkgConfigError || ExecError)![]const PkgConfigPkg {
- const stdout = try self.execAllowFail(&[_][]const u8{ "pkg-config", "--list-all" }, out_code, .Ignore);
+fn execPkgConfigList(self: *std.Build, out_code: *u8) (PkgConfigError || RunError)![]const PkgConfigPkg {
+ const stdout = try self.runAllowFail(&[_][]const u8{ "pkg-config", "--list-all" }, out_code, .Ignore);
var list = ArrayList(PkgConfigPkg).init(self.allocator);
errdefer list.deinit();
var line_it = mem.tokenizeAny(u8, stdout, "\r\n");
diff --git a/lib/std/Build/Step/Options.zig b/lib/std/Build/Step/Options.zig
index 5c3ea6d30b..d3a7ab3c72 100644
--- a/lib/std/Build/Step/Options.zig
+++ b/lib/std/Build/Step/Options.zig
@@ -296,6 +296,8 @@ const Arg = struct {
test Options {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena.deinit();
diff --git a/lib/std/Build/Step/Run.zig b/lib/std/Build/Step/Run.zig
index 845abe83bb..3d26d25070 100644
--- a/lib/std/Build/Step/Run.zig
+++ b/lib/std/Build/Step/Run.zig
@@ -7,8 +7,6 @@ const mem = std.mem;
const process = std.process;
const ArrayList = std.ArrayList;
const EnvMap = process.EnvMap;
-const Allocator = mem.Allocator;
-const ExecError = std.Build.ExecError;
const assert = std.debug.assert;
const Run = @This();
diff --git a/lib/std/RingBuffer.zig b/lib/std/RingBuffer.zig
index b83a9b0177..e98081f7c0 100644
--- a/lib/std/RingBuffer.zig
+++ b/lib/std/RingBuffer.zig
@@ -11,6 +11,7 @@
const Allocator = @import("std").mem.Allocator;
const assert = @import("std").debug.assert;
+const copyForwards = @import("std").mem.copyForwards;
const RingBuffer = @This();
@@ -18,7 +19,7 @@ data: []u8,
read_index: usize,
write_index: usize,
-pub const Error = error{Full};
+pub const Error = error{ Full, ReadLengthInvalid };
/// Allocate a new `RingBuffer`; `deinit()` should be called to free the buffer.
pub fn init(allocator: Allocator, capacity: usize) Allocator.Error!RingBuffer {
@@ -63,6 +64,7 @@ pub fn writeAssumeCapacity(self: *RingBuffer, byte: u8) void {
/// Write `bytes` into the ring buffer. Returns `error.Full` if the ring
/// buffer does not have enough space, without writing any data.
+/// Uses memcpy and so `bytes` must not overlap ring buffer data.
pub fn writeSlice(self: *RingBuffer, bytes: []const u8) Error!void {
if (self.len() + bytes.len > self.data.len) return error.Full;
self.writeSliceAssumeCapacity(bytes);
@@ -70,8 +72,51 @@ pub fn writeSlice(self: *RingBuffer, bytes: []const u8) Error!void {
/// Write `bytes` into the ring buffer. If there is not enough space, older
/// bytes will be overwritten.
+/// Uses memcpy and so `bytes` must not overlap ring buffer data.
pub fn writeSliceAssumeCapacity(self: *RingBuffer, bytes: []const u8) void {
- for (bytes) |b| self.writeAssumeCapacity(b);
+ const data_start = self.mask(self.write_index);
+ const part1_data_end = @min(data_start + bytes.len, self.data.len);
+ const part1_len = part1_data_end - data_start;
+ @memcpy(self.data[data_start..part1_data_end], bytes[0..part1_len]);
+
+ const remaining = bytes.len - part1_len;
+ const to_write = @min(remaining, remaining % self.data.len + self.data.len);
+ const part2_bytes_start = bytes.len - to_write;
+ const part2_bytes_end = @min(part2_bytes_start + self.data.len, bytes.len);
+ const part2_len = part2_bytes_end - part2_bytes_start;
+ @memcpy(self.data[0..part2_len], bytes[part2_bytes_start..part2_bytes_end]);
+ if (part2_bytes_end != bytes.len) {
+ const part3_len = bytes.len - part2_bytes_end;
+ @memcpy(self.data[0..part3_len], bytes[part2_bytes_end..bytes.len]);
+ }
+ self.write_index = self.mask2(self.write_index + bytes.len);
+}
+
+/// Write `bytes` into the ring buffer. Returns `error.Full` if the ring
+/// buffer does not have enough space, without writing any data.
+/// Uses copyForwards and can write slices from this RingBuffer into itself.
+pub fn writeSliceForwards(self: *RingBuffer, bytes: []const u8) Error!void {
+ if (self.len() + bytes.len > self.data.len) return error.Full;
+ self.writeSliceForwardsAssumeCapacity(bytes);
+}
+
+/// Write `bytes` into the ring buffer. If there is not enough space, older
+/// bytes will be overwritten.
+/// Uses copyForwards and can write slices from this RingBuffer into itself.
+pub fn writeSliceForwardsAssumeCapacity(self: *RingBuffer, bytes: []const u8) void {
+ const data_start = self.mask(self.write_index);
+ const part1_data_end = @min(data_start + bytes.len, self.data.len);
+ const part1_len = part1_data_end - data_start;
+ copyForwards(u8, self.data[data_start..], bytes[0..part1_len]);
+
+ const remaining = bytes.len - part1_len;
+ const to_write = @min(remaining, remaining % self.data.len + self.data.len);
+ const part2_bytes_start = bytes.len - to_write;
+ const part2_bytes_end = @min(part2_bytes_start + self.data.len, bytes.len);
+ copyForwards(u8, self.data[0..], bytes[part2_bytes_start..part2_bytes_end]);
+ if (part2_bytes_end != bytes.len)
+ copyForwards(u8, self.data[0..], bytes[part2_bytes_end..bytes.len]);
+ self.write_index = self.mask2(self.write_index + bytes.len);
}
/// Consume a byte from the ring buffer and return it. Returns `null` if the
@@ -90,6 +135,50 @@ pub fn readAssumeLength(self: *RingBuffer) u8 {
return byte;
}
+/// Reads first `length` bytes written to the ring buffer into `dest`; Returns
+/// Error.ReadLengthInvalid if length greater than ring or dest length
+/// Uses memcpy and so `dest` must not overlap ring buffer data.
+pub fn readFirst(self: *RingBuffer, dest: []u8, length: usize) Error!void {
+ if (length > self.len() or length > dest.len) return error.ReadLengthInvalid;
+ self.readFirstAssumeLength(dest, length);
+}
+
+/// Reads first `length` bytes written to the ring buffer into `dest`;
+/// Asserts that length not greater than ring buffer or dest length
+/// Uses memcpy and so `dest` must not overlap ring buffer data.
+pub fn readFirstAssumeLength(self: *RingBuffer, dest: []u8, length: usize) void {
+ assert(length <= self.len() and length <= dest.len);
+ const data_start = self.mask(self.read_index);
+ const part1_data_end = @min(self.data.len, data_start + length);
+ const part1_len = part1_data_end - data_start;
+ const part2_len = length - part1_len;
+ @memcpy(dest[0..part1_len], self.data[data_start..part1_data_end]);
+ @memcpy(dest[part1_len..length], self.data[0..part2_len]);
+ self.read_index = self.mask2(self.read_index + length);
+}
+
+/// Reads last `length` bytes written to the ring buffer into `dest`; Returns
+/// Error.ReadLengthInvalid if length greater than ring or dest length
+/// Uses memcpy and so `dest` must not overlap ring buffer data.
+pub fn readLast(self: *RingBuffer, dest: []u8, length: usize) Error!void {
+ if (length > self.len() or length > dest.len) return error.ReadLengthInvalid;
+ self.readLastAssumeLength(dest, length);
+}
+
+/// Reads last `length` bytes written to the ring buffer into `dest`;
+/// Asserts that length not greater than ring buffer or dest length
+/// Uses memcpy and so `dest` must not overlap ring buffer data.
+pub fn readLastAssumeLength(self: *RingBuffer, dest: []u8, length: usize) void {
+ assert(length <= self.len() and length <= dest.len);
+ const data_start = self.mask(self.write_index + self.data.len - length);
+ const part1_data_end = @min(self.data.len, data_start + length);
+ const part1_len = part1_data_end - data_start;
+ const part2_len = length - part1_len;
+ @memcpy(dest[0..part1_len], self.data[data_start..part1_data_end]);
+ @memcpy(dest[part1_len..length], self.data[0..part2_len]);
+ self.write_index = if (self.write_index >= self.data_len) self.write_index - length else data_start;
+}
+
/// Returns `true` if the ring buffer is empty and `false` otherwise.
pub fn isEmpty(self: RingBuffer) bool {
return self.write_index == self.read_index;
diff --git a/lib/std/Thread/Condition.zig b/lib/std/Thread/Condition.zig
index 898fc14520..549ea623dd 100644
--- a/lib/std/Thread/Condition.zig
+++ b/lib/std/Thread/Condition.zig
@@ -369,6 +369,8 @@ test "Condition - signal" {
return error.SkipZigTest;
}
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const num_threads = 4;
const SignalTest = struct {
@@ -498,6 +500,8 @@ test "Condition - broadcasting" {
return error.SkipZigTest;
}
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const num_threads = 10;
const BroadcastTest = struct {
@@ -565,6 +569,8 @@ test "Condition - broadcasting - wake all threads" {
return error.SkipZigTest;
}
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var num_runs: usize = 1;
const num_threads = 10;
diff --git a/lib/std/Thread/Mutex.zig b/lib/std/Thread/Mutex.zig
index 0f618516b5..c6416113b5 100644
--- a/lib/std/Thread/Mutex.zig
+++ b/lib/std/Thread/Mutex.zig
@@ -289,6 +289,8 @@ test "Mutex - many contended" {
return error.SkipZigTest;
}
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const num_threads = 4;
const num_increments = 1000;
diff --git a/lib/std/Thread/RwLock.zig b/lib/std/Thread/RwLock.zig
index e77db10abb..2cd101f913 100644
--- a/lib/std/Thread/RwLock.zig
+++ b/lib/std/Thread/RwLock.zig
@@ -297,6 +297,8 @@ test "RwLock - concurrent access" {
if (builtin.single_threaded)
return;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const num_writers: usize = 2;
const num_readers: usize = 4;
const num_writes: usize = 10000;
diff --git a/lib/std/Uri.zig b/lib/std/Uri.zig
index 0a98c5b641..3f277d0cc6 100644
--- a/lib/std/Uri.zig
+++ b/lib/std/Uri.zig
@@ -731,6 +731,8 @@ test "Special test" {
}
test "URI escaping" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const input = "\\ö/ äöß ~~.adas-https://canvas:123/#ads&&sad";
const expected = "%5C%C3%B6%2F%20%C3%A4%C3%B6%C3%9F%20~~.adas-https%3A%2F%2Fcanvas%3A123%2F%23ads%26%26sad";
diff --git a/lib/std/array_hash_map.zig b/lib/std/array_hash_map.zig
index 75a86f63f6..5090bc0d81 100644
--- a/lib/std/array_hash_map.zig
+++ b/lib/std/array_hash_map.zig
@@ -1,4 +1,5 @@
const std = @import("std.zig");
+const builtin = @import("builtin");
const debug = std.debug;
const assert = debug.assert;
const testing = std.testing;
@@ -2137,6 +2138,8 @@ test "ensure capacity leak" {
}
test "big map" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
defer map.deinit();
@@ -2190,6 +2193,8 @@ test "big map" {
}
test "clone" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var original = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
defer original.deinit();
@@ -2216,6 +2221,8 @@ test "clone" {
}
test "shrink" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
defer map.deinit();
@@ -2256,6 +2263,8 @@ test "shrink" {
}
test "pop" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
defer map.deinit();
@@ -2274,6 +2283,8 @@ test "pop" {
}
test "popOrNull" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
defer map.deinit();
@@ -2294,6 +2305,8 @@ test "popOrNull" {
}
test "reIndex" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var map = ArrayHashMap(i32, i32, AutoContext(i32), true).init(std.testing.allocator);
defer map.deinit();
@@ -2338,6 +2351,8 @@ test "auto store_hash" {
}
test "sort" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var map = AutoArrayHashMap(i32, i32).init(std.testing.allocator);
defer map.deinit();
diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig
index e50eb92041..03e32278cf 100644
--- a/lib/std/array_list.zig
+++ b/lib/std/array_list.zig
@@ -1,4 +1,5 @@
const std = @import("std.zig");
+const builtin = @import("builtin");
const debug = std.debug;
const assert = debug.assert;
const testing = std.testing;
@@ -1183,6 +1184,8 @@ test "std.ArrayList/ArrayListUnmanaged.initCapacity" {
}
test "std.ArrayList/ArrayListUnmanaged.clone" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const a = testing.allocator;
{
var array = ArrayList(i32).init(a);
@@ -1224,6 +1227,8 @@ test "std.ArrayList/ArrayListUnmanaged.clone" {
}
test "std.ArrayList/ArrayListUnmanaged.basic" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const a = testing.allocator;
{
var list = ArrayList(i32).init(a);
@@ -1508,6 +1513,8 @@ test "std.ArrayList/ArrayListUnmanaged.insert" {
}
test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const a = testing.allocator;
{
var list = ArrayList(i32).init(a);
@@ -1554,6 +1561,8 @@ test "std.ArrayList/ArrayListUnmanaged.insertSlice" {
}
test "std.ArrayList/ArrayListUnmanaged.replaceRange" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var arena = std.heap.ArenaAllocator.init(testing.allocator);
defer arena.deinit();
const a = arena.allocator();
@@ -1725,6 +1734,8 @@ test "shrink still sets length when resizing is disabled" {
}
test "shrinkAndFree with a copy" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var failing_allocator = testing.FailingAllocator.init(testing.allocator, .{ .resize_fail_index = 0 });
const a = failing_allocator.allocator();
diff --git a/lib/std/atomic/Atomic.zig b/lib/std/atomic/Atomic.zig
index 3cb7c8e60a..5c89d30fed 100644
--- a/lib/std/atomic/Atomic.zig
+++ b/lib/std/atomic/Atomic.zig
@@ -374,6 +374,8 @@ const atomic_rmw_orderings = [_]Ordering{
};
test "Atomic.swap" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
inline for (atomic_rmw_orderings) |ordering| {
var x = Atomic(usize).init(5);
try testing.expectEqual(x.swap(10, ordering), 5);
@@ -467,6 +469,8 @@ test "Atomic.fetchSub" {
}
test "Atomic.fetchMin" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
inline for (atomicIntTypes()) |Int| {
inline for (atomic_rmw_orderings) |ordering| {
var x = Atomic(Int).init(5);
diff --git a/lib/std/atomic/queue.zig b/lib/std/atomic/queue.zig
index e8d37507d3..c28daead1b 100644
--- a/lib/std/atomic/queue.zig
+++ b/lib/std/atomic/queue.zig
@@ -175,6 +175,8 @@ const puts_per_thread = 500;
const put_thread_count = 3;
test "std.atomic.Queue" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var plenty_of_memory = try std.heap.page_allocator.alloc(u8, 300 * 1024);
defer std.heap.page_allocator.free(plenty_of_memory);
diff --git a/lib/std/base64.zig b/lib/std/base64.zig
index 26f1b1be61..bfcdabaec5 100644
--- a/lib/std/base64.zig
+++ b/lib/std/base64.zig
@@ -1,5 +1,6 @@
const std = @import("std.zig");
const assert = std.debug.assert;
+const builtin = @import("builtin");
const testing = std.testing;
const mem = std.mem;
@@ -354,12 +355,16 @@ pub const Base64DecoderWithIgnore = struct {
};
test "base64" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
@setEvalBranchQuota(8000);
try testBase64();
try comptime testAllApis(standard, "comptime", "Y29tcHRpbWU=");
}
test "base64 padding dest overflow" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const input = "foo";
var expect: [128]u8 = undefined;
@@ -374,6 +379,8 @@ test "base64 padding dest overflow" {
}
test "base64 url_safe_no_pad" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
@setEvalBranchQuota(8000);
try testBase64UrlSafeNoPad();
try comptime testAllApis(url_safe_no_pad, "comptime", "Y29tcHRpbWU");
diff --git a/lib/std/bit_set.zig b/lib/std/bit_set.zig
index 430f521eb6..f4bad13f8a 100644
--- a/lib/std/bit_set.zig
+++ b/lib/std/bit_set.zig
@@ -33,6 +33,7 @@
const std = @import("std.zig");
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
+const builtin = @import("builtin");
/// Returns the optimal static bit set type for the specified number
/// of elements: either `IntegerBitSet` or `ArrayBitSet`,
@@ -1636,7 +1637,10 @@ fn testStaticBitSet(comptime Set: type) !void {
}
test "IntegerBitSet" {
- if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
try testStaticBitSet(IntegerBitSet(0));
try testStaticBitSet(IntegerBitSet(1));
@@ -1649,6 +1653,11 @@ test "IntegerBitSet" {
}
test "ArrayBitSet" {
+ switch (builtin.zig_backend) {
+ .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
+
inline for (.{ 0, 1, 2, 31, 32, 33, 63, 64, 65, 254, 500, 3000 }) |size| {
try testStaticBitSet(ArrayBitSet(u8, size));
try testStaticBitSet(ArrayBitSet(u16, size));
@@ -1659,6 +1668,8 @@ test "ArrayBitSet" {
}
test "DynamicBitSetUnmanaged" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const allocator = std.testing.allocator;
var a = try DynamicBitSetUnmanaged.initEmpty(allocator, 300);
try testing.expectEqual(@as(usize, 0), a.count());
@@ -1712,6 +1723,8 @@ test "DynamicBitSetUnmanaged" {
}
test "DynamicBitSet" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const allocator = std.testing.allocator;
var a = try DynamicBitSet.initEmpty(allocator, 300);
try testing.expectEqual(@as(usize, 0), a.count());
diff --git a/lib/std/child_process.zig b/lib/std/child_process.zig
index b815d89f7a..81c5bc1e03 100644
--- a/lib/std/child_process.zig
+++ b/lib/std/child_process.zig
@@ -262,7 +262,7 @@ pub const ChildProcess = struct {
return term;
}
- pub const ExecResult = struct {
+ pub const RunResult = struct {
term: Term,
stdout: []u8,
stderr: []u8,
@@ -317,14 +317,14 @@ pub const ChildProcess = struct {
stderr.* = fifoToOwnedArrayList(poller.fifo(.stderr));
}
- pub const ExecError = os.GetCwdError || os.ReadError || SpawnError || os.PollError || error{
+ pub const RunError = os.GetCwdError || os.ReadError || SpawnError || os.PollError || error{
StdoutStreamTooLong,
StderrStreamTooLong,
};
/// Spawns a child process, waits for it, collecting stdout and stderr, and then returns.
/// If it succeeds, the caller owns result.stdout and result.stderr memory.
- pub fn exec(args: struct {
+ pub fn run(args: struct {
allocator: mem.Allocator,
argv: []const []const u8,
cwd: ?[]const u8 = null,
@@ -332,7 +332,7 @@ pub const ChildProcess = struct {
env_map: ?*const EnvMap = null,
max_output_bytes: usize = 50 * 1024,
expand_arg0: Arg0Expand = .no_expand,
- }) ExecError!ExecResult {
+ }) RunError!RunResult {
var child = ChildProcess.init(args.argv, args.allocator);
child.stdin_behavior = .Ignore;
child.stdout_behavior = .Pipe;
@@ -352,7 +352,7 @@ pub const ChildProcess = struct {
try child.spawn();
try child.collectOutput(&stdout, &stderr, args.max_output_bytes);
- return ExecResult{
+ return RunResult{
.term = try child.wait(),
.stdout = try stdout.toOwnedSlice(),
.stderr = try stderr.toOwnedSlice(),
@@ -821,7 +821,7 @@ pub const ChildProcess = struct {
const cmd_line_w = try unicode.utf8ToUtf16LeWithNull(self.allocator, cmd_line);
defer self.allocator.free(cmd_line_w);
- exec: {
+ run: {
const PATH: [:0]const u16 = std.os.getenvW(unicode.utf8ToUtf16LeStringLiteral("PATH")) orelse &[_:0]u16{};
const PATHEXT: [:0]const u16 = std.os.getenvW(unicode.utf8ToUtf16LeStringLiteral("PATHEXT")) orelse &[_:0]u16{};
@@ -873,7 +873,7 @@ pub const ChildProcess = struct {
dir_buf.shrinkRetainingCapacity(normalized_len);
if (windowsCreateProcessPathExt(self.allocator, &dir_buf, &app_buf, PATHEXT, cmd_line_w.ptr, envp_ptr, cwd_w_ptr, &siStartInfo, &piProcInfo)) {
- break :exec;
+ break :run;
} else |err| switch (err) {
error.FileNotFound, error.AccessDenied, error.InvalidExe => continue,
error.UnrecoverableInvalidExe => return error.InvalidExe,
diff --git a/lib/std/compress/deflate/compressor.zig b/lib/std/compress/deflate/compressor.zig
index 72de63f162..c50fee8f6c 100644
--- a/lib/std/compress/deflate/compressor.zig
+++ b/lib/std/compress/deflate/compressor.zig
@@ -1069,6 +1069,8 @@ var deflate_tests = [_]DeflateTest{
};
test "deflate" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
for (deflate_tests) |dt| {
var output = ArrayList(u8).init(testing.allocator);
defer output.deinit();
diff --git a/lib/std/compress/deflate/compressor_test.zig b/lib/std/compress/deflate/compressor_test.zig
index 5012bb3c07..a363d170e6 100644
--- a/lib/std/compress/deflate/compressor_test.zig
+++ b/lib/std/compress/deflate/compressor_test.zig
@@ -154,6 +154,8 @@ fn testToFromWithLimit(input: []const u8, limit: [11]u32) !void {
}
test "deflate/inflate" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var limits = [_]u32{0} ** 11;
var test0 = [_]u8{};
@@ -178,6 +180,8 @@ test "deflate/inflate" {
}
test "very long sparse chunk" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// A SparseReader returns a stream consisting of 0s ending with 65,536 (1<<16) 1s.
// This tests missing hash references in a very large input.
const SparseReader = struct {
@@ -239,6 +243,8 @@ test "very long sparse chunk" {
}
test "compressor reset" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
for (std.enums.values(deflate.Compression)) |c| {
try testWriterReset(c, null);
try testWriterReset(c, "dict");
@@ -289,6 +295,8 @@ fn testWriterReset(level: deflate.Compression, dict: ?[]const u8) !void {
}
test "decompressor dictionary" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const dict = "hello world"; // dictionary
const text = "hello again world";
@@ -329,6 +337,8 @@ test "decompressor dictionary" {
}
test "compressor dictionary" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const dict = "hello world";
const text = "hello again world";
@@ -375,6 +385,8 @@ test "compressor dictionary" {
// Update the hash for best_speed only if d.index < d.maxInsertIndex
// See https://golang.org/issue/2508
test "Go non-regression test for 2508" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var comp = try compressor(
testing.allocator,
io.null_writer,
@@ -392,6 +404,8 @@ test "Go non-regression test for 2508" {
}
test "deflate/inflate string" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const StringTest = struct {
filename: []const u8,
limit: [11]u32,
@@ -439,6 +453,8 @@ test "deflate/inflate string" {
}
test "inflate reset" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const strings = [_][]const u8{
"lorem ipsum izzle fo rizzle",
"the quick brown fox jumped over",
@@ -485,6 +501,8 @@ test "inflate reset" {
}
test "inflate reset dictionary" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const dict = "the lorem fox";
const strings = [_][]const u8{
"lorem ipsum izzle fo rizzle",
diff --git a/lib/std/compress/deflate/deflate_fast.zig b/lib/std/compress/deflate/deflate_fast.zig
index a11548fa1f..74982ee2b1 100644
--- a/lib/std/compress/deflate/deflate_fast.zig
+++ b/lib/std/compress/deflate/deflate_fast.zig
@@ -649,6 +649,8 @@ test "best speed shift offsets" {
}
test "best speed reset" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// test that encoding is consistent across a warparound of the table offset.
// See https://github.com/golang/go/issues/34121
const fmt = std.fmt;
diff --git a/lib/std/compress/deflate/deflate_fast_test.zig b/lib/std/compress/deflate/deflate_fast_test.zig
index 08f6079aa5..b592bd07a7 100644
--- a/lib/std/compress/deflate/deflate_fast_test.zig
+++ b/lib/std/compress/deflate/deflate_fast_test.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const expect = std.testing.expect;
const io = std.io;
const mem = std.mem;
@@ -11,6 +12,8 @@ const inflate = @import("decompressor.zig");
const deflate_const = @import("deflate_const.zig");
test "best speed" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Tests that round-tripping through deflate and then inflate recovers the original input.
// The Write sizes are near the thresholds in the compressor.encSpeed method (0, 16, 128), as well
// as near `deflate_const.max_store_block_size` (65535).
@@ -93,6 +96,8 @@ test "best speed" {
}
test "best speed max match offset" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const abc = "abcdefgh";
const xyz = "stuvwxyz";
const input_margin = 16 - 1;
diff --git a/lib/std/compress/deflate/huffman_bit_writer.zig b/lib/std/compress/deflate/huffman_bit_writer.zig
index 5204435106..f2ee8fd338 100644
--- a/lib/std/compress/deflate/huffman_bit_writer.zig
+++ b/lib/std/compress/deflate/huffman_bit_writer.zig
@@ -845,6 +845,8 @@ const testing = std.testing;
const ArrayList = std.ArrayList;
test "writeBlockHuff" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Tests huffman encoding against reference files to detect possible regressions.
// If encoding/bit allocation changes you can regenerate these files
@@ -1569,6 +1571,8 @@ const TestType = enum {
};
test "writeBlock" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// tests if the writeBlock encoding has changed.
const ttype: TestType = .write_block;
@@ -1584,6 +1588,8 @@ test "writeBlock" {
}
test "writeBlockDynamic" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// tests if the writeBlockDynamic encoding has changed.
const ttype: TestType = .write_dyn_block;
diff --git a/lib/std/compress/deflate/huffman_code.zig b/lib/std/compress/deflate/huffman_code.zig
index 4fea45f863..864da16e61 100644
--- a/lib/std/compress/deflate/huffman_code.zig
+++ b/lib/std/compress/deflate/huffman_code.zig
@@ -360,6 +360,8 @@ fn byFreq(context: void, a: LiteralNode, b: LiteralNode) bool {
}
test "generate a Huffman code from an array of frequencies" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var freqs: [19]u16 = [_]u16{
8, // 0
1, // 1
diff --git a/lib/std/compress/gzip.zig b/lib/std/compress/gzip.zig
index f6fb038ae3..b0928850e1 100644
--- a/lib/std/compress/gzip.zig
+++ b/lib/std/compress/gzip.zig
@@ -174,6 +174,8 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
// https://tools.ietf.org/rfc/rfc1952.txt length=25037 bytes
// SHA256=164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67
test "compressed data" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testReader(
@embedFile("testdata/rfc1952.txt.gz"),
@embedFile("testdata/rfc1952.txt"),
diff --git a/lib/std/compress/lzma/test.zig b/lib/std/compress/lzma/test.zig
index bdfe2909d8..da0a8d61c3 100644
--- a/lib/std/compress/lzma/test.zig
+++ b/lib/std/compress/lzma/test.zig
@@ -1,4 +1,5 @@
const std = @import("../../std.zig");
+const builtin = @import("builtin");
const lzma = @import("../lzma.zig");
fn testDecompress(compressed: []const u8) ![]u8 {
@@ -22,6 +23,8 @@ fn testDecompressError(expected: anyerror, compressed: []const u8) !void {
}
test "LZMA: decompress empty world" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testDecompressEqual(
"",
&[_]u8{
@@ -32,6 +35,8 @@ test "LZMA: decompress empty world" {
}
test "LZMA: decompress hello world" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testDecompressEqual(
"Hello world\n",
&[_]u8{
@@ -43,6 +48,8 @@ test "LZMA: decompress hello world" {
}
test "LZMA: decompress huge dict" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testDecompressEqual(
"Hello world\n",
&[_]u8{
@@ -54,6 +61,8 @@ test "LZMA: decompress huge dict" {
}
test "LZMA: unknown size with end of payload marker" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testDecompressEqual(
"Hello\nWorld!\n",
@embedFile("testdata/good-unknown_size-with_eopm.lzma"),
@@ -61,6 +70,8 @@ test "LZMA: unknown size with end of payload marker" {
}
test "LZMA: known size without end of payload marker" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testDecompressEqual(
"Hello\nWorld!\n",
@embedFile("testdata/good-known_size-without_eopm.lzma"),
@@ -68,6 +79,8 @@ test "LZMA: known size without end of payload marker" {
}
test "LZMA: known size with end of payload marker" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testDecompressEqual(
"Hello\nWorld!\n",
@embedFile("testdata/good-known_size-with_eopm.lzma"),
@@ -75,6 +88,8 @@ test "LZMA: known size with end of payload marker" {
}
test "LZMA: too big uncompressed size in header" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testDecompressError(
error.CorruptInput,
@embedFile("testdata/bad-too_big_size-with_eopm.lzma"),
@@ -82,6 +97,8 @@ test "LZMA: too big uncompressed size in header" {
}
test "LZMA: too small uncompressed size in header" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testDecompressError(
error.CorruptInput,
@embedFile("testdata/bad-too_small_size-without_eopm-3.lzma"),
diff --git a/lib/std/compress/lzma/vec2d.zig b/lib/std/compress/lzma/vec2d.zig
index 1ea3d1e8d5..aa805ee521 100644
--- a/lib/std/compress/lzma/vec2d.zig
+++ b/lib/std/compress/lzma/vec2d.zig
@@ -50,6 +50,8 @@ const expectEqualSlices = std.testing.expectEqualSlices;
const expectError = std.testing.expectError;
test "Vec2D.init" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const allocator = testing.allocator;
var vec2d = try Vec2D(i32).init(allocator, 1, .{ 2, 3 });
defer vec2d.deinit(allocator);
diff --git a/lib/std/compress/xz/test.zig b/lib/std/compress/xz/test.zig
index 08180e45c0..fd960bc071 100644
--- a/lib/std/compress/xz/test.zig
+++ b/lib/std/compress/xz/test.zig
@@ -19,6 +19,8 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
}
test "compressed data" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testReader(@embedFile("testdata/good-0-empty.xz"), "");
inline for ([_][]const u8{
diff --git a/lib/std/compress/zlib.zig b/lib/std/compress/zlib.zig
index 5580192537..8dd9853e27 100644
--- a/lib/std/compress/zlib.zig
+++ b/lib/std/compress/zlib.zig
@@ -199,6 +199,8 @@ fn testDecompress(data: []const u8, expected: []const u8) !void {
// https://tools.ietf.org/rfc/rfc1951.txt length=36944 bytes
// SHA256=5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009
test "compressed data" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const rfc1951_txt = @embedFile("testdata/rfc1951.txt");
// Compressed with compression level = 0
@@ -264,6 +266,8 @@ test "sanity checks" {
}
test "compress data" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const allocator = testing.allocator;
const rfc1951_txt = @embedFile("testdata/rfc1951.txt");
diff --git a/lib/std/compress/zstandard.zig b/lib/std/compress/zstandard.zig
index 1e8a0fc86f..ef2ccc2f1c 100644
--- a/lib/std/compress/zstandard.zig
+++ b/lib/std/compress/zstandard.zig
@@ -219,9 +219,7 @@ pub fn DecompressStream(
}
const size = @min(self.buffer.len(), buffer.len);
- for (0..size) |i| {
- buffer[i] = self.buffer.read().?;
- }
+ self.buffer.readFirstAssumeLength(buffer, size);
if (self.state == .LastBlock and self.buffer.len() == 0) {
self.state = .NewFrame;
self.allocator.free(self.literal_fse_buffer);
@@ -266,6 +264,8 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void {
}
test "zstandard decompression" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const uncompressed = @embedFile("testdata/rfc8478.txt");
const compressed3 = @embedFile("testdata/rfc8478.txt.zst.3");
const compressed19 = @embedFile("testdata/rfc8478.txt.zst.19");
diff --git a/lib/std/compress/zstandard/decode/block.zig b/lib/std/compress/zstandard/decode/block.zig
index bbf8492f04..4a035fb543 100644
--- a/lib/std/compress/zstandard/decode/block.zig
+++ b/lib/std/compress/zstandard/decode/block.zig
@@ -311,8 +311,8 @@ pub const DecodeState = struct {
try self.decodeLiteralsRingBuffer(dest, sequence.literal_length);
const copy_start = dest.write_index + dest.data.len - sequence.offset;
const copy_slice = dest.sliceAt(copy_start, sequence.match_length);
- for (copy_slice.first) |b| dest.writeAssumeCapacity(b);
- for (copy_slice.second) |b| dest.writeAssumeCapacity(b);
+ dest.writeSliceForwardsAssumeCapacity(copy_slice.first);
+ dest.writeSliceForwardsAssumeCapacity(copy_slice.second);
self.written_count += sequence.match_length;
}
@@ -723,9 +723,7 @@ pub fn decodeBlockRingBuffer(
},
.rle => {
if (src.len < 1) return error.MalformedRleBlock;
- for (0..block_size) |_| {
- dest.writeAssumeCapacity(src[0]);
- }
+ dest.writeSliceAssumeCapacity(src[0..block_size]);
consumed_count.* += 1;
decode_state.written_count += block_size;
return block_size;
diff --git a/lib/std/crypto.zig b/lib/std/crypto.zig
index c548f01c07..8cb2cfd90d 100644
--- a/lib/std/crypto.zig
+++ b/lib/std/crypto.zig
@@ -314,6 +314,8 @@ test "CSPRNG" {
}
test "issue #4532: no index out of bounds" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const types = [_]type{
hash.Md5,
hash.Sha1,
diff --git a/lib/std/crypto/25519/curve25519.zig b/lib/std/crypto/25519/curve25519.zig
index 7c3343ba8c..5377a9d141 100644
--- a/lib/std/crypto/25519/curve25519.zig
+++ b/lib/std/crypto/25519/curve25519.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const crypto = std.crypto;
const IdentityElementError = crypto.errors.IdentityElementError;
@@ -111,6 +112,8 @@ pub const Curve25519 = struct {
};
test "curve25519" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
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 };
const p = try Curve25519.basePoint.clampedMul(s);
try p.rejectIdentity();
@@ -125,6 +128,8 @@ test "curve25519" {
}
test "curve25519 small order check" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var s: [32]u8 = [_]u8{1} ++ [_]u8{0} ** 31;
const small_order_ss: [7][32]u8 = .{
.{
diff --git a/lib/std/crypto/25519/ed25519.zig b/lib/std/crypto/25519/ed25519.zig
index fc123386f8..43051fb5bf 100644
--- a/lib/std/crypto/25519/ed25519.zig
+++ b/lib/std/crypto/25519/ed25519.zig
@@ -1,5 +1,5 @@
-const builtin = @import("builtin");
const std = @import("std");
+const builtin = @import("builtin");
const crypto = std.crypto;
const debug = std.debug;
const fmt = std.fmt;
@@ -484,6 +484,8 @@ pub const Ed25519 = struct {
};
test "ed25519 key pair creation" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var seed: [32]u8 = undefined;
_ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");
const key_pair = try Ed25519.KeyPair.create(seed);
@@ -493,6 +495,8 @@ test "ed25519 key pair creation" {
}
test "ed25519 signature" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var seed: [32]u8 = undefined;
_ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");
const key_pair = try Ed25519.KeyPair.create(seed);
@@ -505,6 +509,8 @@ test "ed25519 signature" {
}
test "ed25519 batch verification" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var i: usize = 0;
while (i < 100) : (i += 1) {
const key_pair = try Ed25519.KeyPair.create(null);
@@ -534,6 +540,8 @@ test "ed25519 batch verification" {
}
test "ed25519 test vectors" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Vec = struct {
msg_hex: *const [64:0]u8,
public_key_hex: *const [64:0]u8,
@@ -636,6 +644,8 @@ test "ed25519 test vectors" {
}
test "ed25519 with blind keys" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const BlindKeyPair = Ed25519.key_blinding.BlindKeyPair;
// Create a standard Ed25519 key pair
@@ -659,6 +669,8 @@ test "ed25519 with blind keys" {
}
test "ed25519 signatures with streaming" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const kp = try Ed25519.KeyPair.create(null);
var signer = try kp.signer(null);
@@ -675,6 +687,8 @@ test "ed25519 signatures with streaming" {
}
test "ed25519 key pair from secret key" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const kp = try Ed25519.KeyPair.create(null);
const kp2 = try Ed25519.KeyPair.fromSecretKey(kp.secret_key);
try std.testing.expectEqualSlices(u8, &kp.secret_key.toBytes(), &kp2.secret_key.toBytes());
diff --git a/lib/std/crypto/25519/edwards25519.zig b/lib/std/crypto/25519/edwards25519.zig
index 0d42073705..7e099fcf4c 100644
--- a/lib/std/crypto/25519/edwards25519.zig
+++ b/lib/std/crypto/25519/edwards25519.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const crypto = std.crypto;
const debug = std.debug;
const fmt = std.fmt;
@@ -494,6 +495,8 @@ pub const Edwards25519 = struct {
const htest = @import("../test.zig");
test "edwards25519 packing/unpacking" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const s = [_]u8{170} ++ [_]u8{0} ** 31;
var b = Edwards25519.basePoint;
const pk = try b.mul(s);
@@ -530,6 +533,8 @@ test "edwards25519 packing/unpacking" {
}
test "edwards25519 point addition/subtraction" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var s1: [32]u8 = undefined;
var s2: [32]u8 = undefined;
crypto.random.bytes(&s1);
@@ -544,6 +549,8 @@ test "edwards25519 point addition/subtraction" {
}
test "edwards25519 uniform-to-point" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
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 };
var p = Edwards25519.fromUniform(r);
try htest.assertEqual("0691eee3cf70a0056df6bfa03120635636581b5c4ea571dfc680f78c7e0b4137", p.toBytes()[0..]);
@@ -555,6 +562,8 @@ test "edwards25519 uniform-to-point" {
// Test vectors from draft-irtf-cfrg-hash-to-curve-12
test "edwards25519 hash-to-curve operation" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var p = Edwards25519.fromString(true, "QUUX-V01-CS02-with-edwards25519_XMD:SHA-512_ELL2_RO_", "abc");
try htest.assertEqual("31558a26887f23fb8218f143e69d5f0af2e7831130bd5b432ef23883b895839a", p.toBytes()[0..]);
@@ -563,6 +572,8 @@ test "edwards25519 hash-to-curve operation" {
}
test "edwards25519 implicit reduction of invalid scalars" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const s = [_]u8{0} ** 31 ++ [_]u8{255};
const p1 = try Edwards25519.basePoint.mulPublic(s);
const p2 = try Edwards25519.basePoint.mul(s);
diff --git a/lib/std/crypto/25519/ristretto255.zig b/lib/std/crypto/25519/ristretto255.zig
index d12a672e7d..d3482f278f 100644
--- a/lib/std/crypto/25519/ristretto255.zig
+++ b/lib/std/crypto/25519/ristretto255.zig
@@ -168,6 +168,8 @@ pub const Ristretto255 = struct {
};
test "ristretto255" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const p = Ristretto255.basePoint;
var buf: [256]u8 = undefined;
try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{s}", .{std.fmt.fmtSliceHexUpper(&p.toBytes())}), "E2F2AE0A6ABC4E71A884A961C500515F58E30B6AA582DD8DB6A65945E08D2D76");
diff --git a/lib/std/crypto/25519/x25519.zig b/lib/std/crypto/25519/x25519.zig
index b746a51968..7da73f2480 100644
--- a/lib/std/crypto/25519/x25519.zig
+++ b/lib/std/crypto/25519/x25519.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const crypto = std.crypto;
const mem = std.mem;
const fmt = std.fmt;
@@ -82,6 +83,8 @@ pub const X25519 = struct {
const htest = @import("../test.zig");
test "x25519 public key calculation from secret key" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var sk: [32]u8 = undefined;
var pk_expected: [32]u8 = undefined;
_ = try fmt.hexToBytes(sk[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166");
@@ -91,6 +94,8 @@ test "x25519 public key calculation from secret key" {
}
test "x25519 rfc7748 vector1" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
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 };
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 };
@@ -101,6 +106,8 @@ test "x25519 rfc7748 vector1" {
}
test "x25519 rfc7748 vector2" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
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 };
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 };
@@ -111,6 +118,8 @@ test "x25519 rfc7748 vector2" {
}
test "x25519 rfc7748 one iteration" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
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 };
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 };
@@ -128,6 +137,8 @@ test "x25519 rfc7748 one iteration" {
}
test "x25519 rfc7748 1,000 iterations" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// These iteration tests are slow so we always skip them. Results have been verified.
if (true) {
return error.SkipZigTest;
@@ -150,6 +161,8 @@ test "x25519 rfc7748 1,000 iterations" {
}
test "x25519 rfc7748 1,000,000 iterations" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (true) {
return error.SkipZigTest;
}
@@ -171,6 +184,8 @@ test "x25519 rfc7748 1,000,000 iterations" {
}
test "edwards25519 -> curve25519 map" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const ed_kp = try crypto.sign.Ed25519.KeyPair.create([_]u8{0x42} ** 32);
const mont_kp = try X25519.KeyPair.fromEd25519(ed_kp);
try htest.assertEqual("90e7595fc89e52fdfddce9c6a43d74dbf6047025ee0462d2d172e8b6a2841d6e", &mont_kp.secret_key);
diff --git a/lib/std/crypto/Certificate.zig b/lib/std/crypto/Certificate.zig
index f28894fc0d..1b1d4812d3 100644
--- a/lib/std/crypto/Certificate.zig
+++ b/lib/std/crypto/Certificate.zig
@@ -624,6 +624,8 @@ pub fn parseTimeDigits(text: *const [2]u8, min: u8, max: u8) !u8 {
}
test parseTimeDigits {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const expectEqual = std.testing.expectEqual;
try expectEqual(@as(u8, 0), try parseTimeDigits("00", 0, 99));
try expectEqual(@as(u8, 99), try parseTimeDigits("99", 0, 99));
@@ -645,6 +647,8 @@ pub fn parseYear4(text: *const [4]u8) !u16 {
}
test parseYear4 {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const expectEqual = std.testing.expectEqual;
try expectEqual(@as(u16, 0), try parseYear4("0000"));
try expectEqual(@as(u16, 9999), try parseYear4("9999"));
@@ -1119,3 +1123,5 @@ pub const rsa = struct {
return res;
}
};
+
+const builtin = @import("builtin");
diff --git a/lib/std/crypto/Certificate/Bundle.zig b/lib/std/crypto/Certificate/Bundle.zig
index b5a3832115..1bffa325bd 100644
--- a/lib/std/crypto/Certificate/Bundle.zig
+++ b/lib/std/crypto/Certificate/Bundle.zig
@@ -318,6 +318,8 @@ const MapContext = struct {
test "scan for OS-provided certificates" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var bundle: Bundle = .{};
defer bundle.deinit(std.testing.allocator);
diff --git a/lib/std/crypto/aegis.zig b/lib/std/crypto/aegis.zig
index 18047a13b5..5a7f2ec017 100644
--- a/lib/std/crypto/aegis.zig
+++ b/lib/std/crypto/aegis.zig
@@ -17,6 +17,7 @@
//! https://datatracker.ietf.org/doc/draft-irtf-cfrg-aegis-aead/
const std = @import("std");
+const builtin = @import("builtin");
const crypto = std.crypto;
const mem = std.mem;
const assert = std.debug.assert;
@@ -513,6 +514,8 @@ const htest = @import("test.zig");
const testing = std.testing;
test "Aegis128L test vector 1" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key: [Aegis128L.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 14;
const nonce: [Aegis128L.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 13;
const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
@@ -536,6 +539,8 @@ test "Aegis128L test vector 1" {
}
test "Aegis128L test vector 2" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;
const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;
const ad = [_]u8{};
@@ -553,6 +558,8 @@ test "Aegis128L test vector 2" {
}
test "Aegis128L test vector 3" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key: [Aegis128L.key_length]u8 = [_]u8{0x00} ** 16;
const nonce: [Aegis128L.nonce_length]u8 = [_]u8{0x00} ** 16;
const ad = [_]u8{};
@@ -569,6 +576,8 @@ test "Aegis128L test vector 3" {
}
test "Aegis256 test vector 1" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key: [Aegis256.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [_]u8{0x00} ** 30;
const nonce: [Aegis256.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [_]u8{0x00} ** 29;
const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
@@ -592,6 +601,8 @@ test "Aegis256 test vector 1" {
}
test "Aegis256 test vector 2" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;
const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;
const ad = [_]u8{};
@@ -609,6 +620,8 @@ test "Aegis256 test vector 2" {
}
test "Aegis256 test vector 3" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key: [Aegis256.key_length]u8 = [_]u8{0x00} ** 32;
const nonce: [Aegis256.nonce_length]u8 = [_]u8{0x00} ** 32;
const ad = [_]u8{};
@@ -625,6 +638,8 @@ test "Aegis256 test vector 3" {
}
test "Aegis MAC" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key = [_]u8{0x00} ** Aegis128LMac.key_length;
var msg: [64]u8 = undefined;
for (&msg, 0..) |*m, i| {
diff --git a/lib/std/crypto/aes.zig b/lib/std/crypto/aes.zig
index 70246e6630..875898d2e5 100644
--- a/lib/std/crypto/aes.zig
+++ b/lib/std/crypto/aes.zig
@@ -28,6 +28,8 @@ pub const Aes128 = impl.Aes128;
pub const Aes256 = impl.Aes256;
test "ctr" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// NIST SP 800-38A pp 55-58
const ctr = @import("modes.zig").ctr;
@@ -53,6 +55,8 @@ test "ctr" {
}
test "encrypt" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Appendix B
{
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" {
}
test "decrypt" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Appendix B
{
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" {
}
test "expand 128-bit key" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key = [_]u8{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
const exp_enc = [_]*const [32:0]u8{
"2b7e151628aed2a6abf7158809cf4f3c", "a0fafe1788542cb123a339392a6c7605", "f2c295f27a96b9435935807a7359f67f", "3d80477d4716fe3e1e237e446d7a883b", "ef44a541a8525b7fb671253bdb0bad00", "d4d1c6f87c839d87caf2b8bc11f915bc", "6d88a37a110b3efddbf98641ca0093fd", "4e54f70e5f5fc9f384a64fb24ea6dc4f", "ead27321b58dbad2312bf5607f8d292f", "ac7766f319fadc2128d12941575c006e", "d014f9a8c9ee2589e13f0cc8b6630ca6",
@@ -133,6 +141,8 @@ test "expand 128-bit key" {
}
test "expand 256-bit key" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key = [_]u8{
0x60, 0x3d, 0xeb, 0x10,
0x15, 0xca, 0x71, 0xbe,
diff --git a/lib/std/crypto/aes_gcm.zig b/lib/std/crypto/aes_gcm.zig
index fdc42997ad..1715636bed 100644
--- a/lib/std/crypto/aes_gcm.zig
+++ b/lib/std/crypto/aes_gcm.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const assert = std.debug.assert;
const crypto = std.crypto;
const debug = std.debug;
@@ -112,6 +113,8 @@ const htest = @import("test.zig");
const testing = std.testing;
test "Aes256Gcm - Empty message and no associated data" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
const ad = "";
@@ -124,6 +127,8 @@ test "Aes256Gcm - Empty message and no associated data" {
}
test "Aes256Gcm - Associated data only" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
const m = "";
@@ -136,6 +141,8 @@ test "Aes256Gcm - Associated data only" {
}
test "Aes256Gcm - Message only" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
const m = "Test with message only";
@@ -153,6 +160,8 @@ test "Aes256Gcm - Message only" {
}
test "Aes256Gcm - Message and associated data" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key: [Aes256Gcm.key_length]u8 = [_]u8{0x69} ** Aes256Gcm.key_length;
const nonce: [Aes256Gcm.nonce_length]u8 = [_]u8{0x42} ** Aes256Gcm.nonce_length;
const m = "Test with message";
diff --git a/lib/std/crypto/aes_ocb.zig b/lib/std/crypto/aes_ocb.zig
index 3f0a98a5d7..0209d07ec6 100644
--- a/lib/std/crypto/aes_ocb.zig
+++ b/lib/std/crypto/aes_ocb.zig
@@ -261,7 +261,10 @@ inline fn xorWith(x: *Block, y: Block) void {
const hexToBytes = std.fmt.hexToBytes;
test "AesOcb test vector 1" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var k: [Aes128Ocb.key_length]u8 = undefined;
var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
@@ -280,7 +283,10 @@ test "AesOcb test vector 1" {
}
test "AesOcb test vector 2" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var k: [Aes128Ocb.key_length]u8 = undefined;
var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
@@ -301,7 +307,10 @@ test "AesOcb test vector 2" {
}
test "AesOcb test vector 3" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var k: [Aes128Ocb.key_length]u8 = undefined;
var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
@@ -325,7 +334,10 @@ test "AesOcb test vector 3" {
}
test "AesOcb test vector 4" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var k: [Aes128Ocb.key_length]u8 = undefined;
var nonce: [Aes128Ocb.nonce_length]u8 = undefined;
diff --git a/lib/std/crypto/argon2.zig b/lib/std/crypto/argon2.zig
index 898bc24e6f..05dd686aac 100644
--- a/lib/std/crypto/argon2.zig
+++ b/lib/std/crypto/argon2.zig
@@ -622,6 +622,8 @@ pub fn strVerify(
}
test "argon2d" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const password = [_]u8{0x01} ** 32;
const salt = [_]u8{0x02} ** 16;
const secret = [_]u8{0x03} ** 8;
@@ -647,6 +649,8 @@ test "argon2d" {
}
test "argon2i" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const password = [_]u8{0x01} ** 32;
const salt = [_]u8{0x02} ** 16;
const secret = [_]u8{0x03} ** 8;
@@ -672,6 +676,8 @@ test "argon2i" {
}
test "argon2id" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const password = [_]u8{0x01} ** 32;
const salt = [_]u8{0x02} ** 16;
const secret = [_]u8{0x03} ** 8;
@@ -697,6 +703,8 @@ test "argon2id" {
}
test "kdf" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const password = "password";
const salt = "somesalt";
@@ -896,6 +904,8 @@ test "kdf" {
}
test "phc format hasher" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const allocator = std.testing.allocator;
const password = "testpass";
@@ -911,6 +921,8 @@ test "phc format hasher" {
}
test "password hash and password verify" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const allocator = std.testing.allocator;
const password = "testpass";
@@ -924,6 +936,8 @@ test "password hash and password verify" {
}
test "kdf derived key length" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const allocator = std.testing.allocator;
const password = "testpass";
diff --git a/lib/std/crypto/bcrypt.zig b/lib/std/crypto/bcrypt.zig
index 87d2eef79a..ce3a5aec79 100644
--- a/lib/std/crypto/bcrypt.zig
+++ b/lib/std/crypto/bcrypt.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const base64 = std.base64;
const crypto = std.crypto;
const debug = std.debug;
@@ -753,6 +754,8 @@ pub fn strVerify(
}
test "bcrypt codec" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var salt: [salt_length]u8 = undefined;
crypto.random.bytes(&salt);
var salt_str: [salt_str_length]u8 = undefined;
@@ -763,6 +766,8 @@ test "bcrypt codec" {
}
test "bcrypt crypt format" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var hash_options = HashOptions{
.params = .{ .rounds_log = 5 },
.encoding = .crypt,
@@ -803,6 +808,8 @@ test "bcrypt crypt format" {
}
test "bcrypt phc format" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var hash_options = HashOptions{
.params = .{ .rounds_log = 5 },
.encoding = .phc,
diff --git a/lib/std/crypto/blake3.zig b/lib/std/crypto/blake3.zig
index fc1859b99d..08c38ec63b 100644
--- a/lib/std/crypto/blake3.zig
+++ b/lib/std/crypto/blake3.zig
@@ -200,7 +200,7 @@ const CompressGeneric = struct {
}
};
-const compress = if (builtin.cpu.arch == .x86_64)
+const compress = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_x86_64)
CompressVectorized.compress
else
CompressGeneric.compress;
@@ -682,6 +682,8 @@ fn testBlake3(hasher: *Blake3, input_len: usize, expected_hex: [262]u8) !void {
}
test "BLAKE3 reference test cases" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var hash_state = Blake3.init(.{});
const hash = &hash_state;
var keyed_hash_state = Blake3.init(.{ .key = reference_test.key.* });
diff --git a/lib/std/crypto/chacha20.zig b/lib/std/crypto/chacha20.zig
index b45d1c5295..c6a2ddafe7 100644
--- a/lib/std/crypto/chacha20.zig
+++ b/lib/std/crypto/chacha20.zig
@@ -499,6 +499,8 @@ fn ChaChaNonVecImpl(comptime rounds_nb: usize) type {
fn ChaChaImpl(comptime rounds_nb: usize) type {
switch (builtin.cpu.arch) {
.x86_64 => {
+ if (builtin.zig_backend == .stage2_x86_64) return ChaChaNonVecImpl(rounds_nb);
+
const has_avx2 = std.Target.x86.featureSetHas(builtin.cpu.features, .avx2);
const has_avx512f = std.Target.x86.featureSetHas(builtin.cpu.features, .avx512f);
if (has_avx512f) return ChaChaVecImpl(rounds_nb, 4);
@@ -757,6 +759,8 @@ fn XChaChaPoly1305(comptime rounds_nb: usize) type {
}
test "chacha20 AEAD API" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const aeads = [_]type{ ChaCha20Poly1305, XChaCha20Poly1305 };
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.";
const ad = "Additional data";
@@ -778,6 +782,8 @@ test "chacha20 AEAD API" {
// https://tools.ietf.org/html/rfc7539#section-2.4.2
test "crypto.chacha20 test vector sunscreen" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const expected_result = [_]u8{
0x6e, 0x2e, 0x35, 0x9a, 0x25, 0x68, 0xf9, 0x80,
0x41, 0xba, 0x07, 0x28, 0xdd, 0x0d, 0x69, 0x81,
@@ -819,6 +825,8 @@ test "crypto.chacha20 test vector sunscreen" {
// https://tools.ietf.org/html/draft-agl-tls-chacha20poly1305-04#section-7
test "crypto.chacha20 test vector 1" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const expected_result = [_]u8{
0x76, 0xb8, 0xe0, 0xad, 0xa0, 0xf1, 0x3d, 0x90,
0x40, 0x5d, 0x6a, 0xe5, 0x53, 0x86, 0xbd, 0x28,
@@ -853,6 +861,8 @@ test "crypto.chacha20 test vector 1" {
}
test "crypto.chacha20 test vector 2" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const expected_result = [_]u8{
0x45, 0x40, 0xf0, 0x5a, 0x9f, 0x1f, 0xb2, 0x96,
0xd7, 0x73, 0x6e, 0x7b, 0x20, 0x8e, 0x3c, 0x96,
@@ -887,6 +897,8 @@ test "crypto.chacha20 test vector 2" {
}
test "crypto.chacha20 test vector 3" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const expected_result = [_]u8{
0xde, 0x9c, 0xba, 0x7b, 0xf3, 0xd6, 0x9e, 0xf5,
0xe7, 0x86, 0xdc, 0x63, 0x97, 0x3f, 0x65, 0x3a,
@@ -921,6 +933,8 @@ test "crypto.chacha20 test vector 3" {
}
test "crypto.chacha20 test vector 4" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const expected_result = [_]u8{
0xef, 0x3f, 0xdf, 0xd6, 0xc6, 0x15, 0x78, 0xfb,
0xf5, 0xcf, 0x35, 0xbd, 0x3d, 0xd3, 0x3b, 0x80,
@@ -955,6 +969,8 @@ test "crypto.chacha20 test vector 4" {
}
test "crypto.chacha20 test vector 5" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const expected_result = [_]u8{
0xf7, 0x98, 0xa1, 0x89, 0xf1, 0x95, 0xe6, 0x69,
0x82, 0x10, 0x5f, 0xfb, 0x64, 0x0b, 0xb7, 0x75,
@@ -1027,6 +1043,8 @@ test "crypto.chacha20 test vector 5" {
}
test "seal" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
{
const m = "";
const ad = "";
@@ -1077,6 +1095,8 @@ test "seal" {
}
test "open" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
{
const c = [_]u8{ 0xa0, 0x78, 0x4d, 0x7a, 0x47, 0x16, 0xf3, 0xfe, 0xb4, 0xf6, 0x4e, 0x7f, 0x4b, 0x39, 0xbf, 0x4 };
const ad = "";
@@ -1141,6 +1161,8 @@ test "open" {
}
test "crypto.xchacha20" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key = [_]u8{69} ** 32;
const nonce = [_]u8{42} ** 24;
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.";
diff --git a/lib/std/crypto/cmac.zig b/lib/std/crypto/cmac.zig
index fd00461858..5f2d332c01 100644
--- a/lib/std/crypto/cmac.zig
+++ b/lib/std/crypto/cmac.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const crypto = std.crypto;
const mem = std.mem;
@@ -93,6 +94,8 @@ pub fn Cmac(comptime BlockCipher: type) type {
const testing = std.testing;
test "CmacAes128 - Example 1: len = 0" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key = [_]u8{
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
};
@@ -106,6 +109,8 @@ test "CmacAes128 - Example 1: len = 0" {
}
test "CmacAes128 - Example 2: len = 16" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key = [_]u8{
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
};
@@ -121,6 +126,8 @@ test "CmacAes128 - Example 2: len = 16" {
}
test "CmacAes128 - Example 3: len = 40" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key = [_]u8{
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
};
@@ -138,6 +145,8 @@ test "CmacAes128 - Example 3: len = 40" {
}
test "CmacAes128 - Example 4: len = 64" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key = [_]u8{
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
};
diff --git a/lib/std/crypto/ecdsa.zig b/lib/std/crypto/ecdsa.zig
index 1a5335b07e..acb054d8cd 100644
--- a/lib/std/crypto/ecdsa.zig
+++ b/lib/std/crypto/ecdsa.zig
@@ -372,7 +372,10 @@ pub fn Ecdsa(comptime Curve: type, comptime Hash: type) type {
}
test "ECDSA - Basic operations over EcdsaP384Sha384" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
const Scheme = EcdsaP384Sha384;
const kp = try Scheme.KeyPair.create(null);
@@ -388,7 +391,10 @@ test "ECDSA - Basic operations over EcdsaP384Sha384" {
}
test "ECDSA - Basic operations over Secp256k1" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
const Scheme = EcdsaSecp256k1Sha256oSha256;
const kp = try Scheme.KeyPair.create(null);
@@ -404,7 +410,10 @@ test "ECDSA - Basic operations over Secp256k1" {
}
test "ECDSA - Basic operations over EcdsaP384Sha256" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);
const kp = try Scheme.KeyPair.create(null);
@@ -420,7 +429,10 @@ test "ECDSA - Basic operations over EcdsaP384Sha256" {
}
test "ECDSA - Verifying a existing signature with EcdsaP384Sha256" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
const Scheme = Ecdsa(crypto.ecc.P384, crypto.hash.sha2.Sha256);
// zig fmt: off
@@ -464,7 +476,10 @@ const TestVector = struct {
};
test "ECDSA - Test vectors from Project Wycheproof" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
const vectors = [_]TestVector{
.{ .key = "042927b10512bae3eddcfe467828128bad2903269919f7086069c8c4df6c732838c7787964eaac00e5921fb1498a60f4606766b3d9685001558d1a974e7341513e", .msg = "313233343030", .sig = "304402202ba3a8be6b94d5ec80a6d9d1190a436effe50d85a1eee859b8cc6af9bd5c2e1802204cd60b855d442f5b3c7b11eb6c4e0ae7525fe710fab9aa7c77a67f79e6fadd76", .result = .valid },
@@ -878,7 +893,10 @@ fn tvTry(vector: TestVector) !void {
}
test "ECDSA - Sec1 encoding/decoding" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
const Scheme = EcdsaP384Sha384;
const kp = try Scheme.KeyPair.create(null);
diff --git a/lib/std/crypto/ff.zig b/lib/std/crypto/ff.zig
index 287d37544f..037feae5ed 100644
--- a/lib/std/crypto/ff.zig
+++ b/lib/std/crypto/ff.zig
@@ -912,7 +912,10 @@ const ct_unprotected = struct {
};
test {
- if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (@import("builtin").zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
const M = Modulus(256);
const m = try M.fromPrimitive(u256, 3429938563481314093726330772853735541133072814650493833233);
diff --git a/lib/std/crypto/ghash_polyval.zig b/lib/std/crypto/ghash_polyval.zig
index 11379cc8e3..3a78db6214 100644
--- a/lib/std/crypto/ghash_polyval.zig
+++ b/lib/std/crypto/ghash_polyval.zig
@@ -422,6 +422,8 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
const htest = @import("test.zig");
test "ghash" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key = [_]u8{0x42} ** 16;
const m = [_]u8{0x69} ** 256;
@@ -439,6 +441,8 @@ test "ghash" {
}
test "ghash2" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var key: [16]u8 = undefined;
var i: usize = 0;
while (i < key.len) : (i += 1) {
@@ -472,6 +476,8 @@ test "ghash2" {
}
test "polyval" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key = [_]u8{0x42} ** 16;
const m = [_]u8{0x69} ** 256;
diff --git a/lib/std/crypto/hash_composition.zig b/lib/std/crypto/hash_composition.zig
index 1ffa3d4c47..234a990a83 100644
--- a/lib/std/crypto/hash_composition.zig
+++ b/lib/std/crypto/hash_composition.zig
@@ -65,6 +65,8 @@ pub const Sha384oSha384 = Composition(sha2.Sha384, sha2.Sha384);
pub const Sha512oSha512 = Composition(sha2.Sha512, sha2.Sha512);
test "Hash composition" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Sha256 = sha2.Sha256;
const msg = "test";
diff --git a/lib/std/crypto/hkdf.zig b/lib/std/crypto/hkdf.zig
index 9163ba9d15..f0865a9d5e 100644
--- a/lib/std/crypto/hkdf.zig
+++ b/lib/std/crypto/hkdf.zig
@@ -72,6 +72,8 @@ pub fn Hkdf(comptime Hmac: type) type {
const htest = @import("test.zig");
test "Hkdf" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const ikm = [_]u8{0x0b} ** 22;
const salt = [_]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c };
const context = [_]u8{ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9 };
diff --git a/lib/std/crypto/kyber_d00.zig b/lib/std/crypto/kyber_d00.zig
index ba6ed67ec8..fa1627dbd1 100644
--- a/lib/std/crypto/kyber_d00.zig
+++ b/lib/std/crypto/kyber_d00.zig
@@ -553,6 +553,8 @@ const inv_ntt_reductions = [_]i16{
};
test "invNTTReductions bounds" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Checks whether the reductions proposed by invNTTReductions
// don't overflow during invNTT().
var xs = [_]i32{1} ** 256; // start at |x| ≤ q
@@ -656,6 +658,8 @@ fn montReduce(x: i32) i16 {
}
test "Test montReduce" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var rnd = RndGen.init(0);
for (0..1000) |_| {
const bound = comptime @as(i32, Q) * (1 << 15);
@@ -674,6 +678,8 @@ fn feToMont(x: i16) i16 {
}
test "Test feToMont" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var x: i32 = -(1 << 15);
while (x < 1 << 15) : (x += 1) {
const y = feToMont(@as(i16, @intCast(x)));
@@ -707,6 +713,8 @@ fn feBarrettReduce(x: i16) i16 {
}
test "Test Barrett reduction" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var x: i32 = -(1 << 15);
while (x < 1 << 15) : (x += 1) {
var y1 = feBarrettReduce(@as(i16, @intCast(x)));
@@ -727,6 +735,8 @@ fn csubq(x: i16) i16 {
}
test "Test csubq" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var x: i32 = -29439;
while (x < 1 << 15) : (x += 1) {
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 {
}
test "MulHat" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var rnd = RndGen.init(0);
for (0..100) |_| {
@@ -1497,6 +1509,8 @@ test "MulHat" {
}
test "NTT" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var rnd = RndGen.init(0);
for (0..1000) |_| {
@@ -1520,6 +1534,8 @@ test "NTT" {
}
test "Compression" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var rnd = RndGen.init(0);
inline for (.{ 1, 4, 5, 10, 11 }) |d| {
for (0..1000) |_| {
@@ -1532,6 +1548,8 @@ test "Compression" {
}
test "noise" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var seed: [32]u8 = undefined;
for (&seed, 0..) |*s, i| {
s.* = @as(u8, @intCast(i));
@@ -1578,6 +1596,8 @@ test "noise" {
}
test "uniform sampling" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var seed: [32]u8 = undefined;
for (&seed, 0..) |*s, i| {
s.* = @as(u8, @intCast(i));
@@ -1611,6 +1631,8 @@ test "uniform sampling" {
}
test "Polynomial packing" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var rnd = RndGen.init(0);
for (0..1000) |_| {
@@ -1620,6 +1642,8 @@ test "Polynomial packing" {
}
test "Test inner PKE" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var seed: [32]u8 = undefined;
var pt: [32]u8 = undefined;
for (&seed, &pt, 0..) |*s, *p, i| {
@@ -1641,6 +1665,8 @@ test "Test inner PKE" {
}
test "Test happy flow" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var seed: [64]u8 = undefined;
for (&seed, 0..) |*s, i| {
s.* = @as(u8, @intCast(i));
@@ -1667,6 +1693,8 @@ test "Test happy flow" {
const sha2 = crypto.hash.sha2;
test "NIST KAT test" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
inline for (.{
.{ Kyber512, "e9c2bd37133fcb40772f81559f14b1f58dccd1c816701be9ba6214d43baf4547" },
.{ Kyber1024, "89248f2f33f7f4f7051729111f3049c409a933ec904aedadf035f30fa5646cd5" },
diff --git a/lib/std/crypto/pbkdf2.zig b/lib/std/crypto/pbkdf2.zig
index 2e0318369b..126935f02c 100644
--- a/lib/std/crypto/pbkdf2.zig
+++ b/lib/std/crypto/pbkdf2.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const mem = std.mem;
const maxInt = std.math.maxInt;
const OutputTooLongError = std.crypto.errors.OutputTooLongError;
@@ -151,6 +152,8 @@ const HmacSha1 = std.crypto.auth.hmac.HmacSha1;
// RFC 6070 PBKDF2 HMAC-SHA1 Test Vectors
test "RFC 6070 one iteration" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const p = "password";
const s = "salt";
const c = 1;
@@ -166,6 +169,8 @@ test "RFC 6070 one iteration" {
}
test "RFC 6070 two iterations" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const p = "password";
const s = "salt";
const c = 2;
@@ -181,6 +186,8 @@ test "RFC 6070 two iterations" {
}
test "RFC 6070 4096 iterations" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const p = "password";
const s = "salt";
const c = 4096;
@@ -196,6 +203,8 @@ test "RFC 6070 4096 iterations" {
}
test "RFC 6070 16,777,216 iterations" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// These iteration tests are slow so we always skip them. Results have been verified.
if (true) {
return error.SkipZigTest;
@@ -216,6 +225,8 @@ test "RFC 6070 16,777,216 iterations" {
}
test "RFC 6070 multi-block salt and password" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const p = "passwordPASSWORDpassword";
const s = "saltSALTsaltSALTsaltSALTsaltSALTsalt";
const c = 4096;
@@ -231,6 +242,8 @@ test "RFC 6070 multi-block salt and password" {
}
test "RFC 6070 embedded NUL" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const p = "pass\x00word";
const s = "sa\x00lt";
const c = 4096;
@@ -246,6 +259,8 @@ test "RFC 6070 embedded NUL" {
}
test "Very large dk_len" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// This test allocates 8GB of memory and is expected to take several hours to run.
if (true) {
return error.SkipZigTest;
diff --git a/lib/std/crypto/pcurves/p256.zig b/lib/std/crypto/pcurves/p256.zig
index 668c0115b2..87c963f834 100644
--- a/lib/std/crypto/pcurves/p256.zig
+++ b/lib/std/crypto/pcurves/p256.zig
@@ -478,5 +478,7 @@ pub const AffineCoordinates = struct {
};
test {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
_ = @import("tests/p256.zig");
}
diff --git a/lib/std/crypto/pcurves/p384.zig b/lib/std/crypto/pcurves/p384.zig
index d5afd6eb4d..44dd4e50b7 100644
--- a/lib/std/crypto/pcurves/p384.zig
+++ b/lib/std/crypto/pcurves/p384.zig
@@ -478,7 +478,10 @@ pub const AffineCoordinates = struct {
};
test {
- if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (@import("builtin").zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
_ = @import("tests/p384.zig");
}
diff --git a/lib/std/crypto/pcurves/secp256k1.zig b/lib/std/crypto/pcurves/secp256k1.zig
index cd7f1faf75..6286b96249 100644
--- a/lib/std/crypto/pcurves/secp256k1.zig
+++ b/lib/std/crypto/pcurves/secp256k1.zig
@@ -556,7 +556,10 @@ pub const AffineCoordinates = struct {
};
test {
- if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (@import("builtin").zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
_ = @import("tests/secp256k1.zig");
}
diff --git a/lib/std/crypto/phc_encoding.zig b/lib/std/crypto/phc_encoding.zig
index fecd7f1239..58757cec28 100644
--- a/lib/std/crypto/phc_encoding.zig
+++ b/lib/std/crypto/phc_encoding.zig
@@ -1,6 +1,7 @@
// https://github.com/P-H-C/phc-string-format
const std = @import("std");
+const builtin = @import("builtin");
const fmt = std.fmt;
const io = std.io;
const mem = std.mem;
@@ -263,6 +264,8 @@ fn kvSplit(str: []const u8) !struct { key: []const u8, value: []const u8 } {
}
test "phc format - encoding/decoding" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Input = struct {
str: []const u8,
HashResult: type,
@@ -348,18 +351,24 @@ test "phc format - encoding/decoding" {
}
test "phc format - empty input string" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const s = "";
const v = deserialize(struct { alg_id: []const u8 }, s);
try std.testing.expectError(Error.InvalidEncoding, v);
}
test "phc format - hash without salt" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const s = "$scrypt";
const v = deserialize(struct { alg_id: []const u8, hash: BinValue(16) }, s);
try std.testing.expectError(Error.InvalidEncoding, v);
}
test "phc format - calcSize" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const s = "$scrypt$v=1$ln=15,r=8,p=1$c2FsdHNhbHQ$dGVzdHBhc3M";
const v = try deserialize(struct {
alg_id: []const u8,
diff --git a/lib/std/crypto/poly1305.zig b/lib/std/crypto/poly1305.zig
index 5bcb75169d..7bdbabae49 100644
--- a/lib/std/crypto/poly1305.zig
+++ b/lib/std/crypto/poly1305.zig
@@ -196,6 +196,8 @@ pub const Poly1305 = struct {
};
test "poly1305 rfc7439 vector1" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const expected_mac = "\xa8\x06\x1d\xc1\x30\x51\x36\xc6\xc2\x2b\x8b\xaf\x0c\x01\x27\xa9";
const msg = "Cryptographic Forum Research Group";
diff --git a/lib/std/crypto/salsa20.zig b/lib/std/crypto/salsa20.zig
index 9d95331839..a253bf5dd9 100644
--- a/lib/std/crypto/salsa20.zig
+++ b/lib/std/crypto/salsa20.zig
@@ -555,6 +555,8 @@ pub const SealedBox = struct {
const htest = @import("test.zig");
test "(x)salsa20" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const key = [_]u8{0x69} ** 32;
const nonce = [_]u8{0x42} ** 8;
const msg = [_]u8{0} ** 20;
@@ -569,6 +571,8 @@ test "(x)salsa20" {
}
test "xsalsa20poly1305" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var msg: [100]u8 = undefined;
var msg2: [msg.len]u8 = undefined;
var c: [msg.len]u8 = undefined;
@@ -584,6 +588,8 @@ test "xsalsa20poly1305" {
}
test "xsalsa20poly1305 secretbox" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var msg: [100]u8 = undefined;
var msg2: [msg.len]u8 = undefined;
var key: [XSalsa20Poly1305.key_length]u8 = undefined;
@@ -598,6 +604,8 @@ test "xsalsa20poly1305 secretbox" {
}
test "xsalsa20poly1305 box" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var msg: [100]u8 = undefined;
var msg2: [msg.len]u8 = undefined;
var nonce: [Box.nonce_length]u8 = undefined;
@@ -612,6 +620,8 @@ test "xsalsa20poly1305 box" {
}
test "xsalsa20poly1305 sealedbox" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var msg: [100]u8 = undefined;
var msg2: [msg.len]u8 = undefined;
var boxed: [msg.len + SealedBox.seal_length]u8 = undefined;
@@ -623,6 +633,8 @@ test "xsalsa20poly1305 sealedbox" {
}
test "secretbox twoblocks" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
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 };
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 };
const msg = [_]u8{'a'} ** 97;
diff --git a/lib/std/crypto/scrypt.zig b/lib/std/crypto/scrypt.zig
index 8745a3b34e..f830e8f120 100644
--- a/lib/std/crypto/scrypt.zig
+++ b/lib/std/crypto/scrypt.zig
@@ -3,6 +3,7 @@
// https://github.com/Tarsnap/scrypt
const std = @import("std");
+const builtin = @import("builtin");
const crypto = std.crypto;
const fmt = std.fmt;
const io = std.io;
@@ -683,6 +684,8 @@ test "unix-scrypt" {
}
test "crypt format" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D";
const params = try crypt_format.deserialize(crypt_format.HashResult(32), str);
var buf: [str.len]u8 = undefined;
@@ -691,6 +694,8 @@ test "crypt format" {
}
test "kdf fast" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const TestVector = struct {
password: []const u8,
salt: []const u8,
diff --git a/lib/std/crypto/sha2.zig b/lib/std/crypto/sha2.zig
index f87ea90d92..4f09294a30 100644
--- a/lib/std/crypto/sha2.zig
+++ b/lib/std/crypto/sha2.zig
@@ -238,7 +238,7 @@ fn Sha2x32(comptime params: Sha2Params32) type {
return;
},
// C backend doesn't currently support passing vectors to inline asm.
- .x86_64 => if (builtin.zig_backend != .stage2_c and comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .sha, .avx2 })) {
+ .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 })) {
var x: v4u32 = [_]u32{ d.s[5], d.s[4], d.s[1], d.s[0] };
var y: v4u32 = [_]u32{ d.s[7], d.s[6], d.s[3], d.s[2] };
const s_v = @as(*[16]v4u32, @ptrCast(&s));
@@ -406,12 +406,16 @@ fn Sha2x32(comptime params: Sha2Params32) type {
}
test "sha224 single" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try htest.assertEqualHash(Sha224, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", "");
try htest.assertEqualHash(Sha224, "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc");
try htest.assertEqualHash(Sha224, "c97ca9a559850ce97a04a96def6d99a9e0e0e2ab14e6b8df265fc0b3", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
}
test "sha224 streaming" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var h = Sha224.init(.{});
var out: [28]u8 = undefined;
@@ -432,12 +436,16 @@ test "sha224 streaming" {
}
test "sha256 single" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try htest.assertEqualHash(Sha256, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "");
try htest.assertEqualHash(Sha256, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc");
try htest.assertEqualHash(Sha256, "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1", "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu");
}
test "sha256 streaming" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var h = Sha256.init(.{});
var out: [32]u8 = undefined;
@@ -458,6 +466,8 @@ test "sha256 streaming" {
}
test "sha256 aligned final" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var block = [_]u8{0} ** Sha256.block_length;
var out: [Sha256.digest_length]u8 = undefined;
diff --git a/lib/std/crypto/utils.zig b/lib/std/crypto/utils.zig
index ab1b6eab6a..4eb7281bc8 100644
--- a/lib/std/crypto/utils.zig
+++ b/lib/std/crypto/utils.zig
@@ -149,6 +149,8 @@ test "crypto.utils.timingSafeEql" {
}
test "crypto.utils.timingSafeEql (vectors)" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a: [100]u8 = undefined;
var b: [100]u8 = undefined;
random.bytes(a[0..]);
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index 4af395beb4..9598e65b49 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -2513,6 +2513,8 @@ pub fn dumpStackPointerAddr(prefix: []const u8) void {
}
test "manage resources correctly" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (builtin.os.tag == .wasi) return error.SkipZigTest;
if (builtin.os.tag == .windows) {
diff --git a/lib/std/dwarf/expressions.zig b/lib/std/dwarf/expressions.zig
index f89edc08a1..e06aa941af 100644
--- a/lib/std/dwarf/expressions.zig
+++ b/lib/std/dwarf/expressions.zig
@@ -1054,6 +1054,8 @@ fn isOpcodeRegisterLocation(opcode: u8) bool {
const testing = std.testing;
test "DWARF expressions" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const allocator = std.testing.allocator;
const options = ExpressionOptions{};
diff --git a/lib/std/fifo.zig b/lib/std/fifo.zig
index 5b19125e02..72fd44e02d 100644
--- a/lib/std/fifo.zig
+++ b/lib/std/fifo.zig
@@ -505,6 +505,8 @@ test "LinearFifo(u8, .Dynamic)" {
}
test "LinearFifo" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
inline for ([_]type{ u1, u8, u16, u64 }) |T| {
inline for ([_]LinearFifoBufferType{ LinearFifoBufferType{ .Static = 32 }, .Slice, .Dynamic }) |bt| {
const FifoType = LinearFifo(T, bt);
diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig
index 9538d91fa3..611737161e 100644
--- a/lib/std/fmt.zig
+++ b/lib/std/fmt.zig
@@ -2129,6 +2129,8 @@ test "int.small" {
}
test "int.specifier" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
{
const value: u8 = 'a';
try expectFmt("u8: a\n", "u8: {c}\n", .{value});
@@ -2179,6 +2181,8 @@ test "int.padded" {
}
test "buffer" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
{
var buf1: [32]u8 = undefined;
var fbs = std.io.fixedBufferStream(&buf1);
@@ -2375,6 +2379,8 @@ test "float.scientific" {
}
test "float.scientific.precision" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try expectFmt("f64: 1.40971e-42", "f64: {e:.5}", .{@as(f64, 1.409706e-42)});
try expectFmt("f64: 1.00000e-09", "f64: {e:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 814313563))))});
try expectFmt("f64: 7.81250e-03", "f64: {e:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 1006632960))))});
@@ -2435,6 +2441,8 @@ test "float.hexadecimal" {
}
test "float.hexadecimal.precision" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try expectFmt("f16: 0x1.5p-2", "f16: {x:.1}", .{@as(f16, 1.0 / 3.0)});
try expectFmt("f32: 0x1.555p-2", "f32: {x:.3}", .{@as(f32, 1.0 / 3.0)});
try expectFmt("f64: 0x1.55555p-2", "f64: {x:.5}", .{@as(f64, 1.0 / 3.0)});
@@ -2449,6 +2457,8 @@ test "float.hexadecimal.precision" {
}
test "float.decimal" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try expectFmt("f64: 152314000000000000000000000000", "f64: {d}", .{@as(f64, 1.52314e+29)});
try expectFmt("f32: 0", "f32: {d}", .{@as(f32, 0.0)});
try expectFmt("f32: 0", "f32: {d:.0}", .{@as(f32, 0.0)});
@@ -2472,6 +2482,8 @@ test "float.decimal" {
}
test "float.libc.sanity" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try expectFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 916964781))))});
try expectFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 925353389))))});
try expectFmt("f64: 0.10000", "f64: {d:.5}", .{@as(f64, @as(f32, @bitCast(@as(u32, 1036831278))))});
@@ -2491,6 +2503,8 @@ test "float.libc.sanity" {
}
test "custom" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Vec2 = struct {
const SelfType = @This();
x: f32,
@@ -2669,6 +2683,8 @@ test "formatFloatValue with comptime_float" {
}
test "formatType max_depth" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Vec2 = struct {
const SelfType = @This();
x: f32,
@@ -2735,6 +2751,8 @@ test "formatType max_depth" {
}
test "positional" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try expectFmt("2 1 0", "{2} {1} {0}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
try expectFmt("2 1 0", "{2} {1} {}", .{ @as(usize, 0), @as(usize, 1), @as(usize, 2) });
try expectFmt("0 0", "{0} {0}", .{@as(usize, 0)});
@@ -2743,14 +2761,20 @@ test "positional" {
}
test "positional with specifier" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try expectFmt("10.0", "{0d:.1}", .{@as(f64, 9.999)});
}
test "positional/alignment/width/precision" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try expectFmt("10.0", "{0d: >3.1}", .{@as(f64, 9.999)});
}
test "vector" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (builtin.target.cpu.arch == .riscv64) {
// https://github.com/ziglang/zig/issues/4486
return error.SkipZigTest;
diff --git a/lib/std/fmt/parse_float.zig b/lib/std/fmt/parse_float.zig
index 0e9af059d9..b3ab3c9f5e 100644
--- a/lib/std/fmt/parse_float.zig
+++ b/lib/std/fmt/parse_float.zig
@@ -1,8 +1,8 @@
pub const parseFloat = @import("parse_float/parse_float.zig").parseFloat;
pub const ParseFloatError = @import("parse_float/parse_float.zig").ParseFloatError;
-const builtin = @import("builtin");
const std = @import("std");
+const builtin = @import("builtin");
const math = std.math;
const testing = std.testing;
const expect = testing.expect;
@@ -14,6 +14,8 @@ const epsilon = 1e-7;
// See https://github.com/tiehuis/parse-number-fxx-test-data for a wider-selection of test-data.
test "fmt.parseFloat" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
inline for ([_]type{ f16, f32, f64, f128 }) |T| {
try testing.expectError(error.InvalidCharacter, parseFloat(T, ""));
try testing.expectError(error.InvalidCharacter, parseFloat(T, " 1"));
@@ -70,6 +72,8 @@ test "fmt.parseFloat" {
}
test "fmt.parseFloat nan and inf" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
inline for ([_]type{ f16, f32, f64, f128 }) |T| {
const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
@@ -80,16 +84,22 @@ test "fmt.parseFloat nan and inf" {
}
test "fmt.parseFloat #11169" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try expectEqual(try parseFloat(f128, "9007199254740993.0"), 9007199254740993.0);
}
test "fmt.parseFloat hex.special" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testing.expect(math.isNan(try parseFloat(f32, "nAn")));
try testing.expect(math.isPositiveInf(try parseFloat(f32, "iNf")));
try testing.expect(math.isPositiveInf(try parseFloat(f32, "+Inf")));
try testing.expect(math.isNegativeInf(try parseFloat(f32, "-iNf")));
}
test "fmt.parseFloat hex.zero" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0"));
try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "-0x0"));
try testing.expectEqual(@as(f32, 0.0), try parseFloat(f32, "0x0p42"));
@@ -98,6 +108,8 @@ test "fmt.parseFloat hex.zero" {
}
test "fmt.parseFloat hex.f16" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testing.expectEqual(try parseFloat(f16, "0x1p0"), 1.0);
try testing.expectEqual(try parseFloat(f16, "-0x1p-1"), -0.5);
try testing.expectEqual(try parseFloat(f16, "0x10p+10"), 16384.0);
@@ -114,6 +126,8 @@ test "fmt.parseFloat hex.f16" {
}
test "fmt.parseFloat hex.f32" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testing.expectError(error.InvalidCharacter, parseFloat(f32, "0x"));
try testing.expectEqual(try parseFloat(f32, "0x1p0"), 1.0);
try testing.expectEqual(try parseFloat(f32, "-0x1p-1"), -0.5);
@@ -148,6 +162,8 @@ test "fmt.parseFloat hex.f64" {
try testing.expectEqual(try parseFloat(f64, "-0x1p-1074"), -math.floatTrueMin(f64));
}
test "fmt.parseFloat hex.f128" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testing.expectEqual(try parseFloat(f128, "0x1p0"), 1.0);
try testing.expectEqual(try parseFloat(f128, "-0x1p-1"), -0.5);
try testing.expectEqual(try parseFloat(f128, "0x10p+10"), 16384.0);
diff --git a/lib/std/fs.zig b/lib/std/fs.zig
index 62446a29ea..cf58251c5a 100644
--- a/lib/std/fs.zig
+++ b/lib/std/fs.zig
@@ -1459,8 +1459,9 @@ pub const Dir = struct {
try os.mkdiratW(self.fd, sub_path, default_new_dir_mode);
}
- /// Calls makeDir recursively to make an entire path. Returns success if the path
- /// already exists and is a directory.
+ /// Calls makeDir iteratively to make an entire path
+ /// (i.e. creating any parent directories that do not exist).
+ /// Returns success if the path already exists and is a directory.
/// This function is not atomic, and if it returns an error, the file system may
/// have been modified regardless.
pub fn makePath(self: Dir, sub_path: []const u8) !void {
@@ -1483,22 +1484,89 @@ pub const Dir = struct {
}
}
+ /// Calls makeOpenDirAccessMaskW iteratively to make an entire path
+ /// (i.e. creating any parent directories that do not exist).
+ /// Opens the dir if the path already exists and is a directory.
+ /// This function is not atomic, and if it returns an error, the file system may
+ /// have been modified regardless.
+ fn makeOpenPathAccessMaskW(self: Dir, sub_path: []const u8, access_mask: u32, no_follow: bool) OpenError!Dir {
+ const w = os.windows;
+ var it = try path.componentIterator(sub_path);
+ // If there are no components in the path, then create a dummy component with the full path.
+ var component = it.last() orelse path.NativeUtf8ComponentIterator.Component{
+ .name = "",
+ .path = sub_path,
+ };
+
+ while (true) {
+ const sub_path_w = try w.sliceToPrefixedFileW(self.fd, component.path);
+ const is_last = it.peekNext() == null;
+ var result = self.makeOpenDirAccessMaskW(sub_path_w.span().ptr, access_mask, .{
+ .no_follow = no_follow,
+ .create_disposition = if (is_last) w.FILE_OPEN_IF else w.FILE_CREATE,
+ }) catch |err| switch (err) {
+ error.FileNotFound => |e| {
+ component = it.previous() orelse return e;
+ continue;
+ },
+ else => |e| return e,
+ };
+
+ component = it.next() orelse return result;
+ // Don't leak the intermediate file handles
+ result.close();
+ }
+ }
+
/// This function performs `makePath`, followed by `openDir`.
/// If supported by the OS, this operation is atomic. It is not atomic on
/// all operating systems.
+ /// On Windows, this function performs `makeOpenPathAccessMaskW`.
pub fn makeOpenPath(self: Dir, sub_path: []const u8, open_dir_options: OpenDirOptions) !Dir {
- // TODO improve this implementation on Windows; we can avoid 1 call to NtClose
- try self.makePath(sub_path);
- return self.openDir(sub_path, open_dir_options);
+ return switch (builtin.os.tag) {
+ .windows => {
+ const w = os.windows;
+ const base_flags = w.STANDARD_RIGHTS_READ | w.FILE_READ_ATTRIBUTES | w.FILE_READ_EA |
+ w.SYNCHRONIZE | w.FILE_TRAVERSE;
+
+ return self.makeOpenPathAccessMaskW(sub_path, base_flags, open_dir_options.no_follow);
+ },
+ else => {
+ return self.openDir(sub_path, open_dir_options) catch |err| switch (err) {
+ error.FileNotFound => {
+ try self.makePath(sub_path);
+ return self.openDir(sub_path, open_dir_options);
+ },
+ else => |e| return e,
+ };
+ },
+ };
}
/// This function performs `makePath`, followed by `openIterableDir`.
/// If supported by the OS, this operation is atomic. It is not atomic on
/// all operating systems.
pub fn makeOpenPathIterable(self: Dir, sub_path: []const u8, open_dir_options: OpenDirOptions) !IterableDir {
- // TODO improve this implementation on Windows; we can avoid 1 call to NtClose
- try self.makePath(sub_path);
- return self.openIterableDir(sub_path, open_dir_options);
+ return switch (builtin.os.tag) {
+ .windows => {
+ const w = os.windows;
+ const base_flags = w.STANDARD_RIGHTS_READ | w.FILE_READ_ATTRIBUTES | w.FILE_READ_EA |
+ w.SYNCHRONIZE | w.FILE_TRAVERSE | w.FILE_LIST_DIRECTORY;
+
+ return IterableDir{
+ .dir = try self.makeOpenPathAccessMaskW(sub_path, base_flags, open_dir_options.no_follow),
+ };
+ },
+ else => {
+ return self.openIterableDir(sub_path, open_dir_options) catch |err| switch (err) {
+ error.FileNotFound => {
+ try self.makePath(sub_path);
+ return self.openIterableDir(sub_path, open_dir_options);
+ },
+ else => |e| return e,
+ };
+ },
+ };
}
/// This function returns the canonicalized absolute pathname of
@@ -1742,7 +1810,10 @@ pub const Dir = struct {
const base_flags = w.STANDARD_RIGHTS_READ | w.FILE_READ_ATTRIBUTES | w.FILE_READ_EA |
w.SYNCHRONIZE | w.FILE_TRAVERSE;
const flags: u32 = if (iterable) base_flags | w.FILE_LIST_DIRECTORY else base_flags;
- var dir = try self.openDirAccessMaskW(sub_path_w, flags, args.no_follow);
+ var dir = try self.makeOpenDirAccessMaskW(sub_path_w, flags, .{
+ .no_follow = args.no_follow,
+ .create_disposition = w.FILE_OPEN,
+ });
return dir;
}
@@ -1765,7 +1836,12 @@ pub const Dir = struct {
return Dir{ .fd = fd };
}
- fn openDirAccessMaskW(self: Dir, sub_path_w: [*:0]const u16, access_mask: u32, no_follow: bool) OpenError!Dir {
+ const MakeOpenDirAccessMaskWOptions = struct {
+ no_follow: bool,
+ create_disposition: u32,
+ };
+
+ fn makeOpenDirAccessMaskW(self: Dir, sub_path_w: [*:0]const u16, access_mask: u32, flags: MakeOpenDirAccessMaskWOptions) OpenError!Dir {
const w = os.windows;
var result = Dir{
@@ -1786,7 +1862,7 @@ pub const Dir = struct {
.SecurityDescriptor = null,
.SecurityQualityOfService = null,
};
- const open_reparse_point: w.DWORD = if (no_follow) w.FILE_OPEN_REPARSE_POINT else 0x0;
+ const open_reparse_point: w.DWORD = if (flags.no_follow) w.FILE_OPEN_REPARSE_POINT else 0x0;
var io: w.IO_STATUS_BLOCK = undefined;
const rc = w.ntdll.NtCreateFile(
&result.fd,
@@ -1794,13 +1870,14 @@ pub const Dir = struct {
&attr,
&io,
null,
- 0,
+ w.FILE_ATTRIBUTE_NORMAL,
w.FILE_SHARE_READ | w.FILE_SHARE_WRITE,
- w.FILE_OPEN,
+ flags.create_disposition,
w.FILE_DIRECTORY_FILE | w.FILE_SYNCHRONOUS_IO_NONALERT | w.FILE_OPEN_FOR_BACKUP_INTENT | open_reparse_point,
null,
0,
);
+
switch (rc) {
.SUCCESS => return result,
.OBJECT_NAME_INVALID => return error.BadPathName,
@@ -3167,13 +3244,15 @@ fn copy_file(fd_in: os.fd_t, fd_out: os.fd_t, maybe_size: ?u64) CopyFileRawError
}
test {
- if (builtin.os.tag != .wasi) {
- _ = &makeDirAbsolute;
- _ = &makeDirAbsoluteZ;
- _ = &copyFileAbsolute;
- _ = &updateFileAbsolute;
+ if (builtin.zig_backend != .stage2_x86_64) {
+ if (builtin.os.tag != .wasi) {
+ _ = &makeDirAbsolute;
+ _ = &makeDirAbsoluteZ;
+ _ = &copyFileAbsolute;
+ _ = &updateFileAbsolute;
+ }
+ _ = &Dir.copyFile;
}
- _ = &Dir.copyFile;
_ = @import("fs/test.zig");
_ = @import("fs/path.zig");
_ = @import("fs/file.zig");
diff --git a/lib/std/fs/path.zig b/lib/std/fs/path.zig
index 8457991f59..395b5a335d 100644
--- a/lib/std/fs/path.zig
+++ b/lib/std/fs/path.zig
@@ -1507,6 +1507,14 @@ pub fn ComponentIterator(comptime path_type: PathType, comptime T: type) type {
/// For example, if the path is `/a/b/c` and the most recently returned component
/// is `b`, then this will return the `c` component.
pub fn next(self: *Self) ?Component {
+ const peek_result = self.peekNext() orelse return null;
+ self.start_index = peek_result.path.len - peek_result.name.len;
+ self.end_index = peek_result.path.len;
+ return peek_result;
+ }
+
+ /// Like `next`, but does not modify the iterator state.
+ pub fn peekNext(self: Self) ?Component {
var start_index = self.end_index;
while (start_index < self.path.len and path_type.isSep(T, self.path[start_index])) {
start_index += 1;
@@ -1516,11 +1524,9 @@ pub fn ComponentIterator(comptime path_type: PathType, comptime T: type) type {
end_index += 1;
}
if (start_index == end_index) return null;
- self.start_index = start_index;
- self.end_index = end_index;
return .{
- .name = self.path[self.start_index..self.end_index],
- .path = self.path[0..self.end_index],
+ .name = self.path[start_index..end_index],
+ .path = self.path[0..end_index],
};
}
@@ -1529,6 +1535,14 @@ pub fn ComponentIterator(comptime path_type: PathType, comptime T: type) type {
/// For example, if the path is `/a/b/c` and the most recently returned component
/// is `b`, then this will return the `a` component.
pub fn previous(self: *Self) ?Component {
+ const peek_result = self.peekPrevious() orelse return null;
+ self.start_index = peek_result.path.len - peek_result.name.len;
+ self.end_index = peek_result.path.len;
+ return peek_result;
+ }
+
+ /// Like `previous`, but does not modify the iterator state.
+ pub fn peekPrevious(self: Self) ?Component {
var end_index = self.start_index;
while (true) {
if (end_index == self.root_end_index) return null;
@@ -1542,11 +1556,9 @@ pub fn ComponentIterator(comptime path_type: PathType, comptime T: type) type {
start_index -= 1;
}
if (start_index == end_index) return null;
- self.start_index = start_index;
- self.end_index = end_index;
return .{
- .name = self.path[self.start_index..self.end_index],
- .path = self.path[0..self.end_index],
+ .name = self.path[start_index..end_index],
+ .path = self.path[0..end_index],
};
}
};
diff --git a/lib/std/fs/test.zig b/lib/std/fs/test.zig
index 6f607bfa45..2d724a7c2c 100644
--- a/lib/std/fs/test.zig
+++ b/lib/std/fs/test.zig
@@ -124,6 +124,8 @@ fn testWithAllSupportedPathTypes(test_func: anytype) !void {
}
test "Dir.readLink" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
// Create some targets
@@ -161,6 +163,8 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo
}
test "relative symlink to parent directory" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -178,6 +182,8 @@ test "relative symlink to parent directory" {
}
test "openDir" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const allocator = ctx.arena.allocator();
@@ -196,6 +202,8 @@ test "openDir" {
test "accessAbsolute" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -214,6 +222,8 @@ test "accessAbsolute" {
test "openDirAbsolute" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -252,6 +262,8 @@ test "openDir non-cwd parent .." {
else => {},
}
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -273,6 +285,8 @@ test "openDir non-cwd parent .." {
test "readLinkAbsolute" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -323,6 +337,8 @@ fn testReadLinkAbsolute(target_path: []const u8, symlink_path: []const u8) !void
}
test "Dir.Iterator" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp_dir = tmpIterableDir(.{});
defer tmp_dir.cleanup();
@@ -353,6 +369,8 @@ test "Dir.Iterator" {
}
test "Dir.Iterator many entries" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp_dir = tmpIterableDir(.{});
defer tmp_dir.cleanup();
@@ -388,6 +406,8 @@ test "Dir.Iterator many entries" {
}
test "Dir.Iterator twice" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp_dir = tmpIterableDir(.{});
defer tmp_dir.cleanup();
@@ -421,6 +441,8 @@ test "Dir.Iterator twice" {
}
test "Dir.Iterator reset" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp_dir = tmpIterableDir(.{});
defer tmp_dir.cleanup();
@@ -457,6 +479,8 @@ test "Dir.Iterator reset" {
}
test "Dir.Iterator but dir is deleted during iteration" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
@@ -499,6 +523,8 @@ fn contains(entries: *const std.ArrayList(IterableDir.Entry), el: IterableDir.En
test "Dir.realpath smoke test" {
if (!comptime std.os.isGetFdPathSupportedOnTarget(builtin.os)) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const allocator = ctx.arena.allocator();
@@ -549,6 +575,8 @@ test "Dir.realpath smoke test" {
}
test "readAllAlloc" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp_dir = tmpDir(.{});
defer tmp_dir.cleanup();
@@ -585,6 +613,8 @@ test "Dir.statFile" {
// TODO: Re-enable once https://github.com/ziglang/zig/issues/17034 is solved
if (builtin.os.tag == .linux and builtin.link_libc and builtin.abi == .gnu) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const test_file_name = try ctx.transformPath("test_file");
@@ -600,6 +630,8 @@ test "Dir.statFile" {
}
test "directory operations on files" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const test_file_name = try ctx.transformPath("test_file");
@@ -629,6 +661,8 @@ test "file operations on directories" {
// TODO: fix this test on FreeBSD. https://github.com/ziglang/zig/issues/1759
if (builtin.os.tag == .freebsd) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const test_dir_name = try ctx.transformPath("test_dir");
@@ -663,7 +697,23 @@ test "file operations on directories" {
}.impl);
}
+test "makeOpenPath parent dirs do not exist" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
+ var tmp_dir = tmpDir(.{});
+ defer tmp_dir.cleanup();
+
+ var dir = try tmp_dir.dir.makeOpenPath("root_dir/parent_dir/some_dir", .{});
+ dir.close();
+
+ // double check that the full directory structure was created
+ var dir_verification = try tmp_dir.dir.openDir("root_dir/parent_dir/some_dir", .{});
+ dir_verification.close();
+}
+
test "deleteDir" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const test_dir_path = try ctx.transformPath("test_dir");
@@ -685,6 +735,8 @@ test "deleteDir" {
}
test "Dir.rename files" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
// Rename on Windows can hit intermittent AccessDenied errors
@@ -727,6 +779,8 @@ test "Dir.rename files" {
}
test "Dir.rename directories" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
// Rename on Windows can hit intermittent AccessDenied errors
@@ -768,6 +822,8 @@ test "Dir.rename directory onto empty dir" {
// TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
if (builtin.os.tag == .windows) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const test_dir_path = try ctx.transformPath("test_dir");
@@ -789,6 +845,8 @@ test "Dir.rename directory onto non-empty dir" {
// TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
if (builtin.os.tag == .windows) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const test_dir_path = try ctx.transformPath("test_dir");
@@ -815,6 +873,8 @@ test "Dir.rename file <-> dir" {
// TODO: Fix on Windows, see https://github.com/ziglang/zig/issues/6364
if (builtin.os.tag == .windows) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const test_file_path = try ctx.transformPath("test_file");
@@ -830,6 +890,8 @@ test "Dir.rename file <-> dir" {
}
test "rename" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp_dir1 = tmpDir(.{});
defer tmp_dir1.cleanup();
@@ -852,6 +914,8 @@ test "rename" {
test "renameAbsolute" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp_dir = tmpDir(.{});
defer tmp_dir.cleanup();
@@ -910,6 +974,8 @@ test "openSelfExe" {
}
test "makePath, put some files in it, deleteTree" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const allocator = ctx.arena.allocator();
@@ -926,6 +992,8 @@ test "makePath, put some files in it, deleteTree" {
}
test "makePath, put some files in it, deleteTreeMinStackSize" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const allocator = ctx.arena.allocator();
@@ -944,6 +1012,8 @@ test "makePath, put some files in it, deleteTreeMinStackSize" {
test "makePath in a directory that no longer exists" {
if (builtin.os.tag == .windows) return error.SkipZigTest; // Windows returns FileBusy if attempting to remove an open dir
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
try tmp.parent_dir.deleteTree(&tmp.sub_path);
@@ -975,6 +1045,8 @@ fn testFilenameLimits(iterable_dir: IterableDir, maxed_filename: []const u8) !vo
}
test "max file name component lengths" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpIterableDir(.{});
defer tmp.cleanup();
@@ -996,6 +1068,8 @@ test "max file name component lengths" {
}
test "writev, readv" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1038,6 +1112,8 @@ test "writev, readv" {
}
test "pwritev, preadv" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1079,6 +1155,8 @@ test "pwritev, preadv" {
}
test "access file" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const dir_path = try ctx.transformPath("os_test_tmp");
@@ -1095,6 +1173,8 @@ test "access file" {
}
test "sendfile" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1160,6 +1240,8 @@ test "sendfile" {
}
test "copyRangeAll" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1186,6 +1268,8 @@ test "copyRangeAll" {
}
test "copyFile" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const data = "u6wj+JmdF3qHsFPE BUlH2g4gJCmEz0PP";
@@ -1216,6 +1300,8 @@ fn expectFileContents(dir: Dir, file_path: []const u8, data: []const u8) !void {
}
test "AtomicFile" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const allocator = ctx.arena.allocator();
@@ -1242,6 +1328,8 @@ test "AtomicFile" {
test "open file with exclusive nonblocking lock twice" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
@@ -1258,6 +1346,8 @@ test "open file with exclusive nonblocking lock twice" {
test "open file with shared and exclusive nonblocking lock" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
@@ -1274,6 +1364,8 @@ test "open file with shared and exclusive nonblocking lock" {
test "open file with exclusive and shared nonblocking lock" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
const filename = try ctx.transformPath("file_nonblocking_lock_test.txt");
@@ -1288,6 +1380,8 @@ test "open file with exclusive and shared nonblocking lock" {
}
test "open file with exclusive lock twice, make sure second lock waits" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (builtin.single_threaded) return error.SkipZigTest;
if (std.io.is_async) {
@@ -1338,6 +1432,8 @@ test "open file with exclusive lock twice, make sure second lock waits" {
test "open file with exclusive nonblocking lock twice (absolute paths)" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var random_bytes: [12]u8 = undefined;
std.crypto.random.bytes(&random_bytes);
@@ -1372,6 +1468,8 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" {
test "walker" {
if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpIterableDir(.{});
defer tmp.cleanup();
@@ -1425,6 +1523,8 @@ test "walker" {
test "walker without fully iterating" {
if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpIterableDir(.{});
defer tmp.cleanup();
@@ -1448,6 +1548,8 @@ test "walker without fully iterating" {
test ". and .. in fs.Dir functions" {
if (builtin.os.tag == .wasi and builtin.link_libc) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64) {
// https://github.com/ziglang/zig/issues/17134
return error.SkipZigTest;
@@ -1488,6 +1590,8 @@ test ". and .. in fs.Dir functions" {
test ". and .. in absolute functions" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1533,6 +1637,8 @@ test "chmod" {
if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1555,6 +1661,8 @@ test "chown" {
if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1570,6 +1678,8 @@ test "chown" {
}
test "File.Metadata" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1588,6 +1698,8 @@ test "File.Permissions" {
if (builtin.os.tag == .wasi)
return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1614,6 +1726,8 @@ test "File.PermissionsUnix" {
if (builtin.os.tag == .windows or builtin.os.tag == .wasi)
return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1649,6 +1763,8 @@ test "delete a read-only file on windows" {
if (builtin.os.tag != .windows)
return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = testing.tmpDir(.{});
defer tmp.cleanup();
@@ -1679,6 +1795,8 @@ test "delete a read-only file on windows" {
test "delete a setAsCwd directory on Windows" {
if (builtin.os.tag != .windows) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
// Set tmp dir as current working directory.
try tmp.dir.setAsCwd();
diff --git a/lib/std/hash/auto_hash.zig b/lib/std/hash/auto_hash.zig
index c5c6c585eb..c9741c00a2 100644
--- a/lib/std/hash/auto_hash.zig
+++ b/lib/std/hash/auto_hash.zig
@@ -1,5 +1,6 @@
const std = @import("std");
const assert = std.debug.assert;
+const builtin = @import("builtin");
const mem = std.mem;
const meta = std.meta;
@@ -252,6 +253,8 @@ test "typeContainsSlice" {
}
test "hash pointer" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const array = [_]u32{ 123, 123, 123 };
const a = &array[0];
const b = &array[1];
@@ -272,6 +275,8 @@ test "hash pointer" {
}
test "hash slice shallow" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Allocate one array dynamically so that we're assured it is not merged
// with the other by the optimization passes.
const array1 = try std.testing.allocator.create([6]u32);
@@ -290,6 +295,8 @@ test "hash slice shallow" {
}
test "hash slice deep" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Allocate one array dynamically so that we're assured it is not merged
// with the other by the optimization passes.
const array1 = try std.testing.allocator.create([6]u32);
@@ -306,6 +313,8 @@ test "hash slice deep" {
}
test "hash struct deep" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Foo = struct {
a: u32,
b: u16,
@@ -345,6 +354,8 @@ test "hash struct deep" {
}
test "testHash optional" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const a: ?u32 = 123;
const b: ?u32 = null;
try testing.expectEqual(testHash(a), testHash(@as(u32, 123)));
@@ -353,6 +364,8 @@ test "testHash optional" {
}
test "testHash array" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const a = [_]u32{ 1, 2, 3 };
const h = testHash(a);
var hasher = Wyhash.init(0);
@@ -369,6 +382,8 @@ test "testHash multi-dimensional array" {
}
test "testHash struct" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Foo = struct {
a: u32 = 1,
b: u32 = 2,
@@ -384,6 +399,8 @@ test "testHash struct" {
}
test "testHash union" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Foo = union(enum) {
A: u32,
B: bool,
@@ -408,6 +425,8 @@ test "testHash union" {
}
test "testHash vector" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const a: @Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };
const b: @Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };
try testing.expect(testHash(a) == testHash(a));
@@ -420,6 +439,8 @@ test "testHash vector" {
}
test "testHash error union" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Errors = error{Test};
const Foo = struct {
a: u32 = 1,
diff --git a/lib/std/hash/wyhash.zig b/lib/std/hash/wyhash.zig
index 91cdf5007f..9ddb50678a 100644
--- a/lib/std/hash/wyhash.zig
+++ b/lib/std/hash/wyhash.zig
@@ -242,6 +242,8 @@ test "smhasher" {
}
test "iterative api" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Test = struct {
fn do() !void {
try verify.iterativeApi(Wyhash);
diff --git a/lib/std/hash/xxhash.zig b/lib/std/hash/xxhash.zig
index 0c493c3ce8..7454abd711 100644
--- a/lib/std/hash/xxhash.zig
+++ b/lib/std/hash/xxhash.zig
@@ -803,6 +803,8 @@ fn testExpect(comptime H: type, seed: anytype, input: []const u8, expected: u64)
}
test "xxhash3" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const H = XxHash3;
// Non-Seeded Tests
try testExpect(H, 0, "", 0x2d06800538d394c2);
@@ -834,6 +836,8 @@ test "xxhash3" {
}
test "xxhash3 smhasher" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Test = struct {
fn do() !void {
try expectEqual(verify.smhasher(XxHash3.hash), 0x9a636405);
@@ -845,6 +849,8 @@ test "xxhash3 smhasher" {
}
test "xxhash3 iterative api" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Test = struct {
fn do() !void {
try verify.iterativeApi(XxHash3);
@@ -856,6 +862,8 @@ test "xxhash3 iterative api" {
}
test "xxhash64" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const H = XxHash64;
try testExpect(H, 0, "", 0xef46db3751d8e999);
try testExpect(H, 0, "a", 0xd24ec4f1a98c6e5b);
@@ -867,6 +875,8 @@ test "xxhash64" {
}
test "xxhash64 smhasher" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Test = struct {
fn do() !void {
try expectEqual(verify.smhasher(XxHash64.hash), 0x024B7CF4);
@@ -878,6 +888,8 @@ test "xxhash64 smhasher" {
}
test "xxhash64 iterative api" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Test = struct {
fn do() !void {
try verify.iterativeApi(XxHash64);
@@ -889,6 +901,8 @@ test "xxhash64 iterative api" {
}
test "xxhash32" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const H = XxHash32;
try testExpect(H, 0, "", 0x02cc5d05);
@@ -901,6 +915,8 @@ test "xxhash32" {
}
test "xxhash32 smhasher" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Test = struct {
fn do() !void {
try expectEqual(verify.smhasher(XxHash32.hash), 0xBA88B743);
@@ -912,6 +928,8 @@ test "xxhash32 smhasher" {
}
test "xxhash32 iterative api" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Test = struct {
fn do() !void {
try verify.iterativeApi(XxHash32);
diff --git a/lib/std/hash_map.zig b/lib/std/hash_map.zig
index 40a412bf3c..b2fe591a02 100644
--- a/lib/std/hash_map.zig
+++ b/lib/std/hash_map.zig
@@ -1873,6 +1873,8 @@ test "std.hash_map multiple removes on same metadata" {
}
test "std.hash_map put and remove loop in random order" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var map = AutoHashMap(u32, u32).init(std.testing.allocator);
defer map.deinit();
diff --git a/lib/std/heap/general_purpose_allocator.zig b/lib/std/heap/general_purpose_allocator.zig
index 6dc6df3998..235c16ed96 100644
--- a/lib/std/heap/general_purpose_allocator.zig
+++ b/lib/std/heap/general_purpose_allocator.zig
@@ -1042,6 +1042,8 @@ const TraceKind = enum {
const test_config = Config{};
test "small allocations - free in same order" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var gpa = GeneralPurposeAllocator(test_config){};
defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
const allocator = gpa.allocator();
@@ -1061,6 +1063,8 @@ test "small allocations - free in same order" {
}
test "small allocations - free in reverse order" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var gpa = GeneralPurposeAllocator(test_config){};
defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
const allocator = gpa.allocator();
diff --git a/lib/std/http/Client.zig b/lib/std/http/Client.zig
index 23bbd994a9..2a6f12103f 100644
--- a/lib/std/http/Client.zig
+++ b/lib/std/http/Client.zig
@@ -1,6 +1,7 @@
//! Connecting and opening requests are threadsafe. Individual requests are not.
const std = @import("../std.zig");
+const builtin = @import("builtin");
const testing = std.testing;
const http = std.http;
const mem = std.mem;
@@ -490,6 +491,8 @@ pub const Response = struct {
}
test parseInt3 {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const expectEqual = testing.expectEqual;
try expectEqual(@as(u10, 0), parseInt3("000".*));
try expectEqual(@as(u10, 418), parseInt3("418".*));
@@ -650,7 +653,7 @@ pub const Request = struct {
if (!req.headers.contains("user-agent")) {
try w.writeAll("User-Agent: zig/");
- try w.writeAll(@import("builtin").zig_version_string);
+ try w.writeAll(builtin.zig_version_string);
try w.writeAll(" (std.http)\r\n");
}
@@ -1567,7 +1570,6 @@ pub fn fetch(client: *Client, allocator: Allocator, options: FetchOptions) !Fetc
}
test {
- const builtin = @import("builtin");
const native_endian = comptime builtin.cpu.arch.endian();
if (builtin.zig_backend == .stage2_llvm and native_endian == .Big) {
// https://github.com/ziglang/zig/issues/13782
@@ -1576,5 +1578,7 @@ test {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
std.testing.refAllDecls(@This());
}
diff --git a/lib/std/http/Server.zig b/lib/std/http/Server.zig
index 057d1ef5ca..adb1ea0812 100644
--- a/lib/std/http/Server.zig
+++ b/lib/std/http/Server.zig
@@ -736,6 +736,8 @@ test "HTTP server handles a chunked transfer coding request" {
return error.SkipZigTest;
}
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const native_endian = comptime builtin.cpu.arch.endian();
if (builtin.zig_backend == .stage2_llvm and native_endian == .Big) {
// https://github.com/ziglang/zig/issues/13782
diff --git a/lib/std/io/bit_reader.zig b/lib/std/io/bit_reader.zig
index 7ea2ff5009..7b6842561d 100644
--- a/lib/std/io/bit_reader.zig
+++ b/lib/std/io/bit_reader.zig
@@ -164,6 +164,8 @@ pub fn bitReader(
}
test "api coverage" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const mem_be = [_]u8{ 0b11001101, 0b00001011 };
const mem_le = [_]u8{ 0b00011101, 0b10010101 };
diff --git a/lib/std/io/multi_writer.zig b/lib/std/io/multi_writer.zig
index 9cd4600e63..57d58d6713 100644
--- a/lib/std/io/multi_writer.zig
+++ b/lib/std/io/multi_writer.zig
@@ -36,6 +36,7 @@ pub fn multiWriter(streams: anytype) MultiWriter(@TypeOf(streams)) {
const testing = std.testing;
test "MultiWriter" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
var tmp = testing.tmpDir(.{});
defer tmp.cleanup();
var f = try tmp.dir.createFile("t.txt", .{});
diff --git a/lib/std/io/test.zig b/lib/std/io/test.zig
index dfff7b5896..b51d8e8ede 100644
--- a/lib/std/io/test.zig
+++ b/lib/std/io/test.zig
@@ -15,6 +15,8 @@ const native_endian = builtin.target.cpu.arch.endian();
const tmpDir = std.testing.tmpDir;
test "write a file, read it, then delete it" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -61,6 +63,8 @@ test "write a file, read it, then delete it" {
}
test "BitStreams with File Stream" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -106,6 +110,8 @@ test "BitStreams with File Stream" {
}
test "File seek ops" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -133,6 +139,8 @@ test "File seek ops" {
}
test "setEndPos" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -159,6 +167,8 @@ test "setEndPos" {
}
test "updateTimes" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
diff --git a/lib/std/json.zig b/lib/std/json.zig
index aa75d892da..2073be5250 100644
--- a/lib/std/json.zig
+++ b/lib/std/json.zig
@@ -9,6 +9,7 @@
//! The low-level `writeStream` emits syntax-conformant JSON tokens to a `std.io.Writer`.
//! The high-level `stringify` serializes a Zig or `Value` type into JSON.
+const builtin = @import("builtin");
const testing = @import("std").testing;
const ArrayList = @import("std").ArrayList;
@@ -23,6 +24,8 @@ test Scanner {
}
test parseFromSlice {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var parsed_str = try parseFromSlice([]const u8, testing.allocator, "\"a\\u0020b\"", .{});
defer parsed_str.deinit();
try testing.expectEqualSlices(u8, "a b", parsed_str.value);
@@ -35,12 +38,16 @@ test parseFromSlice {
}
test Value {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var parsed = try parseFromSlice(Value, testing.allocator, "{\"anything\": \"goes\"}", .{});
defer parsed.deinit();
try testing.expectEqualSlices(u8, "goes", parsed.value.object.get("anything").?.string);
}
test writeStream {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var out = ArrayList(u8).init(testing.allocator);
defer out.deinit();
var write_stream = writeStream(out.writer(), .{ .whitespace = .indent_2 });
@@ -58,6 +65,8 @@ test writeStream {
}
test stringify {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var out = ArrayList(u8).init(testing.allocator);
defer out.deinit();
diff --git a/lib/std/json/JSONTestSuite_test.zig b/lib/std/json/JSONTestSuite_test.zig
index 30c5907f8b..97a00074d4 100644
--- a/lib/std/json/JSONTestSuite_test.zig
+++ b/lib/std/json/JSONTestSuite_test.zig
@@ -104,6 +104,8 @@ test "i_string_utf16LE_no_BOM.json" {
try any("[\x00\"\x00\xe9\x00\"\x00]\x00");
}
test "i_structure_500_nested_arrays.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try any("[" ** 500 ++ "]" ** 500);
}
test "i_structure_UTF-8_BOM_empty_object.json" {
@@ -359,15 +361,21 @@ test "n_object_bracket_key.json" {
try err("{[: \"x\"}\n");
}
test "n_object_comma_instead_of_colon.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"x\", null}");
}
test "n_object_double_colon.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"x\"::\"b\"}");
}
test "n_object_emoji.json" {
try err("{\xf0\x9f\x87\xa8\xf0\x9f\x87\xad}");
}
test "n_object_garbage_at_end.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\":\"a\" 123}");
}
test "n_object_key_with_single_quotes.json" {
@@ -377,18 +385,26 @@ test "n_object_lone_continuation_byte_in_key_and_trailing_comma.json" {
try err("{\"\xb9\":\"0\",}");
}
test "n_object_missing_colon.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\" b}");
}
test "n_object_missing_key.json" {
try err("{:\"b\"}");
}
test "n_object_missing_semicolon.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\" \"b\"}");
}
test "n_object_missing_value.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\":");
}
test "n_object_no-colon.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\"");
}
test "n_object_non_string_key.json" {
@@ -401,39 +417,59 @@ test "n_object_repeated_null_null.json" {
try err("{null:null,null:null}");
}
test "n_object_several_trailing_commas.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"id\":0,,,,,}");
}
test "n_object_single_quote.json" {
try err("{'a':0}");
}
test "n_object_trailing_comma.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"id\":0,}");
}
test "n_object_trailing_comment.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\":\"b\"}/**/");
}
test "n_object_trailing_comment_open.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\":\"b\"}/**//");
}
test "n_object_trailing_comment_slash_open.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\":\"b\"}//");
}
test "n_object_trailing_comment_slash_open_incomplete.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\":\"b\"}/");
}
test "n_object_two_commas_in_a_row.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\":\"b\",,\"c\":\"d\"}");
}
test "n_object_unquoted_key.json" {
try err("{a: \"b\"}");
}
test "n_object_unterminated-value.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\":\"a");
}
test "n_object_with_single_string.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{ \"foo\" : \"bar\", \"a\" }");
}
test "n_object_with_trailing_garbage.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\":\"b\"}#");
}
test "n_single_space.json" {
@@ -560,6 +596,8 @@ test "n_structure_close_unopened_array.json" {
try err("1]");
}
test "n_structure_comma_instead_of_closing_brace.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"x\": true,");
}
test "n_structure_double_array.json" {
@@ -590,12 +628,18 @@ test "n_structure_object_followed_by_closing_object.json" {
try err("{}}");
}
test "n_structure_object_unclosed_no_value.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"\":");
}
test "n_structure_object_with_comment.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\":/*comment*/\"b\"}");
}
test "n_structure_object_with_trailing_garbage.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\": true} \"x\"");
}
test "n_structure_open_array_apostrophe.json" {
@@ -605,6 +649,8 @@ test "n_structure_open_array_comma.json" {
try err("[,");
}
test "n_structure_open_array_object.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("[{\"\":" ** 50000 ++ "\n");
}
test "n_structure_open_array_open_object.json" {
@@ -644,6 +690,8 @@ test "n_structure_single_star.json" {
try err("*");
}
test "n_structure_trailing_#.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"a\":\"b\"}#{}");
}
test "n_structure_uescaped_LF_before_string.json" {
@@ -662,6 +710,8 @@ test "n_structure_unclosed_array_unfinished_true.json" {
try err("[ false, tru");
}
test "n_structure_unclosed_object.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err("{\"asd\":\"asd\"");
}
test "n_structure_unicode-identifier.json" {
@@ -764,39 +814,61 @@ test "y_number_simple_real.json" {
try ok("[123.456789]");
}
test "y_object.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try ok("{\"asd\":\"sdf\", \"dfg\":\"fgh\"}");
}
test "y_object_basic.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try ok("{\"asd\":\"sdf\"}");
}
test "y_object_duplicated_key.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try ok("{\"a\":\"b\",\"a\":\"c\"}");
}
test "y_object_duplicated_key_and_value.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try ok("{\"a\":\"b\",\"a\":\"b\"}");
}
test "y_object_empty.json" {
try ok("{}");
}
test "y_object_empty_key.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try ok("{\"\":0}");
}
test "y_object_escaped_null_in_key.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try ok("{\"foo\\u0000bar\": 42}");
}
test "y_object_extreme_numbers.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try ok("{ \"min\": -1.0e+28, \"max\": 1.0e+28 }");
}
test "y_object_long_strings.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try ok("{\"x\":[{\"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}], \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"}");
}
test "y_object_simple.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try ok("{\"a\":[]}");
}
test "y_object_string_unicode.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try ok("{\"title\":\"\\u041f\\u043e\\u043b\\u0442\\u043e\\u0440\\u0430 \\u0417\\u0435\\u043c\\u043b\\u0435\\u043a\\u043e\\u043f\\u0430\" }");
}
test "y_object_with_newlines.json" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try ok("{\n\"a\": \"b\"\n}");
}
test "y_string_1_2_3_bytes_UTF-8_sequences.json" {
diff --git a/lib/std/json/dynamic_test.zig b/lib/std/json/dynamic_test.zig
index ad737502ed..a3aa833abb 100644
--- a/lib/std/json/dynamic_test.zig
+++ b/lib/std/json/dynamic_test.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const mem = std.mem;
const testing = std.testing;
const ArenaAllocator = std.heap.ArenaAllocator;
@@ -18,6 +19,8 @@ const jsonReader = @import("scanner.zig").reader;
const JsonReader = @import("scanner.zig").Reader;
test "json.parser.dynamic" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const s =
\\{
\\ "Image": {
@@ -72,6 +75,8 @@ test "json.parser.dynamic" {
const writeStream = @import("./stringify.zig").writeStream;
test "write json then parse it" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var out_buffer: [1000]u8 = undefined;
var fixed_buffer_stream = std.io.fixedBufferStream(&out_buffer);
@@ -120,12 +125,16 @@ fn testParse(allocator: std.mem.Allocator, json_str: []const u8) !Value {
}
test "parsing empty string gives appropriate error" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_allocator.deinit();
try testing.expectError(error.UnexpectedEndOfInput, testParse(arena_allocator.allocator(), ""));
}
test "Value.array allocator should still be usable after parsing" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var parsed = try parseFromSlice(Value, std.testing.allocator, "[]", .{});
defer parsed.deinit();
@@ -138,6 +147,8 @@ test "Value.array allocator should still be usable after parsing" {
}
test "integer after float has proper type" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_allocator.deinit();
const parsed = try testParse(arena_allocator.allocator(),
@@ -150,6 +161,8 @@ test "integer after float has proper type" {
}
test "escaped characters" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena_allocator.deinit();
const input =
@@ -182,6 +195,8 @@ test "escaped characters" {
}
test "Value.jsonStringify" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var vals = [_]Value{
.{ .integer = 1 },
.{ .integer = 2 },
@@ -229,6 +244,8 @@ test "Value.jsonStringify" {
}
test "parseFromValue(std.json.Value,...)" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const str =
\\{
\\ "int": 32,
@@ -246,6 +263,8 @@ test "parseFromValue(std.json.Value,...)" {
}
test "polymorphic parsing" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108
const doc =
\\{ "type": "div",
@@ -291,6 +310,8 @@ test "polymorphic parsing" {
}
test "long object value" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const value = "01234567890123456789";
const doc = "{\"key\":\"" ++ value ++ "\"}";
var fbs = std.io.fixedBufferStream(doc);
@@ -303,6 +324,8 @@ test "long object value" {
}
test "ParseOptions.max_value_len" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var arena = ArenaAllocator.init(testing.allocator);
defer arena.deinit();
@@ -317,6 +340,8 @@ test "ParseOptions.max_value_len" {
}
test "many object keys" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const doc =
\\{
\\ "k1": "v1",
diff --git a/lib/std/json/hashmap_test.zig b/lib/std/json/hashmap_test.zig
index 49d8caffae..1f71d91f7b 100644
--- a/lib/std/json/hashmap_test.zig
+++ b/lib/std/json/hashmap_test.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const testing = std.testing;
const ArrayHashMap = @import("hashmap.zig").ArrayHashMap;
@@ -18,6 +19,8 @@ const T = struct {
};
test "parse json hashmap" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const doc =
\\{
\\ "abc": {"i": 0, "s": "d"},
@@ -33,6 +36,8 @@ test "parse json hashmap" {
}
test "parse json hashmap while streaming" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const doc =
\\{
\\ "abc": {"i": 0, "s": "d"},
@@ -58,6 +63,8 @@ test "parse json hashmap while streaming" {
}
test "parse json hashmap duplicate fields" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena.deinit();
@@ -86,6 +93,8 @@ test "parse json hashmap duplicate fields" {
}
test "stringify json hashmap" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var value = ArrayHashMap(T){};
defer value.deinit(testing.allocator);
{
@@ -123,6 +132,8 @@ test "stringify json hashmap" {
}
test "stringify json hashmap whitespace" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var value = ArrayHashMap(T){};
defer value.deinit(testing.allocator);
try value.map.put(testing.allocator, "abc", .{ .i = 0, .s = "d" });
@@ -147,6 +158,8 @@ test "stringify json hashmap whitespace" {
}
test "json parse from value hashmap" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const doc =
\\{
\\ "abc": {"i": 0, "s": "d"},
diff --git a/lib/std/json/static_test.zig b/lib/std/json/static_test.zig
index 82b0d89044..c977de88e8 100644
--- a/lib/std/json/static_test.zig
+++ b/lib/std/json/static_test.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const testing = std.testing;
const ArenaAllocator = std.heap.ArenaAllocator;
const Allocator = std.mem.Allocator;
@@ -371,6 +372,8 @@ test "test all types" {
}
test "parse" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testing.expectEqual(false, try parseFromSliceLeaky(bool, testing.allocator, "false", .{}));
try testing.expectEqual(true, try parseFromSliceLeaky(bool, testing.allocator, "true", .{}));
try testing.expectEqual(@as(u1, 1), try parseFromSliceLeaky(u1, testing.allocator, "1", .{}));
@@ -389,6 +392,8 @@ test "parse" {
}
test "parse into enum" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = enum(u32) {
Foo = 42,
Bar,
@@ -402,6 +407,8 @@ test "parse into enum" {
}
test "parse into that allocates a slice" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
{
// string as string
const parsed = try parseFromSlice([]u8, testing.allocator, "\"foo\"", .{});
@@ -422,12 +429,16 @@ test "parse into that allocates a slice" {
}
test "parse into sentinel slice" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const parsed = try parseFromSlice([:0]const u8, testing.allocator, "\"\\n\"", .{});
defer parsed.deinit();
try testing.expect(std.mem.eql(u8, parsed.value, "\n"));
}
test "parse into tagged union" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = union(enum) {
nothing,
int: i32,
@@ -443,6 +454,8 @@ test "parse into tagged union" {
}
test "parse into tagged union errors" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = union(enum) {
nothing,
int: i32,
@@ -465,6 +478,8 @@ test "parse into tagged union errors" {
}
test "parse into struct with no fields" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = struct {};
const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});
defer parsed.deinit();
@@ -474,6 +489,8 @@ test "parse into struct with no fields" {
const test_const_value: usize = 123;
test "parse into struct with default const pointer field" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = struct { a: *const usize = &test_const_value };
const parsed = try parseFromSlice(T, testing.allocator, "{}", .{});
defer parsed.deinit();
@@ -489,6 +506,8 @@ const test_default_str_slice: [2][]const u8 = [_][]const u8{
};
test "freeing parsed structs with pointers to default values" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = struct {
int: *const usize = &test_default_usize,
int_ptr: *allowzero align(1) const usize = test_default_usize_ptr,
@@ -502,11 +521,15 @@ test "freeing parsed structs with pointers to default values" {
}
test "parse into struct where destination and source lengths mismatch" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = struct { a: [2]u8 };
try testing.expectError(error.LengthMismatch, parseFromSlice(T, testing.allocator, "{\"a\": \"bbb\"}", .{}));
}
test "parse into struct with misc fields" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = struct {
int: i64,
float: f64,
@@ -582,6 +605,8 @@ test "parse into struct with misc fields" {
}
test "parse into struct with strings and arrays with sentinels" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = struct {
language: [:0]const u8,
language_without_sentinel: []const u8,
@@ -610,6 +635,8 @@ test "parse into struct with strings and arrays with sentinels" {
}
test "parse into struct with duplicate field" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const options_first = ParseOptions{ .duplicate_field_behavior = .use_first };
const options_last = ParseOptions{ .duplicate_field_behavior = .use_last };
@@ -629,6 +656,8 @@ test "parse into struct with duplicate field" {
}
test "parse into struct ignoring unknown fields" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = struct {
int: i64,
language: []const u8,
@@ -667,6 +696,8 @@ test "parse into struct ignoring unknown fields" {
}
test "parse into tuple" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Union = union(enum) {
char: u8,
float: f64,
@@ -722,6 +753,8 @@ const ParseIntoRecursiveUnionDefinitionValue = union(enum) {
};
test "parse into recursive union definition" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = struct {
values: ParseIntoRecursiveUnionDefinitionValue,
};
@@ -743,6 +776,8 @@ const ParseIntoDoubleRecursiveUnionValueSecond = union(enum) {
};
test "parse into double recursive union definition" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = struct {
values: ParseIntoDoubleRecursiveUnionValueFirst,
};
@@ -754,6 +789,8 @@ test "parse into double recursive union definition" {
}
test "parse exponential into int" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = struct { int: i64 };
const r = try parseFromSliceLeaky(T, testing.allocator, "{ \"int\": 4.2e2 }", .{});
try testing.expectEqual(@as(i64, 420), r.int);
@@ -762,6 +799,8 @@ test "parse exponential into int" {
}
test "parseFromTokenSource" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
{
var scanner = JsonScanner.initCompleteInput(testing.allocator, "123");
defer scanner.deinit();
@@ -781,10 +820,14 @@ test "parseFromTokenSource" {
}
test "max_value_len" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testing.expectError(error.ValueTooLong, parseFromSlice([]u8, testing.allocator, "\"0123456789\"", .{ .max_value_len = 5 }));
}
test "parse into vector" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = struct {
vec_i32: @Vector(4, i32),
vec_f32: @Vector(2, f32),
@@ -817,6 +860,8 @@ fn assertKey(
}
}
test "json parse partial" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Inner = struct {
num: u32,
yes: bool,
@@ -872,6 +917,8 @@ test "json parse partial" {
}
test "json parse allocate when streaming" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = struct {
not_const: []u8,
is_const: []const u8,
@@ -902,6 +949,8 @@ test "json parse allocate when streaming" {
}
test "parse at comptime" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const doc =
\\{
\\ "vals": {
diff --git a/lib/std/json/stringify_test.zig b/lib/std/json/stringify_test.zig
index 9baeae9389..d2c4104316 100644
--- a/lib/std/json/stringify_test.zig
+++ b/lib/std/json/stringify_test.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const mem = std.mem;
const testing = std.testing;
@@ -15,6 +16,8 @@ const writeStreamMaxDepth = @import("stringify.zig").writeStreamMaxDepth;
const writeStreamArbitraryDepth = @import("stringify.zig").writeStreamArbitraryDepth;
test "json write stream" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var out_buf: [1024]u8 = undefined;
var slice_stream = std.io.fixedBufferStream(&out_buf);
const out = slice_stream.writer();
@@ -97,6 +100,8 @@ fn getJsonObject(allocator: std.mem.Allocator) !Value {
}
test "stringify null optional fields" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const MyStruct = struct {
optional: ?[]const u8 = null,
required: []const u8 = "something",
@@ -118,6 +123,8 @@ test "stringify null optional fields" {
}
test "stringify basic types" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testStringify("false", false, .{});
try testStringify("true", true, .{});
try testStringify("null", @as(?u8, null), .{});
@@ -134,6 +141,8 @@ test "stringify basic types" {
}
test "stringify string" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testStringify("\"hello\"", "hello", .{});
try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{});
try testStringify("\"with\\nescapes\\r\"", "with\nescapes\r", .{ .escape_unicode = true });
@@ -158,12 +167,16 @@ test "stringify string" {
}
test "stringify many-item sentinel-terminated string" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testStringify("\"hello\"", @as([*:0]const u8, "hello"), .{});
try testStringify("\"with\\nescapes\\r\"", @as([*:0]const u8, "with\nescapes\r"), .{ .escape_unicode = true });
try testStringify("\"with unicode\\u0001\"", @as([*:0]const u8, "with unicode\u{1}"), .{ .escape_unicode = true });
}
test "stringify enums" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const E = enum {
foo,
bar,
@@ -173,11 +186,15 @@ test "stringify enums" {
}
test "stringify enum literals" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testStringify("\"foo\"", .foo, .{});
try testStringify("\"bar\"", .bar, .{});
}
test "stringify tagged unions" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const T = union(enum) {
nothing,
foo: u32,
@@ -189,12 +206,16 @@ test "stringify tagged unions" {
}
test "stringify struct" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testStringify("{\"foo\":42}", struct {
foo: u32,
}{ .foo = 42 }, .{});
}
test "emit_strings_as_arrays" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Should only affect string values, not object keys.
try testStringify("{\"foo\":\"bar\"}", .{ .foo = "bar" }, .{});
try testStringify("{\"foo\":[98,97,114]}", .{ .foo = "bar" }, .{ .emit_strings_as_arrays = true });
@@ -209,6 +230,8 @@ test "emit_strings_as_arrays" {
}
test "stringify struct with indentation" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testStringify(
\\{
\\ "foo": 42,
@@ -254,6 +277,8 @@ test "stringify struct with indentation" {
}
test "stringify struct with void field" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testStringify("{\"foo\":42}", struct {
foo: u32,
bar: void = {},
@@ -261,6 +286,8 @@ test "stringify struct with void field" {
}
test "stringify array of structs" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const MyStruct = struct {
foo: u32,
};
@@ -272,6 +299,8 @@ test "stringify array of structs" {
}
test "stringify struct with custom stringifier" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testStringify("[\"something special\",42]", struct {
foo: u32,
const Self = @This();
@@ -286,12 +315,16 @@ test "stringify struct with custom stringifier" {
}
test "stringify vector" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testStringify("[1,1]", @as(@Vector(2, u32), @splat(1)), .{});
try testStringify("\"AA\"", @as(@Vector(2, u8), @splat('A')), .{});
try testStringify("[65,65]", @as(@Vector(2, u8), @splat('A')), .{ .emit_strings_as_arrays = true });
}
test "stringify tuple" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testStringify("[\"foo\",42]", std.meta.Tuple(&.{ []const u8, usize }){ "foo", 42 }, .{});
}
@@ -378,6 +411,8 @@ fn testStringifyArbitraryDepth(expected: []const u8, value: anytype, options: St
}
test "stringify alloc" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const allocator = std.testing.allocator;
const expected =
\\{"foo":"bar","answer":42,"my_friend":"sammy"}
@@ -389,6 +424,8 @@ test "stringify alloc" {
}
test "comptime stringify" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
comptime testStringifyMaxDepth("false", false, .{}, null) catch unreachable;
comptime testStringifyMaxDepth("false", false, .{}, 0) catch unreachable;
comptime testStringifyArbitraryDepth("false", false, .{}) catch unreachable;
@@ -409,6 +446,8 @@ test "comptime stringify" {
}
test "print" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var out_buf: [1024]u8 = undefined;
var slice_stream = std.io.fixedBufferStream(&out_buf);
const out = slice_stream.writer();
@@ -440,6 +479,8 @@ test "print" {
}
test "nonportable numbers" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testStringify("9999999999999999", 9999999999999999, .{});
try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true });
}
diff --git a/lib/std/json/test.zig b/lib/std/json/test.zig
index 9530ab37a6..453a324b20 100644
--- a/lib/std/json/test.zig
+++ b/lib/std/json/test.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const testing = std.testing;
const parseFromSlice = @import("./static.zig").parseFromSlice;
const validate = @import("./scanner.zig").validate;
@@ -34,11 +35,15 @@ fn testHighLevelDynamicParser(s: []const u8) !void {
// Additional tests not part of test JSONTestSuite.
test "y_trailing_comma_after_empty" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try roundTrip(
\\{"1":[],"2":{},"3":"4"}
);
}
test "n_object_closed_missing_value" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try err(
\\{"a":}
);
diff --git a/lib/std/leb128.zig b/lib/std/leb128.zig
index f6e9b9ea60..7cfbec0b97 100644
--- a/lib/std/leb128.zig
+++ b/lib/std/leb128.zig
@@ -215,6 +215,8 @@ fn test_read_uleb128_seq(comptime T: type, comptime N: usize, encoded: []const u
}
test "deserialize signed LEB128" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Truncated
try testing.expectError(error.EndOfStream, test_read_stream_ileb128(i64, "\x80"));
@@ -361,6 +363,8 @@ test "serialize unsigned LEB128" {
}
test "serialize signed LEB128" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// explicitly test i0 because starting `t` at 0
// will break the while loop
try test_write_leb128(@as(i0, 0));
diff --git a/lib/std/math.zig b/lib/std/math.zig
index 817a98f314..57376f4d61 100644
--- a/lib/std/math.zig
+++ b/lib/std/math.zig
@@ -492,10 +492,13 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T {
}
test "shl" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
// https://github.com/ziglang/zig/issues/12012
return error.SkipZigTest;
}
+
try testing.expect(shl(u8, 0b11111111, @as(usize, 3)) == 0b11111000);
try testing.expect(shl(u8, 0b11111111, @as(usize, 8)) == 0);
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 {
}
test "shr" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
// https://github.com/ziglang/zig/issues/12012
return error.SkipZigTest;
}
+
try testing.expect(shr(u8, 0b11111111, @as(usize, 3)) == 0b00011111);
try testing.expect(shr(u8, 0b11111111, @as(usize, 8)) == 0);
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 {
}
test "rotr" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
// https://github.com/ziglang/zig/issues/12012
return error.SkipZigTest;
}
+
try testing.expect(rotr(u0, 0b0, @as(usize, 3)) == 0b0);
try testing.expect(rotr(u5, 0b00001, @as(usize, 0)) == 0b00001);
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 {
}
test "rotl" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
// https://github.com/ziglang/zig/issues/12012
return error.SkipZigTest;
}
+
try testing.expect(rotl(u0, 0b0, @as(usize, 3)) == 0b0);
try testing.expect(rotl(u5, 0b00001, @as(usize, 0)) == 0b00001);
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 {
}
test "divTrunc" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testDivTrunc();
try comptime testDivTrunc();
}
@@ -776,6 +790,8 @@ pub fn divFloor(comptime T: type, numerator: T, denominator: T) !T {
}
test "divFloor" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testDivFloor();
try comptime testDivFloor();
}
@@ -813,6 +829,8 @@ pub fn divCeil(comptime T: type, numerator: T, denominator: T) !T {
}
test "divCeil" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testDivCeil();
try comptime testDivCeil();
}
@@ -857,6 +875,8 @@ pub fn divExact(comptime T: type, numerator: T, denominator: T) !T {
}
test "divExact" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testDivExact();
try comptime testDivExact();
}
@@ -887,6 +907,8 @@ test "mod" {
try comptime testMod();
}
fn testMod() !void {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testing.expect((mod(i32, -5, 3) catch unreachable) == 1);
try testing.expect((mod(i32, 5, 3) catch unreachable) == 2);
try testing.expectError(error.NegativeDenominator, mod(i32, 10, -1));
@@ -909,6 +931,8 @@ pub fn rem(comptime T: type, numerator: T, denominator: T) !T {
}
test "rem" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testRem();
try comptime testRem();
}
@@ -1261,6 +1285,8 @@ pub fn lerp(a: anytype, b: anytype, t: anytype) @TypeOf(a, b, t) {
}
test "lerp" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testing.expectEqual(@as(f64, 75), lerp(50, 100, 0.5));
try testing.expectEqual(@as(f32, 43.75), lerp(50, 25, 0.25));
try testing.expectEqual(@as(f64, -31.25), lerp(-50, 25, 0.25));
diff --git a/lib/std/math/big/int_test.zig b/lib/std/math/big/int_test.zig
index 668f07b32d..d54c417dfb 100644
--- a/lib/std/math/big/int_test.zig
+++ b/lib/std/math/big/int_test.zig
@@ -71,6 +71,8 @@ test "big.int set negative minimum" {
}
test "big.int set double-width maximum then zero" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));
defer a.deinit();
try a.set(@as(DoubleLimb, 0));
@@ -244,6 +246,8 @@ test "big.int fits" {
}
test "big.int string set" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.init(testing.allocator);
defer a.deinit();
@@ -260,6 +264,8 @@ test "big.int string negative" {
}
test "big.int string set number with underscores" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.init(testing.allocator);
defer a.deinit();
@@ -268,6 +274,8 @@ test "big.int string set number with underscores" {
}
test "big.int string set case insensitive number" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.init(testing.allocator);
defer a.deinit();
@@ -318,6 +326,8 @@ test "big.int twos complement limit set" {
}
test "big.int string to" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 120317241209124781241290847124);
defer a.deinit();
@@ -358,6 +368,8 @@ test "big.int string to base 16" {
}
test "big.int neg string to" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, -123907434);
defer a.deinit();
@@ -380,6 +392,8 @@ test "big.int zero string to" {
}
test "big.int clone" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 1234);
defer a.deinit();
var b = try a.clone();
@@ -517,6 +531,8 @@ test "big.int add multi-single" {
}
test "big.int add multi-multi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var op1: u128 = 0xefefefef7f7f7f7f;
var op2: u128 = 0xfefefefe9f9f9f9f;
var a = try Managed.initSet(testing.allocator, op1);
@@ -618,6 +634,8 @@ test "big.int addWrap single-single, unsigned" {
}
test "big.int subWrap single-single, unsigned" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 0);
defer a.deinit();
@@ -631,6 +649,8 @@ test "big.int subWrap single-single, unsigned" {
}
test "big.int addWrap multi-multi, unsigned, limb aligned" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));
defer a.deinit();
@@ -683,6 +703,8 @@ test "big.int subWrap single-single, signed" {
}
test "big.int addWrap multi-multi, signed, limb aligned" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb));
defer a.deinit();
@@ -733,6 +755,8 @@ test "big.int subSat single-single, unsigned" {
}
test "big.int addSat multi-multi, unsigned, limb aligned" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, maxInt(DoubleLimb));
defer a.deinit();
@@ -818,6 +842,8 @@ test "big.int sub single-single" {
}
test "big.int sub multi-single" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, maxInt(Limb) + 1);
defer a.deinit();
var b = try Managed.initSet(testing.allocator, 1);
@@ -831,6 +857,8 @@ test "big.int sub multi-single" {
}
test "big.int sub multi-multi" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var op1: u128 = 0xefefefefefefefefefefefef;
var op2: u128 = 0xabababababababababababab;
@@ -915,7 +943,10 @@ test "big.int mul multi-single" {
}
test "big.int mul multi-multi" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var op1: u256 = 0x998888efefefefefefefef;
var op2: u256 = 0x333000abababababababab;
@@ -932,6 +963,8 @@ test "big.int mul multi-multi" {
}
test "big.int mul alias r with a" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, maxInt(Limb));
defer a.deinit();
var b = try Managed.initSet(testing.allocator, 2);
@@ -943,6 +976,8 @@ test "big.int mul alias r with a" {
}
test "big.int mul alias r with b" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, maxInt(Limb));
defer a.deinit();
var b = try Managed.initSet(testing.allocator, 2);
@@ -954,6 +989,8 @@ test "big.int mul alias r with b" {
}
test "big.int mul alias r with a and b" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, maxInt(Limb));
defer a.deinit();
@@ -989,6 +1026,8 @@ test "big.int mul 0*0" {
}
test "big.int mul large" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initCapacity(testing.allocator, 50);
defer a.deinit();
var b = try Managed.initCapacity(testing.allocator, 100);
@@ -1036,7 +1075,10 @@ test "big.int mulWrap single-single signed" {
}
test "big.int mulWrap multi-multi unsigned" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var op1: u256 = 0x998888efefefefefefefef;
var op2: u256 = 0x333000abababababababab;
@@ -1053,7 +1095,10 @@ test "big.int mulWrap multi-multi unsigned" {
}
test "big.int mulWrap multi-multi signed" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb) - 1);
defer a.deinit();
@@ -1068,6 +1113,8 @@ test "big.int mulWrap multi-multi signed" {
}
test "big.int mulWrap large" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initCapacity(testing.allocator, 50);
defer a.deinit();
var b = try Managed.initCapacity(testing.allocator, 100);
@@ -1124,6 +1171,8 @@ test "big.int div single-half with rem" {
}
test "big.int div single-single no rem" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// assumes usize is <= 64 bits.
var a = try Managed.initSet(testing.allocator, 1 << 52);
defer a.deinit();
@@ -1141,6 +1190,8 @@ test "big.int div single-single no rem" {
}
test "big.int div single-single with rem" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, (1 << 52) | (1 << 33));
defer a.deinit();
var b = try Managed.initSet(testing.allocator, (1 << 35));
@@ -1157,6 +1208,8 @@ test "big.int div single-single with rem" {
}
test "big.int div multi-single no rem" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var op1: u128 = 0xffffeeeeddddcccc;
var op2: u128 = 34;
@@ -1176,6 +1229,8 @@ test "big.int div multi-single no rem" {
}
test "big.int div multi-single with rem" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var op1: u128 = 0xffffeeeeddddcccf;
var op2: u128 = 34;
@@ -1195,6 +1250,8 @@ test "big.int div multi-single with rem" {
}
test "big.int div multi>2-single" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var op1: u128 = 0xfefefefefefefefefefefefefefefefe;
var op2: u128 = 0xefab8;
@@ -1214,6 +1271,8 @@ test "big.int div multi>2-single" {
}
test "big.int div single-single q < r" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 0x0078f432);
defer a.deinit();
var b = try Managed.initSet(testing.allocator, 0x01000000);
@@ -1258,7 +1317,10 @@ test "big.int div q=0 alias" {
}
test "big.int div multi-multi q < r" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
const op1 = 0x1ffffffff0078f432;
const op2 = 0x1ffffffff01000000;
@@ -1374,6 +1436,8 @@ test "big.int div trunc single-single -/-" {
}
test "big.int divTrunc #15535" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var one = try Managed.initSet(testing.allocator, 1);
defer one.deinit();
var x = try Managed.initSet(testing.allocator, std.math.pow(u128, 2, 64));
@@ -1387,6 +1451,8 @@ test "big.int divTrunc #15535" {
}
test "big.int divFloor #10932" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.init(testing.allocator);
defer a.deinit();
@@ -1411,6 +1477,8 @@ test "big.int divFloor #10932" {
}
test "big.int divFloor #11166" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.init(testing.allocator);
defer a.deinit();
@@ -1438,6 +1506,8 @@ test "big.int divFloor #11166" {
}
test "big.int gcd #10932" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.init(testing.allocator);
defer a.deinit();
@@ -1572,6 +1642,8 @@ test "big.int div floor single-single -/-" {
}
test "big.int div floor no remainder negative quotient" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const u: i32 = -0x80000000;
const v: i32 = 1;
@@ -1629,7 +1701,10 @@ test "big.int div floor positive close to zero" {
}
test "big.int div multi-multi with rem" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeeddddccccbbbbaaaa9999);
defer a.deinit();
@@ -1647,7 +1722,10 @@ test "big.int div multi-multi with rem" {
}
test "big.int div multi-multi no rem" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var a = try Managed.initSet(testing.allocator, 0x8888999911110000ffffeeeedb4fec200ee3a4286361);
defer a.deinit();
@@ -1665,7 +1743,10 @@ test "big.int div multi-multi no rem" {
}
test "big.int div multi-multi (2 branch)" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var a = try Managed.initSet(testing.allocator, 0x866666665555555588888887777777761111111111111111);
defer a.deinit();
@@ -1683,7 +1764,10 @@ test "big.int div multi-multi (2 branch)" {
}
test "big.int div multi-multi (3.1/3.3 branch)" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var a = try Managed.initSet(testing.allocator, 0x11111111111111111111111111111111111111111111111111111111111111);
defer a.deinit();
@@ -1701,7 +1785,10 @@ test "big.int div multi-multi (3.1/3.3 branch)" {
}
test "big.int div multi-single zero-limb trailing" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var a = try Managed.initSet(testing.allocator, 0x60000000000000000000000000000000000000000000000000000000000000000);
defer a.deinit();
@@ -1721,7 +1808,10 @@ test "big.int div multi-single zero-limb trailing" {
}
test "big.int div multi-multi zero-limb trailing (with rem)" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);
defer a.deinit();
@@ -1742,7 +1832,10 @@ test "big.int div multi-multi zero-limb trailing (with rem)" {
}
test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count > divisor zero-limb count" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var a = try Managed.initSet(testing.allocator, 0x8666666655555555888888877777777611111111111111110000000000000000);
defer a.deinit();
@@ -1763,7 +1856,10 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li
}
test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-limb count < divisor zero-limb count" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var a = try Managed.initSet(testing.allocator, 0x86666666555555558888888777777776111111111111111100000000000000000000000000000000);
defer a.deinit();
@@ -1786,6 +1882,8 @@ test "big.int div multi-multi zero-limb trailing (with rem) and dividend zero-li
}
test "big.int div multi-multi fuzz case #1" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.init(testing.allocator);
defer a.deinit();
var b = try Managed.init(testing.allocator);
@@ -1810,6 +1908,8 @@ test "big.int div multi-multi fuzz case #1" {
}
test "big.int div multi-multi fuzz case #2" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.init(testing.allocator);
defer a.deinit();
var b = try Managed.init(testing.allocator);
@@ -1882,6 +1982,8 @@ test "big.int truncate multi to multi unsigned" {
}
test "big.int truncate multi to multi signed" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 3 << @bitSizeOf(Limb));
defer a.deinit();
@@ -1891,6 +1993,8 @@ test "big.int truncate multi to multi signed" {
}
test "big.int truncate negative multi to single" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, -@as(SignedDoubleLimb, maxInt(Limb) + 1));
defer a.deinit();
@@ -1997,6 +2101,8 @@ test "big.int shift-right multi" {
}
test "big.int shift-left single" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 0xffff);
defer a.deinit();
try a.shiftLeft(&a, 16);
@@ -2041,6 +2147,8 @@ test "big.int sat shift-left simple unsigned" {
}
test "big.int sat shift-left simple unsigned no sat" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 1);
defer a.deinit();
try a.shiftLeftSat(&a, 16, .unsigned, 21);
@@ -2097,6 +2205,8 @@ test "big.int sat shift-left signed simple positive" {
}
test "big.int sat shift-left signed multi positive" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var x: SignedDoubleLimb = 1;
const shift = @bitSizeOf(SignedDoubleLimb) - 1;
@@ -2108,6 +2218,8 @@ test "big.int sat shift-left signed multi positive" {
}
test "big.int sat shift-left signed multi negative" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var x: SignedDoubleLimb = -1;
const shift = @bitSizeOf(SignedDoubleLimb) - 1;
@@ -2294,6 +2406,8 @@ test "big.int bitwise xor simple" {
}
test "big.int bitwise xor multi-limb" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var x: DoubleLimb = maxInt(Limb) + 1;
var y: DoubleLimb = maxInt(Limb);
var a = try Managed.initSet(testing.allocator, x);
@@ -2468,6 +2582,8 @@ test "big.int var args" {
}
test "big.int gcd non-one small" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 17);
defer a.deinit();
var b = try Managed.initSet(testing.allocator, 97);
@@ -2481,6 +2597,8 @@ test "big.int gcd non-one small" {
}
test "big.int gcd non-one medium" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 4864);
defer a.deinit();
var b = try Managed.initSet(testing.allocator, 3458);
@@ -2494,6 +2612,8 @@ test "big.int gcd non-one medium" {
}
test "big.int gcd non-one large" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 0xffffffffffffffff);
defer a.deinit();
var b = try Managed.initSet(testing.allocator, 0xffffffffffffffff7777);
@@ -2507,7 +2627,10 @@ test "big.int gcd non-one large" {
}
test "big.int gcd large multi-limb result" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var a = try Managed.initSet(testing.allocator, 0x12345678123456781234567812345678123456781234567812345678);
defer a.deinit();
@@ -2523,6 +2646,8 @@ test "big.int gcd large multi-limb result" {
}
test "big.int gcd one large" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 1897056385327307);
defer a.deinit();
var b = try Managed.initSet(testing.allocator, 2251799813685248);
@@ -2547,6 +2672,8 @@ test "big.int mutable to managed" {
}
test "big.int const to managed" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 123423453456);
defer a.deinit();
@@ -2557,6 +2684,8 @@ test "big.int const to managed" {
}
test "big.int pow" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
{
var a = try Managed.initSet(testing.allocator, -3);
defer a.deinit();
@@ -2612,6 +2741,8 @@ test "big.int pow" {
}
test "big.int sqrt" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var r = try Managed.init(testing.allocator);
defer r.deinit();
var a = try Managed.init(testing.allocator);
@@ -2642,6 +2773,8 @@ test "big.int sqrt" {
}
test "big.int regression test for 1 limb overflow with alias" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Note these happen to be two consecutive Fibonacci sequence numbers, the
// first two whose sum exceeds 2**64.
var a = try Managed.initSet(testing.allocator, 7540113804746346429);
@@ -2656,6 +2789,8 @@ test "big.int regression test for 1 limb overflow with alias" {
}
test "big.int regression test for realloc with alias" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Note these happen to be two consecutive Fibonacci sequence numbers, the
// second of which is the first such number to exceed 2**192.
var a = try Managed.initSet(testing.allocator, 5611500259351924431073312796924978741056961814867751431689);
@@ -2670,6 +2805,8 @@ test "big.int regression test for realloc with alias" {
}
test "big int popcount" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.init(testing.allocator);
defer a.deinit();
@@ -2750,6 +2887,8 @@ fn popCountTest(val: *const Managed, bit_count: usize, expected: usize) !void {
}
test "big int conversion read/write twos complement" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, (1 << 493) - 1);
defer a.deinit();
var b = try Managed.initSet(testing.allocator, (1 << 493) - 1);
@@ -2848,6 +2987,8 @@ test "big int write twos complement +/- zero" {
}
test "big int conversion write twos complement with padding" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 0x01_ffffffff_ffffffff_ffffffff);
defer a.deinit();
@@ -3031,6 +3172,8 @@ fn byteSwapTest(comptime T: type, comptime input: comptime_int, comptime expecte
}
test "big int byte swap" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 0x01_ffffffff_ffffffff_ffffffff);
defer a.deinit();
@@ -3075,6 +3218,8 @@ test "big int byte swap" {
}
test "big.int mul multi-multi alias r with a and b" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb));
defer a.deinit();
@@ -3091,6 +3236,8 @@ test "big.int mul multi-multi alias r with a and b" {
}
test "big.int sqr multi alias r with a" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Managed.initSet(testing.allocator, 2 * maxInt(Limb));
defer a.deinit();
diff --git a/lib/std/math/big/rational.zig b/lib/std/math/big/rational.zig
index ee641adf50..a7b2e0b52b 100644
--- a/lib/std/math/big/rational.zig
+++ b/lib/std/math/big/rational.zig
@@ -1,4 +1,5 @@
const std = @import("../../std.zig");
+const builtin = @import("builtin");
const debug = std.debug;
const math = std.math;
const mem = std.mem;
@@ -493,6 +494,8 @@ fn extractLowBits(a: Int, comptime T: type) T {
}
test "big.rational extractLowBits" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Int.initSet(testing.allocator, 0x11112222333344441234567887654321);
defer a.deinit();
@@ -513,6 +516,8 @@ test "big.rational extractLowBits" {
}
test "big.rational set" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
@@ -542,6 +547,8 @@ test "big.rational set" {
}
test "big.rational setFloat" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
@@ -567,6 +574,8 @@ test "big.rational setFloat" {
}
test "big.rational setFloatString" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
@@ -578,6 +587,8 @@ test "big.rational setFloatString" {
}
test "big.rational toFloat" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
@@ -591,6 +602,8 @@ test "big.rational toFloat" {
}
test "big.rational set/to Float round-trip" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
var prng = std.rand.DefaultPrng.init(0x5EED);
@@ -604,6 +617,8 @@ test "big.rational set/to Float round-trip" {
}
test "big.rational copy" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
@@ -634,6 +649,8 @@ test "big.rational copy" {
}
test "big.rational negate" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
@@ -651,6 +668,8 @@ test "big.rational negate" {
}
test "big.rational abs" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
@@ -668,6 +687,8 @@ test "big.rational abs" {
}
test "big.rational swap" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
var b = try Rational.init(testing.allocator);
@@ -692,6 +713,8 @@ test "big.rational swap" {
}
test "big.rational order" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
var b = try Rational.init(testing.allocator);
@@ -707,6 +730,8 @@ test "big.rational order" {
}
test "big.rational order/orderAbs with negative" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
var b = try Rational.init(testing.allocator);
@@ -719,6 +744,8 @@ test "big.rational order/orderAbs with negative" {
}
test "big.rational add single-limb" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
var b = try Rational.init(testing.allocator);
@@ -734,6 +761,8 @@ test "big.rational add single-limb" {
}
test "big.rational add" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
var b = try Rational.init(testing.allocator);
@@ -750,6 +779,8 @@ test "big.rational add" {
}
test "big.rational sub" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
var b = try Rational.init(testing.allocator);
@@ -766,6 +797,8 @@ test "big.rational sub" {
}
test "big.rational mul" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var a = try Rational.init(testing.allocator);
defer a.deinit();
var b = try Rational.init(testing.allocator);
@@ -782,6 +815,8 @@ test "big.rational mul" {
}
test "big.rational div" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
{
var a = try Rational.init(testing.allocator);
defer a.deinit();
diff --git a/lib/std/math/ilogb.zig b/lib/std/math/ilogb.zig
index 735a2250c9..f3cfc5f6fe 100644
--- a/lib/std/math/ilogb.zig
+++ b/lib/std/math/ilogb.zig
@@ -6,6 +6,7 @@
// https://git.musl-libc.org/cgit/musl/tree/src/math/ilogb.c
const std = @import("../std.zig");
+const builtin = @import("builtin");
const math = std.math;
const expect = std.testing.expect;
const maxInt = std.math.maxInt;
@@ -108,6 +109,8 @@ test "64" {
}
test "80" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try expect(ilogbX(f80, 0.0) == fp_ilogb0);
try expect(ilogbX(f80, 0.5) == -1);
try expect(ilogbX(f80, 0.8923) == -1);
@@ -122,6 +125,8 @@ test "80" {
}
test "128" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try expect(ilogbX(f128, 0.0) == fp_ilogb0);
try expect(ilogbX(f128, 0.5) == -1);
try expect(ilogbX(f128, 0.8923) == -1);
@@ -157,6 +162,8 @@ test "64 special" {
}
test "80 special" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try expect(ilogbX(f80, math.inf(f80)) == maxInt(i32));
try expect(ilogbX(f80, -math.inf(f80)) == maxInt(i32));
try expect(ilogbX(f80, 0.0) == minInt(i32));
@@ -164,6 +171,8 @@ test "80 special" {
}
test "128 special" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try expect(ilogbX(f128, math.inf(f128)) == maxInt(i32));
try expect(ilogbX(f128, -math.inf(f128)) == maxInt(i32));
try expect(ilogbX(f128, 0.0) == minInt(i32));
diff --git a/lib/std/math/ldexp.zig b/lib/std/math/ldexp.zig
index d32a8189b6..c42b5703e0 100644
--- a/lib/std/math/ldexp.zig
+++ b/lib/std/math/ldexp.zig
@@ -67,6 +67,7 @@ pub fn ldexp(x: anytype, n: i32) @TypeOf(x) {
}
test "math.ldexp" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
// subnormals
try expect(ldexp(@as(f16, 0x1.1FFp14), -14 - 9 - 15) == math.floatTrueMin(f16));
diff --git a/lib/std/math/log10.zig b/lib/std/math/log10.zig
index 785f11771c..7544c0f9cc 100644
--- a/lib/std/math/log10.zig
+++ b/lib/std/math/log10.zig
@@ -170,11 +170,11 @@ test "log10_int vs old implementation" {
test "log10_int close to powers of 10" {
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
- if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_llvm and comptime builtin.target.isWasm()) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
const int_types = .{ u8, u16, u32, u64, u128, u256, u512 };
const max_log_values: [7]usize = .{ 2, 4, 9, 19, 38, 77, 154 };
diff --git a/lib/std/math/log_int.zig b/lib/std/math/log_int.zig
index d73e273d71..066f983f08 100644
--- a/lib/std/math/log_int.zig
+++ b/lib/std/math/log_int.zig
@@ -56,6 +56,8 @@ pub fn log_int(comptime T: type, base: T, x: T) Log2Int(T) {
}
test "math.log_int" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Test all unsigned integers with 2, 3, ..., 64 bits.
// We cannot test 0 or 1 bits since base must be > 1.
inline for (2..64 + 1) |bits| {
diff --git a/lib/std/math/nextafter.zig b/lib/std/math/nextafter.zig
index 3a0b2d88a5..56117b36d9 100644
--- a/lib/std/math/nextafter.zig
+++ b/lib/std/math/nextafter.zig
@@ -103,6 +103,8 @@ fn nextAfterFloat(comptime T: type, x: T, y: T) T {
}
test "math.nextAfter.int" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try expect(nextAfter(i0, 0, 0) == 0);
try expect(nextAfter(u0, 0, 0) == 0);
try expect(nextAfter(i1, 0, 0) == 0);
diff --git a/lib/std/math/scalbn.zig b/lib/std/math/scalbn.zig
index 2c8c3733fa..4515cda5b0 100644
--- a/lib/std/math/scalbn.zig
+++ b/lib/std/math/scalbn.zig
@@ -7,6 +7,8 @@ const expect = std.testing.expect;
pub const scalbn = @import("ldexp.zig").ldexp;
test "math.scalbn" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Verify we are using base 2.
try expect(scalbn(@as(f16, 1.5), 4) == 24.0);
try expect(scalbn(@as(f32, 1.5), 4) == 24.0);
diff --git a/lib/std/mem.zig b/lib/std/mem.zig
index e9d957d387..cf9369fbe4 100644
--- a/lib/std/mem.zig
+++ b/lib/std/mem.zig
@@ -315,6 +315,8 @@ pub fn zeroes(comptime T: type) T {
}
test "zeroes" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const C_struct = extern struct {
x: u32,
y: u32 align(128),
@@ -1023,6 +1025,8 @@ pub fn indexOfSentinel(comptime T: type, comptime sentinel: T, p: [*:sentinel]co
}
test "indexOfSentinel vector paths" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Types = [_]type{ u8, u16, u32, u64 };
const allocator = std.testing.allocator;
@@ -1737,6 +1741,8 @@ pub fn readIntSlice(comptime T: type, bytes: []const u8, endian: Endian) T {
}
test "comptime read/write int" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
comptime {
var bytes: [2]u8 = undefined;
writeIntLittle(u16, &bytes, 0x1234);
@@ -1752,7 +1758,10 @@ test "comptime read/write int" {
}
test "readIntBig and readIntLittle" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
try testing.expect(readIntSliceBig(u0, &[_]u8{}) == 0x0);
try testing.expect(readIntSliceLittle(u0, &[_]u8{}) == 0x0);
@@ -2053,7 +2062,10 @@ pub fn writeVarPackedInt(bytes: []u8, bit_offset: usize, bit_count: usize, value
}
test "writeIntBig and writeIntLittle" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var buf0: [0]u8 = undefined;
var buf1: [1]u8 = undefined;
@@ -3297,6 +3309,8 @@ test "testStringEquality" {
}
test "testReadInt" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testReadIntImpl();
try comptime testReadIntImpl();
}
@@ -4650,8 +4664,10 @@ pub fn alignInSlice(slice: anytype, comptime new_alignment: usize) ?AlignedSlice
}
test "read/write(Var)PackedInt" {
- if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
-
+ switch (builtin.zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
switch (builtin.cpu.arch) {
// This test generates too much code to execute on WASI.
// LLVM backend fails with "too many locals: locals exceed maximum"
diff --git a/lib/std/multi_array_list.zig b/lib/std/multi_array_list.zig
index 11dec78036..eca1301320 100644
--- a/lib/std/multi_array_list.zig
+++ b/lib/std/multi_array_list.zig
@@ -583,6 +583,8 @@ pub fn MultiArrayList(comptime T: type) type {
}
test "basic usage" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const ally = testing.allocator;
const Foo = struct {
@@ -677,6 +679,8 @@ test "basic usage" {
// This was observed to fail on aarch64 with LLVM 11, when the capacityInBytes
// function used the @reduce code path.
test "regression test for @reduce bug" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const ally = testing.allocator;
var list = MultiArrayList(struct {
tag: std.zig.Token.Tag,
@@ -754,6 +758,8 @@ test "regression test for @reduce bug" {
}
test "ensure capacity on empty list" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const ally = testing.allocator;
const Foo = struct {
@@ -789,6 +795,8 @@ test "ensure capacity on empty list" {
}
test "insert elements" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const ally = testing.allocator;
const Foo = struct {
@@ -808,6 +816,8 @@ test "insert elements" {
}
test "union" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const ally = testing.allocator;
const Foo = union(enum) {
@@ -863,6 +873,8 @@ test "union" {
}
test "sorting a span" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var list: MultiArrayList(struct { score: u32, chr: u8 }) = .{};
defer list.deinit(testing.allocator);
@@ -903,6 +915,8 @@ test "sorting a span" {
}
test "0 sized struct field" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const ally = testing.allocator;
const Foo = struct {
@@ -930,6 +944,8 @@ test "0 sized struct field" {
}
test "0 sized struct" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const ally = testing.allocator;
const Foo = struct {
diff --git a/lib/std/net/test.zig b/lib/std/net/test.zig
index fd92c64f35..1bacfe867f 100644
--- a/lib/std/net/test.zig
+++ b/lib/std/net/test.zig
@@ -5,6 +5,7 @@ const mem = std.mem;
const testing = std.testing;
test "parse and render IPv6 addresses" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
if (builtin.os.tag == .wasi) return error.SkipZigTest;
var buffer: [100]u8 = undefined;
@@ -70,6 +71,7 @@ test "invalid but parseable IPv6 scope ids" {
}
test "parse and render IPv4 addresses" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
if (builtin.os.tag == .wasi) return error.SkipZigTest;
var buffer: [18]u8 = undefined;
@@ -109,6 +111,8 @@ test "parse and render UNIX addresses" {
test "resolve DNS" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (builtin.os.tag == .windows) {
_ = try std.os.windows.WSAStartup(2, 2);
}
@@ -291,6 +295,8 @@ test "listen on a unix socket, send bytes, receive bytes" {
if (builtin.single_threaded) return error.SkipZigTest;
if (!net.has_unix_sockets) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (builtin.os.tag == .windows) {
_ = try std.os.windows.WSAStartup(2, 2);
}
diff --git a/lib/std/once.zig b/lib/std/once.zig
index f012e017dd..87f81ee59c 100644
--- a/lib/std/once.zig
+++ b/lib/std/once.zig
@@ -46,6 +46,8 @@ fn incr() void {
}
test "Once executes its function just once" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (builtin.single_threaded) {
global_once.call();
global_once.call();
diff --git a/lib/std/os/linux/io_uring.zig b/lib/std/os/linux/io_uring.zig
index 7f7dd21f95..91a9f1618c 100644
--- a/lib/std/os/linux/io_uring.zig
+++ b/lib/std/os/linux/io_uring.zig
@@ -1741,6 +1741,8 @@ test "readv" {
test "writev/fsync/readv" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(4, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -1811,6 +1813,8 @@ test "writev/fsync/readv" {
test "write/read" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -1858,6 +1862,8 @@ test "write/read" {
test "splice/read" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(4, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -1929,6 +1935,8 @@ test "splice/read" {
test "write_fixed/read_fixed" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -1994,6 +2002,8 @@ test "write_fixed/read_fixed" {
test "openat" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -2045,6 +2055,8 @@ test "openat" {
test "close" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -2204,6 +2216,8 @@ test "sendmsg/recvmsg" {
test "timeout (after a relative time)" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -2268,6 +2282,8 @@ test "timeout (after a number of completions)" {
test "timeout_remove" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -2376,6 +2392,8 @@ test "accept/connect/recv/link_timeout" {
test "fallocate" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -2422,6 +2440,8 @@ test "fallocate" {
test "statx" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -2678,6 +2698,8 @@ test "shutdown" {
test "renameat" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -2747,6 +2769,8 @@ test "renameat" {
test "unlinkat" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -2799,6 +2823,8 @@ test "unlinkat" {
test "mkdirat" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -2843,6 +2869,8 @@ test "mkdirat" {
test "symlinkat" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
@@ -2891,6 +2919,8 @@ test "symlinkat" {
test "linkat" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
diff --git a/lib/std/os/linux/test.zig b/lib/std/os/linux/test.zig
index 170bde6334..1c2ca643b2 100644
--- a/lib/std/os/linux/test.zig
+++ b/lib/std/os/linux/test.zig
@@ -8,6 +8,8 @@ const expectEqual = std.testing.expectEqual;
const fs = std.fs;
test "fallocate" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
@@ -69,6 +71,8 @@ test "timer" {
}
test "statx" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
@@ -107,6 +111,8 @@ test "user and group ids" {
}
test "fadvise" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig
index c74733cd93..ca3de5f264 100644
--- a/lib/std/os/test.zig
+++ b/lib/std/os/test.zig
@@ -88,6 +88,8 @@ test "chdir smoke test" {
test "open smoke test" {
if (native_os == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// TODO verify file attributes using `fstat`
var tmp = tmpDir(.{});
@@ -142,6 +144,8 @@ test "open smoke test" {
test "openat smoke test" {
if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// TODO verify file attributes using `fstatat`
var tmp = tmpDir(.{});
@@ -276,6 +280,8 @@ test "link with relative paths" {
test "linkat with different directories" {
if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
switch (native_os) {
.wasi, .linux, .solaris, .illumos => {},
else => return error.SkipZigTest,
@@ -321,6 +327,8 @@ test "fstatat" {
// enable when `fstat` and `fstatat` are implemented on Windows
if (native_os == .windows) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -340,6 +348,8 @@ test "fstatat" {
}
test "readlinkat" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -375,6 +385,8 @@ fn testThreadIdFn(thread_id: *Thread.Id) void {
test "std.Thread.getCurrentId" {
if (builtin.single_threaded) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var thread_current_id: Thread.Id = undefined;
const thread = try Thread.spawn(.{}, testThreadIdFn, .{&thread_current_id});
thread.join();
@@ -417,6 +429,9 @@ test "cpu count" {
test "thread local storage" {
if (builtin.single_threaded) return error.SkipZigTest;
+
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const thread1 = try Thread.spawn(.{}, testTls, .{});
const thread2 = try Thread.spawn(.{}, testTls, .{});
try testTls();
@@ -504,6 +519,8 @@ fn iter_fn(info: *dl_phdr_info, size: usize, counter: *usize) IterFnError!void {
test "dl_iterate_phdr" {
if (builtin.object_format != .elf) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var counter: usize = 0;
try os.dl_iterate_phdr(&counter, IterFnError, iter_fn);
try expect(counter != 0);
@@ -566,6 +583,8 @@ test "mmap" {
if (native_os == .windows or native_os == .wasi)
return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -676,6 +695,8 @@ test "fcntl" {
if (native_os == .windows or native_os == .wasi)
return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -716,6 +737,8 @@ test "sync" {
if (native_os != .linux)
return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -736,6 +759,8 @@ test "fsync" {
else => return error.SkipZigTest,
}
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -755,6 +780,8 @@ test "getrlimit and setrlimit" {
return error.SkipZigTest;
}
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
inline for (std.meta.fields(os.rlimit_resource)) |field| {
const resource = @as(os.rlimit_resource, @enumFromInt(field.value));
const limit = try os.getrlimit(resource);
@@ -797,6 +824,8 @@ test "sigaction" {
if (native_os == .wasi or native_os == .windows)
return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// https://github.com/ziglang/zig/issues/7427
if (native_os == .linux and builtin.target.cpu.arch == .x86)
return error.SkipZigTest;
@@ -874,6 +903,8 @@ test "dup & dup2" {
else => return error.SkipZigTest,
}
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -903,6 +934,8 @@ test "dup & dup2" {
test "writev longer than IOV_MAX" {
if (native_os == .windows or native_os == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -920,6 +953,8 @@ test "POSIX file locking with fcntl" {
return error.SkipZigTest;
}
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (true) {
// https://github.com/ziglang/zig/issues/11074
return error.SkipZigTest;
@@ -982,6 +1017,8 @@ test "POSIX file locking with fcntl" {
test "rename smoke test" {
if (native_os == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1038,6 +1075,8 @@ test "rename smoke test" {
test "access smoke test" {
if (native_os == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1102,6 +1141,8 @@ test "timerfd" {
}
test "isatty" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1114,6 +1155,8 @@ test "isatty" {
test "read with empty buffer" {
if (native_os == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1139,6 +1182,8 @@ test "read with empty buffer" {
test "pread with empty buffer" {
if (native_os == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1164,6 +1209,8 @@ test "pread with empty buffer" {
test "write with empty buffer" {
if (native_os == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1189,6 +1236,8 @@ test "write with empty buffer" {
test "pwrite with empty buffer" {
if (native_os == .wasi) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
@@ -1214,6 +1263,8 @@ test "pwrite with empty buffer" {
test "fchmodat smoke test" {
if (!std.fs.has_executable_bit) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var tmp = tmpDir(.{});
defer tmp.cleanup();
diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig
index 05b754de8d..b426db968d 100644
--- a/lib/std/os/windows.zig
+++ b/lib/std/os/windows.zig
@@ -2491,6 +2491,8 @@ pub fn ntToWin32Namespace(path: []const u16) !PathSpace {
}
test "ntToWin32Namespace" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const L = std.unicode.utf8ToUtf16LeStringLiteral;
try testNtToWin32Namespace(L("UNC"), L("\\??\\UNC"));
diff --git a/lib/std/priority_dequeue.zig b/lib/std/priority_dequeue.zig
index 31ae965286..b68bd97d05 100644
--- a/lib/std/priority_dequeue.zig
+++ b/lib/std/priority_dequeue.zig
@@ -705,6 +705,8 @@ test "std.PriorityDequeue: fromOwnedSlice trivial case 1" {
}
test "std.PriorityDequeue: fromOwnedSlice" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 };
const queue_items = try testing.allocator.dupe(u32, items[0..]);
var queue = PDQ.fromOwnedSlice(testing.allocator, queue_items[0..], {});
diff --git a/lib/std/priority_queue.zig b/lib/std/priority_queue.zig
index a568eeadcf..84ee9d6cdf 100644
--- a/lib/std/priority_queue.zig
+++ b/lib/std/priority_queue.zig
@@ -385,6 +385,8 @@ test "std.PriorityQueue: fromOwnedSlice trivial case 1" {
}
test "std.PriorityQueue: fromOwnedSlice" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const items = [_]u32{ 15, 7, 21, 14, 13, 22, 12, 6, 7, 25, 5, 24, 11, 16, 15, 24, 2, 1 };
const heap_items = try testing.allocator.dupe(u32, items[0..]);
var queue = PQlt.fromOwnedSlice(testing.allocator, heap_items[0..], {});
diff --git a/lib/std/rand/Xoshiro256.zig b/lib/std/rand/Xoshiro256.zig
index c72d9ee1a2..29988f1166 100644
--- a/lib/std/rand/Xoshiro256.zig
+++ b/lib/std/rand/Xoshiro256.zig
@@ -90,7 +90,10 @@ pub fn fill(self: *Xoshiro256, buf: []u8) void {
}
test "xoroshiro sequence" {
- if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest;
+ switch (@import("builtin").zig_backend) {
+ .stage2_c, .stage2_x86_64 => return error.SkipZigTest,
+ else => {},
+ }
var r = Xoshiro256.init(0);
diff --git a/lib/std/rand/test.zig b/lib/std/rand/test.zig
index 551e47f8ff..39b25eff15 100644
--- a/lib/std/rand/test.zig
+++ b/lib/std/rand/test.zig
@@ -1,4 +1,5 @@
const std = @import("../std.zig");
+const builtin = @import("builtin");
const math = std.math;
const DefaultPrng = std.rand.DefaultPrng;
const Random = std.rand.Random;
@@ -157,6 +158,8 @@ fn testRandomEnumValue() !void {
}
test "Random intLessThan" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
@setEvalBranchQuota(10000);
try testRandomIntLessThan();
try comptime testRandomIntLessThan();
@@ -199,6 +202,8 @@ fn testRandomIntLessThan() !void {
}
test "Random intAtMost" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
@setEvalBranchQuota(10000);
try testRandomIntAtMost();
try comptime testRandomIntAtMost();
@@ -239,6 +244,8 @@ fn testRandomIntAtMost() !void {
}
test "Random Biased" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var prng = DefaultPrng.init(0);
const random = prng.random();
// Not thoroughly checking the logic here.
@@ -436,6 +443,8 @@ fn testRangeBias(r: Random, start: i8, end: i8, biased: bool) !void {
}
test "CSPRNG" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var secret_seed: [DefaultCsprng.secret_seed_length]u8 = undefined;
std.crypto.random.bytes(&secret_seed);
var csprng = DefaultCsprng.init(secret_seed);
@@ -447,6 +456,8 @@ test "CSPRNG" {
}
test "Random weightedIndex" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
// Make sure weightedIndex works for various integers and floats
inline for (.{ u64, i4, f32, f64 }) |T| {
var prng = DefaultPrng.init(0);
diff --git a/lib/std/segmented_list.zig b/lib/std/segmented_list.zig
index 1c9cffa766..0c73fdc982 100644
--- a/lib/std/segmented_list.zig
+++ b/lib/std/segmented_list.zig
@@ -409,6 +409,8 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type
}
test "SegmentedList basic usage" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testSegmentedList(0);
try testSegmentedList(1);
try testSegmentedList(2);
diff --git a/lib/std/simd.zig b/lib/std/simd.zig
index 93e8534f4a..7629dfac1a 100644
--- a/lib/std/simd.zig
+++ b/lib/std/simd.zig
@@ -196,10 +196,13 @@ pub fn extract(
}
test "vector patterns" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
// https://github.com/ziglang/zig/issues/12012
return error.SkipZigTest;
}
+
const base = @Vector(4, u32){ 10, 20, 30, 40 };
const other_base = @Vector(4, u32){ 55, 66, 77, 88 };
@@ -269,6 +272,8 @@ pub fn reverseOrder(vec: anytype) @TypeOf(vec) {
}
test "vector shifting" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const base = @Vector(4, u32){ 10, 20, 30, 40 };
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)))
}
test "vector searching" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const base = @Vector(8, u32){ 6, 4, 7, 4, 4, 2, 3, 7 };
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
}
test "vector prefix scan" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (comptime builtin.cpu.arch.isMIPS()) {
return error.SkipZigTest;
}
diff --git a/lib/std/sort.zig b/lib/std/sort.zig
index e110a8beb8..149f632944 100644
--- a/lib/std/sort.zig
+++ b/lib/std/sort.zig
@@ -1,5 +1,6 @@
const std = @import("std.zig");
const assert = std.debug.assert;
+const builtin = @import("builtin");
const testing = std.testing;
const mem = std.mem;
const math = std.math;
@@ -176,6 +177,8 @@ const IdAndValue = struct {
};
test "stable sort" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const expected = [_]IdAndValue{
IdAndValue{ .id = 0, .value = 0 },
IdAndValue{ .id = 1, .value = 0 },
@@ -223,6 +226,8 @@ test "stable sort" {
}
test "sort" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const u8cases = [_][]const []const u8{
&[_][]const u8{
"",
@@ -301,6 +306,8 @@ test "sort" {
}
test "sort descending" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const rev_cases = [_][]const []const i32{
&[_][]const i32{
&[_]i32{},
@@ -340,6 +347,8 @@ test "sort descending" {
}
test "sort with context in the middle of a slice" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const Context = struct {
items: []i32,
@@ -379,6 +388,8 @@ test "sort with context in the middle of a slice" {
}
test "sort fuzz testing" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var prng = std.rand.DefaultPrng.init(0x12345678);
const random = prng.random();
const test_case_count = 10;
diff --git a/lib/std/time.zig b/lib/std/time.zig
index c078e97793..1948decdf8 100644
--- a/lib/std/time.zig
+++ b/lib/std/time.zig
@@ -122,6 +122,8 @@ pub fn nanoTimestamp() i128 {
}
test "timestamp" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const margin = ns_per_ms * 50;
const time_0 = milliTimestamp();
@@ -319,6 +321,8 @@ pub const Timer = struct {
};
test "Timer + Instant" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const margin = ns_per_ms * 150;
var timer = try Timer.start();
diff --git a/lib/std/treap.zig b/lib/std/treap.zig
index 383dc1802a..f25ba527fe 100644
--- a/lib/std/treap.zig
+++ b/lib/std/treap.zig
@@ -350,6 +350,8 @@ const TestTreap = Treap(u64, std.math.order);
const TestNode = TestTreap.Node;
test "std.Treap: insert, find, replace, remove" {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var treap = TestTreap{};
var nodes: [10]TestNode = undefined;
diff --git a/lib/std/unicode.zig b/lib/std/unicode.zig
index 46c5432570..b1a9b3db0b 100644
--- a/lib/std/unicode.zig
+++ b/lib/std/unicode.zig
@@ -1,5 +1,6 @@
const std = @import("./std.zig");
const assert = std.debug.assert;
+const builtin = @import("builtin");
const testing = std.testing;
const mem = std.mem;
@@ -200,21 +201,18 @@ pub fn utf8CountCodepoints(s: []const u8) !usize {
pub fn utf8ValidateSlice(input: []const u8) bool {
var remaining = input;
- const V_len = std.simd.suggestVectorSize(usize) orelse 1;
- const V = @Vector(V_len, usize);
- const u8s_in_vector = @sizeOf(usize) * V_len;
+ const chunk_len = std.simd.suggestVectorSize(u8) orelse 1;
+ const Chunk = @Vector(chunk_len, u8);
// Fast path. Check for and skip ASCII characters at the start of the input.
- while (remaining.len >= u8s_in_vector) {
- const chunk: V = @bitCast(remaining[0..u8s_in_vector].*);
- const swapped = mem.littleToNative(V, chunk);
- const reduced = @reduce(.Or, swapped);
- const mask: usize = @bitCast([1]u8{0x80} ** @sizeOf(usize));
- if (reduced & mask != 0) {
- // Found a non ASCII byte
+ while (remaining.len >= chunk_len) {
+ const chunk: Chunk = remaining[0..chunk_len].*;
+ const mask: Chunk = @splat(0x80);
+ if (@reduce(.Or, chunk & mask == mask)) {
+ // found a non ASCII byte
break;
}
- remaining = remaining[u8s_in_vector..];
+ remaining = remaining[chunk_len..];
}
// default lowest and highest continuation byte
@@ -499,11 +497,15 @@ fn testUtf16CountCodepoints() !void {
}
test "utf16 count codepoints" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testUtf16CountCodepoints();
try comptime testUtf16CountCodepoints();
}
test "utf8 encode" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try comptime testUtf8Encode();
try testUtf8Encode();
}
@@ -530,6 +532,8 @@ fn testUtf8Encode() !void {
}
test "utf8 encode error" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try comptime testUtf8EncodeError();
try testUtf8EncodeError();
}
@@ -546,6 +550,8 @@ fn testErrorEncode(codePoint: u21, array: []u8, expectedErr: anyerror) !void {
}
test "utf8 iterator on ascii" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try comptime testUtf8IteratorOnAscii();
try testUtf8IteratorOnAscii();
}
@@ -566,6 +572,8 @@ fn testUtf8IteratorOnAscii() !void {
}
test "utf8 view bad" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try comptime testUtf8ViewBad();
try testUtf8ViewBad();
}
@@ -576,6 +584,8 @@ fn testUtf8ViewBad() !void {
}
test "utf8 view ok" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try comptime testUtf8ViewOk();
try testUtf8ViewOk();
}
@@ -596,6 +606,8 @@ fn testUtf8ViewOk() !void {
}
test "validate slice" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try comptime testValidateSlice();
try testValidateSlice();
@@ -636,6 +648,8 @@ fn testValidateSlice() !void {
}
test "valid utf8" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try comptime testValidUtf8();
try testValidUtf8();
}
@@ -655,6 +669,8 @@ fn testValidUtf8() !void {
}
test "invalid utf8 continuation bytes" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try comptime testInvalidUtf8ContinuationBytes();
try testInvalidUtf8ContinuationBytes();
}
@@ -687,6 +703,8 @@ fn testInvalidUtf8ContinuationBytes() !void {
}
test "overlong utf8 codepoint" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try comptime testOverlongUtf8Codepoint();
try testOverlongUtf8Codepoint();
}
@@ -700,6 +718,8 @@ fn testOverlongUtf8Codepoint() !void {
}
test "misc invalid utf8" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try comptime testMiscInvalidUtf8();
try testMiscInvalidUtf8();
}
@@ -715,6 +735,8 @@ fn testMiscInvalidUtf8() !void {
}
test "utf8 iterator peeking" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try comptime testUtf8Peeking();
try testUtf8Peeking();
}
@@ -799,6 +821,8 @@ pub fn utf16leToUtf8(utf8: []u8, utf16le: []const u16) !usize {
}
test "utf16leToUtf8" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var utf16le: [2]u16 = undefined;
const utf16le_as_bytes = mem.sliceAsBytes(utf16le[0..]);
@@ -911,6 +935,8 @@ pub fn utf8ToUtf16Le(utf16le: []u16, utf8: []const u8) !usize {
}
test "utf8ToUtf16Le" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
var utf16le: [2]u16 = [_]u16{0} ** 2;
{
const length = try utf8ToUtf16Le(utf16le[0..], "𐐷");
@@ -929,6 +955,8 @@ test "utf8ToUtf16Le" {
}
test "utf8ToUtf16LeWithNull" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
{
const utf16 = try utf8ToUtf16LeWithNull(testing.allocator, "𐐷");
defer testing.allocator.free(utf16);
@@ -987,6 +1015,8 @@ fn testCalcUtf16LeLen() !void {
}
test "calculate utf16 string length of given utf8 string in u16" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testCalcUtf16LeLen();
try comptime testCalcUtf16LeLen();
}
@@ -1020,6 +1050,8 @@ pub fn fmtUtf16le(utf16le: []const u16) std.fmt.Formatter(formatUtf16le) {
}
test "fmtUtf16le" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const expectFmt = std.testing.expectFmt;
try expectFmt("", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral(""))});
try expectFmt("foo", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral("foo"))});
@@ -1033,6 +1065,8 @@ test "fmtUtf16le" {
}
test "utf8ToUtf16LeStringLiteral" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
{
const bytes = [_:0]u16{
mem.nativeToLittle(u16, 0x41),
@@ -1093,6 +1127,8 @@ fn testUtf8CountCodepoints() !void {
}
test "utf8 count codepoints" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testUtf8CountCodepoints();
try comptime testUtf8CountCodepoints();
}
@@ -1109,6 +1145,8 @@ fn testUtf8ValidCodepoint() !void {
}
test "utf8 valid codepoint" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testUtf8ValidCodepoint();
try comptime testUtf8ValidCodepoint();
}
diff --git a/lib/std/zig/CrossTarget.zig b/lib/std/zig/CrossTarget.zig
index cf3d109edb..5a28ebda86 100644
--- a/lib/std/zig/CrossTarget.zig
+++ b/lib/std/zig/CrossTarget.zig
@@ -785,6 +785,8 @@ fn parseOs(result: *CrossTarget, diags: *ParseOptions.Diagnostics, text: []const
}
test "CrossTarget.parse" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
if (builtin.target.isGnuLibC()) {
var cross_target = try CrossTarget.parse(.{});
cross_target.setGnuLibCVersion(2, 1, 1);
diff --git a/lib/std/zig/Parse.zig b/lib/std/zig/Parse.zig
index 0187c09108..84c80214e5 100644
--- a/lib/std/zig/Parse.zig
+++ b/lib/std/zig/Parse.zig
@@ -4102,5 +4102,7 @@ const TokenIndex = Ast.TokenIndex;
const Token = std.zig.Token;
test {
+ if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
_ = @import("parser_test.zig");
}
diff --git a/lib/std/zig/fmt.zig b/lib/std/zig/fmt.zig
index 5375b93025..6804af466b 100644
--- a/lib/std/zig/fmt.zig
+++ b/lib/std/zig/fmt.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const builtin = @import("builtin");
const mem = std.mem;
/// 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) {
}
test "escape invalid identifiers" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
const expectFmt = std.testing.expectFmt;
try expectFmt("@\"while\"", "{}", .{fmtId("while")});
try expectFmt("hello", "{}", .{fmtId("hello")});
diff --git a/lib/std/zig/system/darwin.zig b/lib/std/zig/system/darwin.zig
index ade3e7c653..59262beadc 100644
--- a/lib/std/zig/system/darwin.zig
+++ b/lib/std/zig/system/darwin.zig
@@ -13,7 +13,7 @@ pub const macos = @import("darwin/macos.zig");
/// stderr from xcode-select is ignored.
/// If error.OutOfMemory occurs in Allocator, this function returns null.
pub fn isSdkInstalled(allocator: Allocator) bool {
- const result = std.process.Child.exec(.{
+ const result = std.process.Child.run(.{
.allocator = allocator,
.argv = &.{ "/usr/bin/xcode-select", "--print-path" },
}) catch return false;
@@ -44,7 +44,7 @@ pub fn getSdk(allocator: Allocator, target: Target) ?[]const u8 {
else => return null,
};
const argv = &[_][]const u8{ "/usr/bin/xcrun", "--sdk", sdk, "--show-sdk-path" };
- const result = std.process.Child.exec(.{ .allocator = allocator, .argv = argv }) catch return null;
+ const result = std.process.Child.run(.{ .allocator = allocator, .argv = argv }) catch return null;
defer {
allocator.free(result.stderr);
allocator.free(result.stdout);
diff --git a/lib/std/zig/tokenizer.zig b/lib/std/zig/tokenizer.zig
index 72f65afb3a..4cbcb3af72 100644
--- a/lib/std/zig/tokenizer.zig
+++ b/lib/std/zig/tokenizer.zig
@@ -1,4 +1,5 @@
const std = @import("../std.zig");
+const builtin = @import("builtin");
pub const Token = struct {
tag: Tag,
@@ -1449,6 +1450,8 @@ test "chars" {
}
test "invalid token characters" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testTokenize("#", &.{.invalid});
try testTokenize("`", &.{.invalid});
try testTokenize("'c", &.{.invalid});
@@ -1478,6 +1481,8 @@ test "utf8" {
}
test "invalid utf8" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testTokenize("//\x80", &.{
.invalid,
});
@@ -1568,6 +1573,8 @@ test "pipe and then invalid" {
}
test "line comment and doc comment" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testTokenize("//", &.{});
try testTokenize("// a / b", &.{});
try testTokenize("// /", &.{});
@@ -1642,6 +1649,8 @@ test "range literals" {
}
test "number literals decimal" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testTokenize("0", &.{.number_literal});
try testTokenize("1", &.{.number_literal});
try testTokenize("2", &.{.number_literal});
@@ -1890,6 +1899,8 @@ test "invalid token with unfinished escape right before eof" {
}
test "saturating operators" {
+ if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
+
try testTokenize("<<", &.{.angle_bracket_angle_bracket_left});
try testTokenize("<<|", &.{.angle_bracket_angle_bracket_left_pipe});
try testTokenize("<<|=", &.{.angle_bracket_angle_bracket_left_pipe_equal});