test(scheduler): aggregate 28 white-box tests into one sched_unit_test
Collapse the 28 zero-#include white-box scheduler tests (whose meson executable blocks each duplicated the full scheduler_srcs list) into a single sched_unit_test aggregate, following the controller controller_test.c precedent: one executable, one process, one runner. - sched_unit_runner.c: SUITES registry (28 entries) with per-suite setUp/tearDown dispatch, -t <suite> filter, UnitySetTestFile per entry - testsuite/meson.build: runner + 28 test TUs + every scheduler_srcs entry except src/main.c as separate TUs; foreach over scheduler_srcs so the aggregate can never drift from the production source list; all baked-path defines (XCE_SCHED_*_PATH, XCE_SIM_*) move to the aggregate's c_args; -Werror=incompatible-pointer-types carried suite-wide (verified clean across all 28 tests + 50 src TUs) - transformed tests drop main()/setUp()/tearDown() and local stubs that now resolve against the aggregate's real src TUs - test() registrations 126 -> 99 (126 - 28 + 1 aggregate); the three --wrap= interposition tests (decision publish retry, backpressure, decision redelivery) keep their standalone executables unchanged - isolation libs (sched_core_isolation_lib, sched_sim_isolation_lib) stay build-only and are wired as test()-level depends; the nm(1) text-scan tests find them via XCE_CORE_LIB_PATH/XCE_SIM_LIB_PATH Verified: meson test --suite scheduler 100/100 green x3 consecutive runs (43s total, aggregate 3.3s); /tmp/xce_* sweep clean (the one leftover is test_worker_launch_type_dispatch.c's by-design fixed-path fake xrun launcher). Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
d167923632
commit
a905baf013
30 changed files with 560 additions and 752 deletions
File diff suppressed because it is too large
Load diff
196
src/scheduler/testsuite/sched_unit_runner.c
Normal file
196
src/scheduler/testsuite/sched_unit_runner.c
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
/*
|
||||
* sched_unit_runner.c - single-process Unity runner for the scheduler
|
||||
* white-box unit suites (controller_unit_test.c pattern).
|
||||
*
|
||||
* One process runs every suite that previously shipped as its own
|
||||
* standalone test executable. Each transformed test file contributes a
|
||||
* suite entry function (void test_sched_<name>(void)) plus optional
|
||||
* per-suite setUp/tearDown hooks; the runner's global Unity setUp()/
|
||||
* tearDown() (invoked by UnityDefaultTestRun around EVERY case) dispatch
|
||||
* to the current suite's hooks, preserving per-exe fixture semantics.
|
||||
*
|
||||
* -t <suite> runs only the named suites (name = suite function name,
|
||||
* e.g. -t test_sched_election_null_schedobj); no -t runs everything.
|
||||
*/
|
||||
#include <argp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <unity/unity.h>
|
||||
|
||||
/* Per-suite fixture hooks (each transformed test file; NULL = no-op). */
|
||||
typedef struct {
|
||||
const char* name;
|
||||
void (*suite)(void);
|
||||
void (*setup)(void); /* replaces the file's old setUp() */
|
||||
void (*teardown)(void); /* replaces the file's old tearDown() */
|
||||
} suite_entry_t;
|
||||
|
||||
/* Runner state used by the global setUp/tearDown below. */
|
||||
static const suite_entry_t* g_current = NULL;
|
||||
static int g_nsel = 0;
|
||||
static const char* g_sel[512];
|
||||
|
||||
/* Set to 1 from main() once the registry is wired; lets setUp/tearDown
|
||||
* no-op safely when Unity runs outside this runner (defensive). */
|
||||
static int g_ready = 0;
|
||||
|
||||
/* ---- Global Unity hooks: dispatch to the current suite's hooks ---- */
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
if (g_ready && g_current != NULL && g_current->setup != NULL) {
|
||||
g_current->setup();
|
||||
}
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
if (g_ready && g_current != NULL && g_current->teardown != NULL) {
|
||||
g_current->teardown();
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- Suite registry (extern decls; one block per transformed file) ---- */
|
||||
|
||||
/* Suites without fixture hooks (trivial setUp/tearDown in the old exes). */
|
||||
#define SUITE(fn) {#fn, fn, NULL, NULL}
|
||||
|
||||
/* Suites with per-suite hooks (the file's old setUp/tearDown, now static). */
|
||||
#define SUITE_H(fn, setup, teardown) {#fn, fn, setup, teardown}
|
||||
|
||||
/* Transformee suite entries (extern decls). */
|
||||
extern void test_sched_election_null_schedobj(void);
|
||||
extern void test_sched_picker_iface(void);
|
||||
extern void test_sched_picker_pendreason_factory_audit(void);
|
||||
extern void test_sched_picker_core_loop_boundary(void);
|
||||
extern void test_sched_no_bare_printf(void);
|
||||
extern void test_sched_core_isolation(void);
|
||||
extern void test_sched_sim_isolation(void);
|
||||
extern void test_sched_scheduler_connect(void);
|
||||
extern void test_sched_repl_output_compression(void);
|
||||
extern void test_sched_repl_resource_formatting(void);
|
||||
extern void test_sched_sim_cache_clear_isolation(void);
|
||||
extern void test_sched_host_admin_close(void);
|
||||
extern void test_sched_host_unavail_reconciling(void);
|
||||
extern void test_sched_limit_host_dedup(void);
|
||||
extern void test_sched_queue_admin_control(void);
|
||||
extern void test_sched_job_move_priority(void);
|
||||
extern void test_sched_config_push_deferred(void);
|
||||
extern void test_sched_sim_group_limit_parity(void);
|
||||
extern void test_sched_sim_limit_config_push_parity(void);
|
||||
extern void test_sched_sim_live_allocation(void);
|
||||
extern void test_sched_sim_e2e_limit_visibility(void);
|
||||
extern void test_sched_sim_contention_resource_driver_parity(void);
|
||||
extern void test_sched_sim_contention_limit_driver_parity(void);
|
||||
extern void test_sched_election_sim_fixture(void);
|
||||
extern void test_sched_scheduler_dispatch_commit(void);
|
||||
extern void test_sched_repl_trace_emit(void);
|
||||
extern void test_sched_snapshot_sparse_resvals(void);
|
||||
extern void test_sched_sim_alloc_limit_fanout(void);
|
||||
|
||||
/* transformee per-suite hooks (test_repl_trace_emit.c) */
|
||||
extern void trace_emit_setup(void);
|
||||
extern void trace_emit_teardown(void);
|
||||
|
||||
static const suite_entry_t SUITES[] = {
|
||||
/* %%SUITES%% — populated by the aggregation batches below */
|
||||
SUITE(test_sched_election_null_schedobj),
|
||||
SUITE(test_sched_picker_iface),
|
||||
SUITE(test_sched_picker_pendreason_factory_audit),
|
||||
SUITE(test_sched_picker_core_loop_boundary),
|
||||
SUITE(test_sched_no_bare_printf),
|
||||
SUITE(test_sched_core_isolation),
|
||||
SUITE(test_sched_sim_isolation),
|
||||
SUITE(test_sched_scheduler_connect),
|
||||
SUITE(test_sched_repl_output_compression),
|
||||
SUITE(test_sched_repl_resource_formatting),
|
||||
SUITE(test_sched_sim_cache_clear_isolation),
|
||||
SUITE(test_sched_host_admin_close),
|
||||
SUITE(test_sched_host_unavail_reconciling),
|
||||
SUITE(test_sched_limit_host_dedup),
|
||||
SUITE(test_sched_queue_admin_control),
|
||||
SUITE(test_sched_job_move_priority),
|
||||
SUITE(test_sched_config_push_deferred),
|
||||
SUITE(test_sched_sim_group_limit_parity),
|
||||
SUITE(test_sched_sim_limit_config_push_parity),
|
||||
SUITE(test_sched_sim_live_allocation),
|
||||
SUITE(test_sched_sim_e2e_limit_visibility),
|
||||
SUITE(test_sched_sim_contention_resource_driver_parity),
|
||||
SUITE(test_sched_sim_contention_limit_driver_parity),
|
||||
SUITE(test_sched_election_sim_fixture),
|
||||
SUITE(test_sched_scheduler_dispatch_commit),
|
||||
SUITE_H(test_sched_repl_trace_emit, trace_emit_setup, trace_emit_teardown),
|
||||
SUITE(test_sched_snapshot_sparse_resvals),
|
||||
SUITE(test_sched_sim_alloc_limit_fanout),
|
||||
};
|
||||
|
||||
#define N_SUITES (sizeof(SUITES) / sizeof(SUITES[0]))
|
||||
|
||||
static error_t parse_opt(int key, char* arg, struct argp_state* state)
|
||||
{
|
||||
switch (key) {
|
||||
case 't':
|
||||
if (g_nsel >= (int)(sizeof(g_sel) / sizeof(g_sel[0]))) {
|
||||
fprintf(stderr, "too many -t selections\n");
|
||||
exit(-1);
|
||||
}
|
||||
g_sel[g_nsel++] = arg;
|
||||
break;
|
||||
default:
|
||||
return ARGP_ERR_UNKNOWN;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct argp_option options[] = {
|
||||
{"run", 't', "SUITE", 0, "run only named suite(s)", 0},
|
||||
{0}
|
||||
};
|
||||
|
||||
static struct argp argp = {options, parse_opt, NULL,
|
||||
"scheduler unit test runner"};
|
||||
|
||||
static int selected(const char* name)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (g_nsel == 0) {
|
||||
return 1;
|
||||
}
|
||||
for (i = 0; i < g_nsel; i++) {
|
||||
if (strcmp(name, g_sel[i]) == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* bug-1429 lesson (controller_unit_test): stdout is fully buffered when
|
||||
* meson pipes it, so a FAIL line was lost whenever the run later hung or
|
||||
* aborted -- line-buffer it so the first failure is always visible. */
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
size_t i;
|
||||
|
||||
argp_parse(&argp, argc, argv, 0, 0, NULL);
|
||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
|
||||
g_ready = 1;
|
||||
|
||||
UNITY_BEGIN();
|
||||
|
||||
for (i = 0; i < N_SUITES; i++) {
|
||||
if (!selected(SUITES[i].name)) {
|
||||
continue;
|
||||
}
|
||||
printf("=== suite: %s ===\n", SUITES[i].name);
|
||||
g_current = &SUITES[i];
|
||||
UnitySetTestFile(SUITES[i].name);
|
||||
SUITES[i].suite();
|
||||
}
|
||||
|
||||
g_current = NULL;
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
@ -54,9 +54,6 @@ extern int scheduler_req_handler(xce_request_t* request, void* args);
|
|||
#define JOBB_ID ((uint64_t)518472ULL)
|
||||
#define JOBC_ID ((uint64_t)518473ULL)
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
static void register_slots_resource(var resmgr)
|
||||
{
|
||||
xce_resource_t res;
|
||||
|
|
@ -325,11 +322,11 @@ static void test_config_reapply_updates_queue_in_place_and_frees_old(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_config_push_deferred(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_config_push_mid_session_does_not_end_round);
|
||||
RUN_TEST(test_applied_config_push_is_recorded);
|
||||
RUN_TEST(test_config_reapply_updates_queue_in_place_and_frees_old);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,9 +215,6 @@ static char* read_whole_file(const char* path)
|
|||
return buf;
|
||||
}
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
/* Sanity check: both source paths baked in by meson.build must actually be
|
||||
* readable -- without this, a stale path would make every scan below
|
||||
* silently pass on zero bytes of text (the exact false-confidence failure
|
||||
|
|
@ -794,9 +791,10 @@ static void test_core_object_has_no_forbidden_undefined_symbols(void)
|
|||
"vacuously)");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_core_isolation(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_core_source_paths_are_readable);
|
||||
RUN_TEST(test_core_never_includes_forbidden_headers);
|
||||
RUN_TEST(test_core_never_calls_forbidden_symbols);
|
||||
|
|
@ -804,5 +802,4 @@ int main(void)
|
|||
RUN_TEST(test_trace_io_scan_detects_and_ignores);
|
||||
RUN_TEST(test_trace_sources_do_no_stdio_or_file_io);
|
||||
RUN_TEST(test_core_object_has_no_forbidden_undefined_symbols);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,6 @@ extern void sim_bootstrap_parjob_allocator(xce_sched_sim_driver_t* sim);
|
|||
#define JOBB_ID ((uint64_t)193902ULL)
|
||||
#define JOBP_ID ((uint64_t)193903ULL)
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
static void register_slots_resource(var resmgr)
|
||||
{
|
||||
xce_resource_t res;
|
||||
|
|
@ -272,9 +269,9 @@ static void test_admin_closed_host_gets_no_new_jobs(void)
|
|||
assert_outcome(&(g_sim.core), closed_sim, "sim mode");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_host_admin_close(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_admin_closed_host_gets_no_new_jobs);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,9 +56,6 @@ static const int g_bad_status[NSCENARIOS] = { XCE_WORKER_UNAVAIL,
|
|||
XCE_WORKER_RECONCILING };
|
||||
static const char* g_bad_label[NSCENARIOS] = { "unavailable", "reconciling" };
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
static void register_slots_resource(var resmgr)
|
||||
{
|
||||
xce_resource_t res;
|
||||
|
|
@ -278,9 +275,9 @@ static void test_unavail_and_reconciling_hosts_get_no_new_jobs(void)
|
|||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_host_unavail_reconciling(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_unavail_and_reconciling_hosts_get_no_new_jobs);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,6 @@
|
|||
#define JOB_B2_ID ((uint64_t)194402ULL)
|
||||
#define JOB_M_ID ((uint64_t)194403ULL)
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
static void register_slots_resource(var resmgr)
|
||||
{
|
||||
xce_resource_t res;
|
||||
|
|
@ -219,9 +216,9 @@ static void test_moved_job_keeps_its_priority_and_place(void)
|
|||
"the moved job must not overtake jobs already pending in qb");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_job_move_priority(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_moved_job_keeps_its_priority_and_place);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,6 @@
|
|||
#define JOB_ID ((uint64_t)518461ULL)
|
||||
#define NATTEMPTS (5)
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
static void register_slots_resource(var resmgr)
|
||||
{
|
||||
xce_resource_t res;
|
||||
|
|
@ -280,10 +277,10 @@ static void test_hlimits_zarray_releases_its_lists(void)
|
|||
printf("test_hlimits_zarray_releases_its_lists: PASS\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_limit_host_dedup(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_repeated_host_attempts_stage_host_limit_once);
|
||||
RUN_TEST(test_hlimits_zarray_releases_its_lists);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@
|
|||
"XCE_SCHEDULER_PLUGINS_DIR must be defined by meson.build to src/scheduler/src/plugins's absolute path"
|
||||
#endif
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
static char* read_whole_file(const char* path)
|
||||
{
|
||||
FILE* f = fopen(path, "rb");
|
||||
|
|
@ -175,10 +172,10 @@ static void test_scheduler_plugins_has_no_bare_printf_calls(void)
|
|||
scan_dir_for_bare_printf(XCE_SCHEDULER_PLUGINS_DIR);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_no_bare_printf(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_scheduler_src_has_no_bare_printf_calls);
|
||||
RUN_TEST(test_scheduler_plugins_has_no_bare_printf_calls);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,13 +243,10 @@ static void test_core_loop_calls_only_through_picker_interface(void)
|
|||
free(body);
|
||||
}
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_picker_core_loop_boundary(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_core_loop_has_no_forbidden_traversal_symbols);
|
||||
RUN_TEST(test_core_loop_calls_only_through_picker_interface);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ static int stub_on_job_rusage(void* picker, xce_sched_job_t* job,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_picker_iface(void);
|
||||
|
||||
/* Assigns every hook through an explicitly-typed intermediate function
|
||||
* pointer -- see file header comment. If any field's declared signature in
|
||||
|
|
@ -218,10 +218,9 @@ static void test_picker_iface_optional_hooks_may_be_null(void)
|
|||
TEST_ASSERT_NOT_NULL(iface.next_job);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
void test_sched_picker_iface(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_picker_iface_has_every_hook_with_correct_signature);
|
||||
RUN_TEST(test_picker_iface_optional_hooks_may_be_null);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,8 +156,8 @@ static int scan_file_for_violation(const char* path, char* violating_line_out,
|
|||
return found;
|
||||
}
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_picker_pendreason_factory_audit(void);
|
||||
|
||||
/* Sanity check for the audit itself: every baked-in path must actually
|
||||
* open. Without this, a stale/typo'd relative path would make
|
||||
|
|
@ -233,11 +233,10 @@ static void test_no_direct_pendreason_calloc_in_scheduler_tree(void)
|
|||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
void test_sched_picker_pendreason_factory_audit(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_all_scanned_paths_are_readable);
|
||||
RUN_TEST(test_detector_fires_on_same_line_and_not_on_split_lines);
|
||||
RUN_TEST(test_no_direct_pendreason_calloc_in_scheduler_tree);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,6 @@ extern void sim_bootstrap_parjob_allocator(xce_sched_sim_driver_t* sim);
|
|||
#define JOB_CLOSED_ID ((uint64_t)193802ULL)
|
||||
#define JOB_INACT_ID ((uint64_t)193803ULL)
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
static void register_slots_resource(var resmgr)
|
||||
{
|
||||
xce_resource_t res;
|
||||
|
|
@ -282,9 +279,9 @@ static void test_inactive_queue_holds_jobs_closed_queue_dispatches(void)
|
|||
assert_outcome(&(g_sim.core), n_sim, "sim mode");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_queue_admin_control(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_inactive_queue_holds_jobs_closed_queue_dispatches);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,9 +86,6 @@
|
|||
extern int repl_fmt_jobid_range(char* buf, size_t bufsz,
|
||||
const uint64_t* jobids, int njobids);
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Fixture helpers -- real, correctly bit-packed jobids (see header */
|
||||
/* comment above for the exact encoding each mirrors). */
|
||||
|
|
@ -303,15 +300,13 @@ static void test_buffer_too_small_fails_safely_without_truncating(void)
|
|||
"test_buffer_too_small_fails_safely_without_truncating: PASS\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_repl_output_compression(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_contiguous_array_range_compresses_to_single_range);
|
||||
RUN_TEST(test_noncontiguous_indices_compress_to_commajoined_subranges);
|
||||
RUN_TEST(test_multiple_array_submissions_compress_independently);
|
||||
RUN_TEST(test_mixed_array_and_nonarray_ids_shows_nonarray_individually);
|
||||
RUN_TEST(test_buffer_too_small_fails_safely_without_truncating);
|
||||
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,9 +109,6 @@
|
|||
extern bool repl_is_bytes_valued_resource(const char* name);
|
||||
extern void repl_format_bytes_human(double bytes, char* buf, size_t bufsz);
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Test 1 (AC 6.1): the classifier returns true for EXACTLY the five */
|
||||
/* confirmed canonical-bytes resource names. */
|
||||
|
|
@ -406,10 +403,10 @@ static void test_shared_current_units_mode_reads_state_or_defaults(void)
|
|||
TEST_ASSERT_EQUAL_INT(XCE_REPL_UNITS_RAW, repl_current_units_mode(&sim));
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_repl_resource_formatting(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_bytes_valued_classifier_true_for_canonical_five);
|
||||
RUN_TEST(test_bytes_valued_classifier_false_for_swp_unitless_and_unknown);
|
||||
RUN_TEST(
|
||||
|
|
@ -421,6 +418,4 @@ int main(void)
|
|||
RUN_TEST(test_shared_numeric_resource_value_formats_per_units_mode);
|
||||
RUN_TEST(test_shared_consumable_value_and_used_formats);
|
||||
RUN_TEST(test_shared_current_units_mode_reads_state_or_defaults);
|
||||
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ static int g_cap_fd = -1;
|
|||
static int g_cap_saved = -1;
|
||||
static char g_cap_path[64];
|
||||
|
||||
void setUp(void)
|
||||
/* Per-suite hooks for the sched_unit_test aggregate (were setUp/tearDown). */
|
||||
void trace_emit_setup(void)
|
||||
{
|
||||
memset(&g_sim, 0, sizeof(g_sim));
|
||||
memset(&g_rs, 0, sizeof(g_rs));
|
||||
|
|
@ -73,7 +74,7 @@ void setUp(void)
|
|||
TEST_ASSERT_EQUAL_INT(0, chdir(g_dir));
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
void trace_emit_teardown(void)
|
||||
{
|
||||
repl_trace_shutdown(&g_sim);
|
||||
free(g_rs.collapse_pend_jobids);
|
||||
|
|
@ -692,9 +693,10 @@ static void test_file_write_error_inside_render_reports_cause(void)
|
|||
repl_trace_session_end(&g_sim);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_repl_trace_emit(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_session_begin_publishes_next_with_stamp);
|
||||
RUN_TEST(test_session_begin_with_tracing_off_publishes_nothing);
|
||||
RUN_TEST(test_command_during_session_applies_next_session);
|
||||
|
|
@ -707,5 +709,4 @@ int main(void)
|
|||
RUN_TEST(test_file_copy_byte_equal_to_console);
|
||||
RUN_TEST(test_file_write_error_inside_render_reports_cause);
|
||||
RUN_TEST(test_file_write_error_reported_once_per_session);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@
|
|||
#define TEST_JOBID ((uint64_t)189701ULL)
|
||||
#define QUEUE_NAME "normal"
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_election_null_schedobj(void);
|
||||
|
||||
static void test_sched_allocator_skips_job_without_schedobj(void)
|
||||
{
|
||||
|
|
@ -107,9 +107,8 @@ static void test_sched_allocator_skips_job_without_schedobj(void)
|
|||
TEST_ASSERT_NULL(job->allocs);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
void test_sched_election_null_schedobj(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_sched_allocator_skips_job_without_schedobj);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,9 +100,6 @@
|
|||
#define QUEUE_NAME "normal"
|
||||
#define TEST_RESREQ ((char*)"select[type==any] rusage[mem=1]")
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
/*
|
||||
* Req 1.1/1.2/5.1: sched_job_picker()/sched_allocator() (sched_election.c),
|
||||
* spawned via pthread_create() against nothing but a bare
|
||||
|
|
@ -288,9 +285,9 @@ test_sched_election_thread_pair_runs_against_bare_core_fixture(void)
|
|||
TEST_ASSERT_NULL(job->accounts);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_election_sim_fixture(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_sched_election_thread_pair_runs_against_bare_core_fixture);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,9 +79,6 @@
|
|||
|
||||
extern int scheduler_req_handler(xce_request_t*, void*);
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
/* ════════════════════════════════════════════════════════════════════════
|
||||
* Helpers
|
||||
* ════════════════════════════════════════════════════════════════════════ */
|
||||
|
|
@ -570,9 +567,10 @@ static void test_no_periodic_heartbeat_call_in_source(void)
|
|||
printf("test_no_periodic_heartbeat_call_in_source: PASS\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_scheduler_connect(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_no_peers_and_single_entry_peers_produce_identical_cluster_cfg_shape);
|
||||
RUN_TEST(test_multi_candidate_cluster_cfg_passthrough);
|
||||
RUN_TEST(test_sched_init_all_candidates_unreachable_fails_fast);
|
||||
|
|
@ -582,5 +580,4 @@ int main(void)
|
|||
RUN_TEST(test_no_periodic_heartbeat_call_in_source);
|
||||
RUN_TEST(test_rejoin_callback_body_has_no_io_or_xcecli_calls);
|
||||
RUN_TEST(test_sched_init_has_single_connect_sequence_not_a_loop);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,9 +133,6 @@ static xce_job_alloc_t* make_dispatch_alloc(uint64_t jobid, char* host,
|
|||
return j;
|
||||
}
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
/*
|
||||
* Requirement 1.1: committing a DISPATCH decision transitions the job to
|
||||
* JOB_STAT_RUN in the SAME operation that commits job->allocs/job->accounts
|
||||
|
|
@ -436,13 +433,13 @@ static void test_dispatch_commit_multi_round_gap_matches_same_round_confirmation
|
|||
TEST_ASSERT_EQUAL_FLOAT(same_round_val, multi_round_gap_val);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_scheduler_dispatch_commit(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_dispatch_commit_transitions_job_to_run);
|
||||
RUN_TEST(test_dispatch_commit_survives_round_boundary_before_confirmation);
|
||||
RUN_TEST(test_dispatch_commit_survives_several_rounds_before_confirmation);
|
||||
RUN_TEST(test_dispatch_commit_multi_round_gap_matches_same_round_confirmation);
|
||||
RUN_TEST(test_pend_decision_does_not_touch_job_state);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,9 +110,6 @@ extern void sim_bootstrap_parjob_allocator(xce_sched_sim_driver_t* sim);
|
|||
#define LIMIT_RESNAME "sim_alloc_host_res"
|
||||
#define LIMIT_NAME "sim_alloc_host_limit"
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Fixture helpers */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
|
@ -380,10 +377,10 @@ test_host_scoped_limit_usage_instance_created_via_live_sim_dispatch(void)
|
|||
"dispatch: PASS\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_sim_alloc_limit_fanout(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(
|
||||
test_host_scoped_limit_usage_instance_created_via_live_sim_dispatch);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,22 +71,8 @@
|
|||
#include "sched/alloc_cache.h"
|
||||
#include "sim.h"
|
||||
|
||||
void kill_sched_job(void* arg) { (void)arg; }
|
||||
void kill_sched_queue(void* arg) { (void)arg; }
|
||||
void kill_sched_worker(void* arg) { (void)arg; }
|
||||
void kill_sched_user(void* arg) { (void)arg; }
|
||||
void kill_sched_project(void* arg) { (void)arg; }
|
||||
void kill_sched_resval(xce_val_t* val) { (void)val; }
|
||||
void plugin_unregister(void* arg) { (void)arg; }
|
||||
|
||||
/* sched_worker_release_host_ctx (resource.c) is outside this test's linked
|
||||
* source set (only core.c/core_clock.c/core_session.c/decision.c/
|
||||
* alloc_cache.c, meson.build) -- this fixture never adds a worker, so it
|
||||
* is never actually invoked at runtime either. */
|
||||
void sched_worker_release_host_ctx(xce_sched_worker_t* w) { (void)w; }
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
/* kill_sched_* / plugin_unregister / sched_worker_release_host_ctx come
|
||||
* from the aggregate's shared fixture (sched_unit_fixture.c). */
|
||||
|
||||
/*
|
||||
* THE Observable this regression guards (Req 7.2, round-2 review
|
||||
|
|
@ -181,10 +167,10 @@ static void test_sim_registered_cache_clear_uses_the_core_table(void)
|
|||
destroy(sim.core.unsatisfiable_cache);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_sim_cache_clear_isolation(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_sim_begin_session_never_corrupts_alt_events_file);
|
||||
RUN_TEST(test_sim_registered_cache_clear_uses_the_core_table);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,9 +103,6 @@ extern void sim_bootstrap_parjob_allocator(xce_sched_sim_driver_t* sim);
|
|||
#define JOBB_ID ((uint64_t)510202ULL)
|
||||
#define JOBC_ID ((uint64_t)510203ULL)
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Fixture helpers -- identical techniques to this file's sibling */
|
||||
/* (test_sim_contention_resource_driver_parity.c) plus test_sim_alloc_ */
|
||||
|
|
@ -577,10 +574,10 @@ test_limit_constrained_contention_matches_between_normal_and_sim_drivers(
|
|||
"sim_drivers: PASS\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_sim_contention_limit_driver_parity(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(
|
||||
test_limit_constrained_contention_matches_between_normal_and_sim_drivers);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,9 +145,6 @@ extern void sim_bootstrap_parjob_allocator(xce_sched_sim_driver_t* sim);
|
|||
#define JOBB_ID ((uint64_t)510102ULL)
|
||||
#define JOBC_ID ((uint64_t)510103ULL)
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Fixture helpers -- same techniques test_sched_election_sim_fixture.c/ */
|
||||
/* test_sim_alloc_limit_fanout.c/test_sim_contention_parity.c each already */
|
||||
|
|
@ -578,9 +575,9 @@ test_resource_contention_matches_between_normal_and_sim_drivers(void)
|
|||
"drivers: PASS\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_sim_contention_resource_driver_parity(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_resource_contention_matches_between_normal_and_sim_drivers);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,9 +149,6 @@ extern int write_capnp_message(FILE* f, struct capn* c);
|
|||
#define HOST_LIMIT_PERCENT_VAL 50.0f
|
||||
#define HOST_RES_CAPACITY 1000.0f
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Fixture helpers -- capnp event writers duplicated from test_sim_live_ */
|
||||
/* allocation.c's own proven shape (this directory's established */
|
||||
|
|
@ -717,9 +714,9 @@ test_sim_replay_shows_real_global_and_host_scoped_limit_usage(void)
|
|||
"PASS\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_sim_e2e_limit_visibility(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_sim_replay_shows_real_global_and_host_scoped_limit_usage);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,9 +54,6 @@ extern void sim_bootstrap_parjob_allocator(xce_sched_sim_driver_t* sim);
|
|||
#define JOB_USER "user1"
|
||||
#define JOB_ID ((uint64_t)194301ULL)
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
static void register_resources(var resmgr)
|
||||
{
|
||||
xce_resource_t res;
|
||||
|
|
@ -340,9 +337,9 @@ static void test_user_group_limit_matches_in_sim_as_in_live(void)
|
|||
TEST_ASSERT_TRUE(is_in_group(g, (char*)WORKER_NAME) > 0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_sim_group_limit_parity(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_user_group_limit_matches_in_sim_as_in_live);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -603,9 +603,6 @@ static int dirname_of(const char* path, char* out, size_t out_sz)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
/* Sanity check: all three source paths baked in by meson.build must
|
||||
* actually be readable -- without this, a stale path would make every scan
|
||||
* below silently pass on zero bytes of text (the exact false-confidence
|
||||
|
|
@ -1156,9 +1153,10 @@ static void test_sim_object_has_no_forbidden_undefined_symbols(void)
|
|||
"vacuously)");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_sim_isolation(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_sim_source_paths_are_readable);
|
||||
RUN_TEST(test_sim_never_includes_forbidden_headers);
|
||||
RUN_TEST(test_sim_never_calls_forbidden_symbols);
|
||||
|
|
@ -1167,5 +1165,4 @@ int main(void)
|
|||
RUN_TEST(test_trace_enable_is_repl_only);
|
||||
RUN_TEST(test_sim_driver_struct_has_no_forbidden_fields);
|
||||
RUN_TEST(test_sim_object_has_no_forbidden_undefined_symbols);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,9 +56,6 @@ extern void sim_bootstrap_parjob_allocator(xce_sched_sim_driver_t* sim);
|
|||
#define JOB_USER "user1"
|
||||
#define JOB_ID ((uint64_t)196401ULL)
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
static void register_resources(var resmgr)
|
||||
{
|
||||
xce_resource_t res;
|
||||
|
|
@ -317,9 +314,9 @@ static void test_config_push_reaches_limit_plugin_in_sim_as_in_live(void)
|
|||
"sim: the pushed limit must match the job as it does live");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_sim_limit_config_push_parity(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_config_push_reaches_limit_plugin_in_sim_as_in_live);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,9 +132,6 @@ extern int write_capnp_message(FILE* f, struct capn* c);
|
|||
#define TEST_JOBID ((uint64_t)940101ULL)
|
||||
#define WORKER_SLOTS 4.0f
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Fixture helpers */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
|
@ -842,12 +839,12 @@ static void test_sim_replay_reproduces_recorded_alloc_from(void)
|
|||
free(captured);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_sim_live_allocation(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_sim_driver_run_dispatches_a_job_with_available_resources);
|
||||
RUN_TEST(
|
||||
test_sim_verify_no_false_mismatch_after_live_dispatch_and_later_confirmation);
|
||||
RUN_TEST(test_sim_replay_reproduces_recorded_alloc_from);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,9 +47,6 @@
|
|||
#define LICENSE_TOTAL 2.0f
|
||||
#define GPU_TOTAL 8.0f
|
||||
|
||||
void setUp(void) { return; }
|
||||
void tearDown(void) { return; }
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Fixture helpers */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
|
@ -388,14 +385,14 @@ static void test_replay_round_trip_keeps_sparse_resvals(void)
|
|||
rmdir(tmpl);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
/* ---- suite entry for the sched_unit_test aggregate ---------------------- */
|
||||
void test_sched_snapshot_sparse_resvals(void)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
UnitySetTestFile(__FILE__);
|
||||
RUN_TEST(test_save_keeps_sparse_shared_resval);
|
||||
RUN_TEST(test_save_keeps_sparse_worker_resval);
|
||||
RUN_TEST(test_save_load_round_trip_keeps_sparse_resvals);
|
||||
RUN_TEST(test_load_takes_shared_resval_with_empty_host);
|
||||
RUN_TEST(test_load_skips_resval_with_named_host);
|
||||
RUN_TEST(test_replay_round_trip_keeps_sparse_resvals);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue