gvisorgvisor.dev/gvisor/test/runner/gtest Index | Files

package gtest

import "gvisor.dev/gvisor/test/runner/gtest"

Package gtest contains helpers for running google-test tests from Go.

Index

Variables

var (

	// TestFlags is the flags that are set for all tests.
	TestFlags = []string{}
)

Functions

func BuildTestArgs

func BuildTestArgs(indices []int, testCases []TestCase) []string

BuildTestArgs builds arguments to be passed to the test binary to execute only the test cases in `indices`.

Preconditions: len(indices) != 0.

Types

type TestCase

type TestCase struct {
	// Suite is the suite for this test.
	Suite string

	// Name is the name of this individual test.
	Name string
	// contains filtered or unexported fields
}

TestCase is a single gtest test case.

func ParseBenchmarks

func ParseBenchmarks(binary string, extraArgs ...string) ([]TestCase, error)

ParseBenchmarks returns each benchmark in the binary's list as a single test case.

func ParseTestCases

func ParseTestCases(testBin string, benchmarks bool, extraArgs ...string) ([]TestCase, error)

ParseTestCases calls a gtest test binary to list its test and returns a slice with the name and suite of each test.

If benchmarks is true, then benchmarks will be included in the list of test cases provided. Note that this requires the binary to support the benchmarks_list_tests flag.

func (TestCase) Args

func (tc TestCase) Args() []string

Args returns arguments to be passed when invoking the test.

func (TestCase) FullName

func (tc TestCase) FullName() string

FullName returns the name of the test including the suite. It is suitable to pass to "-gtest_filter".

Source Files

gtest.go

Version
v0.0.0-20250605235530-a6711d1e1dc6 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
4 hours ago

Tools for package owners.