Documentation
¶
Overview ¶
Package faultinject provides named checkpoints for self-update fault tests.
Release builds compile Point to an inlinable no-op. Builds tagged selfupdate_faults read DMG_FAULT=<checkpoint>[@user|@system]:<action>[,...] (merged with the link-time Baked value) and act at the matching checkpoint. Actions: kill (os.Exit(137), no cleanup), err (return ErrInjected), hang (block until killed), diskfull (return an error wrapping the OS disk-full errno), panic (a real Go panic, so recovery paths run), sleep<duration> (block that long, Go duration syntax up to 10m, then continue), exit<N> (os.Exit(N)). S6.mutex fires with the scan instance mutex held. With DMG_FAULT_TRACE=<file>, every reached checkpoint name is appended to file.
Checkpoint names may contain ':' (S4.downloaded:<asset>); the action is the text after the last ':'.
Index ¶
Constants ¶
const Enabled = false
Enabled reports whether fault injection is compiled in.
const MalformedExitCode = 64
MalformedExitCode is how a fault build exits on a malformed DMG_FAULT or Baked spec: distinct from every fault action and from a Go panic (2), so it can't pass for a crash.
const MalformedMarker = "faultinject: malformed spec:"
MalformedMarker starts the stderr line written before that exit; drivers fail the test when they see it.
const MaxSleep = 10 * time.Minute
MaxSleep bounds the sleep<duration> action.
Variables ¶
var ErrInjected = errors.New("faultinject: injected fault")
ErrInjected is wrapped by every error Point returns for an injected fault.
Functions ¶
Types ¶
This section is empty.