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.
41 lines
1.3 KiB
C
41 lines
1.3 KiB
C
#include <stdio.h>
|
|
|
|
#include <unity/unity.h>
|
|
|
|
#include "xce/cluster_def.h"
|
|
|
|
static void test_hook_detail_job_stop_exists(void)
|
|
{
|
|
/* HOOK_DETAIL_JOB_STOP must be defined and distinct from JOB_UPDATE */
|
|
int stop_val = (int)HOOK_DETAIL_JOB_STOP;
|
|
int update_val = (int)HOOK_DETAIL_JOB_UPDATE;
|
|
TEST_ASSERT_TRUE(stop_val != 0);
|
|
TEST_ASSERT_TRUE(stop_val != update_val);
|
|
printf("test_hook_detail_job_stop_exists: PASS\n");
|
|
}
|
|
|
|
static void test_hook_detail_job_resume_exists(void)
|
|
{
|
|
int resume_val = (int)HOOK_DETAIL_JOB_RESUME;
|
|
int update_val = (int)HOOK_DETAIL_JOB_UPDATE;
|
|
TEST_ASSERT_TRUE(resume_val != 0);
|
|
TEST_ASSERT_TRUE(resume_val != update_val);
|
|
TEST_ASSERT_TRUE(resume_val != (int)HOOK_DETAIL_JOB_STOP);
|
|
printf("test_hook_detail_job_resume_exists: PASS\n");
|
|
}
|
|
|
|
static void test_hook_detail_job_stop_and_resume_are_distinct(void)
|
|
{
|
|
TEST_ASSERT_NOT_EQUAL((int)HOOK_DETAIL_JOB_STOP, (int)HOOK_DETAIL_JOB_RESUME);
|
|
printf("test_hook_detail_job_stop_and_resume_are_distinct: PASS\n");
|
|
}
|
|
|
|
void test_hooks(void)
|
|
{
|
|
UnitySetTestFile(__FILE__);
|
|
printf("\n>> hook detail enum tests\n\n");
|
|
|
|
RUN_TEST(test_hook_detail_job_stop_exists);
|
|
RUN_TEST(test_hook_detail_job_resume_exists);
|
|
RUN_TEST(test_hook_detail_job_stop_and_resume_are_distinct);
|
|
}
|