runner

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package runner decides pass/fail for `srig run` from streamed serial output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Evaluator

type Evaluator struct {
	// contains filtered or unexported fields
}

Evaluator matches serial lines against the sentinel and optional patterns.

func NewEvaluator

func NewEvaluator(expect, fail string) (*Evaluator, error)

NewEvaluator compiles the optional expect/fail regexes (empty string = unset).

func (*Evaluator) Feed

func (e *Evaluator) Feed(line string) (Outcome, bool)

Feed evaluates one line of serial output. It returns (outcome, true) when a terminal condition is reached; precedence is sentinel > fail > expect.

func (*Evaluator) Timeout

func (e *Evaluator) Timeout() Outcome

Timeout is the outcome when the watch window elapses with no terminal line: a fail if --expect was set (never matched), otherwise a clean pass.

type Outcome

type Outcome struct {
	ExitCode int
	Reason   string // "sentinel" | "fail" | "expect" | "timeout" | "ran"
	Matched  string
}

Outcome is the terminal result of a run.

type Result

type Result struct {
	Result    string `json:"result"` // "pass" | "fail"
	ExitCode  int    `json:"exit_code"`
	Reason    string `json:"reason"`
	Matched   string `json:"matched,omitempty"`
	SessionID string `json:"session_id"`
}

Result is the machine-readable form of an Outcome for --json.

func ResultFrom

func ResultFrom(o Outcome, sessionID string) Result

ResultFrom maps an Outcome (exit 0 = pass) to a Result.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL