From 1a7b4ddeaedb81255cfa8907958c3cf09dd340ee Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Fri, 3 Jun 2022 15:30:25 +0300 Subject: [PATCH] std: disable tests that crash stage2 --- lib/std/compress.zig | 1 + lib/std/event/batch.zig | 1 + lib/std/fmt.zig | 4 ++++ lib/std/segmented_list.zig | 5 ++++- lib/std/unicode.zig | 1 + lib/std/x.zig | 1 + 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/std/compress.zig b/lib/std/compress.zig index 7fa25175d5..1d671f1aa6 100644 --- a/lib/std/compress.zig +++ b/lib/std/compress.zig @@ -5,6 +5,7 @@ pub const gzip = @import("compress/gzip.zig"); pub const zlib = @import("compress/zlib.zig"); test { + if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest; _ = deflate; _ = gzip; _ = zlib; diff --git a/lib/std/event/batch.zig b/lib/std/event/batch.zig index 4165f88f48..ba50d4bee5 100644 --- a/lib/std/event/batch.zig +++ b/lib/std/event/batch.zig @@ -109,6 +109,7 @@ pub fn Batch( } test "std.event.Batch" { + if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest; var count: usize = 0; var batch = Batch(void, 2, .auto_async).init(); batch.add(&async sleepALittle(&count)); diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index 939921535d..20f1319d50 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -2111,6 +2111,7 @@ test "slice" { } test "escape non-printable" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; try expectFmt("abc", "{s}", .{fmtSliceEscapeLower("abc")}); try expectFmt("ab\\xffc", "{s}", .{fmtSliceEscapeLower("ab\xffc")}); try expectFmt("ab\\xFFc", "{s}", .{fmtSliceEscapeUpper("ab\xffc")}); @@ -2146,6 +2147,7 @@ test "cstr" { } test "filesize" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; try expectFmt("file size: 42B\n", "file size: {}\n", .{fmtIntSizeDec(42)}); try expectFmt("file size: 42B\n", "file size: {}\n", .{fmtIntSizeBin(42)}); try expectFmt("file size: 63MB\n", "file size: {}\n", .{fmtIntSizeDec(63 * 1000 * 1000)}); @@ -2445,6 +2447,7 @@ test "struct.zero-size" { } test "bytes.hex" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; const some_bytes = "\xCA\xFE\xBA\xBE"; try expectFmt("lowercase: cafebabe\n", "lowercase: {x}\n", .{fmtSliceHexLower(some_bytes)}); try expectFmt("uppercase: CAFEBABE\n", "uppercase: {X}\n", .{fmtSliceHexUpper(some_bytes)}); @@ -2476,6 +2479,7 @@ pub fn hexToBytes(out: []u8, input: []const u8) ![]u8 { } test "hexToBytes" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; var buf: [32]u8 = undefined; try expectFmt("90" ** 32, "{s}", .{fmtSliceHexUpper(try hexToBytes(&buf, "90" ** 32))}); try expectFmt("ABCD", "{s}", .{fmtSliceHexUpper(try hexToBytes(&buf, "ABCD"))}); diff --git a/lib/std/segmented_list.zig b/lib/std/segmented_list.zig index 72e956a637..81ad6f6211 100644 --- a/lib/std/segmented_list.zig +++ b/lib/std/segmented_list.zig @@ -391,7 +391,10 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type } test "SegmentedList basic usage" { - try testSegmentedList(0); + if (@import("builtin").zig_backend == .stage1) { + // https://github.com/ziglang/zig/issues/11787 + try testSegmentedList(0); + } try testSegmentedList(1); try testSegmentedList(2); try testSegmentedList(4); diff --git a/lib/std/unicode.zig b/lib/std/unicode.zig index 81a7ed838f..a0cf7f6624 100644 --- a/lib/std/unicode.zig +++ b/lib/std/unicode.zig @@ -804,6 +804,7 @@ pub fn fmtUtf16le(utf16le: []const u16) std.fmt.Formatter(formatUtf16le) { } test "fmtUtf16le" { + if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest; const expectFmt = std.testing.expectFmt; try expectFmt("", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral(""))}); try expectFmt("foo", "{}", .{fmtUtf16le(utf8ToUtf16LeStringLiteral("foo"))}); diff --git a/lib/std/x.zig b/lib/std/x.zig index 64caf324ed..bafcdd5426 100644 --- a/lib/std/x.zig +++ b/lib/std/x.zig @@ -13,6 +13,7 @@ pub const net = struct { }; test { + if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest; inline for (.{ os, net }) |module| { std.testing.refAllDecls(module); }