-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
introduce a new tool for testing incremental compilation #20688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
converts an unsigned integer into an array
@@ -2032,3 +2032,9 @@ pub fn createWindowsEnvBlock(allocator: mem.Allocator, env_map: *const EnvMap) ! | |||
i += 1; | |||
return try allocator.realloc(result, i); | |||
} | |||
|
|||
/// Logs an error and then terminates the process with exit code 1. | |||
pub fn fatal(comptime format: []const u8, format_arguments: anytype) noreturn { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this move. Wouldn't this be better on std.log
itself? That is what Go does if that counts for anything https://pkg.go.dev/log#Fatal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What another language does is entirely irrelevant, especially one as different as Go. Why would this live in std.log
? Just because it happens to use that API doesn't mean it's part of it. std.process
seems like an entirely reasonable place for this to live given its other task of terminating the process with exit code 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go and Zig both allow creating custom loggers. This is important because I would like to be able to call fatal on my custom logger without duplicating this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if std.log.fatal
was going to exist, i would still expect this one to exist and for std.log.fatal
to call it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it belongs in process since it exits the process.
failing incremental test case filed as #20697 |
This is a tiny component of an overall testing strategy. This provides the ability to have compact test cases that can be run with a single command which are then tested in isolation, aiding reproducibility. For example, I have included one test case along with this tool:
You can run it like this:
You can see how once this patchset is merged, this will become our first incremental compilation bug report, and it comes with a reduction.
A future enhancement will provide the ability to generate these test cases using fuzzer input and test various properties, such as path independence.