One user-space repair task per eligible HWE debug-diag / compile-deploy base ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content filter. Each ships a public spec with a check-to-basis table, at least two defects with single-fix fixtures, a symptom-masking fixture and an alternative correct implementation. Claude re-checked all 320: structure, the HWE quality items and trace6 Docker calibration receipts against current digests (320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120 ad-hoc family names; the next batch maps them to the canonical list. The batch's 1,256-line progress log stays in its factory report and the 36-local branch batch15-hwe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
109 lines
3.4 KiB
C
109 lines
3.4 KiB
C
#include "array_report.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
typedef struct {
|
|
void *blocks[2];
|
|
size_t sizes[2];
|
|
int fail_at;
|
|
int calls;
|
|
int releases;
|
|
int live;
|
|
int invalid;
|
|
int publications;
|
|
ra_report report;
|
|
} observer;
|
|
static void *allocate(void *context, size_t bytes)
|
|
{
|
|
observer *state = context;
|
|
state->calls += 1;
|
|
if (state->calls <= 2) {
|
|
state->sizes[state->calls - 1] = bytes;
|
|
}
|
|
if (state->fail_at == state->calls || state->calls > 2) {
|
|
return NULL;
|
|
}
|
|
void *block = malloc(bytes);
|
|
if (block != NULL) {
|
|
state->blocks[state->calls - 1] = block;
|
|
state->live += 1;
|
|
}
|
|
return block;
|
|
}
|
|
static void release(void *context, void *block)
|
|
{
|
|
observer *state = context;
|
|
state->releases += 1;
|
|
for (int index = 0; index < 2; ++index) {
|
|
if (block != NULL && block == state->blocks[index]) {
|
|
free(block);
|
|
state->blocks[index] = NULL;
|
|
state->live -= 1;
|
|
return;
|
|
}
|
|
}
|
|
state->invalid += 1;
|
|
}
|
|
static void publish(void *context, const ra_report *report)
|
|
{
|
|
observer *state = context;
|
|
state->publications += 1;
|
|
if (state->live != 2) {
|
|
state->invalid += 1;
|
|
}
|
|
state->report = *report;
|
|
}
|
|
int main(void)
|
|
{
|
|
for (;;) {
|
|
ra_request request;
|
|
int got = scanf("%d %u %d %d %d %d %d %d %d", &request.count,
|
|
&request.seed, &request.base, &request.step, &request.mode,
|
|
&request.cutoff, &request.window, &request.bins, &request.fail_at);
|
|
if (got == EOF) {
|
|
return 0;
|
|
}
|
|
if (got != 9) {
|
|
return 2;
|
|
}
|
|
observer state;
|
|
memset(&state, 0, sizeof(state));
|
|
state.fail_at = request.fail_at;
|
|
ra_port port = {&state, allocate, release, publish};
|
|
const ra_request *selected_request = &request;
|
|
const ra_port *selected_port = &port;
|
|
int probe = request.count;
|
|
if (probe <= -2 && probe >= -6) {
|
|
request.count = 1;
|
|
if (probe == -2) selected_request = NULL;
|
|
if (probe == -3) selected_port = NULL;
|
|
if (probe == -4) port.allocate = NULL;
|
|
if (probe == -5) port.release = NULL;
|
|
if (probe == -6) port.publish = NULL;
|
|
}
|
|
ra_request saved = request;
|
|
ra_port saved_port = port;
|
|
int rc = ra_process(selected_request, selected_port);
|
|
if (request.count != saved.count || request.seed != saved.seed ||
|
|
request.base != saved.base || request.step != saved.step ||
|
|
request.mode != saved.mode || request.cutoff != saved.cutoff ||
|
|
request.window != saved.window || request.bins != saved.bins ||
|
|
request.fail_at != saved.fail_at ||
|
|
port.context != saved_port.context ||
|
|
port.allocate != saved_port.allocate ||
|
|
port.release != saved_port.release ||
|
|
port.publish != saved_port.publish) {
|
|
state.invalid += 1;
|
|
}
|
|
printf("%d %d %d %d %d %zu %zu %d", rc, state.calls, state.releases,
|
|
state.live, state.invalid, state.sizes[0], state.sizes[1], state.publications);
|
|
for (int field = 0; field < RA_FIELDS; ++field) {
|
|
printf(" %lld", state.report.v[field]);
|
|
}
|
|
putchar('\n');
|
|
for (int index = 0; index < 2; ++index) {
|
|
free(state.blocks[index]);
|
|
}
|
|
}
|
|
}
|