fix(xce-test-cli-ux): fix bug-1557's join maxmem default
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
This commit is contained in:
parent
a8154acb0a
commit
878a42fb48
7 changed files with 304 additions and 40 deletions
70
src/controller/testsuite/join_worker_args.c
Normal file
70
src/controller/testsuite/join_worker_args.c
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/* join_worker_args.c -- xce-test-cli-ux task 2.6 remediation (bug-1557 fix)
|
||||
*
|
||||
* See join_worker_args.h for the full extraction rationale. Verbatim
|
||||
* extraction of test.c's cmd_join_worker() parsing/defaulting block -- no
|
||||
* behavior change from the pre-extraction version.
|
||||
*/
|
||||
#include "join_worker_args.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h> /* getopt, optarg, optind */
|
||||
|
||||
int join_worker_parse_attrs(int argc, char* argv[], hostattrs_t* attrs)
|
||||
{
|
||||
int opt;
|
||||
|
||||
if (attrs == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* bug-1557: maxmem is bytes-canonical (see resources.yaml, hardware_
|
||||
* monitor.c's total_memory) -- this default used to read plain "64"
|
||||
* back when maxmem was MB-scale (64 MB); an earlier session converted
|
||||
* the codebase's canonical unit to bytes but missed this test-tool
|
||||
* default, leaving it at a nonsensical 64 BYTES. Expressed here as
|
||||
* 64 * 1024 * 1024 (64MB in bytes) to preserve the original intent,
|
||||
* matching this file's own byte-constant convention (see test.c's
|
||||
* main() `logsize = 64 * 1024 * 1024`). */
|
||||
attrs->cpufactor = 1.0;
|
||||
attrs->maxcpus = 4;
|
||||
attrs->maxmem = 64 * 1024 * 1024;
|
||||
attrs->maxswap = 1024;
|
||||
attrs->maxtmp = 2048;
|
||||
attrs->ndisks = 1;
|
||||
|
||||
attrs->hostmodel = "Intel64";
|
||||
attrs->hosttype = "LINUX64";
|
||||
|
||||
optind = 1;
|
||||
|
||||
while ((opt = getopt(argc, argv, "f:c:m:s:t:d:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'f':
|
||||
attrs->cpufactor = atof(optarg);
|
||||
break;
|
||||
case 'c':
|
||||
attrs->maxcpus = atoi(optarg);
|
||||
break;
|
||||
case 'm':
|
||||
attrs->maxmem = atoi(optarg);
|
||||
break;
|
||||
case 's':
|
||||
attrs->maxswap = atoi(optarg);
|
||||
break;
|
||||
case 't':
|
||||
attrs->maxtmp = atoi(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
attrs->ndisks = atoi(optarg);
|
||||
break;
|
||||
default:
|
||||
printf(" join [-f cpufactor] [-c maxcpus] [-m maxmem] [-s maxswap] "
|
||||
"[-t maxtmp] [-d ndisks]\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue