feat(xce-test-cli-ux): add JSON output mode to the listing commands
Bring workerlist/joblist/reslist onto the shared flagspec_t library with an identically-spelled --json flag, wired to the task-2.2 JSON list formatter via a new pure field-mapping module (listrow_json.c/.h). Default table output is unchanged; JSON rows carry raw numeric values (flags, timestamps, memory sizes) rather than their humanized display strings, per Requirement 5.1's "same fields" contract. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019jaMf9QEwpugH2W9KAuc7f
This commit is contained in:
parent
a57c04716b
commit
0d67f5cbde
7 changed files with 996 additions and 16 deletions
|
|
@ -55,7 +55,7 @@ controller = executable('xce_controller',
|
|||
link_args: wrap_link_args,
|
||||
install: true)
|
||||
|
||||
xce_test_src = [ 'testsuite/test.c', 'testsuite/waldump.c', 'testsuite/walcompare.c', 'testsuite/snapverify.c', 'testsuite/snapdiff.c', 'testsuite/configcompare.c', 'testsuite/resval_typeresolve.c', 'testsuite/joblist_display.c', 'testsuite/join_worker_args.c', 'testsuite/rcfile.c', 'testsuite/flagspec.c', 'testsuite/interruptcall.c', 'testsuite/confirm.c', 'testsuite/listfmt_json.c']
|
||||
xce_test_src = [ 'testsuite/test.c', 'testsuite/waldump.c', 'testsuite/walcompare.c', 'testsuite/snapverify.c', 'testsuite/snapdiff.c', 'testsuite/configcompare.c', 'testsuite/resval_typeresolve.c', 'testsuite/joblist_display.c', 'testsuite/join_worker_args.c', 'testsuite/rcfile.c', 'testsuite/flagspec.c', 'testsuite/interruptcall.c', 'testsuite/confirm.c', 'testsuite/listfmt_json.c', 'testsuite/listrow_json.c']
|
||||
|
||||
# BSD-licensed readline replacement (scheduler-core spec, task 12.1 review
|
||||
# finding): GNU readline is GPL; xce_test's REPL only needs readline()/
|
||||
|
|
@ -451,3 +451,31 @@ test('join worker args test', join_worker_args_unit_test,
|
|||
timeout: 60,
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
|
||||
# xce-test-cli-ux task 3.4: listrow_json.c is a small, dependency-light
|
||||
# module (no networking/REPL/global state) extracted from cmd_reslist/
|
||||
# cmd_workerlist/joblist_query specifically so their new --json output
|
||||
# mode's per-command field-mapping logic can be unit-tested in isolation
|
||||
# -- test.c itself cannot be white-box included into a Unity test, same
|
||||
# rationale as joblist_display_unit_test/resval_typeresolve_unit_test
|
||||
# above. Standalone binary (not folded into controller_unit_test_src)
|
||||
# mirroring those tests' own standalone-binary rationale. Links
|
||||
# listfmt_json.c directly (not struct2json_dep alone) since listrow_json.c
|
||||
# calls its add_string()/add_number()/new_row() helpers.
|
||||
listrow_json_unit_test_src = [
|
||||
'testsuite/test_listrow_json.c',
|
||||
'testsuite/listrow_json.c',
|
||||
'testsuite/listfmt_json.c',
|
||||
]
|
||||
|
||||
listrow_json_unit_test = executable('listrow_json_unit_test',
|
||||
listrow_json_unit_test_src,
|
||||
include_directories: [incdir],
|
||||
dependencies: controller_unit_test_deps,
|
||||
c_args: ['-DXCE_TESTING'],
|
||||
install: false)
|
||||
|
||||
test('listrow json test', listrow_json_unit_test,
|
||||
suite: 'controller',
|
||||
timeout: 60,
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue