Rho.Dyn.Selftest (rho v0.1.0)

Copy Markdown View Source

Selftests a compiled generation (the end of the pipeline's step 2, see Rho.Dyn), one module at a time, each in a fresh process with a max_heap_size (killed when exceeded, off-heap binaries included), a timeout and trap_exit (a linked helper that crashes doesn't take the test down unreported).

Any module that also exports selftest/0 gets it run too (:ok passes). When the test process finishes, processes linked to it go down with it. A failure is formatted inside the test process (Rho.Untrusted.format/4) and the caller only takes strings back; a test process that dies otherwise is described, not formatted (Rho.Untrusted.exit_text/2).

Summary

Functions

The kind a loaded module is filed under.

Runs every module's test; {:ok, results} only if all passed. Options: :selftest_timeout_ms (5000), :selftest_max_heap_mb (64). Each result carries the tool's name (nil for other kinds).

Functions

kind(mod)

@spec kind(module()) :: Rho.Dyn.Generation.kind()

The kind a loaded module is filed under.

run(mods, opts \\ [])

@spec run([module()], keyword()) ::
  {:ok, [Rho.Dyn.Generation.selftest()]}
  | {:error, [Rho.Dyn.Generation.selftest()]}

Runs every module's test; {:ok, results} only if all passed. Options: :selftest_timeout_ms (5000), :selftest_max_heap_mb (64). Each result carries the tool's name (nil for other kinds).