| ... | ... | @@ -89,19 +89,22 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { |
| 89 | 89 | |
| 90 | 90 | switch (case.special) { |
| 91 | 91 | Special.Asm => { |
| 92 | | const annotated_case_name = fmt.allocPrint(self.b.allocator, "run assemble-and-link {s}", .{ |
| 92 | const annotated_case_name = b.fmt("run assemble-and-link {s}", .{ |
| 93 | 93 | case.name, |
| 94 | | }) catch @panic("OOM"); |
| 94 | }); |
| 95 | 95 | for (self.test_filters) |test_filter| { |
| 96 | 96 | if (mem.indexOf(u8, annotated_case_name, test_filter)) |_| break; |
| 97 | 97 | } else if (self.test_filters.len > 0) return; |
| 98 | 98 | |
| 99 | 99 | const exe = b.addExecutable(.{ |
| 100 | 100 | .name = "test", |
| 101 | | .target = b.graph.host, |
| 102 | | .optimize = .Debug, |
| 101 | .root_module = b.createModule(.{ |
| 102 | .root_source_file = null, |
| 103 | .target = b.graph.host, |
| 104 | .optimize = .Debug, |
| 105 | }), |
| 103 | 106 | }); |
| 104 | | exe.addAssemblyFile(first_file); |
| 107 | exe.root_module.addAssemblyFile(first_file); |
| 105 | 108 | |
| 106 | 109 | const run = b.addRunArtifact(exe); |
| 107 | 110 | run.setName(annotated_case_name); |
| ... | ... | @@ -112,22 +115,22 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { |
| 112 | 115 | }, |
| 113 | 116 | Special.None => { |
| 114 | 117 | for (self.optimize_modes) |optimize| { |
| 115 | | const annotated_case_name = fmt.allocPrint(self.b.allocator, "run compare-output {s} ({s})", .{ |
| 118 | const annotated_case_name = b.fmt("run compare-output {s} ({s})", .{ |
| 116 | 119 | case.name, @tagName(optimize), |
| 117 | | }) catch @panic("OOM"); |
| 120 | }); |
| 118 | 121 | for (self.test_filters) |test_filter| { |
| 119 | 122 | if (mem.indexOf(u8, annotated_case_name, test_filter)) |_| break; |
| 120 | 123 | } else if (self.test_filters.len > 0) return; |
| 121 | 124 | |
| 122 | 125 | const exe = b.addExecutable(.{ |
| 123 | 126 | .name = "test", |
| 124 | | .root_source_file = first_file, |
| 125 | | .optimize = optimize, |
| 126 | | .target = b.graph.host, |
| 127 | .root_module = b.createModule(.{ |
| 128 | .root_source_file = first_file, |
| 129 | .optimize = optimize, |
| 130 | .target = b.graph.host, |
| 131 | }), |
| 127 | 132 | }); |
| 128 | | if (case.link_libc) { |
| 129 | | exe.linkSystemLibrary("c"); |
| 130 | | } |
| 133 | if (case.link_libc) exe.root_module.link_libc = true; |
| 131 | 134 | |
| 132 | 135 | const run = b.addRunArtifact(exe); |
| 133 | 136 | run.setName(annotated_case_name); |
| ... | ... | @@ -140,20 +143,20 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { |
| 140 | 143 | Special.RuntimeSafety => { |
| 141 | 144 | // TODO iterate over self.optimize_modes and test this in both |
| 142 | 145 | // debug and release safe mode |
| 143 | | const annotated_case_name = fmt.allocPrint(self.b.allocator, "run safety {s}", .{case.name}) catch @panic("OOM"); |
| 146 | const annotated_case_name = b.fmt("run safety {s}", .{case.name}); |
| 144 | 147 | for (self.test_filters) |test_filter| { |
| 145 | 148 | if (mem.indexOf(u8, annotated_case_name, test_filter)) |_| break; |
| 146 | 149 | } else if (self.test_filters.len > 0) return; |
| 147 | 150 | |
| 148 | 151 | const exe = b.addExecutable(.{ |
| 149 | 152 | .name = "test", |
| 150 | | .root_source_file = first_file, |
| 151 | | .target = b.graph.host, |
| 152 | | .optimize = .Debug, |
| 153 | .root_module = b.createModule(.{ |
| 154 | .root_source_file = first_file, |
| 155 | .target = b.graph.host, |
| 156 | .optimize = .Debug, |
| 157 | }), |
| 153 | 158 | }); |
| 154 | | if (case.link_libc) { |
| 155 | | exe.linkSystemLibrary("c"); |
| 156 | | } |
| 159 | if (case.link_libc) exe.root_module.link_libc = true; |
| 157 | 160 | |
| 158 | 161 | const run = b.addRunArtifact(exe); |
| 159 | 162 | run.setName(annotated_case_name); |
| ... | ... | @@ -168,7 +171,6 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void { |
| 168 | 171 | const CompareOutput = @This(); |
| 169 | 172 | const std = @import("std"); |
| 170 | 173 | const ArrayList = std.ArrayList; |
| 171 | | const fmt = std.fmt; |
| 172 | 174 | const mem = std.mem; |
| 173 | 175 | const fs = std.fs; |
| 174 | 176 | const OptimizeMode = std.builtin.OptimizeMode; |