Skip to content

Build and Test Commands#

This page describes the commands that build and test ACRES. Run each command from the root of the repository. Commands gives the conventions of the synopsis.

Game/Core/build.sh#

Builds ACRES Core with CMake and Ninja, then runs its tests with CTest.

Game/Core/build.sh [--all | --no-tests]

The build makes libacres_core, the Python module acres_core, the test programs and the tools in Game/Core/Build. Without an option, the script runs the unit tests and the fast integration tests.

--all
Runs every test except the golden values and the benchmarks (ctest -LE "golden|bench").
--no-tests
Builds only.
Variable Function Default
BUILD_DIR The build folder. Game/Core/Build
PYTHON The interpreter for the Python module. It needs pybind11, numpy and mcap. python3 on PATH
CMAKE_BUILD_PARALLEL_LEVEL The compile jobs. The number of cores
CTEST_PARALLEL_LEVEL The tests at one time. The compile jobs

CMake, CTest and Ninja come from PATH, else from the bin folder of the Python environment. A test that needs map data of Git LFS exits with code 77 when the data is not there. CTest then reports the test as skipped.

The tests have labels: a tier (unit, integration, e2e), a data label (data:none, data:tile, data:region) and extras (slow, golden, bench). ctest --test-dir Game/Core/Build --print-labels lists them.

PYTHON=$(command -v python) Game/Core/build.sh            # build, then the fast tests
ctest --test-dir Game/Core/Build -L unit -j4              # the unit tests only

Vehicle/Runtime/build.sh#

Builds the run-time library libacres_runtime.so with ACRES Core in it, the Python module _acres_runtime and the test programs. Then it runs the tests.

Vehicle/Runtime/build.sh [--no-tests | --all | --label LABEL]

Without an option, the script runs the tiers unit, static and integration (ctest -L runtime -LE nightly).

--no-tests
Builds only.
--all
Runs each test. A test with the label reference is skipped when the recorded reference is not there.
--label LABEL
Runs the tests of a label regular expression, for example unit or e2e. It needs CTest 3.21 or later.
Variable Function Default
BUILD_DIR The build folder. Vehicle/Runtime/Build
ACRES_RUNTIME_JOBS The compile jobs and the test jobs. 3
PYTHON The interpreter for the Python module. It needs pybind11. python3 on PATH
ACRES_RUNTIME_STRICT 1: a skipped test is a failure.
ACRES_RUNTIME_REFERENCE The folder of the recorded reference. Game/Saved/work/runtime-reference
ACRES_RUNTIME_LEAN 1: also builds the checker plug-in from the Lean model. It needs the Lean tool chain. generated: builds the plug-in from the C code in Vehicle/Runtime/Lean/Generated with the system compiler. No plug-in
PYTHON=$(command -v python) Vehicle/Runtime/build.sh
Vehicle/Runtime/build.sh --label unit

Tests/Game/run.sh#

Builds and runs the tests of the engine-free models of the game: vehicle, Polaris, LiDAR, implements and episode log. No Unreal is necessary.

Tests/Game/run.sh

The exit code is 1 when a suite fails.

Python Tests#

Runs the Python tests of Tests/Map, Tests/SimControl, Tests/Data and Tests/Fast. The file pytest.ini gives the paths and the markers.

python -m pytest [-m EXPRESSION]

The default run is -m "unit and not slow and not timing".

Marker Meaning
unit No build and no LFS data.
integration The simulation build, the default map and the cost tables, or the committed map products.
e2e Full missions, a replay of a whole run, the link or the game.
core, mapdata, variant Needs acres_core and _acres_runtime, the map products, or a map variant.
slow, timing More than about 30 s, or a test of a bound of wall time.
gpu, game, ros, recording Needs a CUDA GPU, the packaged game (ACRES_TEST_GAME=1), the ROS 2 workspace, or a recording of the vehicle.
python -m pytest -m "unit or integration"

Tools/ci.sh#

The local continuous integration. It builds what changed and runs the fast test tiers in parallel. Run it before a push.

Tools/ci.sh

The script builds ACRES Core and the run-time library. Then it runs the Core tests without the benchmarks, the Runtime tests without e2e, nightly and reference, the Python tests, the documentation check and Tests/Game/run.sh.

Variable Function Default
PYTHON The interpreter with numpy, pybind11 and the map packages. git config acres.python, else python3
JOBS The parallel jobs. The CPUs of the process

The Git hooks in Tools/hooks are those of Git LFS only. There is no pre-commit hook: run the test tiers by hand (Fast/README.md).

Tools/Unreal/package.sh#

Packages the game for Linux (Development configuration) into Packaged/.

UE=/path/to/UnrealEngine Tools/Unreal/package.sh [LOGFILE]

Warning

The script stops each running Acres process and each running UnrealEditor. Save your work in the editor before you start it.

The script does these steps:

  1. It runs Map/check_runtime_data.py. This check refuses old road and scouting products.
  2. It runs Tools/Unreal/apply_patches.sh.
  3. It runs RunUAT.sh BuildCookRun for the map /Game/Maps/ACRE.
  4. It runs Map/check_runtime_data.py --packaged.
UE
The folder of Unreal Engine. Required.
LOGFILE
The build log. Default: Game/Saved/work/build.log.
ACRES_BUILD_THREADS
Limits the build tool to this number of parallel actions.

The last line is PACKAGE_EXIT with the exit code.

Tools/Unreal/apply_patches.sh#

Applies the small engine fixes that ACRES needs (Tools/Unreal/patches). You can run it more than one time. It stops on a changed engine source and does not overwrite it.

UE=/path/to/UnrealEngine Tools/Unreal/apply_patches.sh

Vehicle/Runtime/Reference/refresh.sh#

Makes each reference of the compiled command chain again after a deliberate change of the chain. Only this command changes the simulation version in Vehicle/Runtime/Reference/sim_version.txt.

Vehicle/Runtime/Reference/refresh.sh [--report-only] [--no-node] [--sensor-change]
--report-only
Makes the new references and prints the reports. It replaces no reference.
--no-node
Skips the references of the vehicle node.
--sensor-change
A deliberate change of the simulated sensor inputs. The script replaces the recorded scans and raises the simulation version.

The script refuses a working tree with changes that are not committed. It adds 1 to the simulation version only when its report says that a drive changed.

Documentation Commands#

Docs/Tools/check_docs.py
Checks the built site and the pages: the diagrams, the links, the coverage of the options and interfaces, the assets and the source paths. Options: --site DIR, --diagrams, --sync-diagrams, --links, --coverage, --assets, --sources, --external. The exit code is 1 when a check finds an error.
Docs/Tools/ste_check.py [FILE...] [--warnings]
Checks the text against the ASD-STE100 rules of the project. Without a file, it checks each handwritten page and README.md.
Docs/Tools/gen_api.py [--out DIR]
Writes the generated reference pages (the C++ headers, the ROS 2 messages, the menu settings and the option index) into a folder. MkDocs runs it on each build.
python -m pip install -r Docs/requirements.txt
mkdocs build --strict
python Docs/Tools/check_docs.py