| ... | @@ -158,6 +158,7 @@ pub fn addGenHTests(b: *build.Builder, test_filter: ?[]const u8) *build.Step { | ... | @@ -158,6 +158,7 @@ pub fn addGenHTests(b: *build.Builder, test_filter: ?[]const u8) *build.Step { |
| 158 | .step = b.step("test-gen-h", "Run the C header file generation tests"), | 158 | .step = b.step("test-gen-h", "Run the C header file generation tests"), |
| 159 | .test_index = 0, | 159 | .test_index = 0, |
| 160 | .test_filter = test_filter, | 160 | .test_filter = test_filter, |
| | 161 | .counter = 0, |
| 161 | }; | 162 | }; |
| 162 | | 163 | |
| 163 | gen_h.addCases(cases); | 164 | gen_h.addCases(cases); |
| ... | @@ -1104,6 +1105,7 @@ pub const GenHContext = struct { | ... | @@ -1104,6 +1105,7 @@ pub const GenHContext = struct { |
| 1104 | step: *build.Step, | 1105 | step: *build.Step, |
| 1105 | test_index: usize, | 1106 | test_index: usize, |
| 1106 | test_filter: ?[]const u8, | 1107 | test_filter: ?[]const u8, |
| | 1108 | counter: usize, |
| 1107 | | 1109 | |
| 1108 | const TestCase = struct { | 1110 | const TestCase = struct { |
| 1109 | name: []const u8, | 1111 | name: []const u8, |
| ... | @@ -1206,7 +1208,11 @@ pub const GenHContext = struct { | ... | @@ -1206,7 +1208,11 @@ pub const GenHContext = struct { |
| 1206 | } | 1208 | } |
| 1207 | | 1209 | |
| 1208 | pub fn add(self: *GenHContext, name: []const u8, source: []const u8, expected_lines: ...) void { | 1210 | pub fn add(self: *GenHContext, name: []const u8, source: []const u8, expected_lines: ...) void { |
| 1209 | const tc = self.create("test.zig", name, source, expected_lines); | 1211 | // MacOS appears to not be returning nanoseconds in fstat mtime, |
| | 1212 | // which causes fast test executions to think the file contents are unchanged. |
| | 1213 | const modified_name = self.b.fmt("test-{}.zig", self.counter); |
| | 1214 | self.counter += 1; |
| | 1215 | const tc = self.create(modified_name, name, source, expected_lines); |
| 1210 | self.addCase(tc); | 1216 | self.addCase(tc); |
| 1211 | } | 1217 | } |
| 1212 | | 1218 | |