authorgravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2023-08-26 11:32:37+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-09-23 12:36:44-07:00
log79f7481575005f9f63b5b3be8dd89b92b11b9c77
treeab44253bc9180d8947322504c78ddc5c91e01b75
parent865b2e259bf78dbf1d4c1051b5fff68b90bca65f

spirv: disable failing tests


22 files changed, 61 insertions(+), 0 deletions(-)

src/codegen/spirv.zig+1
...@@ -1242,6 +1242,7 @@ pub const DeclGen = struct {...@@ -1242,6 +1242,7 @@ pub const DeclGen = struct {
1242 },1242 },
1243 .Int => {1243 .Int => {
1244 const int_info = ty.intInfo(mod);1244 const int_info = ty.intInfo(mod);
1245 // TODO: Integers in OpenCL kernels are always unsigned.
1245 return try self.intType(int_info.signedness, int_info.bits);1246 return try self.intType(int_info.signedness, int_info.bits);
1246 },1247 },
1247 .Enum => {1248 .Enum => {
src/link/SpirV.zig+5
...@@ -110,6 +110,8 @@ pub fn updateFunc(self: *SpirV, module: *Module, func_index: InternPool.Index, a...@@ -110,6 +110,8 @@ pub fn updateFunc(self: *SpirV, module: *Module, func_index: InternPool.Index, a
110 }110 }
111111
112 const func = module.funcInfo(func_index);112 const func = module.funcInfo(func_index);
113 const decl = module.declPtr(func.owner_decl);
114 log.debug("lowering function {s}", .{ module.intern_pool.stringToSlice(decl.name) });
113115
114 var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link);116 var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link);
115 defer decl_gen.deinit();117 defer decl_gen.deinit();
...@@ -124,6 +126,9 @@ pub fn updateDecl(self: *SpirV, module: *Module, decl_index: Module.Decl.Index)...@@ -124,6 +126,9 @@ pub fn updateDecl(self: *SpirV, module: *Module, decl_index: Module.Decl.Index)
124 @panic("Attempted to compile for architecture that was disabled by build configuration");126 @panic("Attempted to compile for architecture that was disabled by build configuration");
125 }127 }
126128
129 const decl = module.declPtr(decl_index);
130 log.debug("lowering declaration {s}", .{ module.intern_pool.stringToSlice(decl.name) });
131
127 var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link);132 var decl_gen = codegen.DeclGen.init(self.base.allocator, module, &self.spv, &self.decl_link);
128 defer decl_gen.deinit();133 defer decl_gen.deinit();
129134
test/behavior/alignof.zig+2
...@@ -28,6 +28,8 @@ test "comparison of @alignOf(T) against zero" {...@@ -28,6 +28,8 @@ test "comparison of @alignOf(T) against zero" {
28}28}
2929
30test "correct alignment for elements and slices of aligned array" {30test "correct alignment for elements and slices of aligned array" {
31 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
32
31 var buf: [1024]u8 align(64) = undefined;33 var buf: [1024]u8 align(64) = undefined;
32 var start: usize = 1;34 var start: usize = 1;
33 var end: usize = undefined;35 var end: usize = undefined;
test/behavior/array.zig+4
...@@ -763,6 +763,8 @@ test "slicing array of zero-sized values" {...@@ -763,6 +763,8 @@ test "slicing array of zero-sized values" {
763}763}
764764
765test "array init with no result pointer sets field result types" {765test "array init with no result pointer sets field result types" {
766 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
767
766 const S = struct {768 const S = struct {
767 // A function parameter has a result type, but no result pointer.769 // A function parameter has a result type, but no result pointer.
768 fn f(arr: [1]u32) u32 {770 fn f(arr: [1]u32) u32 {
...@@ -777,6 +779,8 @@ test "array init with no result pointer sets field result types" {...@@ -777,6 +779,8 @@ test "array init with no result pointer sets field result types" {
777}779}
778780
779test "runtime side-effects in comptime-known array init" {781test "runtime side-effects in comptime-known array init" {
782 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
783
780 var side_effects: u4 = 0;784 var side_effects: u4 = 0;
781 const init = [4]u4{785 const init = [4]u4{
782 blk: {786 blk: {
test/behavior/bitcast.zig+4
...@@ -271,6 +271,8 @@ test "comptime bitcast used in expression has the correct type" {...@@ -271,6 +271,8 @@ test "comptime bitcast used in expression has the correct type" {
271}271}
272272
273test "bitcast passed as tuple element" {273test "bitcast passed as tuple element" {
274 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
275
274 const S = struct {276 const S = struct {
275 fn foo(args: anytype) !void {277 fn foo(args: anytype) !void {
276 try comptime expect(@TypeOf(args[0]) == f32);278 try comptime expect(@TypeOf(args[0]) == f32);
...@@ -281,6 +283,8 @@ test "bitcast passed as tuple element" {...@@ -281,6 +283,8 @@ test "bitcast passed as tuple element" {
281}283}
282284
283test "triple level result location with bitcast sandwich passed as tuple element" {285test "triple level result location with bitcast sandwich passed as tuple element" {
286 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
287
284 const S = struct {288 const S = struct {
285 fn foo(args: anytype) !void {289 fn foo(args: anytype) !void {
286 try comptime expect(@TypeOf(args[0]) == f64);290 try comptime expect(@TypeOf(args[0]) == f64);
test/behavior/bugs/5487.zig+1
...@@ -13,5 +13,6 @@ test "crash" {...@@ -13,5 +13,6 @@ test "crash" {
13 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;13 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
14 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;14 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
15 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO15 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
16 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
16 _ = io.multiWriter(.{writer()});17 _ = io.multiWriter(.{writer()});
17}18}
test/behavior/call_tail.zig+1
...@@ -46,6 +46,7 @@ test "arguments pointed to on stack into tailcall" {...@@ -46,6 +46,7 @@ test "arguments pointed to on stack into tailcall" {
46 }46 }
47 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;47 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
48 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;48 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
49 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
4950
50 var data = [_]u64{ 1, 6, 2, 7, 1, 9, 3 };51 var data = [_]u64{ 1, 6, 2, 7, 1, 9, 3 };
51 base = @intFromPtr(&data);52 base = @intFromPtr(&data);
test/behavior/cast.zig+2
...@@ -1156,6 +1156,7 @@ fn foobar(func: PFN_void) !void {...@@ -1156,6 +1156,7 @@ fn foobar(func: PFN_void) !void {
11561156
1157test "cast function with an opaque parameter" {1157test "cast function with an opaque parameter" {
1158 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;1158 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
1159 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
11591160
1160 if (builtin.zig_backend == .stage2_c) {1161 if (builtin.zig_backend == .stage2_c) {
1161 // https://github.com/ziglang/zig/issues/168451162 // https://github.com/ziglang/zig/issues/16845
...@@ -2501,6 +2502,7 @@ test "@intFromBool on vector" {...@@ -2501,6 +2502,7 @@ test "@intFromBool on vector" {
2501test "numeric coercions with undefined" {2502test "numeric coercions with undefined" {
2502 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;2503 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
2503 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;2504 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
2505 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
25042506
2505 const from: i32 = undefined;2507 const from: i32 = undefined;
2506 var to: f32 = from;2508 var to: f32 = from;
test/behavior/comptime_memory.zig+2
...@@ -425,6 +425,8 @@ test "mutate entire slice at comptime" {...@@ -425,6 +425,8 @@ test "mutate entire slice at comptime" {
425}425}
426426
427test "dereference undefined pointer to zero-bit type" {427test "dereference undefined pointer to zero-bit type" {
428 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
429
428 const p0: *void = undefined;430 const p0: *void = undefined;
429 try testing.expectEqual({}, p0.*);431 try testing.expectEqual({}, p0.*);
430432
test/behavior/error.zig+1
...@@ -942,6 +942,7 @@ test "returning an error union containing a type with no runtime bits" {...@@ -942,6 +942,7 @@ test "returning an error union containing a type with no runtime bits" {
942test "try used in recursive function with inferred error set" {942test "try used in recursive function with inferred error set" {
943 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO943 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
944 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO944 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
945 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
945946
946 const Value = union(enum) {947 const Value = union(enum) {
947 values: []const @This(),948 values: []const @This(),
test/behavior/eval.zig+1
...@@ -729,6 +729,7 @@ fn loopNTimes(comptime n: usize) void {...@@ -729,6 +729,7 @@ fn loopNTimes(comptime n: usize) void {
729}729}
730730
731test "variable inside inline loop that has different types on different iterations" {731test "variable inside inline loop that has different types on different iterations" {
732 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
732 try testVarInsideInlineLoop(.{ true, @as(u32, 42) });733 try testVarInsideInlineLoop(.{ true, @as(u32, 42) });
733}734}
734735
test/behavior/fn.zig+2
...@@ -583,6 +583,8 @@ test "lazy values passed to anytype parameter" {...@@ -583,6 +583,8 @@ test "lazy values passed to anytype parameter" {
583}583}
584584
585test "pass and return comptime-only types" {585test "pass and return comptime-only types" {
586 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
587
586 const S = struct {588 const S = struct {
587 fn returnNull(comptime x: @Type(.Null)) @Type(.Null) {589 fn returnNull(comptime x: @Type(.Null)) @Type(.Null) {
588 return x;590 return x;
test/behavior/generics.zig+1
...@@ -288,6 +288,7 @@ test "generic function instantiation turns into comptime call" {...@@ -288,6 +288,7 @@ test "generic function instantiation turns into comptime call" {
288288
289test "generic function with void and comptime parameter" {289test "generic function with void and comptime parameter" {
290 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO290 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
291 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
291292
292 const S = struct { x: i32 };293 const S = struct { x: i32 };
293 const namespace = struct {294 const namespace = struct {
test/behavior/math.zig+2
...@@ -1289,6 +1289,8 @@ fn testShrExact(x: u8) !void {...@@ -1289,6 +1289,8 @@ fn testShrExact(x: u8) !void {
1289}1289}
12901290
1291test "shift left/right on u0 operand" {1291test "shift left/right on u0 operand" {
1292 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1293
1292 const S = struct {1294 const S = struct {
1293 fn doTheTest() !void {1295 fn doTheTest() !void {
1294 var x: u0 = 0;1296 var x: u0 = 0;
test/behavior/optional.zig+2
...@@ -500,6 +500,8 @@ test "cast slice to const slice nested in error union and optional" {...@@ -500,6 +500,8 @@ test "cast slice to const slice nested in error union and optional" {
500}500}
501501
502test "variable of optional of noreturn" {502test "variable of optional of noreturn" {
503 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
504
503 var null_opv: ?noreturn = null;505 var null_opv: ?noreturn = null;
504 try std.testing.expectEqual(@as(?noreturn, null), null_opv);506 try std.testing.expectEqual(@as(?noreturn, null), null_opv);
505}507}
test/behavior/struct.zig+11
...@@ -137,6 +137,8 @@ test "invoke static method in global scope" {...@@ -137,6 +137,8 @@ test "invoke static method in global scope" {
137const empty_global_instance = StructWithNoFields{};137const empty_global_instance = StructWithNoFields{};
138138
139test "return empty struct instance" {139test "return empty struct instance" {
140 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
141
140 _ = returnEmptyStructInstance();142 _ = returnEmptyStructInstance();
141}143}
142fn returnEmptyStructInstance() StructWithNoFields {144fn returnEmptyStructInstance() StructWithNoFields {
...@@ -331,6 +333,7 @@ const VoidStructFieldsFoo = struct {...@@ -331,6 +333,7 @@ const VoidStructFieldsFoo = struct {
331333
332test "return empty struct from fn" {334test "return empty struct from fn" {
333 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO335 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
336 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
334337
335 _ = testReturnEmptyStructFromFn();338 _ = testReturnEmptyStructFromFn();
336}339}
...@@ -893,6 +896,8 @@ test "anonymous struct literal syntax" {...@@ -893,6 +896,8 @@ test "anonymous struct literal syntax" {
893}896}
894897
895test "fully anonymous struct" {898test "fully anonymous struct" {
899 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
900
896 const S = struct {901 const S = struct {
897 fn doTheTest() !void {902 fn doTheTest() !void {
898 try dump(.{903 try dump(.{
...@@ -915,6 +920,8 @@ test "fully anonymous struct" {...@@ -915,6 +920,8 @@ test "fully anonymous struct" {
915}920}
916921
917test "fully anonymous list literal" {922test "fully anonymous list literal" {
923 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
924
918 const S = struct {925 const S = struct {
919 fn doTheTest() !void {926 fn doTheTest() !void {
920 try dump(.{ @as(u32, 1234), @as(f64, 12.34), true, "hi" });927 try dump(.{ @as(u32, 1234), @as(f64, 12.34), true, "hi" });
...@@ -1715,6 +1722,8 @@ test "extern struct field pointer has correct alignment" {...@@ -1715,6 +1722,8 @@ test "extern struct field pointer has correct alignment" {
1715}1722}
17161723
1717test "packed struct field in anonymous struct" {1724test "packed struct field in anonymous struct" {
1725 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1726
1718 const T = packed struct {1727 const T = packed struct {
1719 f1: bool = false,1728 f1: bool = false,
1720 };1729 };
...@@ -1740,6 +1749,8 @@ test "struct init with no result pointer sets field result types" {...@@ -1740,6 +1749,8 @@ test "struct init with no result pointer sets field result types" {
1740}1749}
17411750
1742test "runtime side-effects in comptime-known struct init" {1751test "runtime side-effects in comptime-known struct init" {
1752 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1753
1743 var side_effects: u4 = 0;1754 var side_effects: u4 = 0;
1744 const S = struct { a: u4, b: u4, c: u4, d: u4 };1755 const S = struct { a: u4, b: u4, c: u4, d: u4 };
1745 const init = S{1756 const init = S{
test/behavior/switch.zig+2
...@@ -799,6 +799,8 @@ test "inline switch range that includes the maximum value of the switched type"...@@ -799,6 +799,8 @@ test "inline switch range that includes the maximum value of the switched type"
799}799}
800800
801test "nested break ignores switch conditions and breaks instead" {801test "nested break ignores switch conditions and breaks instead" {
802 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
803
802 const S = struct {804 const S = struct {
803 fn register_to_address(ident: []const u8) !u8 {805 fn register_to_address(ident: []const u8) !u8 {
804 const reg: u8 = if (std.mem.eql(u8, ident, "zero")) 0x00 else blk: {806 const reg: u8 = if (std.mem.eql(u8, ident, "zero")) 0x00 else blk: {
test/behavior/translate_c_macros.zig+2
...@@ -233,6 +233,8 @@ test "@typeInfo on @cImport result" {...@@ -233,6 +233,8 @@ test "@typeInfo on @cImport result" {
233}233}
234234
235test "Macro that uses Long type concatenation casting" {235test "Macro that uses Long type concatenation casting" {
236 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
237
236 try expect((@TypeOf(h.X)) == c_long);238 try expect((@TypeOf(h.X)) == c_long);
237 try expectEqual(h.X, @as(c_long, 10));239 try expectEqual(h.X, @as(c_long, 10));
238}240}
test/behavior/type_info_only_pub_decls.zig+3
...@@ -1,3 +1,4 @@...@@ -1,3 +1,4 @@
1const builtin = @import("builtin");
1const std = @import("std");2const std = @import("std");
2const other = struct {3const other = struct {
3 const std = @import("std");4 const std = @import("std");
...@@ -14,6 +15,8 @@ const other = struct {...@@ -14,6 +15,8 @@ const other = struct {
14};15};
1516
16test {17test {
18 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
19
17 const ti = @typeInfo(other);20 const ti = @typeInfo(other);
18 const decls = ti.Struct.decls;21 const decls = ti.Struct.decls;
1922
test/behavior/undefined.zig+1
...@@ -82,6 +82,7 @@ test "assign undefined to struct with method" {...@@ -82,6 +82,7 @@ test "assign undefined to struct with method" {
8282
83test "type name of undefined" {83test "type name of undefined" {
84 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO84 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
85 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
8586
86 const x = undefined;87 const x = undefined;
87 try expect(mem.eql(u8, @typeName(@TypeOf(x)), "@TypeOf(undefined)"));88 try expect(mem.eql(u8, @typeName(@TypeOf(x)), "@TypeOf(undefined)"));
test/behavior/union.zig+2
...@@ -1669,6 +1669,8 @@ test "packed union field pointer has correct alignment" {...@@ -1669,6 +1669,8 @@ test "packed union field pointer has correct alignment" {
1669}1669}
16701670
1671test "union with 128 bit integer" {1671test "union with 128 bit integer" {
1672 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1673
1672 const ValueTag = enum { int, other };1674 const ValueTag = enum { int, other };
16731675
1674 const Value3 = union(ValueTag) {1676 const Value3 = union(ValueTag) {
test/behavior/var_args.zig+9
...@@ -14,6 +14,8 @@ fn add(args: anytype) i32 {...@@ -14,6 +14,8 @@ fn add(args: anytype) i32 {
14}14}
1515
16test "add arbitrary args" {16test "add arbitrary args" {
17 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
18
17 try expect(add(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10);19 try expect(add(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10);
18 try expect(add(.{@as(i32, 1234)}) == 1234);20 try expect(add(.{@as(i32, 1234)}) == 1234);
19 try expect(add(.{}) == 0);21 try expect(add(.{}) == 0);
...@@ -24,12 +26,15 @@ fn readFirstVarArg(args: anytype) void {...@@ -24,12 +26,15 @@ fn readFirstVarArg(args: anytype) void {
24}26}
2527
26test "send void arg to var args" {28test "send void arg to var args" {
29 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
30
27 readFirstVarArg(.{{}});31 readFirstVarArg(.{{}});
28}32}
2933
30test "pass args directly" {34test "pass args directly" {
31 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO35 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
32 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO36 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
37 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
3338
34 try expect(addSomeStuff(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10);39 try expect(addSomeStuff(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10);
35 try expect(addSomeStuff(.{@as(i32, 1234)}) == 1234);40 try expect(addSomeStuff(.{@as(i32, 1234)}) == 1234);
...@@ -82,11 +87,15 @@ fn foo2(args: anytype) bool {...@@ -82,11 +87,15 @@ fn foo2(args: anytype) bool {
82}87}
8388
84test "array of var args functions" {89test "array of var args functions" {
90 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
91
85 try expect(foos[0](.{}));92 try expect(foos[0](.{}));
86 try expect(!foos[1](.{}));93 try expect(!foos[1](.{}));
87}94}
8895
89test "pass zero length array to var args param" {96test "pass zero length array to var args param" {
97 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
98
90 doNothingWithFirstArg(.{""});99 doNothingWithFirstArg(.{""});
91}100}
92101