Skip to content

Commit 64563e2

Browse files
committed
test: skip tests that were not meant to pass for spirv
1 parent bed99e1 commit 64563e2

File tree

10 files changed

+38
-0
lines changed

10 files changed

+38
-0
lines changed

test/behavior/align.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,8 @@ test "function pointer @intFromPtr/@ptrFromInt roundtrip" {
561561
}
562562

563563
test "function pointer align mask" {
564+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
565+
564566
const int = if (builtin.cpu.arch.isArm() or builtin.cpu.arch.isMIPS()) 0x20202021 else 0x20202020;
565567
const unaligned: *const fn () callconv(.c) void = @ptrFromInt(int);
566568
const aligned: *align(16) const fn () callconv(.c) void = @alignCast(unaligned);

test/behavior/array.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,8 @@ test "pass pointer to empty array initializer to anytype parameter" {
10881088
}
10891089

10901090
test "initialize pointer to anyopaque with reference to empty array initializer" {
1091+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
1092+
10911093
const ptr: *const anyopaque = &.{};
10921094
// The above acts like an untyped initializer, since the `.{}` has no result type.
10931095
// So, `ptr` points in memory to an empty tuple (`@TypeOf(.{})`).

test/behavior/cast.zig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ const maxInt = std.math.maxInt;
99
const native_endian = builtin.target.cpu.arch.endian();
1010

1111
test "int to ptr cast" {
12+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
13+
1214
const x = @as(usize, 13);
1315
const y = @as(*u8, @ptrFromInt(x));
1416
const z = @intFromPtr(y);
1517
try expect(z == 13);
1618
}
1719

1820
test "integer literal to pointer cast" {
21+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
22+
1923
const vga_mem = @as(*u16, @ptrFromInt(0xB8000));
2024
try expect(@intFromPtr(vga_mem) == 0xB8000);
2125
}
@@ -269,6 +273,8 @@ test "implicit cast from *[N]T to [*c]T" {
269273
}
270274

271275
test "*usize to *void" {
276+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
277+
272278
var i = @as(usize, 0);
273279
const v: *void = @ptrCast(&i);
274280
v.* = {};
@@ -1481,6 +1487,8 @@ test "coerce between pointers of compatible differently-named floats" {
14811487
}
14821488

14831489
test "peer type resolution of const and non-const pointer to array" {
1490+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
1491+
14841492
const a = @as(*[1024]u8, @ptrFromInt(42));
14851493
const b = @as(*const [1024]u8, @ptrFromInt(42));
14861494
try std.testing.expect(@TypeOf(a, b) == *const [1024]u8);
@@ -1543,6 +1551,8 @@ test "optional pointer coerced to optional allowzero pointer" {
15431551
}
15441552

15451553
test "optional slice coerced to allowzero many pointer" {
1554+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
1555+
15461556
const a: ?[]const u32 = null;
15471557
const b: [*]allowzero const u8 = @ptrCast(a);
15481558
const c = @intFromPtr(b);

test/behavior/comptime_memory.zig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,8 @@ test "mutate entire slice at comptime" {
406406
}
407407

408408
test "dereference undefined pointer to zero-bit type" {
409+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
410+
409411
const p0: *void = undefined;
410412
try testing.expectEqual({}, p0.*);
411413

@@ -421,6 +423,8 @@ test "type pun extern struct" {
421423
}
422424

423425
test "type pun @ptrFromInt" {
426+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
427+
424428
const p: *u8 = @ptrFromInt(42);
425429
// note that expectEqual hides the bug
426430
try testing.expect(@as(*const [*]u8, @ptrCast(&p)).* == @as([*]u8, @ptrFromInt(42)));
@@ -511,6 +515,8 @@ fn fieldPtrTest() u32 {
511515
return a.value;
512516
}
513517
test "pointer in aggregate field can mutate comptime state" {
518+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
519+
514520
try comptime std.testing.expect(fieldPtrTest() == 2);
515521
}
516522

test/behavior/generics.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ test "generic fn keeps non-generic parameter types" {
169169
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
170170
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
171171
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
172+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
172173

173174
const A = 128;
174175

test/behavior/pointers.zig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ test "implicit cast error unions with non-optional to optional pointer" {
267267
}
268268

269269
test "compare equality of optional and non-optional pointer" {
270+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
271+
270272
const a = @as(*const usize, @ptrFromInt(0x12345678));
271273
const b = @as(?*usize, @ptrFromInt(0x12345678));
272274
try expect(a == b);
@@ -453,6 +455,8 @@ test "pointer sentinel with +inf" {
453455
}
454456

455457
test "pointer to array at fixed address" {
458+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
459+
456460
const array = @as(*volatile [2]u32, @ptrFromInt(0x10));
457461
// Silly check just to reference `array`
458462
try expect(@intFromPtr(&array[0]) == 0x10);
@@ -494,6 +498,8 @@ test "pointer-integer arithmetic affects the alignment" {
494498
}
495499

496500
test "@intFromPtr on null optional at comptime" {
501+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
502+
497503
{
498504
const pointer = @as(?*u8, @ptrFromInt(0x000));
499505
const x = @intFromPtr(pointer);
@@ -704,6 +710,8 @@ test "pointer-to-array constness for zero-size elements, const" {
704710
}
705711

706712
test "cast pointers with zero sized elements" {
713+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
714+
707715
const a: *void = undefined;
708716
const b: *[1]void = a;
709717
_ = b;

test/behavior/ptrfromint.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ test "@ptrFromInt creates null pointer" {
4444
test "@ptrFromInt creates allowzero zero pointer" {
4545
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
4646
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
47+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
4748

4849
const ptr = @as(*allowzero u32, @ptrFromInt(0));
4950
try expectEqual(@as(usize, 0), @intFromPtr(ptr));

test/behavior/slice.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ test "slicing pointer by length" {
238238
const x = @as([*]i32, @ptrFromInt(0x1000))[0..0x500];
239239
const y = x[0x100..];
240240
test "compile time slice of pointer to hard coded address" {
241+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
242+
241243
try expect(@intFromPtr(x) == 0x1000);
242244
try expect(x.len == 0x500);
243245

test/behavior/struct.zig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,8 @@ test "struct field has a pointer to an aligned version of itself" {
13471347
}
13481348

13491349
test "struct has only one reference" {
1350+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
1351+
13501352
const S = struct {
13511353
fn optionalStructParam(_: ?struct { x: u8 }) void {}
13521354
fn errorUnionStructParam(_: error{}!struct { x: u8 }) void {}
@@ -1553,6 +1555,7 @@ test "struct field pointer has correct alignment" {
15531555
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
15541556
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
15551557
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1558+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
15561559

15571560
const S = struct {
15581561
fn doTheTest() !void {
@@ -1582,6 +1585,7 @@ test "extern struct field pointer has correct alignment" {
15821585
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
15831586
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
15841587
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1588+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
15851589

15861590
const S = struct {
15871591
fn doTheTest() !void {

test/behavior/union.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,7 @@ test "defined-layout union field pointer has correct alignment" {
14811481
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
14821482
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
14831483
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1484+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
14841485

14851486
const S = struct {
14861487
fn doTheTest(comptime U: type) !void {
@@ -1515,6 +1516,7 @@ test "undefined-layout union field pointer has correct alignment" {
15151516
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
15161517
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
15171518
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1519+
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
15181520

15191521
const S = struct {
15201522
fn doTheTest(comptime U: type) !void {

0 commit comments

Comments
 (0)