aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorAli Cheraghi <alichraghi@proton.me>2025-08-09 13:27:45 +0330
committerAli Cheraghi <alichraghi@proton.me>2025-08-09 13:27:45 +0330
commit64563e2fffd0e304019c343a32f31c925be20ea2 (patch)
tree10e996625fab88c9a6231616e7ec1a6b5fb9e647 /test/behavior
parentbed99e1ecd6c919f4c8a974e598302773db10b8a (diff)
downloadzig-64563e2fffd0e304019c343a32f31c925be20ea2.tar.gz
zig-64563e2fffd0e304019c343a32f31c925be20ea2.zip
test: skip tests that were not meant to pass for spirv
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/align.zig2
-rw-r--r--test/behavior/array.zig2
-rw-r--r--test/behavior/cast.zig10
-rw-r--r--test/behavior/comptime_memory.zig6
-rw-r--r--test/behavior/generics.zig1
-rw-r--r--test/behavior/pointers.zig8
-rw-r--r--test/behavior/ptrfromint.zig1
-rw-r--r--test/behavior/slice.zig2
-rw-r--r--test/behavior/struct.zig4
-rw-r--r--test/behavior/union.zig2
10 files changed, 38 insertions, 0 deletions
diff --git a/test/behavior/align.zig b/test/behavior/align.zig
index df90207267..f8989a56e6 100644
--- a/test/behavior/align.zig
+++ b/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);
diff --git a/test/behavior/array.zig b/test/behavior/array.zig
index 1eb4c12cbf..2e776d4653 100644
--- a/test/behavior/array.zig
+++ b/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(.{})`).
diff --git a/test/behavior/cast.zig b/test/behavior/cast.zig
index 8fcfbbd9a2..740d123170 100644
--- a/test/behavior/cast.zig
+++ b/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);
diff --git a/test/behavior/comptime_memory.zig b/test/behavior/comptime_memory.zig
index 6f772c6cfb..2efd197475 100644
--- a/test/behavior/comptime_memory.zig
+++ 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);
}
diff --git a/test/behavior/generics.zig b/test/behavior/generics.zig
index a4d5c90711..962148e1b4 100644
--- a/test/behavior/generics.zig
+++ b/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;
diff --git a/test/behavior/pointers.zig b/test/behavior/pointers.zig
index fbc74c1718..f6caa3c76e 100644
--- a/test/behavior/pointers.zig
+++ b/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;
diff --git a/test/behavior/ptrfromint.zig b/test/behavior/ptrfromint.zig
index f72e64f87f..480c773c15 100644
--- a/test/behavior/ptrfromint.zig
+++ 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));
diff --git a/test/behavior/slice.zig b/test/behavior/slice.zig
index 5d1a0e8114..98760458ae 100644
--- a/test/behavior/slice.zig
+++ b/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);
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig
index 2c2432afd9..a0ca203298 100644
--- a/test/behavior/struct.zig
+++ b/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 {
diff --git a/test/behavior/union.zig b/test/behavior/union.zig
index 98da2dc185..04d07f91ae 100644
--- a/test/behavior/union.zig
+++ b/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 {