Documentation ¶
Index ¶
- Constants
- Variables
- type CompileCOptions
- type Context
- func (ctx *Context) Check(fn func() error)
- func (ctx *Context) Cleanup()
- func (ctx *Context) Compile(pkg string, preArgs ...string) string
- func (ctx *Context) CompileC(t *testing.T, opts CompileCOptions) string
- func (ctx *Context) CompileShared(t *testing.T, name string, pkg string) Include
- func (ctx *Context) CompileWithLDFlagsX(pkg string, ldFlagsX map[string]string) string
- func (ctx *Context) CompileWithVersion(pkg string, info version.Info) string
- func (ctx *Context) Dir(elem ...string) string
- func (ctx *Context) File(elem ...string) string
- func (ctx *Context) Go(fn func() error)
- func (ctx *Context) Wait()
- type Include
- type TB
Constants ¶
const DefaultTimeout = 3 * time.Minute
DefaultTimeout is the default timeout used by new context
Variables ¶
var CLibMath = Include{Standard: true, Library: "m"}
CLibMath is the standard C math library (see `man math.h`).
Functions ¶
This section is empty.
Types ¶
type CompileCOptions ¶
CompileCOptions stores options for compiling C source to an executable.
type Context ¶
Context is a context that has utility methods for testing and waiting for asynchronous errors.
func NewWithTimeout ¶
NewWithTimeout creates a new test context with a given timeout
func (*Context) Cleanup ¶
func (ctx *Context) Cleanup()
Cleanup waits everything to be completed, checks errors and goroutines which haven't ended and tries to cleanup directories
func (*Context) CompileC ¶
func (ctx *Context) CompileC(t *testing.T, opts CompileCOptions) string
CompileC compiles file as with gcc and adds the includes.
func (*Context) CompileShared ¶
CompileShared compiles pkg as c-shared. TODO: support inclusion from other directories
(cgo header paths are currently relative to package root)
func (*Context) CompileWithLDFlagsX ¶
CompileWithLDFlagsX compiles the specified package with the -ldflags flag set to "-s -w [-X <key>=<value>,...]" given the passed map and returns the executable name.
func (*Context) CompileWithVersion ¶
CompileWithVersion compiles the specified package with the version variables set to the passed version info values and returns the executable name.
func (*Context) Dir ¶
Dir creates a subdirectory inside temp joining any number of path elements into a single path and return its absolute path.
func (*Context) File ¶
File returns a filepath inside a temp directory joining any number of path elements into a single path and returns its absolute path.