Add JSON-RPC echo server for validation suite

Replaces the external jrpces binary dependency with a self-contained
Python script. The server supports TCP (newline-delimited JSON, port 4321)
and UDP (port 4323), handles JSON-RPC 1.0 and 2.0, and implements:
  - echo(*args) -> [args, {}]
  - unknown methods -> error {code: -32000, message: "function not found"}

test.tum is updated to launch jrpc_echo_server.py via python3 and wait
for the "ready" readiness message before running tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-20 21:34:43 +02:00
parent 2cc42e9065
commit 6d1fb6a6bc
2 changed files with 140 additions and 6 deletions

View File

@@ -1,27 +1,27 @@
- console:
name: json rpc echo server
doc: check if the jsonrpc echo server is installed
doc: check if jrpc_echo_server.py is available
console_name: jrpces
key: $(test)_PASS
steps:
- open:
protocol: terminal
- read_until: {expected: $(terminal_prompt), timeout: 1, no_fail: True}
- writeln: which jrpces
- read_until: {expected: jrpces, timeout: 2}
- writeln: test -f {{include_directory}}/jrpc_echo_server.py && echo JRPC_OK
- read_until: {expected: JRPC_OK, timeout: 2, no_fail: True}
- group:
name: jsonrpc tests
condition: <| '/jrpces' in r'''$(cn_json rpc echo server)''' |>
condition: <| 'JRPC_OK' in r'''$(cn_json rpc echo server)''' |>
steps:
- console:
name: Start the json rpc echo server
console_name: jrpces
key: $(test)_PASS
steps:
- writeln: jrpces -c {{include_directory}}/jrpces.ini
- read_until: {expected: $(terminal_prompt), timeout: 1, no_fail: True}
- writeln: python3 {{include_directory}}/jrpc_echo_server.py -c {{include_directory}}/jrpces.ini
- read_until: {expected: ready, timeout: 5}
- console:
name: Open the raw tcp Console