diff --git a/.kiro/specs/xce-test-e2e-primitives/tasks.md b/.kiro/specs/xce-test-e2e-primitives/tasks.md index bb5ce51..3e48e48 100644 --- a/.kiro/specs/xce-test-e2e-primitives/tasks.md +++ b/.kiro/specs/xce-test-e2e-primitives/tasks.md @@ -9,7 +9,7 @@ - Observable: a piped script with a bogus/failing command makes `xce_test` exit non-zero; an all-valid script exits 0; with `set continue-on-error` a failing line does not stop later lines but the final exit is still non-zero; `#`/blank lines are ignored. - _Requirements: 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 6.1, 6.2_ - _Boundary: VerdictLoopWrapper_ -- [ ] 1.2 `echo` command +- [x] 1.2 `echo` command - Add `cmd_echo` (table-registered) that prints its argument message and returns success. - Observable: `echo hello` emits `hello` and the command succeeds (exit unaffected). - _Requirements: 6.3_ diff --git a/src/controller/testsuite/test.c b/src/controller/testsuite/test.c index cd7fcce..dcd7617 100644 --- a/src/controller/testsuite/test.c +++ b/src/controller/testsuite/test.c @@ -115,6 +115,7 @@ extern int cmd_qctrl(int, char*[]); extern int cmd_runtasks(int, char*[]); extern int cmd_setpend(int, char*[]); extern int cmd_jobinfo(int, char*[]); +extern int cmd_echo(int, char*[]); static int worker_house_keeping(void*); /* Session verdict / loop state (xce-test-e2e-primitives task 1.1). @@ -151,6 +152,7 @@ static command_t top_commands[] = { { "scheduler", cmd_scheduler, "In scheduler context" }, { "client", cmd_client, "In client context" }, { "set", cmd_set, "Show/Set settings" }, + { "echo", cmd_echo, "Print a message" }, { "quit", cmd_quit, "Quit xce test" }, { (char*)NULL, (cmd_func_t)NULL, (char*)NULL } }; @@ -167,6 +169,7 @@ static command_t worker_commands[] = { { "join", cmd_join_worker, "Join the cluster" }, { "jfinish", cmd_jobfinish, "tell controller jobfinish" }, { "resupdate", cmd_resupdate, "update res vals" }, + { "echo", cmd_echo, "Print a message" }, { (char*)NULL, (cmd_func_t)NULL, (char*)NULL } }; @@ -191,6 +194,7 @@ static command_t client_commands[] = { { "resval", cmd_resval, "get value of res" }, { "taskrun", cmd_runtasks, "run tasks" }, { "help", cmd_help, "Display this text" }, + { "echo", cmd_echo, "Print a message" }, { "quit", cmd_quit, "Quit xce test" }, { (char*)NULL, (cmd_func_t)NULL, (char*)NULL } }; @@ -207,6 +211,7 @@ static command_t scheduler_commands[] = { { "join", cmd_join_sched, "Join the cluster" }, { "getconf", cmd_getconf, "Get conf of cluster" }, { "setpend", cmd_setpend, "set job pend reason" }, + { "echo", cmd_echo, "Print a message" }, { (char*)NULL, (cmd_func_t)NULL, (char*)NULL } }; @@ -473,6 +478,25 @@ int cmd_help(int argc, char* argv[]) return rc; } +/* echo — print the remainder of the line (argv[1..] joined by + * single spaces) followed by a newline and succeed (xce-test-e2e-primitives + * task 1.2, Req 6.3). `echo` with no argument prints an empty line and still + * succeeds. Returns 0 always so it never marks the session failed. */ +int cmd_echo(int argc, char* argv[]) +{ + int i; + + for (i = 1; i < argc; i++) { + if (i > 1) { + putchar(' '); + } + fputs(argv[i], stdout); + } + putchar('\n'); + + return 0; +} + int cmd_up(int argc, char* argv[]) { if (active_ctx->parent != NULL) {