Launching TestFlows Machine: self-service deterministic simulation testing environment Read the post

Lifecycle

Command Does
machine create Create a run and start it
machine start Start an existing run
machine pause Pause a running machine
machine resume Resume a paused machine
machine stop Stop a running machine gracefully
machine kill Stop a machine, and end it if it does not stop
machine delete Delete a run that is not running, with its log and checkpoints
machine cleanup Remove stale runs and their leftovers

machine create

Create a run and start it. See Creating a run.

Options configure the machine: disk, memory, CPUs, devices and virtual time. The RNG seed and the virtual time base, rate and costs fix the sources of nondeterminism.

Use --auto-checkpoints to set how often checkpoints are taken. Use --like to inherit the options of another run. The disk is not inherited, so --disk is always given.

The machine waits for commands. Use --no-daemon to run it to completion instead.

The run keeps its execution options. Start and fork repeat them unless given others.

A source is a device the machine prints on, such as ttyS1, or a file under /output. Use --keep-output to store a source that would be dropped. Use --drop-output to store less. The run keeps both lists for its whole life, and the describe command shows them.

A run stores every source but the files under /output/drop. A file there has a name and no bytes. A program writes under /output/drop through MACHINE_DROP_OUTPUT_DIR. It writes under /output/keep through MACHINE_OUTPUT_DIR.

A run stores the events an Antithesis SDK writes to /output/drop/sdk.jsonl and /output/drop/*/sdk.jsonl. A name the run keeps or drops decides before that.

A name given to either option may be a pattern, such as /output/drop//.log. A star matches within one directory name, a leading dot included, and never a slash. Two stars match any number of directories.

A name given to --keep-output or --drop-output decides before the directory does. When a kept name and a dropped name cover one source, a name spelled out decides over a pattern. Of two names spelled out, the longer decides, and a tie keeps the source. Of two patterns, the kept one decides.

The name none, given alone, is an empty list. Use it to keep or to drop nothing where the run would have the names of another run.

The command waits until the machine accepts commands. Use --no-wait to return once the request is accepted.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
machine create [-h] [--like run] [--label name=value] [--no-wait] [--keep-output name]
[--drop-output name] [--disk disk] [--mem size] [--cpus n]
[--console {serial,virtio}] [--mem-type {auto,hugepages}]
[--mem-mode {auto,map,lazy}] [--fs-sync | --no-fs-sync]
[--fs-dirsync | --no-fs-dirsync] [--fb type] [--rng | --no-rng]
[--rng-seed n] [--daemon | --no-daemon] [--single-step | --no-single-step]
[--rdtsc-exit | --no-rdtsc-exit] [--repeatable | --no-repeatable]
[--limit-margin n] [--timer-slack duration] [--instr-margin n]
[--dispatch-bound duration] [--fast-backstop n] [--irq-wait n] [--limit n]
[--backstop-limit n] [--pin-cpu n] [--vtime-base n] [--vtime-rate rate]
[--vtime-io-cost ns] [--vtime-rdtsc-cost ns] [--vtime-pause-cost ns]
[--auto-checkpoints n] [--side-dump | --no-side-dump]
[--side-trace | --no-side-trace] [--mem-hash | --no-mem-hash]
[--disk-hash | --no-disk-hash]
[name]
Argument Does
[name] Name for the new run, defaulting to a generated one
Option Does
--like run Inherit options from another run, its disk aside, overridden by explicit ones
--label name=value Attach a label, repeatable; an empty value removes an inherited one
--no-wait Return without waiting
--keep-output name Source that the run stores though it is dropped: a path under /output, a device such as ttyS1, a pattern, or none (repeatable)
--drop-output name Source that the run does not store: a path under /output, a device such as ttyS1, a pattern, or none (repeatable)
--disk disk Disk to create the run from
--mem size Memory, MB or with a K/M/G/T suffix (default: 256)
--cpus n Number of CPUs (default: 1)
--console {serial,virtio} Device the console is: serial for ttyS0 (default) or virtio for hvc0
--mem-type {auto,hugepages} Machine RAM backing: auto (default) or hugepages (local only)
--mem-mode {auto,map,lazy} How memory loads when the run starts from a checkpoint: auto (default), map to load it first, lazy to load each page at first use
--fs-sync, --no-fs-sync Mount filesystem with sync (default: off)
--fs-dirsync, --no-fs-dirsync Mount filesystem with dirsync (default: off)
--fb type Framebuffer type: vnc, gtk, sdl, or none
--rng, --no-rng Give the guest an RNG device, whose seed a branch can change (default: on)
--rng-seed n Seed of the RNG device, 0 to 2^64-1 (default: 0)
--daemon, --no-daemon Wait for commands instead of running to completion (default: on)
--single-step, --no-single-step Run in step mode, with --no-daemon. A run that waits for commands takes its mode from machine run --mode
--rdtsc-exit, --no-rdtsc-exit Record an entry for every RDTSC exit, with --no-daemon only
--repeatable, --no-repeatable Stop fast exactly at the limit, so recording again gives the same entries (default: the session’s)
--limit-margin n Conditional branches short of a stop where the CPU’s counter interrupts (default: the host’s)
--timer-slack duration How late a timer may be in code that takes no exit, 0 for none (default: 20ms)
--instr-margin n Instructions short of a stop placed by an instruction count where the CPU’s counter interrupts, 0 for the host’s (default: the host’s)
--dispatch-bound duration Host time a fast dispatch may run before it stops, 0 for 1s. A stop it places does not repeat (default: 1s)
--fast-backstop n Instructions a fast dispatch may run with no other stop, 0 for 100000000 (default: 100000000)
--irq-wait n Conditional branches a dispatch runs while an interrupt waits for the guest to take it, 0 for 200 (default: 200)
--limit n Conditional branches per dispatch in fast mode, steps in step mode, 0 to leave it to the machine (default: 0)
--backstop-limit n Step modes only: machine instructions a dispatch may run without stepping before it ends, 0 for the machine default (default: 0)
--pin-cpu n Pin to this host CPU (default: the least-loaded)
--vtime-base n The vtime base (Unix timestamp, default: 2026-03-01)
--vtime-rate rate Nanoseconds of machine time for each conditional branch the guest retires, a number or num/den, and N=rate for vCPU N’s own, such as 10,1=40 (default: 10)
--vtime-io-cost ns IO exit vtime cost in ns (default: 2000)
--vtime-rdtsc-cost ns RDTSC exit vtime cost in ns (default: the IO cost)
--vtime-pause-cost ns Vtime cost of each PAUSE in ns (default: 2000)
--auto-checkpoints n Checkpoint every n entries, 0 for never (default: scaled by memory, 50000 per 512MB)
--side-dump, --no-side-dump Record a per-entry debug dump in the run log (default: off)
--side-trace, --no-side-trace Record the hypervisor’s trace of each entry, for diagnosis (default: off)
--mem-hash, --no-mem-hash Hash guest memory at every entry, for a replay to compare (default: off)
--disk-hash, --no-disk-hash Hash the guest’s disk at every entry, for a replay to compare (default: off)

Examples:

1
2
3
4
5
6
7
machine create run1 --disk hello                      create run1 from hello
machine create run1 --disk hello --mem 512 --cpus 2 with 512 MB, 2 CPUs
machine create run1 --disk hello --rng-seed 42 its RNG seeded from 42
machine create run1 --disk hello --no-daemon run to completion
machine create run1 --disk hello --repeatable so recording repeats
machine create run1 --disk hello --timer-slack 0 no timer late
machine create run1 --disk hello --drop-output ttyS1 store none of ttyS1

See also:

machine start

Start an existing run. See Stopping and starting.

Use --at to replay the tip from an earlier checkpoint. Use --read-only to open a checkpoint that cannot run or record. Use -f to stop a running machine first.

A stopped run resumes at its tip. A run that stopped past its last checkpoint replays its recorded tail to reach the tip. The replay reports how many entries it replayed. Use --no-recover to refuse instead.

A branch that never ran starts in its own machine. Its parent keeps running.

The machine runs with the execution options of the run. Options given here replace them for this start only.

The command waits until the machine accepts commands. Use --no-wait to return once the request is accepted.

1
2
3
4
machine start [-h] [-f] [--read-only] [--recover | --no-recover] [--at checkpoint]
[--parents mode] [--daemon | --no-daemon] [--single-step | --no-single-step]
[--limit n] [--backstop-limit n] [--pin-cpu n] [--no-wait]
run
Argument Does
run Run name
Option Does
-f, --force Stop a running instance first, then start
--read-only Start read-only at a checkpoint, unable to run or record
--recover, --no-recover Replay a tip that was never checkpointed from the last checkpoint (default: on)
--at checkpoint Checkpoint to replay to the tip from, or to open with --read-only: ^name, or #entry of a checkpoint
--parents mode Where to read the runs it branched from: local for this session, remote for shared storage
--daemon, --no-daemon Wait for commands instead of running to completion (default: the run’s)
--single-step, --no-single-step Run in step mode, with --no-daemon. A run that waits for commands takes its mode from machine run --mode (default: the run’s)
--limit n Conditional branches per dispatch in fast mode, steps in step mode, 0 to leave it to the machine (default: the run’s)
--backstop-limit n Step modes only: machine instructions a dispatch may run without stepping before it ends, 0 for the machine default (default: the run’s)
--pin-cpu n Pin to this host CPU (default: the least-loaded)
--no-wait Return without waiting

Examples:

1
2
3
4
machine start run1              resume run1 at its tip
machine start run1 --at ^cp1 replay from cp1 to the tip
machine start run1 --read-only open it at its last checkpoint
machine start run1 -f stop a running one first, then start

Refuses, and the way past:

1
a run that is running  machine start run1 -f

See also:

machine pause

Pause a running machine. See Stopping and starting.

The command waits until the machine is paused. Use --no-wait to return once the request is accepted.

1
machine pause [-h] [--no-wait] run
Argument Does
run Run name
Option Does
--no-wait Return without waiting

Examples:

1
machine pause run1  pause run1

See also:

machine resume

Resume a paused machine. See Stopping and starting.

The command waits until the machine accepts commands. Use --no-wait to return once the request is accepted.

1
machine resume [-h] [--no-wait] run
Argument Does
run Run name
Option Does
--no-wait Return without waiting

Examples:

1
machine resume run1  resume the paused run1

See also:

machine stop

Stop a running machine gracefully. See Stopping and starting.

Use -r to stop a branch with its descendants. Use -a to stop every running machine. Use --dry-run to list what would stop.

A machine that refuses to stop stays up and is reported. A machine that does not stop in time stays up too. Use -f with -a or -r to kill those machines.

With -f, the command lists the machines it would kill and asks first. Use -y to kill without asking.

The command waits until the machine is gone. A machine that already exited counts as success. Use --no-wait to return once the request is accepted.

1
machine stop [-h] [-a] [-r] [-f] [-y] [--dry-run] [--no-wait] [run]
Argument Does
[run] Run name
Option Does
-a, --all Stop all running machines
-r, --recursive Stop branch and all descendants
-f, --force With -a or -r, kill a machine that refuses to stop or does not stop in time
-y, --yes With -f, kill without asking first
--dry-run List what would be stopped without stopping it
--no-wait Return without waiting

Examples:

1
2
3
4
5
6
7
machine stop run1               stop run1, wait until it is gone
machine stop run1 --no-wait return once the request is accepted
machine stop run1 -r stop run1 and every branch under it
machine stop run1 -r --dry-run list the machines of its tree
machine stop -a stop every running machine
machine stop -a --dry-run list what would stop
machine stop -afy stop all, kill any that do not stop

See also:

machine kill

Stop a machine, and end it if it does not stop. See Stopping and starting.

The machine is asked to stop and save, as stop does. It is ended if it does not stop.

The next start replays the tip of a machine that did not save. The command says when the machine did not save.

The command waits until the machine is gone. A machine already gone counts as success. Use --no-wait to return once the request is accepted.

1
machine kill [-h] [--no-wait] run
Argument Does
run Run name
Option Does
--no-wait Return without waiting

Examples:

1
2
machine kill run1            stop run1, end it if it hangs
machine kill run1 --no-wait return once the request is accepted

See also:

machine delete

Delete a run that is not running, with its log and checkpoints. See Stopping and starting.

Use -r to delete a branch with its descendants. Use --dry-run to list what would be deleted.

The first operand names the run to delete. Use -a to delete every run, or --disk to delete every run created from one disk. Use --cleanup -a to resume interrupted deletes.

The command waits until the run is gone. Use --stop to stop a running machine first. Use -f to also delete a run whose machine is gone. Use --no-wait to return once the request is accepted.

A delete is an operation. It goes on if the command is interrupted. Run machine ops to list it.

1
2
3
machine delete [-h] [-a] [--disk name|id] [-r] [-y] [--stop] [-f] [--cleanup] [--full-scan]
[--dry-run] [--no-wait]
[run]
Argument Does
[run] Run name
Option Does
-a, --all Delete all runs, or cleanup all interrupted deletes (with --cleanup)
--disk name|id Delete every run created from this disk
-r, --recursive Delete branch and all descendants
-y, --yes Skip the confirmation prompt
--stop Stop running machines before deleting
-f, --force Implies --stop, and deletes a run whose machine is already gone
--cleanup Resume interrupted delete operations
--full-scan With --cleanup, check every run, not only those recorded as interrupted
--dry-run List what would be deleted/recovered without acting
--no-wait Return once the delete of one run is accepted

Examples:

1
2
3
4
machine delete run1                    delete a stopped run
machine delete run1 -r --dry-run list what would go with it
machine delete run1 -r -f stop and delete a tree
machine delete --disk hello --dry-run list the runs on hello

Refuses, and the way past:

1
2
a run with branches    machine delete run1 -r
a run that is running machine delete run1 --stop

See also:

machine cleanup

Remove stale runs and their leftovers. See Stopping and starting.

A stale run is listed as running but has no machine. Use -f to kill machines that belong to no run, and to remove those runs from the list.

1
machine cleanup [-h] [-f]
Option Does
-f, --force Also kill machines that belong to no run, and remove runs whose machine is already gone

Examples:

1
2
machine cleanup     remove stale runs
machine cleanup -f also hard-kill orphaned machines

See also: