From 2e6e39a7004dae626ad3088cbf1e652f157e6db8 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Thu, 19 Oct 2023 02:08:34 -0400 Subject: x86_64: fix bugs and disable erroring tests --- lib/std/net/test.zig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/std/net') diff --git a/lib/std/net/test.zig b/lib/std/net/test.zig index fd92c64f35..d584756080 100644 --- a/lib/std/net/test.zig +++ b/lib/std/net/test.zig @@ -109,6 +109,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 +293,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); } -- cgit v1.2.3 From 32e85d44eb72122d174de02d4020f149026dd787 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Fri, 20 Oct 2023 04:35:29 -0400 Subject: x86_64: disable failing tests, enable test-std testing --- lib/std/Thread/Condition.zig | 6 ++ lib/std/Thread/Mutex.zig | 2 + lib/std/Thread/RwLock.zig | 2 + lib/std/Uri.zig | 2 + lib/std/array_hash_map.zig | 15 +++ lib/std/array_list.zig | 11 ++ lib/std/atomic/Atomic.zig | 2 + lib/std/atomic/queue.zig | 2 + lib/std/bit_set.zig | 9 +- lib/std/compress/deflate/compressor.zig | 2 + lib/std/compress/deflate/compressor_test.zig | 18 ++++ lib/std/compress/deflate/deflate_fast.zig | 2 + lib/std/compress/deflate/deflate_fast_test.zig | 5 + lib/std/compress/deflate/huffman_bit_writer.zig | 6 ++ lib/std/compress/deflate/huffman_code.zig | 2 + lib/std/compress/gzip.zig | 2 + lib/std/compress/lzma/vec2d.zig | 2 + lib/std/compress/xz/test.zig | 2 + lib/std/compress/zlib.zig | 4 + lib/std/compress/zstandard.zig | 2 + lib/std/crypto/poly1305.zig | 2 + lib/std/crypto/scrypt.zig | 5 +- lib/std/debug.zig | 2 + lib/std/dwarf/expressions.zig | 2 + lib/std/fifo.zig | 2 + lib/std/fmt.zig | 16 +++ lib/std/hash/auto_hash.zig | 21 ++++ lib/std/hash/wyhash.zig | 2 + lib/std/hash_map.zig | 2 + lib/std/heap/general_purpose_allocator.zig | 4 + lib/std/io/bit_reader.zig | 2 + lib/std/json.zig | 6 +- lib/std/json/JSONTestSuite_test.zig | 72 +++++++++++++ lib/std/json/test.zig | 5 +- lib/std/leb128.zig | 4 + lib/std/math/big/int_test.zig | 130 ++++++++++++++++++++++-- lib/std/math/ilogb.zig | 9 ++ lib/std/math/ldexp.zig | 1 + lib/std/math/log_int.zig | 2 + lib/std/math/scalbn.zig | 2 + lib/std/mem.zig | 2 + lib/std/net/test.zig | 2 + lib/std/once.zig | 2 + lib/std/os/linux/io_uring.zig | 4 + lib/std/os/test.zig | 11 ++ lib/std/os/windows.zig | 2 + lib/std/priority_dequeue.zig | 2 + lib/std/priority_queue.zig | 2 + lib/std/rand/test.zig | 11 +- lib/std/segmented_list.zig | 2 + lib/std/sort.zig | 11 ++ lib/std/treap.zig | 2 + lib/std/zig/Parse.zig | 2 + lib/std/zig/fmt.zig | 3 + lib/std/zig/tokenizer.zig | 11 +- test/tests.zig | 6 +- 56 files changed, 447 insertions(+), 17 deletions(-) (limited to 'lib/std/net') 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 83e7da7649..02077394ad 100644 --- a/lib/std/Uri.zig +++ b/lib/std/Uri.zig @@ -685,6 +685,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 42b4b23da5..5c89d30fed 100644 --- a/lib/std/atomic/Atomic.zig +++ b/lib/std/atomic/Atomic.zig @@ -469,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 7094cce964..e2d20b387b 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/bit_set.zig b/lib/std/bit_set.zig index c0e38705e3..a96da368de 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,7 @@ fn testStaticBitSet(comptime Set: type) !void { } test "IntegerBitSet" { - switch (@import("builtin").zig_backend) { + switch (builtin.zig_backend) { .stage2_c, .stage2_x86_64 => return error.SkipZigTest, else => {}, } @@ -1652,7 +1653,7 @@ test "IntegerBitSet" { } test "ArrayBitSet" { - switch (@import("builtin").zig_backend) { + switch (builtin.zig_backend) { .stage2_x86_64 => return error.SkipZigTest, else => {}, } @@ -1667,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()); @@ -1720,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/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/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..16290eae1b 100644 --- a/lib/std/compress/zstandard.zig +++ b/lib/std/compress/zstandard.zig @@ -266,6 +266,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/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/scrypt.zig b/lib/std/crypto/scrypt.zig index 6ec7fc6ed2..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,7 +684,7 @@ test "unix-scrypt" { } test "crypt format" { - if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; + 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); @@ -693,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/debug.zig b/lib/std/debug.zig index 95bc8d0eaf..8fcc6989a2 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 5d798cb99d..4d2e4a6c8d 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 94e642a7f1..f5cd2bf744 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, 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_map.zig b/lib/std/hash_map.zig index 43a631baf5..74fecdf0f5 100644 --- a/lib/std/hash_map.zig +++ b/lib/std/hash_map.zig @@ -1872,6 +1872,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/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/json.zig b/lib/std/json.zig index b171dc95f9..2073be5250 100644 --- a/lib/std/json.zig +++ b/lib/std/json.zig @@ -38,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 }); @@ -61,7 +65,7 @@ test writeStream { } test stringify { - if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; + 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/test.zig b/lib/std/json/test.zig index 51c54a14aa..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,13 +35,15 @@ fn testHighLevelDynamicParser(s: []const u8) !void { // Additional tests not part of test JSONTestSuite. test "y_trailing_comma_after_empty" { - if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; + 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/big/int_test.zig b/lib/std/math/big/int_test.zig index f51dad02cc..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; @@ -935,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); @@ -946,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); @@ -957,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(); @@ -992,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); @@ -1077,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); @@ -1133,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(); @@ -1150,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)); @@ -1166,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; @@ -1185,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; @@ -1204,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; @@ -1223,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); @@ -1267,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; @@ -1398,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(); @@ -1422,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(); @@ -1585,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; @@ -1642,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(); @@ -1660,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(); @@ -1678,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(); @@ -1717,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(); @@ -1737,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(); @@ -1758,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(); @@ -1779,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(); @@ -1802,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); @@ -1826,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); @@ -1898,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(); @@ -1907,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(); @@ -2013,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); @@ -2057,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); @@ -2314,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); @@ -2578,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(); @@ -2588,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(); @@ -2643,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); @@ -2673,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); @@ -2687,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); @@ -2701,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(); @@ -2781,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); @@ -2879,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(); @@ -3108,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(); @@ -3124,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/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/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/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 c2ab22680a..cf9369fbe4 100644 --- a/lib/std/mem.zig +++ b/lib/std/mem.zig @@ -1025,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; diff --git a/lib/std/net/test.zig b/lib/std/net/test.zig index d584756080..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; 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 aee444bb7c..91a9f1618c 100644 --- a/lib/std/os/linux/io_uring.zig +++ b/lib/std/os/linux/io_uring.zig @@ -1862,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, @@ -2280,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, diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index 2b34d677dd..ca3de5f264 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -385,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(); @@ -427,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(); @@ -514,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); @@ -773,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); @@ -815,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; 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/test.zig b/lib/std/rand/test.zig index 898945575c..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,7 +443,7 @@ fn testRangeBias(r: Random, start: i8, end: i8, biased: bool) !void { } test "CSPRNG" { - if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; + 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); @@ -449,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/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/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/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/tokenizer.zig b/lib/std/zig/tokenizer.zig index 948aeebf99..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,7 +1481,7 @@ test "utf8" { } test "invalid utf8" { - if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest; + if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; try testTokenize("//\x80", &.{ .invalid, @@ -1570,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("// /", &.{}); @@ -1644,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}); @@ -1892,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}); diff --git a/test/tests.zig b/test/tests.zig index 88ab31aabd..479fe98230 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -1002,8 +1002,10 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { test_target.use_llvm == false and mem.eql(u8, options.name, "universal-libc")) continue; - // TODO get std lib tests passing for self-hosted backends. - if (test_target.use_llvm == false and mem.eql(u8, options.name, "std")) + // TODO get std lib tests passing for other self-hosted backends. + if ((test_target.target.getCpuArch() != .x86_64 or + test_target.target.os_tag != .linux) and + test_target.use_llvm == false and mem.eql(u8, options.name, "std")) continue; const want_this_mode = for (options.optimize_modes) |m| { -- cgit v1.2.3