Skip to main content

Module gate

Module gate 

Source
Expand description

Running an SDD’s own commands — the §5 Commands and Verification-table rows — through sh -c: the one sanctioned shell use, and the one place it happens.

Every command gets a TMPDIR of its own for as long as it runs, so concurrent test sessions (the gate’s own rows, and workers building in parallel) never share a temp root. The directories are slots, not throwaways: a slot is exclusive while in use and stays where it is afterwards, to be taken by the next command — so a build daemon a command leaves behind keeps a temp directory that exists, and toolchains that tie a daemon to its temp directory see the same few directories every time. Under vitrify run each command also runs in its own process group and is stopped when the run is interrupted, and holds a token of the run’s gate pool while it runs (install_pool): one bound on the commands of every gate, re-check and preflight in the process.

Structs§

MemoRunner
A runner that already knows the exit codes of the commands it will be asked for: every Verified unit’s Verification rows, each distinct command run once, jobs at a time. The audit then reads the results.
Ran
One finished command.
ShRunner
The audit’s command runner (check 4): plain sh -c, one at a time.
TmpSlot
A temp directory held by one command or one worker. Exclusive while this value lives; the directory itself is left in place for the next holder.
Unwatched
A watcher that does nothing, for callers no one is watching.

Traits§

Watch
Told as each command starts and ends: how the integrator reports its progress while a gate that prints nothing is passing.

Functions§

alive
Whether a process (pid) — or, with group, any member of the process group it leads — still exists.
at_priority
Run f with this thread’s commands waiting for a gate token at priority (higher is served first); the previous priority is restored however f ends. Rows run side by side inherit it.
install_pool
Make size tokens the bound on every command this process runs from here on, and return the pool. The first call decides; a later one gets the pool already installed. Without one (every verb but run), /// commands run unbounded, as their callers schedule them.
kill_group
SIGKILL a whole process group.
priority
The priority this thread’s commands wait for a gate token at.
run_command
Run one command via sh -c in cwd, with a TMPDIR of its own.
run_command_watched
Run one command, telling w as it starts and ends.
run_rows
Run cmds in cwd, at most jobs at once; results are index-aligned.
run_rows_watched
run_rows, telling w as each command starts and ends — the parallel pass and each re-run that confirms a failure alone.
slots_root
Where the temp slots of scope live: a private directory under the system temp root, named by a hash of the user and the scope (kept short — tools put sockets under TMPDIR, and socket paths are length-limited).
tmp_slot
Take the first free slot of kind for scope (the checkout commands run in, or the root workers build under): the same few directories are handed out again and again, never two holders at once — across processes too, since a slot is held by a file lock.
unit_text
The text of a unit’s entry: its unit file (bundle) or its ### U-### region (single).
verification_table
The commands of a unit’s Verification table, in table order.
verified_commands
Every Verified unit’s Verification rows, each distinct command once, in unit and table order: what MemoRunner::for_verified runs, so a caller can count them first.