From 9657349c4a0401c1eaaec833b025121d87e29bfe Mon Sep 17 00:00:00 2001 From: "lei.chen" Date: Mon, 31 Aug 2026 14:57:49 +0000 Subject: [PATCH] merge-fix: reconcile Rongsong WAL-fact replay tests with bug-1509 B3; lib test leak-detection convention MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rongsong's new test_wal_job_{start,rusage,ckpt}_fact.c assert a replayed RUN job's state equals exactly JOB_STAT_RUN, but our bug-1509 B3 marks restarted RUN jobs UNKWN+TRANSIENT in-memory (worker connectivity unknown until resend). Reconcile the 7 restart-replay assertions to expect RUN|UNKWN|TRANSIENT — same reconciliation 8858afed did for test_dispatch_commit.c. lib meson.build: add ASAN_OPTIONS=detect_leaks=0 to the libxce test, matching the suite-wide convention (controller/worker/scheduler all set it; fixtures are not torn down). Rongsong's new test_xcealloc.c leaves test-only allocations unfreed (no public free API for alloc/host_alloc), which aborts the test under default leak detection. --- .../testsuite/test_wal_job_ckpt_fact.c | 13 +++++++++---- .../testsuite/test_wal_job_rusage_fact.c | 10 ++++++++-- .../testsuite/test_wal_job_start_fact.c | 18 +++++++++++++----- src/lib/meson.build | 3 ++- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/controller/testsuite/test_wal_job_ckpt_fact.c b/src/controller/testsuite/test_wal_job_ckpt_fact.c index 1637fee6..7b9e92c2 100644 --- a/src/controller/testsuite/test_wal_job_ckpt_fact.c +++ b/src/controller/testsuite/test_wal_job_ckpt_fact.c @@ -482,7 +482,10 @@ static void test_wjc_restart_replay_recovers_ckptinfo(void) job_t* j = wjc_find_job(74006); TEST_ASSERT_NOT_NULL_MESSAGE(j, "restart replay must construct the job via WAL_JOB_SUBMIT"); - TEST_ASSERT_EQUAL_UINT32(JOB_STAT_RUN, j->job.state); + /* bug-1509 B3: after restart a RUN job is marked UNKWN+TRANSIENT + * in-memory (worker connectivity unknown) until worker resend. */ + TEST_ASSERT_EQUAL_UINT32(JOB_STAT_RUN | JOB_STAT_UNKWN | JOB_STAT_TRANSIENT, + j->job.state); wjc_assert_ckptinfo_matches(j, wire_ckptinfo); wjc_teardown(); @@ -644,9 +647,11 @@ static void test_wjc_real_on_job_ckpt_survives_restart(void) unlock(c2.jobmgr); TEST_ASSERT_NOT_NULL_MESSAGE(j2, "restart replay must reconstruct the job via WAL_JOB_SUBMIT"); - TEST_ASSERT_EQUAL_UINT32_MESSAGE(JOB_STAT_RUN, j2->job.state, - "restart replay must recover the job's state, unchanged by the " - "real on_job_ckpt() call"); + TEST_ASSERT_EQUAL_UINT32_MESSAGE(JOB_STAT_RUN | JOB_STAT_UNKWN | JOB_STAT_TRANSIENT, + j2->job.state, + "restart replay must recover the job as RUNNING (with bug-1509 " + "B3's UNKWN+TRANSIENT marking) from the WAL_JOB_CKPT fact " + "appended by the real on_job_ckpt() call"); /* bug-1691: restart replay must recover the worker/scheduler- * reported ckptinfo string -- the audit's exact confirmed root diff --git a/src/controller/testsuite/test_wal_job_rusage_fact.c b/src/controller/testsuite/test_wal_job_rusage_fact.c index dc83187c..0691d24e 100644 --- a/src/controller/testsuite/test_wal_job_rusage_fact.c +++ b/src/controller/testsuite/test_wal_job_rusage_fact.c @@ -701,7 +701,10 @@ static void test_wru_restart_replay_recovers_runusage(void) job_t* j = wru_find_job(73006); TEST_ASSERT_NOT_NULL_MESSAGE(j, "restart replay must construct the job via WAL_JOB_SUBMIT"); - TEST_ASSERT_EQUAL_UINT32(JOB_STAT_RUN, j->job.state); + /* bug-1509 B3: after restart a RUN job is marked UNKWN+TRANSIENT + * in-memory (worker connectivity unknown) until worker resend. */ + TEST_ASSERT_EQUAL_UINT32(JOB_STAT_RUN | JOB_STAT_UNKWN | JOB_STAT_TRANSIENT, + j->job.state); wru_assert_runusage_matches(j->job.run_usage); wru_teardown(); @@ -875,7 +878,10 @@ static void test_wru_real_hook_appends_and_survives_restart(void) unlock(c2.jobmgr); TEST_ASSERT_NOT_NULL_MESSAGE(j2, "restart replay must reconstruct the job via WAL_JOB_SUBMIT"); - TEST_ASSERT_EQUAL_UINT32(JOB_STAT_RUN, j2->job.state); + /* bug-1509 B3: after restart a RUN job is marked UNKWN+TRANSIENT + * in-memory (worker connectivity unknown) until worker resend. */ + TEST_ASSERT_EQUAL_UINT32(JOB_STAT_RUN | JOB_STAT_UNKWN | JOB_STAT_TRANSIENT, + j2->job.state); /* bug-1690: restart replay must recover the client-reported * run_usage, not just state -- the audit's exact confirmed root diff --git a/src/controller/testsuite/test_wal_job_start_fact.c b/src/controller/testsuite/test_wal_job_start_fact.c index 023e2284..6af30c13 100644 --- a/src/controller/testsuite/test_wal_job_start_fact.c +++ b/src/controller/testsuite/test_wal_job_start_fact.c @@ -757,7 +757,10 @@ static void test_wjs_restart_replay_recovers_pidinfo_but_not_start_time(void) job_t* j = wjs_find_job(72005); TEST_ASSERT_NOT_NULL_MESSAGE(j, "restart replay must construct the job via WAL_JOB_SUBMIT"); - TEST_ASSERT_EQUAL_UINT32(JOB_STAT_RUN, j->job.state); + /* bug-1509 B3: after restart a RUN job is marked UNKWN+TRANSIENT + * in-memory (worker connectivity unknown) until worker resend. */ + TEST_ASSERT_EQUAL_UINT32(JOB_STAT_RUN | JOB_STAT_UNKWN | JOB_STAT_TRANSIENT, + j->job.state); TEST_ASSERT_EQUAL_UINT64_MESSAGE(0, (uint64_t)j->job.start_time, "bug-1697: with no WAL_JOB_DISPATCH fact anywhere in this log, " "restart replay must leave start_time at 0, NOT adopt " @@ -922,7 +925,10 @@ test_wjs_restart_replay_recovers_dispatch_start_time_and_started_pidinfo(void) job_t* j = wjs_find_job(72008); TEST_ASSERT_NOT_NULL_MESSAGE(j, "restart replay must construct the job via WAL_JOB_SUBMIT"); - TEST_ASSERT_EQUAL_UINT32(JOB_STAT_RUN, j->job.state); + /* bug-1509 B3: after restart a RUN job is marked UNKWN+TRANSIENT + * in-memory (worker connectivity unknown) until worker resend. */ + TEST_ASSERT_EQUAL_UINT32(JOB_STAT_RUN | JOB_STAT_UNKWN | JOB_STAT_TRANSIENT, + j->job.state); TEST_ASSERT_EQUAL_UINT64_MESSAGE(dispatch_start_time, (uint64_t)j->job.start_time, "bug-1697: restart replay of a dispatch-then-started job must " @@ -1092,9 +1098,11 @@ static void test_wjs_real_on_job_start_survives_restart(void) unlock(c2.jobmgr); TEST_ASSERT_NOT_NULL_MESSAGE(j2, "restart replay must reconstruct the job via WAL_JOB_SUBMIT"); - TEST_ASSERT_EQUAL_UINT32_MESSAGE(JOB_STAT_RUN, j2->job.state, - "restart replay must recover the job as RUNNING from the " - "WAL_JOB_START fact appended by the real on_job_start() call"); + TEST_ASSERT_EQUAL_UINT32_MESSAGE(JOB_STAT_RUN | JOB_STAT_UNKWN | JOB_STAT_TRANSIENT, + j2->job.state, + "restart replay must recover the job as RUNNING (with bug-1509 " + "B3's UNKWN+TRANSIENT marking) from the WAL_JOB_START fact " + "appended by the real on_job_start() call"); /* bug-1687: restart replay must recover not just STATE but the * worker-reported pidinfo (mirrors bug-1678's own acceptance diff --git a/src/lib/meson.build b/src/lib/meson.build index 1b13535e..28812733 100644 --- a/src/lib/meson.build +++ b/src/lib/meson.build @@ -207,4 +207,5 @@ libxce_test = executable('xcelib_test', c_args: ['-DXCE_TESTING'], install: true) -test('libxce test', libxce_test, timeout: 120) +test('libxce test', libxce_test, timeout: 120, + env: ['ASAN_OPTIONS=detect_leaks=0']) # suite convention — fixtures not torn down