Juggernaut.Schemata (Juggernaut v0.4.0)

Copy Markdown View Source

Metamutant schemata (design notes §10.3, §10.4): every mutant of a run compiled once, each turned on by its switch (Juggernaut.Peer.Switch).

build/3 renders one metamutant per file with mutants (Juggernaut.Schemata.Unit), syncs the sandbox with them (Juggernaut.Sandbox), compiles it (Juggernaut.Schemata.Compile) and, while the compile fails in mutants, takes the poisoned ones out (Juggernaut.Schemata.Poison) and compiles again. Files without mutants are mirrored as written. Switch 0 runs every file as written.

The result lists the switched mutants, the mutants that cannot run (status compile_error, with the reason), each site's switches (keyed by the first, the number a probe hit records) and the compiles it took.

Summary

Functions

Builds and compiles the metamutants of inputs in the sandbox of the project at root. Options: :sandbox, :paths (as Juggernaut.Sandbox.sync/2), :deps_path (the project's dependencies, default <root>/deps, mirrored once per build into Juggernaut.Sandbox.deps_dir/1, which the compile uses, so the project's own are only read), :rounds (poison rounds per file, default 5), :bisect (compiles per file when a file's poison is bisected, default 32) and :compile (a Compile.run/2-shaped function, for tests; by default the build's compiles share one compile server, Juggernaut.Schemata.Compile.open/2). Unknown options raise.

The rendered units of inputs: each file gets a block of switches, in input order, starting at 1. Files are classified and rendered a scheduler each at once; only the blocks are assigned in order.

Types

input()

@type input() :: %{
  file: String.t(),
  source: String.t(),
  mutants: [Juggernaut.Mutant.t()]
}

result()

@type result() :: %{
  mutants: [Juggernaut.Mutant.t()],
  excluded: [
    %{mutant: Juggernaut.Mutant.t(), status: :compile_error, reason: String.t()}
  ],
  sites: %{required(pos_integer()) => [pos_integer()]},
  files: [String.t()],
  compiles: [
    %{
      status: atom(),
      ms: non_neg_integer(),
      verification?: boolean(),
      output: String.t()
    }
  ],
  written: [String.t()]
}

Functions

build(root, inputs, opts \\ [])

@spec build(Path.t(), [input()], keyword()) ::
  {:ok, result()} | {:error, Juggernaut.Error.t()}

Builds and compiles the metamutants of inputs in the sandbox of the project at root. Options: :sandbox, :paths (as Juggernaut.Sandbox.sync/2), :deps_path (the project's dependencies, default <root>/deps, mirrored once per build into Juggernaut.Sandbox.deps_dir/1, which the compile uses, so the project's own are only read), :rounds (poison rounds per file, default 5), :bisect (compiles per file when a file's poison is bisected, default 32) and :compile (a Compile.run/2-shaped function, for tests; by default the build's compiles share one compile server, Juggernaut.Schemata.Compile.open/2). Unknown options raise.

units(inputs)

@spec units([input()]) :: [Juggernaut.Schemata.Unit.t()]

The rendered units of inputs: each file gets a block of switches, in input order, starting at 1. Files are classified and rendered a scheduler each at once; only the blocks are assigned in order.