fix(controller-tests): make Unity test-file attribution and counters consistent suite-wide

Only 21 of 86 test_*.c group functions called their own nested
UNITY_BEGIN()/UNITY_END(). Each nested call reset Unity's global
NumberOfTests/TestFailures counters, so controller_test.c's final
`return UNITY_END();` -- the value meson test actually gates on --
only ever reflected whichever small window of tests ran since the
LAST nested reset, silently discarding pass/fail evidence for
everything before it (measured: 16 of 972 total tests in one run).
The same nested-BEGIN calls also caused PASS/FAIL banners to show
the wrong source file for tests in files that don't reset it
themselves (Unity.TestFile just carries over from whichever group
last called UNITY_BEGIN()).

Fix: replace every nested UNITY_BEGIN() with UnitySetTestFile(__FILE__)
(sets file attribution only, no counter reset) and drop the matching
UNITY_END(); add the same UnitySetTestFile(__FILE__) as the first
statement to the other group functions that had neither. The 2
genuinely standalone binaries (test_job_array_sched_push.c,
test_job_array_apiserver_push.c -- each has its own int main(), not
registered via controller_test.c's TEST() macro) are untouched.

Verified: single consolidated summary now reads
"972 Tests 0 Failures 0 Ignored OK", exactly matching the
ground-truth RUN_TEST call-site count across all 83 registered
group files (976 total minus 4 belonging to the 2 standalone
binaries). Every PASS/FAIL banner now names its own true source
file. Full xce-build.sh all regression pass clean (Ok: 9, Fail: 0).

No production code touched -- test-harness plumbing only.
This commit is contained in:
Rongsong Shen 2026-07-17 14:49:12 +00:00
parent e6956ecf46
commit a81f2a249c
83 changed files with 83 additions and 38 deletions

View file

@ -1585,7 +1585,7 @@ static void test_sync_append_wired_single_member_commits_locally(void)
void test_commit_engine(void)
{
UNITY_BEGIN();
UnitySetTestFile(__FILE__);
RUN_TEST(test_ack_for_lower_lsn_does_not_commit_higher_entry);
RUN_TEST(test_ack_at_entry_plus_self_commits_entry);
RUN_TEST(test_out_of_order_watermarks_advance_to_majority_median);
@ -1630,5 +1630,4 @@ void test_commit_engine(void)
RUN_TEST(test_sync_append_wired_commits_on_per_entry_majority);
RUN_TEST(test_sync_append_wired_stale_acks_time_out);
RUN_TEST(test_sync_append_wired_single_member_commits_locally);
UNITY_END();
}