Help us shape the future of Go! Take the 2026 Go Developer Survey

tracingtest

package
v0.1.61 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package tracingtest runs trace plugins in specs: a runtime over a real sqlite results store and session registry, and helpers that read a session's rows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ended

func Ended(session *query.Session) query.SessionInfo

Ended waits for session to end and returns its final record.

func GoChildBinary

func GoChildBinary(dir string) string

GoChildBinary builds the Go child the process kinds' specs observe (testdata/gochild) into dir, returning its path; a suite builds it once.

func Running

func Running(session *query.Session)

Running waits for session to run.

func Summary

func Summary(info query.SessionInfo) tracing.Summary

Summary decodes what the session's capture reported emitting.

Types

type Env

type Env struct {
	// Dir holds every file the results store writes.
	Dir      string
	Results  *recordresults.Results
	Sessions *query.SessionRegistry
	Runtime  *tracing.Runtime
}

Env is a runtime serving kinds over a sqlite results store in the spec's own temporary directory, whose sessions all stop when the spec ends.

func NewEnv

func NewEnv(kinds map[string]tracing.TracePlugin, configure ...func(*tracing.Runtime)) Env

NewEnv serves kinds, committing every 20ms unless configure says otherwise.

func (Env) Read

func (e Env) Read(kind, stream string, page query.PageRequest, params map[string]any) []query.Row

Read reads every row of stream through kind's result profile under params, as a host serving it would: the profile's own columns, filters and sort.

func (Env) Rows

func (e Env) Rows(info query.SessionInfo) []recordstore.Row

Rows reads every row the session committed.

func (Env) Sealed

func (e Env) Sealed(info query.SessionInfo) bool

Sealed reports whether the session's stream is sealed.

func (Env) Start

func (e Env) Start(kind, params string) *query.Session

Start starts a capture of kind with params, which the kind must accept.

type GoChild

type GoChild struct {
	Cmd       *exec.Cmd
	PID       int
	Announced map[string]string
	Stdin     io.WriteCloser
	// Stderr is what the child wrote to stderr, to read once it exited.
	Stderr *bytes.Buffer
	// contains filtered or unexported fields
}

GoChild is a running Go child: what it announced, by name, and its stdin.

func StartGoChild

func StartGoChild(binary string, args ...string) *GoChild

StartGoChild runs binary with args in its own process group, which the spec kills when it ends, and waits for it to announce it is ready.

func (*GoChild) Await

func (c *GoChild) Await(name string) string

Await waits for the child to announce name, and returns its value.

func (*GoChild) Exited

func (c *GoChild) Exited() <-chan struct{}

Exited is closed once the child exited, and its Stderr is whole.

Jump to

Keyboard shortcuts

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