diff --git a/src/scheduler/testsuite/test_core_events.c b/src/scheduler/testsuite/test_core_events.c index 10ac1c6c..d9ddd7f9 100644 --- a/src/scheduler/testsuite/test_core_events.c +++ b/src/scheduler/testsuite/test_core_events.c @@ -1357,8 +1357,21 @@ static void test_job_rusage_reconciles_mem_reservation_against_usage(void) TEST_ASSERT_NOT_NULL(tracked); TEST_ASSERT_NOT_NULL(tracked->accounts); - /* Sanity: the reservation charge landed at dispatch time (before any - * rusage tick), matching sched_charge_account()'s existing behavior. */ + /* bug-1758: JOBS_PUSH itself never charges resInUse -- by design, that + * is sched_account_jobs()'s job (scheduler.c), a round-boundary + * reconciliation the real normal-mode/sim drivers both call once per + * round (driver.c/sim_loop.c), BEFORE anything in that round ever reads + * resInUse, re-deriving it from every currently-RUN job's accounts via + * sched_charge_account() -- see core.h's own doc comment on + * sched_account_jobs(). This test's own JOBS_PUSH call above is not + * itself a round boundary, so simulate the one sched_account_jobs() + * would perform for this test's single RUN job directly (sched_account_ + * jobs() itself lives in scheduler.c, not white-box #included here -- + * this file already pulls in resource.c for sched_charge_account()). */ + sched_charge_account(&core, tracked->accounts); + + /* Sanity: the reservation charge lands via that reconciliation, before + * any rusage tick. */ idx[0] = r_mem->idx; get_resvals(&(w->resInUse), 1, idx, val); TEST_ASSERT_EQUAL_FLOAT(4.0f, val[0]);