package test

import "gvisor.dev/gvisor/tools/go_marshal/test"

Package test contains data structures for testing the go_marshal tool.

Index

Types

type InetAddr

type InetAddr [4]byte

InetAddr is an example marshallable newtype on an array.

+marshal boundCheck

type SignalSet

type SignalSet uint64

SignalSet is an example marshallable newtype on a primitive.

+marshal slice:SignalSetSlice:inner boundCheck

type SignalSetAlias

type SignalSetAlias SignalSet

SignalSetAlias is an example newtype on another marshallable type.

+marshal slice:SignalSetAliasSlice

type Stat

type Stat struct {
	Dev   uint64
	Ino   uint64
	Nlink uint64
	Mode  uint32
	UID   uint32
	GID   uint32

	Rdev    uint64
	Size    int64
	Blksize int64
	Blocks  int64
	ATime   Timespec
	MTime   Timespec
	CTime   Timespec
	// contains filtered or unexported fields
}

Stat represents struct stat.

+marshal slice:StatSlice

type TestArray

type TestArray [sizeA]int32

TestArray is a test data structure on an array with a constant length.

+marshal

type TestArray2

type TestArray2 [sizeA * sizeB]int32

TestArray2 is a newtype on an array with a simple arithmetic expression of constants for the array length.

+marshal

type TestArray3

type TestArray3 [sizeA*sizeB + 12]int32

TestArray3 is a newtype on an array with a simple arithmetic expression of mixed constants and literals for the array length.

+marshal

type Timespec

type Timespec struct {
	Sec  int64
	Nsec int64
}

Timespec represents struct timespec in <time.h>.

+marshal

type Type1

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

Type1 is a test data type.

+marshal slice:Type1Slice

type Type10

type Type10 struct {
	Type10Embed
	// contains filtered or unexported fields
}

Type10 is a test data type which contains an embedded struct.

+marshal

type Type10Embed

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

Type10Embed is a test data type which is be embedded into another type.

+marshal

type Type11

type Type11 struct {
	ex.External
	// contains filtered or unexported fields
}

Type11 is a test data type which contains an embedded struct from an external package.

+marshal

type Type12Dynamic

type Type12Dynamic struct {
	X primitive.Int64
	Y []primitive.Int64
}

Type12Dynamic is a dynamically sized struct which depends on the autogenerator to generate some Marshallable methods for it.

+marshal dynamic

func (*Type12Dynamic) MarshalBytes

func (t *Type12Dynamic) MarshalBytes(dst []byte) []byte

MarshalBytes implements marshal.Marshallable.MarshalBytes.

func (*Type12Dynamic) SizeBytes

func (t *Type12Dynamic) SizeBytes() int

SizeBytes implements marshal.Marshallable.SizeBytes.

func (*Type12Dynamic) UnmarshalBytes

func (t *Type12Dynamic) UnmarshalBytes(src []byte) []byte

UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.

type Type13Dynamic

type Type13Dynamic string

Type13Dynamic is a dynamically sized struct which depends on the autogenerator to generate some Marshallable methods for it.

It represents a string in memory which is preceded by a uint32 indicating the string size.

+marshal dynamic

func (*Type13Dynamic) MarshalBytes

func (t *Type13Dynamic) MarshalBytes(dst []byte) []byte

MarshalBytes implements marshal.Marshallable.MarshalBytes.

func (*Type13Dynamic) SizeBytes

func (t *Type13Dynamic) SizeBytes() int

SizeBytes implements marshal.Marshallable.SizeBytes.

func (*Type13Dynamic) UnmarshalBytes

func (t *Type13Dynamic) UnmarshalBytes(src []byte) []byte

UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.

type Type2

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

Type2 is a test data type.

+marshal boundCheck

type Type3

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

Type3 is a test data type.

+marshal

type Type4

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

Type4 is a test data type.

+marshal

type Type5

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

Type5 is a test data type.

+marshal

type Type6

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

Type6 is a test data type ends mid-word.

+marshal

type Type7

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

Type7 is a test data type that contains a child struct that ends mid-word. +marshal

type Type8

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

Type8 is a test data type which contains an external non-packed field.

+marshal slice:Type8Slice

type Type9

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

Type9 is a test data type containing an array with a non-literal length.

+marshal

Source Files

dynamic.go test.go

Directories

PathSynopsis
tools/go_marshal/test/escapePackage escape contains test cases for escape analysis.
tools/go_marshal/test/externalPackage external defines types we can import for testing.
Version
v0.0.0-20250605235530-a6711d1e1dc6 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
2 packages
Last checked
4 hours ago

Tools for package owners.