refactor(scheduler): one schedobj builder for ingest and snapshot restore (bug-1767)
snapshot_load.c carried its own field-for-field copy of core_events.c's schedobj builders (primary/compound/alter + hlimits killer), kept separate by a "never share builders" convention. The copy drifted from the original three times, each a field-completeness bug in restored jobs (bug-1772's all-zero resreq_fp among them). The convention's reasons apply to the job/queue/worker builders, not to schedobj, which is never wire-captured. - core_build_schedobj() becomes the exported xce_core_build_schedobj(obj, user, queue, project, resreq) (core.h), taking identity strings instead of a wire job; core_build_job() and snapshot_load.c both call it. - snapshot_load.c's five copied functions are removed. - test_sim_startup.c #includes snapshot_load.c without core_events.c; it now also #includes core_events.c, plus the same sched_reconcile_job_resource_usage link stub test_driver_translate.c uses. - test_fresh_ingest_and_snapshot_restore_derive_identical_... now compares the whole schedobj (tag, user/queue/project, configver, glimits, owner, resreq binding, resreq_fp), guarding against future drift. No RED phase: there is no live gap left to catch; this removes the duplication that kept producing them. Scheduler suite 87/87; full build links. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6103150084
commit
1dfdf42cc9
5 changed files with 70 additions and 158 deletions
|
|
@ -638,6 +638,32 @@ test_fresh_ingest_and_snapshot_restore_derive_identical_task_count_for_equivalen
|
|||
fresh_primary->maxTasks, restored_primary->maxTasks,
|
||||
"Req 5.6: snapshot-restore ingest must derive the IDENTICAL "
|
||||
"standalone primary maxTasks an equivalent fresh submission would");
|
||||
|
||||
/* ── bug-1767: the whole schedobj the allocator reads must be built
|
||||
* identically on both paths (snapshot_load.c used to carry its own
|
||||
* hand-copied builder, which drifted three times, e.g. bug-1772's
|
||||
* missing resreq_fp). ───────────────────────────────────────────── */
|
||||
{
|
||||
xce_sched_obj_t* fo = fresh_sjob->schedobj;
|
||||
xce_sched_obj_t* ro = restored_sjob->schedobj;
|
||||
|
||||
TEST_ASSERT_NOT_NULL(fo);
|
||||
TEST_ASSERT_NOT_NULL(ro);
|
||||
TEST_ASSERT_EQUAL_INT(fo->tag, ro->tag);
|
||||
TEST_ASSERT_EQUAL_STRING(fo->user, ro->user);
|
||||
TEST_ASSERT_EQUAL_STRING(fo->queue, ro->queue);
|
||||
TEST_ASSERT_EQUAL_STRING(fo->project, ro->project);
|
||||
TEST_ASSERT_EQUAL_UINT32(fo->configver, ro->configver);
|
||||
TEST_ASSERT_EQUAL_INT(fo->glimits.count, ro->glimits.count);
|
||||
TEST_ASSERT_NOT_NULL(fo->u.primary);
|
||||
TEST_ASSERT_NOT_NULL(ro->u.primary);
|
||||
TEST_ASSERT_TRUE(ro->u.primary->resreq == restored_primary);
|
||||
TEST_ASSERT_TRUE(ro->u.primary->owner == ro);
|
||||
TEST_ASSERT_EQUAL_MEMORY_MESSAGE(&fo->u.primary->resreq_fp,
|
||||
&ro->u.primary->resreq_fp, sizeof(fo->u.primary->resreq_fp),
|
||||
"bug-1767: fresh and restored schedobj resreq fingerprints "
|
||||
"must be identical");
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -62,12 +62,23 @@
|
|||
* same convention as test_record_lifecycle.c). */
|
||||
#include "../src/core.c"
|
||||
#include "../src/core_clock.c"
|
||||
#include "../src/core_events.c" /* bug-1767: xce_core_build_schedobj() */
|
||||
#include "../src/recording.c"
|
||||
#include "../src/sim.c"
|
||||
#include "../src/snapshot.c"
|
||||
#include "../src/snapshot_load.c"
|
||||
#include "../src/snapshot_wire.c"
|
||||
|
||||
/* core_events.c (included above for xce_core_build_schedobj(), bug-1767)
|
||||
* calls this from its JOB_RUSAGE handler; this test never drives events,
|
||||
* so a link-satisfying stub, the same as test_driver_translate.c's. */
|
||||
int sched_reconcile_job_resource_usage(xce_sched_core_t* c,
|
||||
xce_job_account_t* a,
|
||||
xce_job_rusages_t* r)
|
||||
{
|
||||
(void)c; (void)a; (void)r; return 0;
|
||||
}
|
||||
|
||||
void kill_sched_job(void* arg) { (void)arg; }
|
||||
void kill_sched_queue(void* arg) { (void)arg; }
|
||||
void kill_sched_worker(void* arg) { (void)arg; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue