Skip to main content

Module testing

Module testing 

Source
Available on crate features testing only.
Expand description

Checks of a model entry’s contracts, for a model’s own tests.

check_model runs every ModelCheck that applies to an entry and returns a ModelReport of the failures and the skipped checks. assert_set_conforms checks a whole ModelSet and panics with every failure. A check never panics on a model’s behalf. A model’s panic, a device error and a broken contract each come back as a CheckFailure.

Each check that builds the model sets grid_width, grid_height, num_agents, world_width and world_height small, within their bounds and never above their defaults. ModelCheck::ThreadCount sets the size the work splits at, and the GPU checks and a GPU model’s ModelCheck::Actions build at the declared defaults. CheckSettings::set_text overrides any of these.

A GPU model is built on the device passed to CheckSettings::gpu. Without a device, or on wasm32, every check that builds it is skipped, apart from the failures check_model lists. The GPU checks and headless_test_device are native only.

Note that a caller of check_model or check_model_set installs the panic hook first, through henad_compute::fault::install_panic_hook. Without it the failure of a kernel panic has no file:line.

Structs§

CheckFailure
One check that failed, with what it found.
CheckSettings
Device, run length, thread counts, parameter overrides and exemptions of a check run.
ModelReport
Failures and skipped checks of one model.
SetReport
Reports of every model of a set, and the model ids that the settings specify and that are missing from the set.
SkippedCheck
One check that did not run, with the reason.
TestDeviceRequest
Limits and features to request for a test device.

Enums§

ModelCheck
One contract of a model entry that the kit checks.
SkipReason
Reason a check did not run.

Constants§

MIN_TICKS
Minimum number of ticks that CheckSettings::ticks accepts, one past the coarser sampling cadence.

Functions§

assert_set_conforms
Installs the panic hook, then checks every model of models.
check_model
Checks every contract of entry that settings allows, and reports every failure.
check_model_set
Checks every model of models, in the set’s order.
headless_test_deviceNon-WebAssembly
Returns a headless device for request, or None on a machine without a device.