Fix stuttering stderr in Zig test log

Before this fix, the stderr FIFO was advanced by the length
of the trimmed message, thus the next error log contained
the tail of that message.
This commit is contained in:
Nguyễn Gia Phong 2024-02-28 11:08:53 +09:00 committed by Veikka Tuominen
parent 4b1edad6e2
commit f13401ac69

View File

@ -1181,7 +1181,9 @@ fn evalZigTest(
if (tr_hdr.flags.fail or tr_hdr.flags.leak or tr_hdr.flags.log_err_count > 0) {
const name = std.mem.sliceTo(md.string_bytes[md.names[tr_hdr.index]..], 0);
const msg = std.mem.trim(u8, stderr.readableSlice(0), "\n");
const orig_msg = stderr.readableSlice(0);
defer stderr.discard(orig_msg.len);
const msg = std.mem.trim(u8, orig_msg, "\n");
const label = if (tr_hdr.flags.fail)
"failed"
else if (tr_hdr.flags.leak)
@ -1195,7 +1197,6 @@ fn evalZigTest(
} else {
try self.step.addError("'{s}' {s}", .{ name, label });
}
stderr.discard(msg.len);
}
try requestNextTest(child.stdin.?, &metadata.?, &sub_prog_node);