authorgravatar for noam@pixelhero.devNoam Preil <noam@pixelhero.dev> 2020-06-24 22:31:54-04:00
committergravatar for noam@pixelhero.devNoam Preil <noam@pixelhero.dev> 2020-06-24 22:43:18-04:00
log5d7e981f95423b3b009e0d7eebccae6c856f68ca
treef004a1cd292013b2f053bd44602de1c9f65eea6a
parentd337469e4484ffd160b4508e2366fefd435f6c8a
signaturelock-open Commit is signed but in an unrecognized format.

Clean up test harness


5 files changed, 92 insertions(+), 126 deletions(-)

src-self-hosted/test.zig+68-100
...@@ -21,9 +21,10 @@ const ErrorMsg = struct {...@@ -21,9 +21,10 @@ const ErrorMsg = struct {
21};21};
2222
23pub const TestContext = struct {23pub const TestContext = struct {
24 zir_cases: std.ArrayList(Case),24 /// TODO: find a way to treat cases as individual tests (shouldn't show "1 test passed" if there are 200 cases)
25 cases: std.ArrayList(Case),
2526
26 pub const ZIRUpdate = struct {27 pub const Update = struct {
27 /// The input to the current update. We simulate an incremental update28 /// The input to the current update. We simulate an incremental update
28 /// with the file's contents changed to this value each update.29 /// with the file's contents changed to this value each update.
29 ///30 ///
...@@ -40,67 +41,70 @@ pub const TestContext = struct {...@@ -40,67 +41,70 @@ pub const TestContext = struct {
40 /// fails to compile, and for the expected reasons.41 /// fails to compile, and for the expected reasons.
41 /// A slice containing the expected errors *in sequential order*.42 /// A slice containing the expected errors *in sequential order*.
42 Error: []const ErrorMsg,43 Error: []const ErrorMsg,
43 /// An execution update compiles and runs the input ZIR, feeding in44 /// An execution update compiles and runs the input, testing the
44 /// provided input and ensuring that the stdout match what is expected.45 /// stdout against the expected results
45 Execution: []const u8,46 Execution: []const u8,
46 },47 },
47 };48 };
4849
49 /// A Case consists of a set of *updates*. A update can transform ZIR,50 pub const TestType = enum {
50 /// compile it, ensure that compilation fails, and more. The same Module is51 Zig,
51 /// used for each update, so each update's source is treated as a single file52 ZIR,
52 /// being updated by the test harness and incrementally compiled.53 };
54
55 /// A Case consists of a set of *updates*. The same Module is used for each
56 /// update, so each update's source is treated as a single file being
57 /// updated by the test harness and incrementally compiled.
53 pub const Case = struct {58 pub const Case = struct {
54 name: []const u8,59 name: []const u8,
55 /// The platform the ZIR targets. For non-native platforms, an emulator60 /// The platform the test targets. For non-native platforms, an emulator
56 /// such as QEMU is required for tests to complete.61 /// such as QEMU is required for tests to complete.
57 target: std.zig.CrossTarget,62 target: std.zig.CrossTarget,
58 updates: std.ArrayList(ZIRUpdate),
59 output_mode: std.builtin.OutputMode,63 output_mode: std.builtin.OutputMode,
60 /// Either ".zir" or ".zig"64 updates: std.ArrayList(Update),
61 extension: [4]u8,65 @"type": TestType,
6266
63 /// Adds a subcase in which the module is updated with new ZIR, and the67 /// Adds a subcase in which the module is updated with new ZIR, and the
64 /// resulting ZIR is validated.68 /// resulting ZIR is validated.
65 pub fn addTransform(self: *Case, src: [:0]const u8, result: [:0]const u8) void {69 pub fn addTransform(self: *Case, src: [:0]const u8, result: [:0]const u8) !void {
66 self.updates.append(.{70 try self.updates.append(.{
67 .src = src,71 .src = src,
68 .case = .{ .Transformation = result },72 .case = .{ .Transformation = result },
69 }) catch unreachable;73 });
70 }74 }
7175
72 pub fn addCompareOutput(self: *Case, src: [:0]const u8, result: []const u8) void {76 pub fn addCompareOutput(self: *Case, src: [:0]const u8, result: []const u8) !void {
73 self.updates.append(.{77 try self.updates.append(.{
74 .src = src,78 .src = src,
75 .case = .{ .Execution = result },79 .case = .{ .Execution = result },
76 }) catch unreachable;80 });
77 }81 }
7882
79 /// Adds a subcase in which the module is updated with invalid ZIR, and83 /// Adds a subcase in which the module is updated with invalid ZIR, and
80 /// ensures that compilation fails for the expected reasons.84 /// ensures that compilation fails for the expected reasons.
81 ///85 ///
82 /// Errors must be specified in sequential order.86 /// Errors must be specified in sequential order.
83 pub fn addError(self: *Case, src: [:0]const u8, errors: []const []const u8) void {87 pub fn addError(self: *Case, src: [:0]const u8, errors: []const []const u8) !void {
84 var array = self.updates.allocator.alloc(ErrorMsg, errors.len) catch unreachable;88 var array = try self.updates.allocator.alloc(ErrorMsg, errors.len);
85 for (errors) |e, i| {89 for (errors) |e, i| {
86 if (e[0] != ':') {90 if (e[0] != ':') {
87 std.debug.panic("Invalid test: error must be specified as follows:\n:line:column: error: message\n=========\n", .{});91 @panic("Invalid test: error must be specified as follows:\n:line:column: error: message\n=========\n");
88 }92 }
89 var cur = e[1..];93 var cur = e[1..];
90 var line_index = std.mem.indexOf(u8, cur, ":");94 var line_index = std.mem.indexOf(u8, cur, ":");
91 if (line_index == null) {95 if (line_index == null) {
92 std.debug.panic("Invalid test: error must be specified as follows:\n:line:column: error: message\n=========\n", .{});96 @panic("Invalid test: error must be specified as follows:\n:line:column: error: message\n=========\n");
93 }97 }
94 const line = std.fmt.parseInt(u32, cur[0..line_index.?], 10) catch @panic("Unable to parse line number");98 const line = std.fmt.parseInt(u32, cur[0..line_index.?], 10) catch @panic("Unable to parse line number");
95 cur = cur[line_index.? + 1 ..];99 cur = cur[line_index.? + 1 ..];
96 const column_index = std.mem.indexOf(u8, cur, ":");100 const column_index = std.mem.indexOf(u8, cur, ":");
97 if (column_index == null) {101 if (column_index == null) {
98 std.debug.panic("Invalid test: error must be specified as follows:\n:line:column: error: message\n=========\n", .{});102 @panic("Invalid test: error must be specified as follows:\n:line:column: error: message\n=========\n");
99 }103 }
100 const column = std.fmt.parseInt(u32, cur[0..column_index.?], 10) catch @panic("Unable to parse column number");104 const column = std.fmt.parseInt(u32, cur[0..column_index.?], 10) catch @panic("Unable to parse column number");
101 cur = cur[column_index.? + 2 ..];105 cur = cur[column_index.? + 2 ..];
102 if (!std.mem.eql(u8, cur[0..7], "error: ")) {106 if (!std.mem.eql(u8, cur[0..7], "error: ")) {
103 std.debug.panic("Invalid test: error must be specified as follows:\n:line:column: error: message\n=========\n", .{});107 @panic("Invalid test: error must be specified as follows:\n:line:column: error: message\n=========\n");
104 }108 }
105 const msg = cur[7..];109 const msg = cur[7..];
106110
...@@ -114,125 +118,87 @@ pub const TestContext = struct {...@@ -114,125 +118,87 @@ pub const TestContext = struct {
114 .column = column - 1,118 .column = column - 1,
115 };119 };
116 }120 }
117 self.updates.append(.{ .src = src, .case = .{ .Error = array } }) catch unreachable;121 try self.updates.append(.{ .src = src, .case = .{ .Error = array } });
118 }122 }
119 };123 };
120124
121 pub fn addExeZIR(
122 ctx: *TestContext,
123 name: []const u8,
124 target: std.zig.CrossTarget,
125 ) *Case {
126 const case = Case{
127 .name = name,
128 .target = target,
129 .updates = std.ArrayList(ZIRUpdate).init(ctx.zir_cases.allocator),
130 .output_mode = .Exe,
131 .extension = ".zir".*,
132 };
133 ctx.zir_cases.append(case) catch unreachable;
134 return &ctx.zir_cases.items[ctx.zir_cases.items.len - 1];
135 }
136
137 pub fn addObjZIR(
138 ctx: *TestContext,
139 name: []const u8,
140 target: std.zig.CrossTarget,
141 ) *Case {
142 const case = Case{
143 .name = name,
144 .target = target,
145 .updates = std.ArrayList(ZIRUpdate).init(ctx.zir_cases.allocator),
146 .output_mode = .Obj,
147 .extension = ".zir".*,
148 };
149 ctx.zir_cases.append(case) catch unreachable;
150 return &ctx.zir_cases.items[ctx.zir_cases.items.len - 1];
151 }
152
153 pub fn addExe(125 pub fn addExe(
154 ctx: *TestContext,126 ctx: *TestContext,
155 name: []const u8,127 name: []const u8,
156 target: std.zig.CrossTarget,128 target: std.zig.CrossTarget,
157 ) *Case {129 T: TestType,
130 ) !*Case {
158 const case = Case{131 const case = Case{
159 .name = name,132 .name = name,
160 .target = target,133 .target = target,
161 .updates = std.ArrayList(ZIRUpdate).init(ctx.zir_cases.allocator),134 .updates = std.ArrayList(Update).init(ctx.cases.allocator),
162 .output_mode = .Exe,135 .output_mode = .Exe,
163 .extension = ".zig".*,136 .@"type" = T,
164 };137 };
165 ctx.zir_cases.append(case) catch unreachable;138 try ctx.cases.append(case);
166 return &ctx.zir_cases.items[ctx.zir_cases.items.len - 1];139 return &ctx.cases.items[ctx.cases.items.len - 1];
167 }140 }
168141
169 pub fn addObj(142 pub fn addObj(
170 ctx: *TestContext,143 ctx: *TestContext,
171 name: []const u8,144 name: []const u8,
172 target: std.zig.CrossTarget,145 target: std.zig.CrossTarget,
173 ) *Case {146 T: TestType,
174 const case = Case{147 ) !*Case {
148 try ctx.cases.append(Case{
175 .name = name,149 .name = name,
176 .target = target,150 .target = target,
177 .updates = std.ArrayList(ZIRUpdate).init(ctx.zir_cases.allocator),151 .updates = std.ArrayList(Update).init(ctx.cases.allocator),
178 .output_mode = .Obj,152 .output_mode = .Obj,
179 .extension = ".zig".*,153 .@"type" = T,
180 };154 });
181 ctx.zir_cases.append(case) catch unreachable;155 return &ctx.cases.items[ctx.cases.items.len - 1];
182 return &ctx.zir_cases.items[ctx.zir_cases.items.len - 1];
183 }
184
185 pub fn addZIRCompareOutput(
186 ctx: *TestContext,
187 name: []const u8,
188 src: [:0]const u8,
189 expected_stdout: []const u8,
190 ) void {
191 var c = ctx.addExeZIR(name, .{});
192 c.addCompareOutput(src, expected_stdout);
193 }156 }
194157
195 pub fn addCompareOutput(158 pub fn addCompareOutput(
196 ctx: *TestContext,159 ctx: *TestContext,
197 name: []const u8,160 name: []const u8,
161 T: TestType,
198 src: [:0]const u8,162 src: [:0]const u8,
199 expected_stdout: []const u8,163 expected_stdout: []const u8,
200 ) void {164 ) !void {
201 var c = ctx.addExe(name, .{});165 var c = try ctx.addExe(name, .{}, T);
202 c.addCompareOutput(src, expected_stdout);166 try c.addCompareOutput(src, expected_stdout);
203 }167 }
204168
205 pub fn addZIRTransform(169 pub fn addTransform(
206 ctx: *TestContext,170 ctx: *TestContext,
207 name: []const u8,171 name: []const u8,
208 target: std.zig.CrossTarget,172 target: std.zig.CrossTarget,
173 T: TestType,
209 src: [:0]const u8,174 src: [:0]const u8,
210 result: [:0]const u8,175 result: [:0]const u8,
211 ) void {176 ) !void {
212 var c = ctx.addObjZIR(name, target);177 var c = try ctx.addObj(name, target, T);
213 c.addTransform(src, result);178 try c.addTransform(src, result);
214 }179 }
215180
216 pub fn addZIRError(181 pub fn addError(
217 ctx: *TestContext,182 ctx: *TestContext,
218 name: []const u8,183 name: []const u8,
219 target: std.zig.CrossTarget,184 target: std.zig.CrossTarget,
185 T: TestType,
220 src: [:0]const u8,186 src: [:0]const u8,
221 expected_errors: []const []const u8,187 expected_errors: []const []const u8,
222 ) void {188 ) !void {
223 var c = ctx.addObjZIR(name, target);189 var c = try ctx.addObj(name, target, T);
224 c.addError(src, expected_errors);190 try c.addError(src, expected_errors);
225 }191 }
226192
227 fn init() TestContext {193 fn init() TestContext {
228 const allocator = std.heap.page_allocator;194 const allocator = std.heap.page_allocator;
229 return .{195 return .{
230 .zir_cases = std.ArrayList(Case).init(allocator),196 .cases = std.ArrayList(Case).init(allocator),
231 };197 };
232 }198 }
233199
234 fn deinit(self: *TestContext) void {200 fn deinit(self: *TestContext) void {
235 for (self.zir_cases.items) |c| {201 for (self.cases.items) |c| {
236 for (c.updates.items) |u| {202 for (c.updates.items) |u| {
237 if (u.case == .Error) {203 if (u.case == .Error) {
238 c.updates.allocator.free(u.case.Error);204 c.updates.allocator.free(u.case.Error);
...@@ -240,18 +206,18 @@ pub const TestContext = struct {...@@ -240,18 +206,18 @@ pub const TestContext = struct {
240 }206 }
241 c.updates.deinit();207 c.updates.deinit();
242 }208 }
243 self.zir_cases.deinit();209 self.cases.deinit();
244 self.* = undefined;210 self.* = undefined;
245 }211 }
246212
247 fn run(self: *TestContext) !void {213 fn run(self: *TestContext) !void {
248 var progress = std.Progress{};214 var progress = std.Progress{};
249 const root_node = try progress.start("zir", self.zir_cases.items.len);215 const root_node = try progress.start("tests", self.cases.items.len);
250 defer root_node.end();216 defer root_node.end();
251217
252 const native_info = try std.zig.system.NativeTargetInfo.detect(std.heap.page_allocator, .{});218 const native_info = try std.zig.system.NativeTargetInfo.detect(std.heap.page_allocator, .{});
253219
254 for (self.zir_cases.items) |case| {220 for (self.cases.items) |case| {
255 std.testing.base_allocator_instance.reset();221 std.testing.base_allocator_instance.reset();
256222
257 var prg_node = root_node.start(case.name, case.updates.items.len);223 var prg_node = root_node.start(case.name, case.updates.items.len);
...@@ -267,17 +233,19 @@ pub const TestContext = struct {...@@ -267,17 +233,19 @@ pub const TestContext = struct {
267 }233 }
268 }234 }
269235
270 fn runOneCase(self: *TestContext, allocator: *Allocator, prg_node: *std.Progress.Node, case: Case, target: std.Target) !void {236 fn runOneCase(self: *TestContext, allocator: *Allocator, root_node: *std.Progress.Node, case: Case, target: std.Target) !void {
271 var tmp = std.testing.tmpDir(.{});237 var tmp = std.testing.tmpDir(.{});
272 defer tmp.cleanup();238 defer tmp.cleanup();
273239
274 const root_name = "test_case";240 const tmp_src_path = if (case.type == .Zig) "test_case.zig" else if (case.type == .ZIR) "test_case.zir" else unreachable;
275 const tmp_src_path = try std.fmt.allocPrint(allocator, "{}{}", .{ root_name, case.extension });
276 defer allocator.free(tmp_src_path);
277 const root_pkg = try Package.create(allocator, tmp.dir, ".", tmp_src_path);241 const root_pkg = try Package.create(allocator, tmp.dir, ".", tmp_src_path);
278 defer root_pkg.destroy();242 defer root_pkg.destroy();
279243
280 const bin_name = try std.zig.binNameAlloc(allocator, root_name, target, case.output_mode, null);244 var prg_node = root_node.start(case.name, case.updates.items.len);
245 prg_node.activate();
246 defer prg_node.end();
247
248 const bin_name = try std.zig.binNameAlloc(allocator, "test_case", target, case.output_mode, null);
281 defer allocator.free(bin_name);249 defer allocator.free(bin_name);
282250
283 var module = try Module.init(allocator, .{251 var module = try Module.init(allocator, .{
test/stage2/compare_output.zig+4-4
...@@ -17,9 +17,9 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -17,9 +17,9 @@ pub fn addCases(ctx: *TestContext) !void {
17 }17 }
1818
19 {19 {
20 var case = ctx.addExe("hello world with updates", linux_x64);20 var case = try ctx.addExe("hello world with updates", linux_x64, .Zig);
21 // Regular old hello world21 // Regular old hello world
22 case.addCompareOutput(22 try case.addCompareOutput(
23 \\export fn _start() noreturn {23 \\export fn _start() noreturn {
24 \\ print();24 \\ print();
25 \\25 \\
...@@ -51,7 +51,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -51,7 +51,7 @@ pub fn addCases(ctx: *TestContext) !void {
51 "Hello, World!\n",51 "Hello, World!\n",
52 );52 );
53 // Now change the message only53 // Now change the message only
54 case.addCompareOutput(54 try case.addCompareOutput(
55 \\export fn _start() noreturn {55 \\export fn _start() noreturn {
56 \\ print();56 \\ print();
57 \\57 \\
...@@ -83,7 +83,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -83,7 +83,7 @@ pub fn addCases(ctx: *TestContext) !void {
83 "What is up? This is a longer message that will force the data to be relocated in virtual address space.\n",83 "What is up? This is a longer message that will force the data to be relocated in virtual address space.\n",
84 );84 );
85 // Now we print it twice.85 // Now we print it twice.
86 case.addCompareOutput(86 try case.addCompareOutput(
87 \\export fn _start() noreturn {87 \\export fn _start() noreturn {
88 \\ print();88 \\ print();
89 \\ print();89 \\ print();
test/stage2/compile_errors.zig+10-12
...@@ -9,7 +9,7 @@ const linux_x64 = std.zig.CrossTarget{...@@ -9,7 +9,7 @@ const linux_x64 = std.zig.CrossTarget{
9};9};
1010
11pub fn addCases(ctx: *TestContext) !void {11pub fn addCases(ctx: *TestContext) !void {
12 ctx.addZIRError("call undefined local", linux_x64,12 try ctx.addError("call undefined local", linux_x64, .ZIR,
13 \\@noreturn = primitive(noreturn)13 \\@noreturn = primitive(noreturn)
14 \\14 \\
15 \\@start_fnty = fntype([], @noreturn, cc=Naked)15 \\@start_fnty = fntype([], @noreturn, cc=Naked)
...@@ -19,7 +19,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -19,7 +19,7 @@ pub fn addCases(ctx: *TestContext) !void {
19 // TODO: address inconsistency in this message and the one in the next test19 // TODO: address inconsistency in this message and the one in the next test
20 , &[_][]const u8{":5:13: error: unrecognized identifier: %test"});20 , &[_][]const u8{":5:13: error: unrecognized identifier: %test"});
2121
22 ctx.addZIRError("call with non-existent target", linux_x64,22 try ctx.addError("call with non-existent target", linux_x64, .ZIR,
23 \\@noreturn = primitive(noreturn)23 \\@noreturn = primitive(noreturn)
24 \\24 \\
25 \\@start_fnty = fntype([], @noreturn, cc=Naked)25 \\@start_fnty = fntype([], @noreturn, cc=Naked)
...@@ -31,7 +31,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -31,7 +31,7 @@ pub fn addCases(ctx: *TestContext) !void {
31 , &[_][]const u8{":5:13: error: decl 'notafunc' not found"});31 , &[_][]const u8{":5:13: error: decl 'notafunc' not found"});
3232
33 // TODO: this error should occur at the call site, not the fntype decl33 // TODO: this error should occur at the call site, not the fntype decl
34 ctx.addZIRError("call naked function", linux_x64,34 try ctx.addError("call naked function", linux_x64, .ZIR,
35 \\@noreturn = primitive(noreturn)35 \\@noreturn = primitive(noreturn)
36 \\36 \\
37 \\@start_fnty = fntype([], @noreturn, cc=Naked)37 \\@start_fnty = fntype([], @noreturn, cc=Naked)
...@@ -45,17 +45,15 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -45,17 +45,15 @@ pub fn addCases(ctx: *TestContext) !void {
4545
46 // TODO: re-enable these tests.46 // TODO: re-enable these tests.
47 // https://github.com/ziglang/zig/issues/136447 // https://github.com/ziglang/zig/issues/1364
48 // TODO: add Zig AST -> ZIR testing pipeline
4948
50 //try ctx.testCompileError(49 // try ctx.addError("Export same symbol twice", linux_x64, .Zig,
51 // \\export fn entry() void {}50 // \\export fn entry() void {}
52 // \\export fn entry() void {}51 // \\export fn entry() void {}
53 //, "1.zig", 2, 8, "exported symbol collision: 'entry'");52 // , &[_][]const u8{":2:1: error: exported symbol collision"});
54
55 //try ctx.testCompileError(
56 // \\fn() void {}
57 //, "1.zig", 1, 1, "missing function name");
5853
54 // try ctx.addError("Missing function name", linux_x64, .Zig,
55 // \\fn() void {}
56 // , &[_][]const u8{":1:3: error: missing function name"});
59 //try ctx.testCompileError(57 //try ctx.testCompileError(
60 // \\comptime {58 // \\comptime {
61 // \\ return;59 // \\ return;
test/stage2/test.zig+1-1
...@@ -3,5 +3,5 @@ const TestContext = @import("../../src-self-hosted/test.zig").TestContext;...@@ -3,5 +3,5 @@ const TestContext = @import("../../src-self-hosted/test.zig").TestContext;
3pub fn addCases(ctx: *TestContext) !void {3pub fn addCases(ctx: *TestContext) !void {
4 try @import("compile_errors.zig").addCases(ctx);4 try @import("compile_errors.zig").addCases(ctx);
5 try @import("compare_output.zig").addCases(ctx);5 try @import("compare_output.zig").addCases(ctx);
6 @import("zir.zig").addCases(ctx);6 try @import("zir.zig").addCases(ctx);
7}7}
test/stage2/zir.zig+9-9
...@@ -8,8 +8,8 @@ const linux_x64 = std.zig.CrossTarget{...@@ -8,8 +8,8 @@ const linux_x64 = std.zig.CrossTarget{
8 .os_tag = .linux,8 .os_tag = .linux,
9};9};
1010
11pub fn addCases(ctx: *TestContext) void {11pub fn addCases(ctx: *TestContext) !void {
12 ctx.addZIRTransform("referencing decls which appear later in the file", linux_x64,12 try ctx.addTransform("referencing decls which appear later in the file", linux_x64, .ZIR,
13 \\@void = primitive(void)13 \\@void = primitive(void)
14 \\@fnty = fntype([], @void, cc=C)14 \\@fnty = fntype([], @void, cc=C)
15 \\15 \\
...@@ -32,7 +32,7 @@ pub fn addCases(ctx: *TestContext) void {...@@ -32,7 +32,7 @@ pub fn addCases(ctx: *TestContext) void {
32 \\})32 \\})
33 \\33 \\
34 );34 );
35 ctx.addZIRTransform("elemptr, add, cmp, condbr, return, breakpoint", linux_x64,35 try ctx.addTransform("elemptr, add, cmp, condbr, return, breakpoint", linux_x64, .ZIR,
36 \\@void = primitive(void)36 \\@void = primitive(void)
37 \\@usize = primitive(usize)37 \\@usize = primitive(usize)
38 \\@fnty = fntype([], @void, cc=C)38 \\@fnty = fntype([], @void, cc=C)
...@@ -86,8 +86,8 @@ pub fn addCases(ctx: *TestContext) void {...@@ -86,8 +86,8 @@ pub fn addCases(ctx: *TestContext) void {
86 );86 );
8787
88 {88 {
89 var case = ctx.addObjZIR("reference cycle with compile error in the cycle", linux_x64);89 var case = try ctx.addObj("reference cycle with compile error in the cycle", linux_x64, .ZIR);
90 case.addTransform(90 try case.addTransform(
91 \\@void = primitive(void)91 \\@void = primitive(void)
92 \\@fnty = fntype([], @void, cc=C)92 \\@fnty = fntype([], @void, cc=C)
93 \\93 \\
...@@ -133,7 +133,7 @@ pub fn addCases(ctx: *TestContext) void {...@@ -133,7 +133,7 @@ pub fn addCases(ctx: *TestContext) void {
133 \\133 \\
134 );134 );
135 // Now we introduce a compile error135 // Now we introduce a compile error
136 case.addError(136 try case.addError(
137 \\@void = primitive(void)137 \\@void = primitive(void)
138 \\@fnty = fntype([], @void, cc=C)138 \\@fnty = fntype([], @void, cc=C)
139 \\139 \\
...@@ -163,7 +163,7 @@ pub fn addCases(ctx: *TestContext) void {...@@ -163,7 +163,7 @@ pub fn addCases(ctx: *TestContext) void {
163 // Now we remove the call to `a`. `a` and `b` form a cycle, but no entry points are163 // Now we remove the call to `a`. `a` and `b` form a cycle, but no entry points are
164 // referencing either of them. This tests that the cycle is detected, and the error164 // referencing either of them. This tests that the cycle is detected, and the error
165 // goes away.165 // goes away.
166 case.addTransform(166 try case.addTransform(
167 \\@void = primitive(void)167 \\@void = primitive(void)
168 \\@fnty = fntype([], @void, cc=C)168 \\@fnty = fntype([], @void, cc=C)
169 \\169 \\
...@@ -207,7 +207,7 @@ pub fn addCases(ctx: *TestContext) void {...@@ -207,7 +207,7 @@ pub fn addCases(ctx: *TestContext) void {
207 return;207 return;
208 }208 }
209209
210 ctx.addZIRCompareOutput("hello world ZIR",210 try ctx.addCompareOutput("hello world ZIR", .ZIR,
211 \\@noreturn = primitive(noreturn)211 \\@noreturn = primitive(noreturn)
212 \\@void = primitive(void)212 \\@void = primitive(void)
213 \\@usize = primitive(usize)213 \\@usize = primitive(usize)
...@@ -265,7 +265,7 @@ pub fn addCases(ctx: *TestContext) void {...@@ -265,7 +265,7 @@ pub fn addCases(ctx: *TestContext) void {
265 \\265 \\
266 );266 );
267267
268 ctx.addZIRCompareOutput("function call with no args no return value",268 try ctx.addCompareOutput("function call with no args no return value", .ZIR,
269 \\@noreturn = primitive(noreturn)269 \\@noreturn = primitive(noreturn)
270 \\@void = primitive(void)270 \\@void = primitive(void)
271 \\@usize = primitive(usize)271 \\@usize = primitive(usize)