fix(scheduler-test): unlink the reconcile stdout-capture scratch files (bug-924 tail)

test_sim_reconcile_unaccounted.c captures stdout through mkstemp() files in
/tmp/xce_simreconcile_*, but only the shared capture_stdout_around() helper
unlinked its file after reading it back -- the 4 inlined capture sites left
theirs behind on every passing run (the mkdtemp shim does not intercept
mkstemp, so nothing else removed them). Add the same close(fd); unlink(tmp)
the file family's other capture helpers use to each of the 4 sites.

Verified: scheduler sim reconcile unaccounted test passes and leaves no
/tmp/xce_simreconcile_* files behind.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
lei.chen 2026-10-14 07:27:45 +00:00
parent 0c8607345e
commit f661987a60

View file

@ -800,6 +800,7 @@ static void test_reconcile_skips_job_that_already_has_accounts(void)
TEST_ASSERT_TRUE(nread == len);
}
close(fd);
unlink(tmp); /* capture read back -- drop the scratch file (bug-924) */
TEST_ASSERT_EQUAL_PTR_MESSAGE(
accounts_before, job->accounts,
@ -1189,6 +1190,7 @@ test_reconcile_reports_reconstructed_decision_through_existing_channel(void)
TEST_ASSERT_TRUE(nread == len);
}
close(fd);
unlink(tmp); /* capture read back -- drop the scratch file (bug-924) */
/* The reconciliation itself (task 2.3) still happened. */
TEST_ASSERT_EQUAL_PTR(jalloc, job->allocs);
@ -1886,6 +1888,7 @@ test_reconcile_continue_mode_with_repl_state_suppresses_bare_decision_line(
TEST_ASSERT_TRUE(nread == len);
}
close(fd);
unlink(tmp); /* capture read back -- drop the scratch file (bug-924) */
/* The reconciliation itself (task 2.3) still happened -- this gate only
* ever affects the console print, nothing else in the reporting chain. */
@ -1982,6 +1985,7 @@ test_reconcile_step_mode_with_repl_state_still_prints_bare_decision_line(
TEST_ASSERT_TRUE(nread == len);
}
close(fd);
unlink(tmp); /* capture read back -- drop the scratch file (bug-924) */
TEST_ASSERT_EQUAL_PTR(jalloc, job->allocs);
TEST_ASSERT_NOT_NULL(job->accounts);