ir

package
v0.0.0-...-8023e94 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2021 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StringTooLong               = "STRING_TOO_LONG"
	StringNotUtf8               = "STRING_NOT_UTF8"
	NonEmptyStringWithNullBody  = "NON_EMPTY_STRING_WITH_NULL_BODY"
	StrictUnionFieldNotSet      = "STRICT_UNION_FIELD_NOT_SET"
	StrictUnionUnknownField     = "STRICT_UNION_UNKNOWN_FIELD"
	StrictBitsUnknownBit        = "STRICT_BITS_UNKNOWN_BIT"
	StrictEnumUnknownValue      = "STRICT_ENUM_UNKNOWN_VALUE"
	ExceededMaxOutOfLineDepth   = "EXCEEDED_MAX_OUT_OF_LINE_DEPTH"
	InvalidNumBytesInEnvelope   = "INVALID_NUM_BYTES_IN_ENVELOPE"
	InvalidNumHandlesInEnvelope = "INVALID_NUM_HANDLES_IN_ENVELOPE"
	InvalidPaddingByte          = "INVALID_PADDING_BYTE"
	ExtraHandles                = "EXTRA_HANDLES"
	TooFewHandles               = "TOO_FEW_HANDLES"
	NonResourceUnknownHandles   = "NON_RESOURCE_UNKNOWN_HANDLES"
	MissingRequiredHandleRights = "MISSING_REQUIRED_HANDLE_RIGHTS"
	IncorrectHandleType         = "INCORRECT_HANDLE_TYPE"
)

TODO(fxbug.dev/34770) Organize error codes by encoding / decoding. Potentially do a check in the parser that the code is the right type.

Variables

Functions

func ContainsUnknownField

func ContainsUnknownField(value Value) bool

ContainsUnknownField returns if the value or any subvalue contains an unknown field. Intended to allow bindings that don't support unknown fields to skip test cases that contain them.

func HandleRightsByName

func HandleRightsByName(rightsName string) (fidl.HandleRights, bool)

func HandleSubtypeByName

func HandleSubtypeByName(s string) (fidl.HandleSubtype, bool)

func TypeFromValue

func TypeFromValue(value Value) string

func ValidateAllType

func ValidateAllType(input All, generatorType string)

Types

type All

type All struct {
	EncodeSuccess []EncodeSuccess
	DecodeSuccess []DecodeSuccess
	EncodeFailure []EncodeFailure
	DecodeFailure []DecodeFailure
	Benchmark     []Benchmark
}

func FilterByBinding

func FilterByBinding(input All, binding string) All

func Merge

func Merge(input []All) All

type Benchmark

type Benchmark struct {
	Name                     string
	Value                    interface{}
	HandleDefs               []HandleDef
	BindingsAllowlist        *LanguageList
	BindingsDenylist         *LanguageList
	EnableSendEventBenchmark bool
	EnableEchoCallBenchmark  bool
}

type DecodeFailure

type DecodeFailure struct {
	Name              string
	Type              string
	Encodings         []Encoding
	HandleDefs        []HandleDef
	Err               ErrorCode
	BindingsAllowlist *LanguageList
	BindingsDenylist  *LanguageList
}

type DecodeSuccess

type DecodeSuccess struct {
	Name              string
	Value             interface{}
	Encodings         []Encoding
	HandleDefs        []HandleDef
	BindingsAllowlist *LanguageList
	BindingsDenylist  *LanguageList
}

type EncodeFailure

type EncodeFailure struct {
	Name              string
	Value             interface{}
	HandleDefs        []HandleDef
	WireFormats       []WireFormat
	Err               ErrorCode
	BindingsAllowlist *LanguageList
	BindingsDenylist  *LanguageList
}

type EncodeSuccess

type EncodeSuccess struct {
	Name              string
	Value             interface{}
	Encodings         []HandleDispositionEncoding
	HandleDefs        []HandleDef
	BindingsAllowlist *LanguageList
	BindingsDenylist  *LanguageList
	// CheckHandleRights is true for standalone "encode_success" tests providing
	// "handle_dispositions", but false for bidirectional "success" tests
	// because they provide only "handles" with no rights information.
	CheckHandleRights bool
}

type Encoding

type Encoding struct {
	WireFormat WireFormat
	Bytes      []byte
	Handles    []Handle
}

type ErrorCode

type ErrorCode string

type Field

type Field struct {
	Key   FieldKey
	Value Value
}

Field represents a field in a struct, table, or union value.

type FieldKey

type FieldKey struct {
	Name           string
	UnknownOrdinal uint64
}

FieldKey designates a field in a struct, table, or union type. The key is either known (represented by name) or unknown (represented by ordinal).

Only flexible tables and flexible unions can have unknown keys. Although known table/union fields (strict or flexible) have both a name and ordinal, FieldKey only stores the name.

func (*FieldKey) IsKnown

func (f *FieldKey) IsKnown() bool

IsKnown returns true if f is a known (i.e. named) key.

func (*FieldKey) IsUnknown

func (f *FieldKey) IsUnknown() bool

IsUnknown returns true if f is an unknown (i.e. ordinal) key.

type Handle

type Handle int

A Handle is an index into the test's []HandleDef.

func GetHandlesFromHandleDispositions

func GetHandlesFromHandleDispositions(handleDispositions []HandleDisposition) []Handle

func GetUnusedHandles

func GetUnusedHandles(value Value, handles []Handle) []Handle

GetUnusedHandles returns the list of handles from the input slice that do not appear in the provided Value

type HandleDef

type HandleDef struct {
	Subtype fidl.HandleSubtype
	Rights  fidl.HandleRights
}

type HandleDisposition

type HandleDisposition struct {
	Handle Handle
	Type   fidl.ObjectType
	Rights fidl.HandleRights
}

type HandleDispositionEncoding

type HandleDispositionEncoding struct {
	WireFormat         WireFormat
	Bytes              []byte
	HandleDispositions []HandleDisposition
}

type HandleWithRights

type HandleWithRights struct {
	Handle Handle
	Type   fidl.ObjectType
	Rights fidl.HandleRights
}

A HandleWithRights is a Handle with rights information.

type LanguageList

type LanguageList []string

func (LanguageList) Includes

func (list LanguageList) Includes(targetLanguage string) bool

type RawFloat

type RawFloat uint64

A RawFloat is an integer whose bytes specify an IEEE 754 single or double precision floating point number (sign bit = most significant bit). In the single-precision case, the value should be within uint32 range.

type Record

type Record struct {
	// Unqualified type name.
	Name string
	// List of fields. Struct and table records can have any number of fields.
	// Union records should have exactly one field.
	Fields []Field
}

Record represents a value for a struct, table, or union type.

type UnknownData

type UnknownData struct {
	Bytes   []byte
	Handles []Handle
}

UnknownData represents the raw payload of an envelope, e.g. the data corresponding to an unknown variant of a union

type Value

type Value interface{}

Value represents any acceptable value used to represent a FIDL value. This type may wrap one of: - `string` for strings - `int64` for negative integers (of any size), bits, and enums - `uint64` for nonnegative integers (of any size), bits, and enums - `float64` or `RawFloat` for floating point numbers (of any size) - `bool` for booleans - `Handle` for handles - `Record` for structs, tables, and unions - `[]interface{}` for slices of values - `nil` for null values (only allowed for nullable types) - `UnknownData` for unknown variants of unions

type WireFormat

type WireFormat string
const (
	V1WireFormat WireFormat = "v1"
)

func (WireFormat) String

func (wf WireFormat) String() string

type WireFormatList

type WireFormatList []WireFormat

func (WireFormatList) Includes

func (list WireFormatList) Includes(wireFormat WireFormat) bool

func (WireFormatList) Join

func (list WireFormatList) Join(sep string) string

Jump to

Keyboard shortcuts

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