Preserve ignored error snapshots
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#include "akerror.h"
|
||||
#include "err_capture.h"
|
||||
#include <string.h>
|
||||
|
||||
/* IGNORE logs and releases an error, then lets execution continue. */
|
||||
/* IGNORE snapshots and logs an error, releases its pool slot, then continues. */
|
||||
|
||||
akerr_ErrorContext *boom(void)
|
||||
{
|
||||
@@ -18,10 +19,14 @@ int main(void)
|
||||
(void)e;
|
||||
|
||||
/* More failures than the pool has slots must remain safe: a leaking
|
||||
* IGNORE used to exhaust the pool and terminate the process here. */
|
||||
* IGNORE used to exhaust the pool and terminate the process here. The
|
||||
* copied snapshot must also survive the slot being reused on the next
|
||||
* iteration. */
|
||||
for ( int i = 0; i < AKERR_MAX_ARRAY_ERROR + 1; i++ ) {
|
||||
IGNORE(boom());
|
||||
AKERR_CHECK(__akerr_last_ignored == NULL);
|
||||
AKERR_CHECK(__akerr_last_ignored.status == AKERR_VALUE);
|
||||
AKERR_CHECK(strcmp(__akerr_last_ignored.message,
|
||||
"this error is ignored on purpose") == 0);
|
||||
AKERR_CHECK(akerr_slots_in_use() == 0);
|
||||
}
|
||||
reached_after_ignore = 1;
|
||||
|
||||
Reference in New Issue
Block a user