tests

package
v0.0.0-...-86e9f11 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package tests provides common functions used in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(s1, s2 string) (string, bool)

Diff produces diff of two strings.

Types

type CaseSpec

type CaseSpec struct {
	// Sections is the content of the test case
	// split by sections (delimited by "---") and then by lines.
	Sections [][]string

	// Map of key:value tags extracted from comments
	Tags map[string]string
}

CaseSpec holds parsed testcase content. See ReadSpec.

func ReadSpec

func ReadSpec(reader io.Reader) (*CaseSpec, error)

ReadSpec reads a CaseSpec from an io.Reader. The procedure skips empty lines and lines staring with the character [#]. Tags in the returned spec are in the following form:

## key: value

where [key] is tag key and [value] is the tag value.

type GuardedMemory

type GuardedMemory struct {
	Data []byte // user data
	// contains filtered or unexported fields
}

func GuardMemory

func GuardMemory(userdata []byte) (*GuardedMemory, error)

GuardMemory puts user data at the end of CPU page(s) and unmaps the next page to catch off-buffer accesses.

func (*GuardedMemory) Free

func (gm *GuardedMemory) Free() error

Free releases mapped pages to the system

Jump to

Keyboard shortcuts

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