Documentation
¶
Overview ¶
Package gtest provides utilities to run gtest binary on Tast. TODO(hidehiko): Merge chromiumos/tast/local/chrome/bintest package into this.
Index ¶
- func ARC(a *arc.ARC) option
- func ExtraArgs(args ...string) option
- func Filter(pattern string) option
- func ListTests(ctx context.Context, exec string) ([]string, error)
- func Logfile(path string) option
- func Repeat(repeat int) option
- func TempLogfile(path string) option
- func UID(uid int) option
- type Failure
- type GTest
- type Report
- type TestCase
- type TestSuite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtraArgs ¶
func ExtraArgs(args ...string) option
ExtraArgs returns an option to pass more arguments than gtest arguments for execution.
func Logfile ¶
func Logfile(path string) option
Logfile returns an option to set logfile path of GTest.
func TempLogfile ¶
func TempLogfile(path string) option
TempLogfile returns an option to set logfile path of GTest. The file is created by using ioutil.TempFile to avoid conflict, so its special pattern is usable here.
Types ¶
type Failure ¶
type Failure struct {
Message string `xml:"message,attr"`
}
Failure represents a test validation failure in TestCase.
type GTest ¶
type GTest struct {
// contains filtered or unexported fields
}
GTest is a struct to run gtest binary.
func (*GTest) Run ¶
Run executes the gtest, and returns the parsed Report. Note that the returned Report may not be nil even if test command execution returns an error. E.g., if test case in the gtest fails, the command will return an error, but the report file should be created. This function also handles the case, and returns it.
type Report ¶
type Report struct {
Suites []*TestSuite `xml:"testsuite"`
}
Report is a parsed gtest output report. See https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#generating-an-xml-report for details. // nocheck Note: at the moment, only a subset of the report is parsed. More can be added upon requirements. TODO(crbug.com/940320): Consider switching to use JSON, which is supported gtest 1.8.1 or later.
func ParseReport ¶
ParseReport parses the XML gtest output report at path.
func (*Report) FailedTestNames ¶
FailedTestNames returns an array of failed test names, in the "TestSuite.TestCase" format. If no error is found, returns nil. This walks through whole the report.
func (*Report) PassedTestNames ¶
PassedTestNames returns an array of passed test names, in the "TestSuite.TestCase" format. If no passed tests are found, returns nil. This walks through whole the report.