Commit 64563e2fff

Ali Cheraghi <alichraghi@proton.me>
2025-08-09 11:57:45
test: skip tests that were not meant to pass for spirv
1 parent bed99e1
test/behavior/align.zig
@@ -561,6 +561,8 @@ test "function pointer @intFromPtr/@ptrFromInt roundtrip" {
 }
 
 test "function pointer align mask" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     const int = if (builtin.cpu.arch.isArm() or builtin.cpu.arch.isMIPS()) 0x20202021 else 0x20202020;
     const unaligned: *const fn () callconv(.c) void = @ptrFromInt(int);
     const aligned: *align(16) const fn () callconv(.c) void = @alignCast(unaligned);
test/behavior/array.zig
@@ -1088,6 +1088,8 @@ test "pass pointer to empty array initializer to anytype parameter" {
 }
 
 test "initialize pointer to anyopaque with reference to empty array initializer" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     const ptr: *const anyopaque = &.{};
     // The above acts like an untyped initializer, since the `.{}` has no result type.
     // So, `ptr` points in memory to an empty tuple (`@TypeOf(.{})`).
test/behavior/cast.zig
@@ -9,6 +9,8 @@ const maxInt = std.math.maxInt;
 const native_endian = builtin.target.cpu.arch.endian();
 
 test "int to ptr cast" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     const x = @as(usize, 13);
     const y = @as(*u8, @ptrFromInt(x));
     const z = @intFromPtr(y);
@@ -16,6 +18,8 @@ test "int to ptr cast" {
 }
 
 test "integer literal to pointer cast" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     const vga_mem = @as(*u16, @ptrFromInt(0xB8000));
     try expect(@intFromPtr(vga_mem) == 0xB8000);
 }
@@ -269,6 +273,8 @@ test "implicit cast from *[N]T to [*c]T" {
 }
 
 test "*usize to *void" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     var i = @as(usize, 0);
     const v: *void = @ptrCast(&i);
     v.* = {};
@@ -1481,6 +1487,8 @@ test "coerce between pointers of compatible differently-named floats" {
 }
 
 test "peer type resolution of const and non-const pointer to array" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     const a = @as(*[1024]u8, @ptrFromInt(42));
     const b = @as(*const [1024]u8, @ptrFromInt(42));
     try std.testing.expect(@TypeOf(a, b) == *const [1024]u8);
@@ -1543,6 +1551,8 @@ test "optional pointer coerced to optional allowzero pointer" {
 }
 
 test "optional slice coerced to allowzero many pointer" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     const a: ?[]const u32 = null;
     const b: [*]allowzero const u8 = @ptrCast(a);
     const c = @intFromPtr(b);
test/behavior/comptime_memory.zig
@@ -406,6 +406,8 @@ test "mutate entire slice at comptime" {
 }
 
 test "dereference undefined pointer to zero-bit type" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     const p0: *void = undefined;
     try testing.expectEqual({}, p0.*);
 
@@ -421,6 +423,8 @@ test "type pun extern struct" {
 }
 
 test "type pun @ptrFromInt" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     const p: *u8 = @ptrFromInt(42);
     // note that expectEqual hides the bug
     try testing.expect(@as(*const [*]u8, @ptrCast(&p)).* == @as([*]u8, @ptrFromInt(42)));
@@ -511,6 +515,8 @@ fn fieldPtrTest() u32 {
     return a.value;
 }
 test "pointer in aggregate field can mutate comptime state" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     try comptime std.testing.expect(fieldPtrTest() == 2);
 }
 
test/behavior/generics.zig
@@ -169,6 +169,7 @@ test "generic fn keeps non-generic parameter types" {
     if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
     if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
     if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
 
     const A = 128;
 
test/behavior/pointers.zig
@@ -267,6 +267,8 @@ test "implicit cast error unions with non-optional to optional pointer" {
 }
 
 test "compare equality of optional and non-optional pointer" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     const a = @as(*const usize, @ptrFromInt(0x12345678));
     const b = @as(?*usize, @ptrFromInt(0x12345678));
     try expect(a == b);
@@ -453,6 +455,8 @@ test "pointer sentinel with +inf" {
 }
 
 test "pointer to array at fixed address" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     const array = @as(*volatile [2]u32, @ptrFromInt(0x10));
     // Silly check just to reference `array`
     try expect(@intFromPtr(&array[0]) == 0x10);
@@ -494,6 +498,8 @@ test "pointer-integer arithmetic affects the alignment" {
 }
 
 test "@intFromPtr on null optional at comptime" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     {
         const pointer = @as(?*u8, @ptrFromInt(0x000));
         const x = @intFromPtr(pointer);
@@ -704,6 +710,8 @@ test "pointer-to-array constness for zero-size elements, const" {
 }
 
 test "cast pointers with zero sized elements" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     const a: *void = undefined;
     const b: *[1]void = a;
     _ = b;
test/behavior/ptrfromint.zig
@@ -44,6 +44,7 @@ test "@ptrFromInt creates null pointer" {
 test "@ptrFromInt creates allowzero zero pointer" {
     if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
     if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
 
     const ptr = @as(*allowzero u32, @ptrFromInt(0));
     try expectEqual(@as(usize, 0), @intFromPtr(ptr));
test/behavior/slice.zig
@@ -238,6 +238,8 @@ test "slicing pointer by length" {
 const x = @as([*]i32, @ptrFromInt(0x1000))[0..0x500];
 const y = x[0x100..];
 test "compile time slice of pointer to hard coded address" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     try expect(@intFromPtr(x) == 0x1000);
     try expect(x.len == 0x500);
 
test/behavior/struct.zig
@@ -1347,6 +1347,8 @@ test "struct field has a pointer to an aligned version of itself" {
 }
 
 test "struct has only one reference" {
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
+
     const S = struct {
         fn optionalStructParam(_: ?struct { x: u8 }) void {}
         fn errorUnionStructParam(_: error{}!struct { x: u8 }) void {}
@@ -1553,6 +1555,7 @@ test "struct field pointer has correct alignment" {
     if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
     if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
     if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
 
     const S = struct {
         fn doTheTest() !void {
@@ -1582,6 +1585,7 @@ test "extern struct field pointer has correct alignment" {
     if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
     if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
     if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
 
     const S = struct {
         fn doTheTest() !void {
test/behavior/union.zig
@@ -1481,6 +1481,7 @@ test "defined-layout union field pointer has correct alignment" {
     if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
     if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
     if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
 
     const S = struct {
         fn doTheTest(comptime U: type) !void {
@@ -1515,6 +1516,7 @@ test "undefined-layout union field pointer has correct alignment" {
     if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
     if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
     if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
 
     const S = struct {
         fn doTheTest(comptime U: type) !void {