-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
automatically test for out of memory conditions when std.testing.allocator is used #22086
Copy link
Copy link
Open
Labels
breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.testingThis issue is related to testing the compiler, standard library, or other parts of Zig.This issue is related to testing the compiler, standard library, or other parts of Zig.
Milestone
Metadata
Metadata
Assignees
Labels
breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.testingThis issue is related to testing the compiler, standard library, or other parts of Zig.This issue is related to testing the compiler, standard library, or other parts of Zig.
Zig already has
checkAllAllocationFailuresfor doing this, however it is opt-in.I propose to make the test runner enable this kind of testing by default. When it makes an allocation fail, it allows
error.OutOfMemoryto be returned from the unit test, but still checks for memory leaks.A unit test could opt-out of this by not using
std.testing.allocatoror by setting a flag (i.e.std.testing.skipAllocationFailureChecking();).