feat: add shared integration test framework for garages (#126)

Implements:
- BattleResult type and JSON-lines parser (#127)
- TR server lifecycle manager (#128)
- Bot compiler using nim c (#129)
- runBattle() orchestrator (#130)
- Example test in OscillatorBot_garage (#131)
- Framework usage guide (#132)
- TestBattleRunner.java for external server (#133)
- BattleRunner process lifecycle (#134)

Fix: runner_process.nim was redefining TimeoutError locally; now
uses std/net.TimeoutError consistently with server_manager.nim.
This commit is contained in:
2026-08-30 12:03:35 +02:00
parent a50571e6da
commit 57a1915b10
13 changed files with 654 additions and 2 deletions
@@ -0,0 +1,32 @@
## Public API for the TR integration test framework.
## Import this module only; it re-exports all types you need.
import ./server_manager
import ./bot_compiler
import ./battle_result
import ./runner_process
export battle_result.BattleResult
export battle_result.BotResult
export battle_result.RoundResult
export battle_result.BotRoundResult
proc runBattle*(botDirs: seq[string], rounds: int = 10,
timeout: int = 120000): BattleResult =
ensureServer()
discard compileBots(botDirs)
let stdout = runBattleRunner(getServerUrl(), botDirs, rounds, timeout)
result = parseServerOutput(stdout)
when isMainModule:
echo "test_framework.nim — public API, not a standalone binary."
echo "Requires a TR server JAR. Usage from your test file:"
echo ""
echo " import common_libs/test_framework/test_framework"
echo " let r = runBattle(@[\"path/to/BotA\", \"path/to/BotB\"])"
echo " echo r.winners"
echo ""
echo "Env vars forwarded to sub-modules:"
echo " TR_SERVER_JAR TR server JAR path"
echo " TR_BATTLE_RUNNER BattleRunner JAR path"
echo " TR_BATTLE_RUNNER_DIR BattleRunner class dir"