utils

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const AssetPath = "/test/"

Defined in Dockerfile.test. TODO: Make it a flag

View Source
const C2wBin = "c2w"
View Source
const C2wNetProxyBin = "/opt/c2w-net-proxy.wasm"
View Source
const ImageMounterBin = "/opt/imagemounter.wasm"

Variables

This section is empty.

Functions

func DonePort added in v0.5.0

func DonePort(i int)

func GetPort added in v0.5.0

func GetPort(t *testing.T) int

func ReadInt added in v0.5.0

func ReadInt(t *testing.T, p string) int

func ReadString added in v0.5.0

func ReadString(t *testing.T, p string) string

func RunTestRuntimes

func RunTestRuntimes(t *testing.T, tests ...TestSpec)

func StartDirServer added in v0.6.0

func StartDirServer(t *testing.T, dir string) (pid int, port int)

func StartHelloServer added in v0.5.0

func StartHelloServer(t *testing.T) (pid int, port int)

func StringFlags

func StringFlags(opts ...string) func(t *testing.T, env Env) []string

func WantPrompt

func WantPrompt(prompt string, inputoutput ...[2]string) func(t *testing.T, env Env, in io.Writer, out io.Reader)

func WantPromptWithWorkdir

func WantPromptWithWorkdir(prompt string, inputoutputFunc func(workdir string) [][2]string) func(t *testing.T, env Env, in io.Writer, out io.Reader)

func WantString

func WantString(wantstr string) func(t *testing.T, env Env, in io.Writer, out io.Reader)

Types

type Architecture added in v0.5.0

type Architecture int
const (
	X86_64 Architecture = iota
	RISCV64
	AArch64
)

type Env added in v0.6.0

type Env struct {
	Input   Input
	Workdir string
}

type Input

type Input struct {
	Image        string
	ConvertOpts  []string
	Architecture Architecture
	Dockerfile   string
	BuildArgs    []string
	Mirror       bool
	Store        string
	External     bool
}

type TestSpec

type TestSpec struct {
	Name           string
	Inputs         []Input
	Prepare        func(t *testing.T, env Env)
	Finalize       func(t *testing.T, env Env)
	ImageName      string // default: test.wasm
	Runtime        string
	RuntimeOpts    func(t *testing.T, env Env) []string
	Args           func(t *testing.T, env Env) []string
	Want           func(t *testing.T, env Env, in io.Writer, out io.Reader)
	NoParallel     bool
	IgnoreExitCode bool
}

Jump to

Keyboard shortcuts

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