Imports #
"bufio"
"bytes"
"fmt"
"regexp"
"strconv"
"strings"
"bytes"
"fmt"
"internal/trace/raw"
"internal/txtar"
"io"
"errors"
"fmt"
"internal/trace"
"slices"
"strings"
"bufio"
"bytes"
"fmt"
"regexp"
"strconv"
"strings"
"bytes"
"fmt"
"internal/trace/raw"
"internal/txtar"
"io"
"errors"
"fmt"
"internal/trace"
"slices"
"strings"
Expectation represents the expected result of some operation.
type Expectation struct {
failure bool
errorMatcher *regexp.Regexp
}
Validator is a type used for validating a stream of trace.Events.
type Validator struct {
lastTs trace.Time
gs map[trace.GoID]*goState
ps map[trace.ProcID]*procState
ms map[trace.ThreadID]*schedContext
ranges map[trace.ResourceID][]string
tasks map[trace.TaskID]string
seenSync bool
Go121 bool
}
type errAccumulator struct {
errs []error
}
type goState struct {
state trace.GoState
binding *schedContext
}
type procState struct {
state trace.ProcState
binding *schedContext
}
type schedContext struct {
M trace.ThreadID
P trace.ProcID
G trace.GoID
}
Check validates whether err conforms to the expectation. Returns an error if it does not conform. Conformance means that if failure is true, then err must be non-nil. If err is non-nil, then it must match errorMatcher.
func (e *Expectation) Check(err error) error
func (e *errAccumulator) Errorf(f string, args ...any)
func (e *errAccumulator) Errors() error
Event validates ev as the next event in a stream of trace.Events. Returns an error if validation fails.
func (v *Validator) Event(ev trace.Event) error
ExpectSuccess returns an Expectation that trivially expects success.
func ExpectSuccess() *Expectation
NewValidator creates a new Validator.
func NewValidator() *Validator
ParseExpectation parses the serialized form of an Expectation.
func ParseExpectation(data []byte) (*Expectation, error)
ParseFile parses a test file generated by the testgen package.
func ParseFile(testPath string) (io.Reader, *Expectation, error)
func (v *Validator) addRange(r trace.ResourceID, name string)
func checkStack(e *errAccumulator, stk trace.Stack)
func (v *Validator) deleteRange(r trace.ResourceID, name string)
func (v *Validator) getOrCreateThread(e *errAccumulator, ev trace.Event, m trace.ThreadID) *schedContext
func (v *Validator) hasAnyRange(r trace.ResourceID) bool
func (v *Validator) hasRange(r trace.ResourceID, name string) bool
func parseMatcher(quoted string) (*regexp.Regexp, error)
Generated with Arrow