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

Branches

Command Does
machine checkpoint Create a checkpoint of the machine’s state
machine fork Fork a branch and start it alongside the parent
machine go Branch at a point and switch onto it
machine switch Switch a running machine onto a branch that exists
machine rewind Put a run back at a point and discard what follows
machine detach Detach a new root from a run and start it

machine checkpoint

Create a checkpoint of the machine’s state. See Checkpoints.

A checkpoint is a point to return to, written ^name. It saves the machine state. Fork, go and rewind return to it.

The machine also checkpoints on its own, at the interval that create sets.

1
machine checkpoint [-h] run [name]
Argument Does
run Run name
[name] Checkpoint name (auto-generated if omitted)

Examples:

1
2
machine checkpoint run1      checkpoint run1 under a generated name
machine checkpoint run1 cp1 checkpoint run1 as cp1

See also:

machine fork

Fork a branch and start it alongside the parent. See Starting a branch.

A branch shares the history of its parent up to the fork point. Then it runs on its own path. Use --rebase to copy the data of the ancestors instead of sharing it. Use --no-start to create the branch without starting it.

The parent keeps running. The terminal stays attached to the parent.

The branch forks at the current point and reuses a checkpoint there if one exists. Use --at to fork at another point.

The branch keeps the execution options of the parent. Options given here replace them for the branch.

The new run keeps and drops the output that the run it comes from does. Use --keep-output to replace the names it keeps. Use --drop-output to replace the names it drops. Each option changes its own list only.

Use --from to replay the new run from an earlier point to its point. The new run stores the output of that stretch by its own names. It is forked at the checkpoint at or before the earlier point.

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 branch accepts commands. Use --no-wait to return once the request is accepted.

1
2
3
4
5
6
7
8
9
10
11
machine fork [-h] [--at point [point ...]] [--from point [point ...]] [--name name]
[--rebase] [--depth n] [--lean] [--no-start] [--side-dump | --no-side-dump]
[--side-trace | --no-side-trace] [--mem-hash | --no-mem-hash]
[--repeatable | --no-repeatable] [--limit-margin n] [--timer-slack duration]
[--instr-margin n] [--dispatch-bound duration] [--fast-backstop n]
[--irq-wait n] [--disk-hash | --no-disk-hash] [--rng-seed n]
[--decisions | --no-decisions] [--events | --no-events] [--keep-output name]
[--drop-output name] [--no-wait] [--daemon | --no-daemon]
[--single-step | --no-single-step] [--limit n] [--backstop-limit n]
[--pin-cpu n]
run
Argument Does
run Run to fork from
Option Does
--at point [point ...] Point the new run is at: ^checkpoint, #entry, -N for N entries back, a time such as 10ms or -10ms, console~regex, console:N where line N was printed, now, parent [n], root, or %mark
--from point [point ...] Earlier point to replay the new run from: ^checkpoint, #entry, -N for N entries back, a time such as 10ms or -10ms, console~regex, console:N where line N was printed, parent [n], root, or %mark. The new run starts at the checkpoint at or before it
--name name Name for the new run (default: a name made from where it starts)
--rebase Copy the ancestors’ data into the new branch instead of sharing it
--depth n With --rebase, how many root-side ancestors to keep (default 1: the root)
--lean With --rebase, keep no history shared with the ancestors, so they can be deleted
--no-start Create the new run without starting it
--side-dump, --no-side-dump Record a per-entry debug dump, whatever the run it comes from records
--side-trace, --no-side-trace Record the hypervisor’s trace of each entry, for diagnosis, whatever the run it comes from records
--mem-hash, --no-mem-hash Hash guest memory at every entry, whatever the run it comes from records
--repeatable, --no-repeatable Stop fast exactly at the limit, so recording again gives the same entries, whatever the run it comes from does
--limit-margin n Conditional branches short of a stop where the CPU’s counter interrupts (default: the run’s)
--timer-slack duration How late a timer may be in code that takes no exit, 0 for none (default: the run’s)
--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 run’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: the run’s)
--fast-backstop n Instructions a fast dispatch may run with no other stop, 0 for 100000000 (default: the run’s)
--irq-wait n Conditional branches a dispatch runs while an interrupt waits for the guest to take it, 0 for 200 (default: the run’s)
--disk-hash, --no-disk-hash Hash the guest’s disk at every entry, whatever the run it comes from records
--rng-seed n Seed the new run’s RNG device from n once it is up, and its decisions’ default stream where the run records decisions
--decisions, --no-decisions Record the program’s decisions; --no-decisions answers them by the default stream and records none
--events, --no-events Write the program’s events; --no-events writes none, and the call returns inside the guest
--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)
--no-wait Return without waiting
--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)

Examples:

1
2
3
4
5
6
7
8
9
10
machine fork run1                         fork here and start the branch
machine fork run1 --name probe name the branch probe
machine fork run1 --at ^cp1 fork at checkpoint cp1
machine fork run1 --at -10ms fork 10 ms before now
machine fork run1 --at '#120' --no-start create the branch, do not start it
machine fork run1 --keep-output /output store what is dropped
machine fork run1 --drop-output ttyS1 store none of ttyS1
machine fork run1 --from ^cp1 replay the branch from cp1 to now
machine fork run1 --at ^cp1 --rng-seed 7 a branch seeded from 7
machine fork run1 --no-repeatable a branch without exact stops

See also:

machine go

Branch at a point and switch onto it. See Switching the machine.

Go starts another path from a point. The branch shares the history of the run up to the point.

The machine moves onto the branch. The run it leaves is listed as switched. A switched run keeps its history and has no machine.

Go is the only command that branches and switches in one step. The point operand lists the forms a point takes. Each names a point on the own line of this run.

console~REGEX is where the console first printed a match. It is the entry that printed the first byte of the match. The name of another source takes the place of console, as in ttyS1~REGEX.

A time such as 10ms counts from the start of the run. A minus sign, as in -10ms, counts back from now. A time may carry +N, as machine now prints it, to name one entry among several at that time.

A minus sign before a number with no unit counts entries back from now. The point -10 is #-10, 10 entries before now.

Go reaches a point that is not a checkpoint by branching at the nearest checkpoint at or before it. It then replays the difference.

Every use creates a branch, also for a point gone to before. What runs from a point is a path of its own. Use switch to return to a branch that exists. Use rewind to put this run back at a point.

The new run keeps and drops the output that the run it comes from does. Use --keep-output to replace the names it keeps. Use --drop-output to replace the names it drops. Each option changes its own list only.

Use --from to replay the new run from an earlier point to its point. The new run stores the output of that stretch by its own names. It is forked at the checkpoint at or before the earlier point.

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.

1
machine go [options] <run> <point>
Argument Does
run The running machine that moves
[point ...] Where to branch: ^checkpoint, #entry, -N for N entries back, a time such as 10ms or -10ms, console~regex, console:N where line N was printed, now, parent [n], root, or %mark
Option Does
--from point [point ...] Earlier point to replay the new run from: ^checkpoint, #entry, -N for N entries back, a time such as 10ms or -10ms, console~regex, console:N where line N was printed, parent [n], root, or %mark. The new run starts at the checkpoint at or before it
--name name Name for the new run (default: a name made from where it starts)
--rebase Copy the ancestors’ data into the new branch instead of sharing it
--depth n With --rebase, how many root-side ancestors to keep (default 1: the root)
--lean With --rebase, keep no history shared with the ancestors, so they can be deleted
--side-dump, --no-side-dump Record a per-entry debug dump, whatever the run it comes from records
--side-trace, --no-side-trace Record the hypervisor’s trace of each entry, for diagnosis, whatever the run it comes from records
--mem-hash, --no-mem-hash Hash guest memory at every entry, whatever the run it comes from records
--repeatable, --no-repeatable Stop fast exactly at the limit, so recording again gives the same entries, whatever the run it comes from does
--limit-margin n Conditional branches short of a stop where the CPU’s counter interrupts (default: the run’s)
--timer-slack duration How late a timer may be in code that takes no exit, 0 for none (default: the run’s)
--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 run’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: the run’s)
--fast-backstop n Instructions a fast dispatch may run with no other stop, 0 for 100000000 (default: the run’s)
--irq-wait n Conditional branches a dispatch runs while an interrupt waits for the guest to take it, 0 for 200 (default: the run’s)
--disk-hash, --no-disk-hash Hash the guest’s disk at every entry, whatever the run it comes from records
--rng-seed n Seed the new run’s RNG device from n once it is up, and its decisions’ default stream where the run records decisions
--decisions, --no-decisions Record the program’s decisions; --no-decisions answers them by the default stream and records none
--events, --no-events Write the program’s events; --no-events writes none, and the call returns inside the guest
--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)
--no-wait Return without waiting

Examples:

1
2
3
4
5
6
7
machine go run1 ^cp1                 branch at checkpoint cp1 and switch
machine go run1 '#120' --name probe branch at entry 120 as probe
machine go run1 parent branch where run1 left its parent
machine go run1 -10ms branch 10 ms before now
machine go run1 -10 branch 10 entries before now
machine go run1 console:120 branch where line 120 was printed
machine go run1 now --from ^cp1 replay the branch from cp1

Prints:

1
2
3
result           Branched <parent>/<name> (<id>) at entry <n>
<parent>/<name> how a branch is listed, under the run it left
every command takes the name alone

See also:

machine switch

Switch a running machine onto a branch that exists. See Switching the machine.

The first operand names the run that switches, as with fork and detach. The second names where it goes: a branch, a mark written %mark, parent or root. Switch never creates a branch.

The run that the machine leaves is listed as switched. A switched run keeps its history and has no machine.

Go forks a branch and switches onto it. Fork forks a branch without switching.

1
machine switch [-h] [--no-wait] run [branch ...]
Argument Does
run The running machine that switches
[branch ...] Branch to switch onto: a name, a mark written %mark, parent [n], or root
Option Does
--no-wait Return without waiting

Examples:

1
2
3
machine switch run1 try2    switch run1's machine onto try2
machine switch run1 parent switch it onto the parent branch
machine switch run1 %good switch it onto the branch the mark names

See also:

machine rewind

Put a run back at a point and discard what follows. See Switching the machine.

The run keeps its id and its name. The entries, checkpoints and console output after the point are discarded.

The point is required. It is any entry from #1 to the tip. Write an entry id after #, a checkpoint name after ^, or a machine time. The run lands on it exactly.

The point becomes a checkpoint. Rewinding to the tip changes nothing unless a replay diverged there. A point before the run was forked puts the run back along the line it was forked from. A run with a branch forked after the point is refused.

1
machine rewind <run> to <point>
Argument Does
run The machine that rewinds
[point ...] Point to go back to, from #1 to the tip: ^checkpoint, #entry, -N for N entries back, a time such as 10ms or -10ms, console~regex, console:N where line N was printed, now, parent [n], root, or %mark

Examples:

1
2
machine rewind run1 to ^cp1    put run1 back at checkpoint cp1
machine rewind run1 to '#120' put run1 back at entry 120

Refuses, and the way past:

1
a branch forked after the point  machine delete try2

See also:

machine detach

Detach a new root from a run and start it. See Switching the machine.

Without --at, the root is detached at the current point. The copy includes everything the root still owns. It shares nothing with the origin tree. It is slower than fork --rebase.

The new root is named for the run it copied and the point. A second copy of the same point gets a suffix.

The new root keeps the execution options of the run it copied. Options given here replace them for the root.

The new run keeps and drops the output that the run it comes from does. Use --keep-output to replace the names it keeps. Use --drop-output to replace the names it drops. Each option changes its own list only.

Use --from to replay the new run from an earlier point to its point. The new run stores the output of that stretch by its own names. It is forked at the checkpoint at or before the earlier point.

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.

1
2
3
4
5
6
7
8
9
10
machine detach [-h] [--at point [point ...]] [--from point [point ...]] [--name name]
[--no-start] [--side-dump | --no-side-dump] [--side-trace | --no-side-trace]
[--mem-hash | --no-mem-hash] [--repeatable | --no-repeatable]
[--limit-margin n] [--timer-slack duration] [--instr-margin n]
[--dispatch-bound duration] [--fast-backstop n] [--irq-wait n]
[--disk-hash | --no-disk-hash] [--rng-seed n] [--decisions | --no-decisions]
[--events | --no-events] [--keep-output name] [--drop-output name]
[--no-wait] [--daemon | --no-daemon] [--single-step | --no-single-step]
[--limit n] [--backstop-limit n] [--pin-cpu n]
run
Argument Does
run Run to detach from
Option Does
--at point [point ...] Point the new run is at: ^checkpoint, #entry, -N for N entries back, a time such as 10ms or -10ms, console~regex, console:N where line N was printed, now, parent [n], root, or %mark
--from point [point ...] Earlier point to replay the new run from: ^checkpoint, #entry, -N for N entries back, a time such as 10ms or -10ms, console~regex, console:N where line N was printed, parent [n], root, or %mark. The new run starts at the checkpoint at or before it
--name name Name for the new run (default: a name made from where it starts)
--no-start Create the new run without starting it
--side-dump, --no-side-dump Record a per-entry debug dump, whatever the run it comes from records
--side-trace, --no-side-trace Record the hypervisor’s trace of each entry, for diagnosis, whatever the run it comes from records
--mem-hash, --no-mem-hash Hash guest memory at every entry, whatever the run it comes from records
--repeatable, --no-repeatable Stop fast exactly at the limit, so recording again gives the same entries, whatever the run it comes from does
--limit-margin n Conditional branches short of a stop where the CPU’s counter interrupts (default: the run’s)
--timer-slack duration How late a timer may be in code that takes no exit, 0 for none (default: the run’s)
--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 run’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: the run’s)
--fast-backstop n Instructions a fast dispatch may run with no other stop, 0 for 100000000 (default: the run’s)
--irq-wait n Conditional branches a dispatch runs while an interrupt waits for the guest to take it, 0 for 200 (default: the run’s)
--disk-hash, --no-disk-hash Hash the guest’s disk at every entry, whatever the run it comes from records
--rng-seed n Seed the new run’s RNG device from n once it is up, and its decisions’ default stream where the run records decisions
--decisions, --no-decisions Record the program’s decisions; --no-decisions answers them by the default stream and records none
--events, --no-events Write the program’s events; --no-events writes none, and the call returns inside the guest
--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)
--no-wait Return without waiting
--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)

Examples:

1
2
3
machine detach run1 --at ^cp1                 copy run1 at cp1 to a new root
machine detach run1 --at '#120' --name copy1 name the new root copy1
machine detach run1 --from ^cp1 replay the root from cp1

See also: