cmd_join_worker's simulated-worker maxmem default was 64 bytes -- a leftover from when the field was MB-scale, unfixed when maxmem became bytes-canonical elsewhere. Now 64 * 1024 * 1024. Extracted the argument-parsing/defaulting logic into join_worker_parse_attrs() (join_worker_args.c), since it runs entirely before the function's network call and is a genuine testable seam -- same precedent as task 2.5's joblist_display.c. Verified live against a real deployed cluster (workerlist reports MaxMem: 64.00 MB) plus a permanent 5-test regression suite. maxswap/maxtmp have the identical stale-default bug (logged as bug-1793) but are deliberately left unfixed here since USAGE_JOIN_WORKER's help text currently documents their stale values accurately -- fixing only the code would create a new docs mismatch; a locked-in sibling-defaults test documents this for the follow-up. 1353/1353 across the full controller suite (+5), 0 regressions. Task 2.6 of .kiro/specs/xce-test-cli-ux/tasks.md. Requirements: 12.1 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019jaMf9QEwpugH2W9KAuc7f
40 lines
2 KiB
C
40 lines
2 KiB
C
#ifndef JOIN_WORKER_ARGS_H
|
|
#define JOIN_WORKER_ARGS_H
|
|
|
|
/* join_worker_args.h -- xce-test-cli-ux task 2.6 remediation (bug-1557 fix)
|
|
*
|
|
* Extracted from test.c's cmd_join_worker(): the pure argument-parsing/
|
|
* defaulting block that populates a hostattrs_t (xce/types.h) from argc/argv,
|
|
* including the bug-1557 maxmem default fix. This block runs entirely before
|
|
* cmd_join_worker's only network call (xcecli_join()) and touches no
|
|
* active_ctx, REPL state, or any global beyond the standard `optind` reset
|
|
* every other cmd_ handler in this file already performs -- the same
|
|
* isolation rationale as joblist_display.c's extraction (task 2.5) and
|
|
* resval_typeresolve.c's (resource-value-verification task 1.1).
|
|
*
|
|
* test.c's cmd_join_worker() calls this directly in place of its old inline
|
|
* parsing block, then proceeds to xcecli_join() exactly as before -- no
|
|
* behavior change to the network-call phase, extraction only.
|
|
*/
|
|
|
|
#include "xce/types.h" /* hostattrs_t */
|
|
|
|
/* Parse join's CLI flags ("-f cpufactor -c maxcpus -m maxmem -s maxswap
|
|
* -t maxtmp -d ndisks") into `*attrs`, first defaulting every field
|
|
* (including the bug-1557-corrected maxmem default of 64 * 1024 * 1024
|
|
* bytes -- see the in-body comment in join_worker_args.c for the full
|
|
* bytes-vs-MB history) and then overriding any field whose flag was given.
|
|
*
|
|
* Resets `optind` to 1 before parsing, matching this file's own convention
|
|
* for repeated in-process command invocations (see cmd_jobfinish's comment
|
|
* on the same convention).
|
|
*
|
|
* Returns 0 on success. Returns -EINVAL on an unrecognized flag or a NULL
|
|
* `attrs`, leaving `*attrs` fully defaulted (and possibly partially
|
|
* overridden by whichever flags were already parsed before the
|
|
* unrecognized one) -- callers must not use `*attrs` after a nonzero
|
|
* return. On a parse error, this function itself prints the same usage
|
|
* string cmd_join_worker printed before extraction. */
|
|
int join_worker_parse_attrs(int argc, char* argv[], hostattrs_t* attrs);
|
|
|
|
#endif /* JOIN_WORKER_ARGS_H */
|