exectest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package exectest builds the pdfconcat executable for tests that run it as a child process, and lets the coverage gate (tools/qualitygate coverage) see what those child processes execute.

When the environment variable PDFCONCAT_COVERDIR names a directory, Build compiles with `go build -cover` (instrumenting the packages listed in PDFCONCAT_COVERPKG, default every package of the module) and Command points the child's GOCOVERDIR at that directory. Otherwise the executable is a plain build and nothing changes.

Index

Constants

View Source
const (
	// EnvCoverDir is the directory that receives the child processes' coverage data.
	EnvCoverDir = "PDFCONCAT_COVERDIR"
	// EnvCoverPkg is the comma-separated list of packages the executable is instrumented for.
	EnvCoverPkg = "PDFCONCAT_COVERPKG"
)

Variables

This section is empty.

Functions

func Build

func Build(tb testing.TB, pkg string) string

Build compiles the main package pkg (for example "./cmd/pdfconcat", relative to the module root) once per test process and returns the executable's path.

func Cleanup

func Cleanup()

Cleanup removes every executable Build produced. Call it from TestMain after m.Run; a test process that does not leaves its temporary directory behind.

func Command

func Command(ctx context.Context, path string, args ...string) *exec.Cmd

Command returns a command that runs the executable at path. Under the coverage gate the child's coverage data goes to EnvCoverDir.

Types

This section is empty.

Jump to

Keyboard shortcuts

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