testenv

package
v0.0.0-...-865c840 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: GPL-3.0, BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Sigquit = syscall.SIGQUIT

Sigquit is the signal to send to kill a hanging subprocess. Send SIGQUIT to get a stack trace.

Functions

func Command

func Command(t testing.TB, name string, args ...string) *exec.Cmd

Command is like exec.Command, but applies the same changes as testenv.CommandContext (with a default Context).

func CommandContext

func CommandContext(t testing.TB, ctx context.Context, name string, args ...string) *exec.Cmd

CommandContext is like exec.CommandContext, but:

  • skips t if the platform does not support os/exec,
  • sends SIGQUIT (if supported by the platform) instead of SIGKILL in its Cancel function
  • if the test has a deadline, adds a Context timeout and WaitDelay for an arbitrary grace period before the test's deadline expires,
  • fails the test if the command does not complete before the test's deadline, and
  • sets a Cleanup function that verifies that the test did not leak a subprocess.

Types

This section is empty.

Jump to

Keyboard shortcuts

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