feat(xce-harness-component): relocate the four standalone test binaries
Move test_resval_typeresolve.c, test_joblist_display.c, test_join_worker_args.c, and test_listrow_json.c into src/harness/testsuite/, and re-create their executable()/test() blocks verbatim in src/harness/meson.build under suite 'harness' (task 1.1 had already fully deleted them from src/controller/meson.build, not just moved them, so these had been orphaned on disk since that commit). Fix test_joblist_display.c's ctrlstatus_fmt.h include path to the xce/ location promoted in task 1.2. Verified against the pre-task-1.1 baseline (git show cf55d691^): all four blocks' source lists, c_args, and env are faithfully reproduced, only paths and the suite tag changed. harness suite: 5 binaries, all green (resval_typeresolve 4, joblist_display 20, join_worker_args 5, listrow_json 12, harness_unit_test 132 -- 173 total, 0 failures). controller suite unchanged: 1199 Tests 0 Failures 0 Ignored. This completes Major Task 2 (Core) -- the harness component now owns all 5 of its test binaries independently of the controller build. Task 2.2 of xce-harness-component. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
parent
b5873a67aa
commit
49cf25aa23
6 changed files with 114 additions and 2 deletions
|
|
@ -26,7 +26,7 @@
|
|||
- In the same task, remove `test_test_cli.c`'s and `test_xcetest_process_entry.c`'s entries from `controller_unit_test_src` and their `extern`/`RUN_TEST` lines from `controller_test.c` — the only two of the 13 not already removed in task 1.1 (`test_ctrlstatus`'s entry stays — it tests controller's own `ctrlstatus.c`)
|
||||
- Observable: `meson test --suite harness` runs `harness_unit_test` with the same pass count these 13 files reported before the move; `meson test --suite controller` run immediately after this same task still runs `controller_unit_test` successfully, with its test count reduced by exactly these final 2 entries (11 were already reflected in task 1.1's count drop)
|
||||
- _Requirements: 3.1, 3.2, 3.3, 3.4_
|
||||
- [ ] 2.2 Relocate the four already-standalone harness test binaries
|
||||
- [x] 2.2 Relocate the four already-standalone harness test binaries
|
||||
- Physically relocate the `test_resval_typeresolve.c`, `test_joblist_display.c`, `test_join_worker_args.c`, and `test_listrow_json.c` files into `src/harness/testsuite/` (left on disk at their old path since task 1.1 removed their controller-side `executable()`/`test()` blocks); re-create each of the four `executable()`/`test()` blocks, unchanged in shape, in `src/harness/meson.build` under suite `harness`, referencing their production files already relocated to `src/harness/` in task 1.1
|
||||
- Update `test_joblist_display.c`'s `ctrlstatus_fmt.h` include path to `xce/ctrlstatus_fmt.h` as part of this same move
|
||||
- Observable: `meson test --suite harness` lists all four binaries alongside `harness_unit_test`, each reporting the same pass count as before the move
|
||||
|
|
@ -102,4 +102,5 @@
|
|||
- **Task 1.1**: `test_test_cli.c`/`test_xcetest_process_entry.c` locate `xce_test` as a build-dir sibling via `resolve_xce_test_path()`. Since they still live in `src/controller/testsuite/` until task 2.1, a temporary `xce_test_controller_link` custom_target symlink bridge was added to `src/controller/meson.build` (documented in-code as removable once task 2.1 relocates both files). Task 2.1 must remove this custom_target and the `test()`'s `depends:` on it as part of that relocation.
|
||||
- **Task 1.1 gotcha**: a meson `custom_target` command's `@INPUT0@`/`@OUTPUT0@` tokens expand to build-root-relative paths, but a symlink's target string is resolved relative to the *symlink's own directory* at dereference time, not the invocation cwd or the string's own reference frame — using `@INPUT0@` directly as an `ln -sf` target from a different subdirectory produces a broken link. Use an explicit `../`-relative (or absolute) path instead.
|
||||
- **Build dir note**: this repo's default build dir resolves to `src/xce.build/` (relative to `src/tools/xce-build.sh`'s own cwd), not a bare `xce.build/` at the repo root.
|
||||
- **Task 2.2**: Major Task 2 (Core) is now fully complete — all 5 harness test binaries exist under `suite: 'harness'` (4/20/5/12/132 tests, all green), controller's suite is fully clean at 1199 tests. Minor non-blocking cleanup found for a future pass: `src/controller/meson.build:211`'s `struct2json_dep` comment still cites `test_listfmt_json.c` (relocated to harness in task 2.1) as a consumer, and its own dependency may now be unused in `controller_unit_test_deps` — worth checking whether it can be dropped entirely once someone audits it.
|
||||
- **Task 2.1**: confirmed `resolve_xce_test_path()` (`/proc/self/exe` dirname + sibling lookup) needed zero code change once both `xce_test` and `harness_unit_test` build under the same `src/harness/meson.build` — they land in the same build-dir subdir automatically. Test counts cross-checked and consistent end to end: 1331 (pre-move) → 1228 (after task 1.1's 11-entry removal) → 1199 controller + 132 harness = 1331 (after task 2.1). Minor non-blocking nit for a future pass: `test_xcetest_process_entry.c`'s header comment still describes the old controller-embedded build layout — stale prose only, not a functional issue.
|
||||
|
|
|
|||
|
|
@ -125,3 +125,114 @@ test('harness unit test', harness_unit_test,
|
|||
timeout: 300,
|
||||
depends: [xce_test],
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
|
||||
# xce-harness-component task 2.2: the four already-standalone harness test
|
||||
# binaries, relocated verbatim from src/controller/meson.build (see git
|
||||
# history prior to xce-harness-component task 1.1 for their original
|
||||
# definitions) -- only their include_directories/dependencies source
|
||||
# (controller_unit_test_deps -> harness_unit_test_deps, both declared above)
|
||||
# and suite tag ('controller' -> 'harness') change. Each remains its own
|
||||
# self-contained 2-3 file executable()/test() pair with no shared runner,
|
||||
# per design.md's Harness Unit-Test Suite section.
|
||||
|
||||
# resource-value-verification task 1.1: resval_typeresolve.c is a small,
|
||||
# dependency-light module (no networking/REPL/global state) extracted from
|
||||
# test.c's set_resval() specifically so its name -> Value_u_which resolution
|
||||
# logic can be unit-tested in isolation -- test.c itself (4298 lines, its own
|
||||
# main(), heavy libedit/network dependencies) cannot be white-box included
|
||||
# into a Unity test. Standalone binary since it has zero dependency on
|
||||
# controller-internal state.
|
||||
resval_typeresolve_unit_test_src = [
|
||||
'testsuite/test_resval_typeresolve.c',
|
||||
'resval_typeresolve.c',
|
||||
]
|
||||
|
||||
resval_typeresolve_unit_test = executable('resval_typeresolve_unit_test',
|
||||
resval_typeresolve_unit_test_src,
|
||||
include_directories: [incdir],
|
||||
dependencies: harness_unit_test_deps,
|
||||
c_args: ['-DXCE_TESTING'],
|
||||
install: false)
|
||||
|
||||
test('resval typeresolve test', resval_typeresolve_unit_test,
|
||||
suite: 'harness',
|
||||
timeout: 60,
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
|
||||
# xce-test-cli-ux task 2.5 remediation: joblist_display.c is a small,
|
||||
# dependency-light module (no networking/REPL/global state) extracted from
|
||||
# test.c's worker_status_str()/job_state_str()/format_job_time() specifically
|
||||
# so their bug-1711 display-formatting fixes can be unit-tested in isolation
|
||||
# -- test.c itself cannot be white-box included into a Unity test, same
|
||||
# rationale as resval_typeresolve_unit_test above. Standalone binary since it
|
||||
# has zero dependency on controller-internal state.
|
||||
joblist_display_unit_test_src = [
|
||||
'testsuite/test_joblist_display.c',
|
||||
'joblist_display.c',
|
||||
]
|
||||
|
||||
joblist_display_unit_test = executable('joblist_display_unit_test',
|
||||
joblist_display_unit_test_src,
|
||||
include_directories: [incdir],
|
||||
dependencies: harness_unit_test_deps,
|
||||
c_args: ['-DXCE_TESTING'],
|
||||
install: false)
|
||||
|
||||
test('joblist display test', joblist_display_unit_test,
|
||||
suite: 'harness',
|
||||
timeout: 60,
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
|
||||
# xce-test-cli-ux task 2.6 remediation: join_worker_args.c is a small,
|
||||
# dependency-light module (no networking/REPL/global state) extracted from
|
||||
# test.c's cmd_join_worker() specifically so the bug-1557 maxmem-default fix
|
||||
# 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 since it has zero
|
||||
# dependency on controller-internal state.
|
||||
join_worker_args_unit_test_src = [
|
||||
'testsuite/test_join_worker_args.c',
|
||||
'join_worker_args.c',
|
||||
'flagspec.c', # xce-test-cli-ux task 3.1: join_worker_parse_attrs
|
||||
# migrated onto flagspec_build_opts/flagspec_reject
|
||||
]
|
||||
|
||||
join_worker_args_unit_test = executable('join_worker_args_unit_test',
|
||||
join_worker_args_unit_test_src,
|
||||
include_directories: [incdir],
|
||||
dependencies: harness_unit_test_deps,
|
||||
c_args: ['-DXCE_TESTING'],
|
||||
install: false)
|
||||
|
||||
test('join worker args test', join_worker_args_unit_test,
|
||||
suite: 'harness',
|
||||
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 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',
|
||||
'listrow_json.c',
|
||||
'listfmt_json.c',
|
||||
]
|
||||
|
||||
listrow_json_unit_test = executable('listrow_json_unit_test',
|
||||
listrow_json_unit_test_src,
|
||||
include_directories: [incdir],
|
||||
dependencies: harness_unit_test_deps,
|
||||
c_args: ['-DXCE_TESTING'],
|
||||
install: false)
|
||||
|
||||
test('listrow json test', listrow_json_unit_test,
|
||||
suite: 'harness',
|
||||
timeout: 60,
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <unity/unity.h>
|
||||
|
||||
#include "ctrlstatus_fmt.h" /* ctrlstatus_format_time_ms -- used directly
|
||||
#include "xce/ctrlstatus_fmt.h" /* ctrlstatus_format_time_ms -- used directly
|
||||
* below to prove format_job_time() genuinely
|
||||
* delegates to it (byte-identical output),
|
||||
* rather than a parallel reimplementation that
|
||||
Loading…
Add table
Add a link
Reference in a new issue