myxce/src/lib/testsuite
Rongsong Shen f9146864a3
fix(lib,scheduler): allocation constructors and allocators report OOM instead of building NULL-name records (bug-1882)
make_alloc() and make_host_alloc() assigned strdup() results unchecked,
so under memory exhaustion they returned a record whose resname/reserve/
host was NULL; merge_job_alloc()'s same_alloc_slot() (bug-1863) then
strcmp()'d it (ASAN SEGV at xcealloc.c:337). make_alloc() also passed a
NULL resname straight to strdup().
- xcealloc.c: make_alloc()/make_host_alloc() reject a NULL name (EINVAL)
  and check every strdup(), freeing what they built and returning NULL
  (ENOMEM); on failure make_host_alloc()'s caller keeps `allocs`.
  dup_host_alloc() frees its partial copy on failure instead of leaking.
- scheduler.c sched_make_allocs(): a record that cannot be built fails
  the whole array (NULL, ENOMEM) instead of leaving a NULL entry.
- seqjob/parjob my_alloc(): check every constructor; on failure free
  what was built (parjob also rolls back the remaining claims) and
  return -ENOMEM with ctx->alloc NULL -- the caller moves ctx.alloc onto
  the job whatever the rc.

Tests: new xcealloc_oom_test (8, --wrap=strdup) and
sched_make_allocs_oom_test (real scheduler_srcs + --wrap=strdup); a new
-ENOMEM test in the seqjob and parjob allocator suites. All RED before
(SEGV / "Expected NULL" / "Expected -12 Was 1"), GREEN after.
xce-build.sh all asan: 115/115 suites OK, Go tests OK.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 08:49:51 +00:00
..
failover_harness.h fix(lib): retry a NOT_READY controller in place instead of failing over (bug-1850) 2026-09-25 15:04:47 +00:00
test.c fix(lib): keep per-endpoint message order in the vtask dispatcher (bug-1864) 2026-09-25 14:44:14 +00:00
test_bitset.c - introduce bitset 2026-02-13 11:01:33 +08:00
test_cbuf.c Init commit of jobs output/error message peek project. 2026-05-09 16:57:54 +08:00
test_cluster.c feat(component-failover-adoption): add candidate-list-to-client-config helper 2026-08-11 04:57:31 +00:00
test_cluster_parse.c feat: P2.5-5/6 add --peers/--ca-cert parsing to worker+scheduler with validation 2026-05-08 02:32:56 +00:00
test_config.c fix(test): sync test_config DEFAULT_SYNC_TIMEOUT_MS assertion to 500 2026-06-21 15:18:39 +00:00
test_ctrlstatus.c fix: close bug-1401 ctrlstatus leak, bug-1400 jobsub leak; harden bug-1396 harness 2026-07-03 02:40:52 +00:00
test_delay.c feat(election-iomgr-refactor): add delay_task_ms() for ms-granularity one-shot tasks 2026-05-30 07:15:54 +00:00
test_error.c fix(libxce): xce_strerror_r global-buffer-overflow on HA error codes (utils.c) 2026-06-20 10:13:21 +00:00
test_group.c fix(scheduler): fix limit-plugin usergroup/scope/error-code cascade (gitea#46) 2026-09-07 12:44:16 +00:00
test_hooks.c fix bug-1060 bug-1067 2026-06-24 17:05:43 +08:00
test_htab.c update controller code 2025-11-05 16:58:57 +08:00
test_htab_int.c update controller code 2025-11-05 16:58:57 +08:00
test_idgen.c jobid format and parse 2025-11-19 14:44:49 +08:00
test_job_state_wire.c feat(worker-rejoin-resync): add reconciliation wire codec helpers (task 1.4) 2026-09-01 09:34:25 +00:00
test_jobj.c fix(lib): thread from_host through the wire format and the job-submit interning object (bug-1676, gitea #44) 2026-08-24 15:14:42 +00:00
test_jobj_hardening.c feat(job-array-single-wal-record): harden jobj.c job construction primitives 2026-07-14 08:29:45 +00:00
test_kv.c use librtti for worker/queue/resource 2026-02-25 16:56:50 +08:00
test_kvmgr.c save works 2026-03-04 18:18:53 +08:00
test_kvmgr_capture.c test: add KVMGR_KEY_INT coverage to kvmgr_capture_keys tests 2026-05-07 11:12:11 +00:00
test_kvmgr_reserve.c fix(job-array-single-wal-record): close bug-1443's bulk-insert partial-visibility gap 2026-07-16 15:08:02 +00:00
test_libxce_retry.c fix(lib): retry a NOT_READY controller in place instead of failing over (bug-1850) 2026-09-25 15:04:47 +00:00
test_limit.c fix(scheduler): percent-limit capacity reads maxmem/maxswap, not mem/swap (bug-1834) 2026-09-20 13:18:05 +00:00
test_netio_arm_failure.c fix(libxce-failover): classify and propagate netio I/O errors on failover 2026-06-18 04:17:07 +00:00
test_netio_batch_dispatch_uaf.c fix(netio): bug-1447 same-batch endpoint use-after-free in io_worker dispatch 2026-07-18 13:28:04 +00:00
test_netio_bounded_connect.c feat(raft-drive-async): bound peer connect (O_NONBLOCK+poll), close tasks 1.3/1.4/1.5 2026-06-26 07:10:53 +00:00
test_netio_close_propagation.c fix(libxce-failover): classify and propagate netio I/O errors on failover 2026-06-18 04:17:07 +00:00
test_netio_on_connected.c feat(election-iomgr-refactor): add on_connected fire-once callback to endpoint_t 2026-05-30 07:34:08 +00:00
test_netio_on_fini.c feat(ha): reference-counted ha_elect_ctx_t lifecycle (ha-elect-ctx-lifecycle) 2026-07-12 04:25:42 +00:00
test_netio_reconnect_gen.c fix(component-failover-adoption): Phase 6 -- close apiserver's idle-period rejoin gap (bug-1548/bug-1549) 2026-08-16 03:42:03 +00:00
test_ordq.c pass pend reason back to controller 2025-12-23 15:29:26 +08:00
test_preason.c support limit 2026-01-12 15:27:54 +08:00
test_qobj.c save works 2026-03-06 18:20:30 +08:00
test_raft.c feat(raft-apply-decoupling): task 7.1 apply-ordering conformance assertions 2026-07-05 05:25:32 +00:00
test_request.c feat(controller-status): carry election time on the heartbeat (task 7.3) 2026-09-16 06:03:03 +00:00
test_request_send_propagation.c fix(libxce-failover): classify and propagate netio I/O errors on failover 2026-06-18 04:17:07 +00:00
test_resmgr_fixture.c fix(scheduler): percent-limit capacity reads maxmem/maxswap, not mem/swap (bug-1834) 2026-09-20 13:18:05 +00:00
test_resmgr_fixture.h fix(scheduler): percent-limit capacity reads maxmem/maxswap, not mem/swap (bug-1834) 2026-09-20 13:18:05 +00:00
test_resreq.c fix(apiserver): reject a malformed rusage[] at job submit (bug-1744) 2026-09-27 03:27:32 +00:00
test_resreq_fingerprint.c feat(scheduler-allocation): add resreq fingerprinting for the cache 2026-09-04 15:00:12 +00:00
test_resreq_task_count.c feat(resreq-maxtasks-wiring): add task-count derivation helper 2026-09-06 03:26:32 +00:00
test_select.c fix: sel_key_cmp_fn padding-byte mismatch in kvtab lookups 2026-05-12 09:53:59 +00:00
test_utils.c feat(scheduler-sim-diagnostics): promote byte-unit formatting to shared lib (task 7) 2026-09-20 04:40:44 +00:00
test_vtask_admission.c feat(raft-drive-async): LivenessAdmission pool reservation + commit fold (tasks 1.6/1.7) 2026-06-26 07:43:19 +00:00
test_vtask_enq_race.c fix(bug-1733): fix heap-use-after-free race in vtask_enq() 2026-08-29 11:28:48 +00:00
test_vtask_order.c fix(lib): keep per-endpoint message order in the vtask dispatcher (bug-1864) 2026-09-25 14:44:14 +00:00
test_vtaskmgr_teardown.c fix(lib): stop cbuf_put/get orphaning their mutex on cancellation, hanging vtaskmgr_fini 2026-09-15 04:13:53 +00:00
test_wal_wire.c fix(ha): close two independent chaotic-failover bugs — term-desync liveness stall and bug-847 WAL batch payload loss 2026-07-08 15:21:24 +00:00
test_wobj.c save works 2026-03-06 18:20:30 +08:00
test_xcealloc.c fix(lib): free host_account.host and job_account test fixtures (bug-1723, bug-1621) 2026-09-08 09:16:20 +00:00
test_xcealloc_oom.c fix(lib,scheduler): allocation constructors and allocators report OOM instead of building NULL-name records (bug-1882) 2026-09-28 08:49:51 +00:00
test_xlist.c fix(lib): zarray_fini/xlist_fini must reset caps/count, not just free data 2026-09-16 02:31:53 +00:00
test_xstring.c docs: mark Phase 6 complete in phase6-scheduler-integration-plan 2026-04-30 07:17:32 +00:00
test_xvec.c using xvec related api in scheduler 2026-01-16 18:21:37 +08:00
test_zarray.c fix(lib): zarray_fini/xlist_fini must reset caps/count, not just free data 2026-09-16 02:31:53 +00:00
test_zarray_cow.c feat: implement xzarray COW freeze/thaw with pre-grown shadow array (P0-2) 2026-05-07 09:46:28 +00:00
test_zarray_reserve.c fix(job-array-single-wal-record): close bug-1443's bulk-insert partial-visibility gap 2026-07-16 15:08:02 +00:00