Test architecture
LandSandBoat has a custom test framework built into thexi_test binary. Tests are written in Lua using a BDD-style describe/it API, and the test runner is a dedicated process (src/test/) that spins up a full in-memory MapEngine and WorldEngine against a live database.
Running tests locally
With Docker (recommended)
Thedev.docker-compose.yml test service runs xi_test against a containerized MariaDB:
--keep-going flag ensures all tests run even if some fail.
Without Docker
Buildxi_test with CMake and run it directly:
xi_test requires a running MariaDB instance with a populated database. Use environment variables to configure the connection:
Writing Lua tests
Test files live underscripts/tests/ and use a describe/it BDD API. The test runner discovers all .lua files in that tree automatically.
Basic test structure
Lifecycle hooks
CClientEntityPair
xi.test.world:spawnPlayer(...) returns a CClientEntityPair — a coupled (client, server entity) pair that lets you drive the player from the Lua test:
Test specs (type definitions)
scripts/specs/ contains Lua type definition files (LuaLS annotations) for all binding types. These are picked up by the Lua Language Server and provide autocomplete and type checking in editors:
Startup checks
Thestartup_checks service (run as python -m tools.ci.startup_checks) validates that the server can start cleanly — including zone initialization, Lua loading, and basic sanity checks — without running the full test suite.
Static analysis — clang-tidy
clang-tidy runs as a separate build in CI and locally via Docker:.clang-tidy at the repository root. See Code style for the full list.
CI workflows
CI is handled by GitHub Actions. The relevant workflows are:| Workflow | File | Trigger |
|---|---|---|
| Builds | build.yml | Push to base |
| Tests | test.yml | After Builds succeeds |
| PR Checks | pr_checks.yml | Pull request |
| CodeQL | codeql_analysis.yml | Push to base |
| Docker Build | docker_build.yml | Called from build.yml |
| Docker Test | docker_test.yml | Called from test.yml |
Build matrix
TheBuilds workflow compiles on:
| OS | Compiler | Build type |
|---|---|---|
| Ubuntu 24.04 | GCC 14 | Debug |
| Ubuntu 24.04 | Clang 20 | Debug (+ clang-tidy) |
| Windows 2025 | MSVC | Debug + Release |
| macOS 26 | Apple Clang | Debug + Release |
| Docker (Ubuntu) | GCC 14 | Release |
| Docker (Alpine) | Clang 20 | Release |
Test matrix
TheTests workflow runs after a successful build:
- Sanity checks — shell-based checks run against
origin/base - Lua Language Server — type-checks all Lua scripts
- Runner tests —
xi_teston Windows and macOS - Docker tests —
xi_test+ startup checks on Ubuntu and Alpine containers