Skip to main content

Synopsis

Description

crucihil scaffold generates boilerplate so you can start writing tests immediately. It has three modes:

Options

path
Path to a rig TOML. Reads the TOML and generates suites/smoke.yaml, suites/regression.yaml, tests/smoke.py, and tests/regression.py tailored to the detected hardware (CAN buses, ECUs, power rails). Short form: -r.
string
Drop a self-contained runnable example. Available names: hello_world, can_signals, fault_injection. Short form: -e.
string
Generate a custom backend adapter stub. Available types: can, power, gpio, doip, someip, udp, uds. Short form: -a.
string
Class name for an adapter stub. Example: --adapter can --name RelayBoard generates a RelayBoardBackend class. Defaults to Custom<Type>. Short form: -n.
path
default:"."
Directory to write generated files into. Short form: -d.

Test project from a rig TOML

Reads bench_01.toml and generates:
The generated YAML manifests reference the signals and ECUs from your rig TOML. For example, if your TOML has [rig.ecus.engine_ecu] and [rig.can.powertrain], the scaffold creates test stubs that reference those. After scaffolding, fill in the pass stubs with real assertions:
The stubs pass immediately (they contain pass), giving you a working baseline to build from.

Examples

hello_world

A minimal three-test suite with a virtual rig and sample DBC:
Creates:
Run it immediately:

can_signals

Demonstrates rig.can.send, rig.can.expect, rig.sim.set, and rig.sim.override:

fault_injection

Demonstrates the fault injection API — rig.fault.can_dropout, rig.fault.power_cycle, rig.fault.gpio_stuck:

Custom backend adapters

If you have a proprietary CAN adapter, power supply, or GPIO board, you can implement it as a Python class and load it via backend = "myorg.my_module" in the rig TOML. The scaffold generates the correct boilerplate:

CAN adapter stub

Generates relay_board_backend.py:

Power backend stub

GPIO backend stub

Stub generation (crucihil stub)

After adding new test IDs to a YAML manifest, run crucihil stub to generate the missing Python function stubs:
This appends typed async def test_* stubs for every test function that is declared in the YAML but missing from the corresponding Python module. Use --dry-run to preview what would be written:

See also