authorgravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2025-08-09 13:27:45+03:30
committergravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2025-08-09 13:27:45+03:30
log64563e2fffd0e304019c343a32f31c925be20ea2
tree10e996625fab88c9a6231616e7ec1a6b5fb9e647
parentbed99e1ecd6c919f4c8a974e598302773db10b8a
signaturelock-open Commit is signed but in an unrecognized format.

test: skip tests that were not meant to pass for spirv


10 files changed, 38 insertions(+), 0 deletions(-)

test/behavior/align.zig+2
...@@ -561,6 +561,8 @@ test "function pointer @intFromPtr/@ptrFromInt roundtrip" {...@@ -561,6 +561,8 @@ test "function pointer @intFromPtr/@ptrFromInt roundtrip" {
561}561}
562562
563test "function pointer align mask" {563test "function pointer align mask" {
564 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
565
564 const int = if (builtin.cpu.arch.isArm() or builtin.cpu.arch.isMIPS()) 0x20202021 else 0x20202020;566 const int = if (builtin.cpu.arch.isArm() or builtin.cpu.arch.isMIPS()) 0x20202021 else 0x20202020;
565 const unaligned: *const fn () callconv(.c) void = @ptrFromInt(int);567 const unaligned: *const fn () callconv(.c) void = @ptrFromInt(int);
566 const aligned: *align(16) const fn () callconv(.c) void = @alignCast(unaligned);568 const aligned: *align(16) const fn () callconv(.c) void = @alignCast(unaligned);
test/behavior/array.zig+2
...@@ -1088,6 +1088,8 @@ test "pass pointer to empty array initializer to anytype parameter" {...@@ -1088,6 +1088,8 @@ test "pass pointer to empty array initializer to anytype parameter" {
1088}1088}
10891089
1090test "initialize pointer to anyopaque with reference to empty array initializer" {1090test "initialize pointer to anyopaque with reference to empty array initializer" {
1091 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
1092
1091 const ptr: *const anyopaque = &.{};1093 const ptr: *const anyopaque = &.{};
1092 // The above acts like an untyped initializer, since the `.{}` has no result type.1094 // The above acts like an untyped initializer, since the `.{}` has no result type.
1093 // So, `ptr` points in memory to an empty tuple (`@TypeOf(.{})`).1095 // So, `ptr` points in memory to an empty tuple (`@TypeOf(.{})`).
test/behavior/cast.zig+10
...@@ -9,6 +9,8 @@ const maxInt = std.math.maxInt;...@@ -9,6 +9,8 @@ const maxInt = std.math.maxInt;
9const native_endian = builtin.target.cpu.arch.endian();9const native_endian = builtin.target.cpu.arch.endian();
1010
11test "int to ptr cast" {11test "int to ptr cast" {
12 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
13
12 const x = @as(usize, 13);14 const x = @as(usize, 13);
13 const y = @as(*u8, @ptrFromInt(x));15 const y = @as(*u8, @ptrFromInt(x));
14 const z = @intFromPtr(y);16 const z = @intFromPtr(y);
...@@ -16,6 +18,8 @@ test "int to ptr cast" {...@@ -16,6 +18,8 @@ test "int to ptr cast" {
16}18}
1719
18test "integer literal to pointer cast" {20test "integer literal to pointer cast" {
21 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
22
19 const vga_mem = @as(*u16, @ptrFromInt(0xB8000));23 const vga_mem = @as(*u16, @ptrFromInt(0xB8000));
20 try expect(@intFromPtr(vga_mem) == 0xB8000);24 try expect(@intFromPtr(vga_mem) == 0xB8000);
21}25}
...@@ -269,6 +273,8 @@ test "implicit cast from *[N]T to [*c]T" {...@@ -269,6 +273,8 @@ test "implicit cast from *[N]T to [*c]T" {
269}273}
270274
271test "*usize to *void" {275test "*usize to *void" {
276 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
277
272 var i = @as(usize, 0);278 var i = @as(usize, 0);
273 const v: *void = @ptrCast(&i);279 const v: *void = @ptrCast(&i);
274 v.* = {};280 v.* = {};
...@@ -1481,6 +1487,8 @@ test "coerce between pointers of compatible differently-named floats" {...@@ -1481,6 +1487,8 @@ test "coerce between pointers of compatible differently-named floats" {
1481}1487}
14821488
1483test "peer type resolution of const and non-const pointer to array" {1489test "peer type resolution of const and non-const pointer to array" {
1490 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
1491
1484 const a = @as(*[1024]u8, @ptrFromInt(42));1492 const a = @as(*[1024]u8, @ptrFromInt(42));
1485 const b = @as(*const [1024]u8, @ptrFromInt(42));1493 const b = @as(*const [1024]u8, @ptrFromInt(42));
1486 try std.testing.expect(@TypeOf(a, b) == *const [1024]u8);1494 try std.testing.expect(@TypeOf(a, b) == *const [1024]u8);
...@@ -1543,6 +1551,8 @@ test "optional pointer coerced to optional allowzero pointer" {...@@ -1543,6 +1551,8 @@ test "optional pointer coerced to optional allowzero pointer" {
1543}1551}
15441552
1545test "optional slice coerced to allowzero many pointer" {1553test "optional slice coerced to allowzero many pointer" {
1554 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
1555
1546 const a: ?[]const u32 = null;1556 const a: ?[]const u32 = null;
1547 const b: [*]allowzero const u8 = @ptrCast(a);1557 const b: [*]allowzero const u8 = @ptrCast(a);
1548 const c = @intFromPtr(b);1558 const c = @intFromPtr(b);
test/behavior/comptime_memory.zig+6
...@@ -406,6 +406,8 @@ test "mutate entire slice at comptime" {...@@ -406,6 +406,8 @@ test "mutate entire slice at comptime" {
406}406}
407407
408test "dereference undefined pointer to zero-bit type" {408test "dereference undefined pointer to zero-bit type" {
409 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
410
409 const p0: *void = undefined;411 const p0: *void = undefined;
410 try testing.expectEqual({}, p0.*);412 try testing.expectEqual({}, p0.*);
411413
...@@ -421,6 +423,8 @@ test "type pun extern struct" {...@@ -421,6 +423,8 @@ test "type pun extern struct" {
421}423}
422424
423test "type pun @ptrFromInt" {425test "type pun @ptrFromInt" {
426 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
427
424 const p: *u8 = @ptrFromInt(42);428 const p: *u8 = @ptrFromInt(42);
425 // note that expectEqual hides the bug429 // note that expectEqual hides the bug
426 try testing.expect(@as(*const [*]u8, @ptrCast(&p)).* == @as([*]u8, @ptrFromInt(42)));430 try testing.expect(@as(*const [*]u8, @ptrCast(&p)).* == @as([*]u8, @ptrFromInt(42)));
...@@ -511,6 +515,8 @@ fn fieldPtrTest() u32 {...@@ -511,6 +515,8 @@ fn fieldPtrTest() u32 {
511 return a.value;515 return a.value;
512}516}
513test "pointer in aggregate field can mutate comptime state" {517test "pointer in aggregate field can mutate comptime state" {
518 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
519
514 try comptime std.testing.expect(fieldPtrTest() == 2);520 try comptime std.testing.expect(fieldPtrTest() == 2);
515}521}
516522
test/behavior/generics.zig+1
...@@ -169,6 +169,7 @@ test "generic fn keeps non-generic parameter types" {...@@ -169,6 +169,7 @@ test "generic fn keeps non-generic parameter types" {
169 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;169 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
170 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO170 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
171 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;171 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
172 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
172173
173 const A = 128;174 const A = 128;
174175
test/behavior/pointers.zig+8
...@@ -267,6 +267,8 @@ test "implicit cast error unions with non-optional to optional pointer" {...@@ -267,6 +267,8 @@ test "implicit cast error unions with non-optional to optional pointer" {
267}267}
268268
269test "compare equality of optional and non-optional pointer" {269test "compare equality of optional and non-optional pointer" {
270 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
271
270 const a = @as(*const usize, @ptrFromInt(0x12345678));272 const a = @as(*const usize, @ptrFromInt(0x12345678));
271 const b = @as(?*usize, @ptrFromInt(0x12345678));273 const b = @as(?*usize, @ptrFromInt(0x12345678));
272 try expect(a == b);274 try expect(a == b);
...@@ -453,6 +455,8 @@ test "pointer sentinel with +inf" {...@@ -453,6 +455,8 @@ test "pointer sentinel with +inf" {
453}455}
454456
455test "pointer to array at fixed address" {457test "pointer to array at fixed address" {
458 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
459
456 const array = @as(*volatile [2]u32, @ptrFromInt(0x10));460 const array = @as(*volatile [2]u32, @ptrFromInt(0x10));
457 // Silly check just to reference `array`461 // Silly check just to reference `array`
458 try expect(@intFromPtr(&array[0]) == 0x10);462 try expect(@intFromPtr(&array[0]) == 0x10);
...@@ -494,6 +498,8 @@ test "pointer-integer arithmetic affects the alignment" {...@@ -494,6 +498,8 @@ test "pointer-integer arithmetic affects the alignment" {
494}498}
495499
496test "@intFromPtr on null optional at comptime" {500test "@intFromPtr on null optional at comptime" {
501 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
502
497 {503 {
498 const pointer = @as(?*u8, @ptrFromInt(0x000));504 const pointer = @as(?*u8, @ptrFromInt(0x000));
499 const x = @intFromPtr(pointer);505 const x = @intFromPtr(pointer);
...@@ -704,6 +710,8 @@ test "pointer-to-array constness for zero-size elements, const" {...@@ -704,6 +710,8 @@ test "pointer-to-array constness for zero-size elements, const" {
704}710}
705711
706test "cast pointers with zero sized elements" {712test "cast pointers with zero sized elements" {
713 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
714
707 const a: *void = undefined;715 const a: *void = undefined;
708 const b: *[1]void = a;716 const b: *[1]void = a;
709 _ = b;717 _ = b;
test/behavior/ptrfromint.zig+1
...@@ -44,6 +44,7 @@ test "@ptrFromInt creates null pointer" {...@@ -44,6 +44,7 @@ test "@ptrFromInt creates null pointer" {
44test "@ptrFromInt creates allowzero zero pointer" {44test "@ptrFromInt creates allowzero zero pointer" {
45 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;45 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
46 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO46 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
47 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
4748
48 const ptr = @as(*allowzero u32, @ptrFromInt(0));49 const ptr = @as(*allowzero u32, @ptrFromInt(0));
49 try expectEqual(@as(usize, 0), @intFromPtr(ptr));50 try expectEqual(@as(usize, 0), @intFromPtr(ptr));
test/behavior/slice.zig+2
...@@ -238,6 +238,8 @@ test "slicing pointer by length" {...@@ -238,6 +238,8 @@ test "slicing pointer by length" {
238const x = @as([*]i32, @ptrFromInt(0x1000))[0..0x500];238const x = @as([*]i32, @ptrFromInt(0x1000))[0..0x500];
239const y = x[0x100..];239const y = x[0x100..];
240test "compile time slice of pointer to hard coded address" {240test "compile time slice of pointer to hard coded address" {
241 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
242
241 try expect(@intFromPtr(x) == 0x1000);243 try expect(@intFromPtr(x) == 0x1000);
242 try expect(x.len == 0x500);244 try expect(x.len == 0x500);
243245
test/behavior/struct.zig+4
...@@ -1347,6 +1347,8 @@ test "struct field has a pointer to an aligned version of itself" {...@@ -1347,6 +1347,8 @@ test "struct field has a pointer to an aligned version of itself" {
1347}1347}
13481348
1349test "struct has only one reference" {1349test "struct has only one reference" {
1350 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
1351
1350 const S = struct {1352 const S = struct {
1351 fn optionalStructParam(_: ?struct { x: u8 }) void {}1353 fn optionalStructParam(_: ?struct { x: u8 }) void {}
1352 fn errorUnionStructParam(_: error{}!struct { x: u8 }) void {}1354 fn errorUnionStructParam(_: error{}!struct { x: u8 }) void {}
...@@ -1553,6 +1555,7 @@ test "struct field pointer has correct alignment" {...@@ -1553,6 +1555,7 @@ test "struct field pointer has correct alignment" {
1553 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO1555 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
1554 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO1556 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1555 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1557 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1558 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
15561559
1557 const S = struct {1560 const S = struct {
1558 fn doTheTest() !void {1561 fn doTheTest() !void {
...@@ -1582,6 +1585,7 @@ test "extern struct field pointer has correct alignment" {...@@ -1582,6 +1585,7 @@ test "extern struct field pointer has correct alignment" {
1582 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO1585 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
1583 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO1586 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1584 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1587 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1588 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
15851589
1586 const S = struct {1590 const S = struct {
1587 fn doTheTest() !void {1591 fn doTheTest() !void {
test/behavior/union.zig+2
...@@ -1481,6 +1481,7 @@ test "defined-layout union field pointer has correct alignment" {...@@ -1481,6 +1481,7 @@ test "defined-layout union field pointer has correct alignment" {
1481 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO1481 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
1482 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO1482 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1483 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1483 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1484 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
14841485
1485 const S = struct {1486 const S = struct {
1486 fn doTheTest(comptime U: type) !void {1487 fn doTheTest(comptime U: type) !void {
...@@ -1515,6 +1516,7 @@ test "undefined-layout union field pointer has correct alignment" {...@@ -1515,6 +1516,7 @@ test "undefined-layout union field pointer has correct alignment" {
1515 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO1516 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
1516 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO1517 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1517 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO1518 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1519 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
15181520
1519 const S = struct {1521 const S = struct {
1520 fn doTheTest(comptime U: type) !void {1522 fn doTheTest(comptime U: type) !void {