authorgravatar for paul.verigo@gmail.comPavel Verigo <paul.verigo@gmail.com> 2026-08-31 21:12:09+02:00
committergravatar for mlugg@mlugg.co.ukmlugg <mlugg@mlugg.co.uk> 2026-09-01 21:22:06+02:00
log79837d51123460e4f0a04ba523d01b10f7c314cd
treefceae30e698802fb04b5d06166275c1f5161e4fc
parentc961124d93a47e9ae317b2e057cf0fe5118303e3

incr-check: update timestamp on each update


4 files changed, 13 insertions(+), 11 deletions(-)

test/incremental/add_decl-1
...@@ -1,4 +1,3 @@...@@ -1,4 +1,3 @@
1#skip_target=x86_64-linux-selfhosted
2#update=initial version1#update=initial version
3#file=main.zig2#file=main.zig
4const std = @import("std");3const std = @import("std");
test/incremental/add_decl_namespaced-2
...@@ -1,5 +1,3 @@...@@ -1,5 +1,3 @@
1#skip_target=wasm32-wasi-selfhosted
2#skip_target=x86_64-linux-selfhosted
3#update=initial version1#update=initial version
4#file=main.zig2#file=main.zig
5const std = @import("std");3const std = @import("std");
test/incremental/change_enum_tag_type-1
...@@ -1,4 +1,3 @@...@@ -1,4 +1,3 @@
1#skip_target=wasm32-wasi-selfhosted
2#update=initial version1#update=initial version
3#file=main.zig2#file=main.zig
4const Tag = u2;3const Tag = u2;
tools/incr-check.zig+13-7
...@@ -241,6 +241,7 @@ pub fn main(init: std.process.Init) !void {...@@ -241,6 +241,7 @@ pub fn main(init: std.process.Init) !void {
241 multi_reader.init(gpa, io, multi_reader_buffer.toStreams(), &.{ child.stdout.?, child.stderr.? });241 multi_reader.init(gpa, io, multi_reader_buffer.toStreams(), &.{ child.stdout.?, child.stderr.? });
242 defer multi_reader.deinit();242 defer multi_reader.deinit();
243243
244 var update_mtime = Io.Clock.real.now(io);
244 for (case.updates) |update| {245 for (case.updates) |update| {
245 var update_prog_node = updates_prog_node.start(update.name, 0);246 var update_prog_node = updates_prog_node.start(update.name, 0);
246 defer update_prog_node.end();247 defer update_prog_node.end();
...@@ -253,7 +254,8 @@ pub fn main(init: std.process.Init) !void {...@@ -253,7 +254,8 @@ pub fn main(init: std.process.Init) !void {
253 log_cur_update = &update;254 log_cur_update = &update;
254 defer log_cur_update = null;255 defer log_cur_update = null;
255256
256 eval.write(update);257 eval.write(update, update_mtime);
258 update_mtime = update_mtime.addDuration(.fromSeconds(5));
257 try eval.requestUpdate();259 try eval.requestUpdate();
258 try eval.check(&multi_reader, update, update_prog_node);260 try eval.check(&multi_reader, update, update_prog_node);
259 }261 }
...@@ -286,14 +288,18 @@ const Eval = struct {...@@ -286,14 +288,18 @@ const Eval = struct {
286 enable_darling: bool,288 enable_darling: bool,
287289
288 /// Currently this function assumes the previous updates have already been written.290 /// Currently this function assumes the previous updates have already been written.
289 fn write(eval: *Eval, update: Case.Update) void {291 fn write(eval: *Eval, update: Case.Update, mtime: Io.Timestamp) void {
290 const io = eval.io;292 const io = eval.io;
291 for (update.changes) |full_contents| {293 for (update.changes) |full_contents| {
292 eval.tmp_dir.writeFile(io, .{294 var update_file = eval.tmp_dir.createFile(io, full_contents.name, .{}) catch |err| {
293 .sub_path = full_contents.name,295 eval.fatal("failed to create update '{s}': {t}", .{ full_contents.name, err });
294 .data = full_contents.bytes,296 };
295 }) catch |err| {297 defer update_file.close(io);
296 eval.fatal("failed to update '{s}': {t}", .{ full_contents.name, err });298 update_file.writeStreamingAll(io, full_contents.bytes) catch |err| {
299 eval.fatal("failed to write update '{s}': {t}", .{ full_contents.name, err });
300 };
301 update_file.setTimestamps(io, .{ .modify_timestamp = .{ .new = mtime } }) catch |err| {
302 eval.fatal("failed to set mtime for '{s}': {t}", .{ full_contents.name, err });
297 };303 };
298 }304 }
299 for (update.deletes) |doomed_name| {305 for (update.deletes) |doomed_name| {