testutil

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindNextThread added in v1.9.2

func FindNextThread(state *multithreaded.State) *multithreaded.ThreadState

FindNextThread Finds the next thread in line according to thread traversal logic

func FindNextThreadExcluding added in v1.9.2

func FindNextThreadExcluding(state *multithreaded.State, threadId arch.Word) *multithreaded.ThreadState

func FindNextThreadFiltered added in v1.9.2

func FindNextThreadFiltered(state *multithreaded.State, filter ThreadFilter) *multithreaded.ThreadState

func FindThread added in v1.9.2

func FindThread(state *multithreaded.State, threadId arch.Word) *multithreaded.ThreadState

func GetAllThreads added in v1.9.2

func GetAllThreads(state *multithreaded.State) []*multithreaded.ThreadState

func GetMtState added in v1.9.2

func GetMtState(t require.TestingT, vm mipsevm.FPVM) *multithreaded.State

func GetThreadStacks added in v1.9.2

func GetThreadStacks(state *multithreaded.State) (activeStack, inactiveStack []*multithreaded.ThreadState)

func InitializeSingleThread added in v1.9.2

func InitializeSingleThread(randSeed int, state *multithreaded.State, traverseRight bool, opts ...testutil.StateOption)

func NewStateMutatorMultiThreaded

func NewStateMutatorMultiThreaded(state *multithreaded.State) testutil.StateMutator

func RandomState added in v1.9.2

func RandomState(seed int) *multithreaded.State

func RandomThread added in v1.9.2

func RandomThread(randSeed int64) *multithreaded.ThreadState

func SetupThreads added in v1.9.2

func SetupThreads(randomSeed int64, state *multithreaded.State, traverseRight bool, activeStackSize, otherStackSize int)

Types

type ExpectedMTState added in v1.9.2

type ExpectedMTState struct {
	PreimageKey         common.Hash
	PreimageOffset      arch.Word
	Heap                arch.Word
	LLReservationStatus multithreaded.LLReservationStatus
	LLAddress           arch.Word
	LLOwnerThread       arch.Word
	ExitCode            uint8
	Exited              bool
	Step                uint64
	LastHint            hexutil.Bytes
	MemoryRoot          common.Hash

	// Threading-related expectations
	StepsSinceLastContextSwitch uint64
	Wakeup                      arch.Word
	TraverseRight               bool
	NextThreadId                arch.Word
	ThreadCount                 int
	RightStackSize              int
	LeftStackSize               int

	ActiveThreadId arch.Word
	// contains filtered or unexported fields
}

ExpectedMTState is a test utility that basically stores a copy of a state that can be explicitly mutated to define an expected post-state. The post-state is then validated with ExpectedMTState.Validate(t, postState)

func NewExpectedMTState added in v1.9.2

func NewExpectedMTState(fromState *multithreaded.State) *ExpectedMTState

func (*ExpectedMTState) ActiveThread added in v1.9.2

func (e *ExpectedMTState) ActiveThread() *ExpectedThreadState

func (*ExpectedMTState) ExpectMemoryWordWrite added in v1.9.4

func (e *ExpectedMTState) ExpectMemoryWordWrite(addr arch.Word, val arch.Word)

func (*ExpectedMTState) ExpectMemoryWriteUint32 added in v1.9.5

func (e *ExpectedMTState) ExpectMemoryWriteUint32(t require.TestingT, addr arch.Word, val uint32)

func (*ExpectedMTState) ExpectNewThread added in v1.9.2

func (e *ExpectedMTState) ExpectNewThread() *ExpectedThreadState

func (*ExpectedMTState) ExpectPreemption added in v1.9.2

func (e *ExpectedMTState) ExpectPreemption(preState *multithreaded.State)

func (*ExpectedMTState) ExpectStep added in v1.9.2

func (e *ExpectedMTState) ExpectStep()

func (*ExpectedMTState) PrestateActiveThread added in v1.9.2

func (e *ExpectedMTState) PrestateActiveThread() *ExpectedThreadState

func (*ExpectedMTState) Thread added in v1.9.2

func (e *ExpectedMTState) Thread(threadId arch.Word) *ExpectedThreadState

func (*ExpectedMTState) Validate added in v1.9.2

func (e *ExpectedMTState) Validate(t require.TestingT, actualState *multithreaded.State)

type ExpectedThreadState added in v1.9.2

type ExpectedThreadState struct {
	ThreadId         arch.Word
	ExitCode         uint8
	Exited           bool
	FutexAddr        arch.Word
	FutexVal         arch.Word
	FutexTimeoutStep uint64
	PC               arch.Word
	NextPC           arch.Word
	HI               arch.Word
	LO               arch.Word
	Registers        [32]arch.Word
	Dropped          bool
}

type StateMutatorMultiThreaded

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

func (*StateMutatorMultiThreaded) Randomize added in v1.9.2

func (m *StateMutatorMultiThreaded) Randomize(randSeed int64)

func (*StateMutatorMultiThreaded) SetExitCode

func (m *StateMutatorMultiThreaded) SetExitCode(val uint8)

func (*StateMutatorMultiThreaded) SetExited

func (m *StateMutatorMultiThreaded) SetExited(val bool)

func (*StateMutatorMultiThreaded) SetHI

func (m *StateMutatorMultiThreaded) SetHI(val arch.Word)

func (*StateMutatorMultiThreaded) SetHeap

func (m *StateMutatorMultiThreaded) SetHeap(val arch.Word)

func (*StateMutatorMultiThreaded) SetLO

func (m *StateMutatorMultiThreaded) SetLO(val arch.Word)

func (*StateMutatorMultiThreaded) SetLastHint

func (m *StateMutatorMultiThreaded) SetLastHint(val hexutil.Bytes)

func (*StateMutatorMultiThreaded) SetNextPC

func (m *StateMutatorMultiThreaded) SetNextPC(val arch.Word)

func (*StateMutatorMultiThreaded) SetPC

func (m *StateMutatorMultiThreaded) SetPC(val arch.Word)

func (*StateMutatorMultiThreaded) SetPreimageKey

func (m *StateMutatorMultiThreaded) SetPreimageKey(val common.Hash)

func (*StateMutatorMultiThreaded) SetPreimageOffset

func (m *StateMutatorMultiThreaded) SetPreimageOffset(val arch.Word)

func (*StateMutatorMultiThreaded) SetStep

func (m *StateMutatorMultiThreaded) SetStep(val uint64)

type ThreadFilter added in v1.9.2

type ThreadFilter func(thread *multithreaded.ThreadState) bool

type ThreadIterator added in v1.9.2

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

func NewThreadIterator added in v1.9.2

func NewThreadIterator(state *multithreaded.State) ThreadIterator

func (*ThreadIterator) Next added in v1.9.2

Jump to

Keyboard shortcuts

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