Commit 521bd2e94a

Jakub Konka <kubkon@jakubkonka.com>
2022-02-01 21:55:34
x86_64: pass more behaviour tests
1 parent 0cccd8a
Changed files (2)
test/behavior/struct.zig
@@ -9,6 +9,8 @@ const maxInt = std.math.maxInt;
 top_level_field: i32,
 
 test "top level fields" {
+    if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
     var instance = @This(){
         .top_level_field = 1234,
     };
@@ -29,6 +31,8 @@ const StructFoo = struct {
 };
 
 test "structs" {
+    if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
     var foo: StructFoo = undefined;
     @memset(@ptrCast([*]u8, &foo), 0, @sizeOf(StructFoo));
     foo.a += 1;
@@ -45,6 +49,8 @@ fn testMutation(foo: *StructFoo) void {
 }
 
 test "struct byval assign" {
+    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
     var foo1: StructFoo = undefined;
     var foo2: StructFoo = undefined;
 
@@ -56,6 +62,8 @@ test "struct byval assign" {
 }
 
 test "call struct static method" {
+    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
     const result = StructWithNoFields.add(3, 4);
     try expect(result == 7);
 }
@@ -85,6 +93,8 @@ const Val = struct {
 };
 
 test "fn call of struct field" {
+    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
     const Foo = struct {
         ptr: fn () i32,
     };
@@ -114,12 +124,16 @@ const MemberFnTestFoo = struct {
 };
 
 test "call member function directly" {
+    if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
     const instance = MemberFnTestFoo{ .x = 1234 };
     const result = MemberFnTestFoo.member(instance);
     try expect(result == 1234);
 }
 
 test "store member function in variable" {
+    if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
     const instance = MemberFnTestFoo{ .x = 1234 };
     const memberFn = MemberFnTestFoo.member;
     const result = memberFn(instance);
@@ -127,6 +141,8 @@ test "store member function in variable" {
 }
 
 test "member functions" {
+    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
     const r = MemberFnRand{ .seed = 1234 };
     try expect(r.getSeed() == 1234);
 }
@@ -138,6 +154,8 @@ const MemberFnRand = struct {
 };
 
 test "return struct byval from function" {
+    if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
     const bar = makeBar2(1234, 5678);
     try expect(bar.y == 5678);
 }
@@ -153,6 +171,8 @@ fn makeBar2(x: i32, y: i32) Bar {
 }
 
 test "call method with mutable reference to struct with no fields" {
+    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
     const S = struct {
         fn doC(s: *const @This()) bool {
             _ = s;
@@ -172,6 +192,8 @@ test "call method with mutable reference to struct with no fields" {
 }
 
 test "usingnamespace within struct scope" {
+    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
     const S = struct {
         usingnamespace struct {
             pub fn inner() i32 {
@@ -183,6 +205,8 @@ test "usingnamespace within struct scope" {
 }
 
 test "struct field init with catch" {
+    if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
     const S = struct {
         fn doTheTest() !void {
             var x: anyerror!isize = 1;
test/behavior.zig
@@ -34,6 +34,7 @@ test {
     _ = @import("behavior/slice_sentinel_comptime.zig");
     _ = @import("behavior/type.zig");
     _ = @import("behavior/truncate.zig");
+    _ = @import("behavior/struct.zig");
 
     if (builtin.zig_backend != .stage2_arm and builtin.zig_backend != .stage2_x86_64) {
         // Tests that pass for stage1, llvm backend, C backend, wasm backend.
@@ -69,7 +70,6 @@ test {
         _ = @import("behavior/ptrcast.zig");
         _ = @import("behavior/ref_var_in_if_after_if_2nd_switch_prong.zig");
         _ = @import("behavior/src.zig");
-        _ = @import("behavior/struct.zig");
         _ = @import("behavior/this.zig");
         _ = @import("behavior/try.zig");
         _ = @import("behavior/type_info.zig");