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

This reverts commit 0c99ba1eab, reversing
changes made to 5f92b070bf.

This caused a CI failure when it landed in master branch due to a
128-bit `@byteSwap` in std.mem.
This commit is contained in:
Andrew Kelley
2023-10-22 12:16:35 -07:00
parent 9f0359d78f
commit 6f0198cadb
150 changed files with 183 additions and 1694 deletions

View File

@@ -1,5 +1,4 @@
const std = @import("std");
const builtin = @import("builtin");
const mem = std.mem;
const testing = std.testing;
@@ -16,8 +15,6 @@ 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();
@@ -100,8 +97,6 @@ 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",
@@ -123,8 +118,6 @@ 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), .{});
@@ -141,8 +134,6 @@ 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 });
@@ -167,16 +158,12 @@ 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,
@@ -186,15 +173,11 @@ 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,
@@ -206,16 +189,12 @@ 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 });
@@ -230,8 +209,6 @@ test "emit_strings_as_arrays" {
}
test "stringify struct with indentation" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
try testStringify(
\\{
\\ "foo": 42,
@@ -277,8 +254,6 @@ 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 = {},
@@ -286,8 +261,6 @@ 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,
};
@@ -299,8 +272,6 @@ 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();
@@ -315,16 +286,12 @@ 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 }, .{});
}
@@ -411,8 +378,6 @@ 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"}
@@ -424,8 +389,6 @@ 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;
@@ -446,8 +409,6 @@ 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();
@@ -479,8 +440,6 @@ 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 });
}