atutil

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Package atutil provides a higher level Autotest interface than the autotest package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddProvisionDetailsToHostInfoFile

func AddProvisionDetailsToHostInfoFile(ctx context.Context, bt *tls.BackgroundTLS, infoFileDir, dutName, crosVersion string) error

func HostInfoFilePath

func HostInfoFilePath(rootDir, host string) string

func LinkHostInfoFile

func LinkHostInfoFile(srcResultsDir, dstResultDir, host string) error

LinkHostInfoFile prepares the host info store by linking the host file in the dstResultDir to the srcResultsDir. It is intended as an alternative to prepareHostInfo, which contains autoserv-specific logic and does not work for TLS.

func TKOParse

func TKOParse(c autotest.Config, resultsDir string, w io.Writer) (failed int, err error)

TKOParse runs tko/parse on the results directory. The level is used by tko/parse to determine how many parts of the results dir absolute path to take for the unique job tag.

Parse output is written to the Writer.

This function returns the number of tests failed and an error if any.

Types

type AdminTask

type AdminTask struct {
	Type       AdminTaskType
	Host       string
	ResultsDir string
}

AdminTask represents an admin task to run. AdminTask implements AutoservJob.

func (*AdminTask) AutoservArgs

func (t *AdminTask) AutoservArgs() *autotest.AutoservArgs

AutoservArgs represents the CLI args for `autoserv`.

type AdminTaskType

type AdminTaskType int

AdminTaskType is an enum used in AdminTask to determine what type of admin task to run.

const (
	// NoTask can be used as a null AdminTaskType value.
	NoTask AdminTaskType = iota
	// Verify represents `autoserv -v`.
	Verify
	// Cleanup represents `autoserv --cleanup`.
	Cleanup
	// Reset represents `autoserv --reset`.
	Reset
	// Repair represents `autoserv -R`.
	Repair
)

func (AdminTaskType) String

func (i AdminTaskType) String() string

type AutoservJob

type AutoservJob interface {
	AutoservArgs() *autotest.AutoservArgs
}

AutoservJob describes the interface a job object needs to be passed to RunAutoserv.

type HostInfo

type HostInfo struct {
	Attributes        map[string]string `json:"attributes"`
	Labels            []string          `json:"labels"`
	SerializerVersion int               `json:"serializer_version,omitempty"`
	StableVersions    map[string]string `json:"stable_versions"`
}

HostInfo is a struct providing a mapping to an autotest host_info file.

type MainJob

type MainJob struct {
	AutotestConfig autotest.Config
	ResultsDir     string
}

MainJob describes the overall job, which dictates certain job global settings for running autoserv.

type Provision

type Provision struct {
	Host       string
	Labels     []string
	ResultsDir string
}

Provision represents a provision task to run. Provision implements AutoservJob.

func (*Provision) AutoservArgs

func (p *Provision) AutoservArgs() *autotest.AutoservArgs

AutoservArgs represents the CLI args for `autoserv`.

type Result

type Result struct {
	osutil.RunResult
	// Exit is the exit status for the autoserv command, if
	// autoserv was run.
	Exit        int
	TestsFailed int
}

Result contains information about RunAutoserv results.

func RunAutoserv

func RunAutoserv(ctx context.Context, m *MainJob, j AutoservJob, w io.Writer) (r *Result, err error)

RunAutoserv runs an autoserv task.

This function always returns a non-nil Result, but some fields may not be meaningful. For example, Result.Exit will be 0 even if autoserv could not be run. In this case, Result.Started will be false and an error will also returned.

Output is written to the Writer.

Result.TestsFailed may not be set, depending on AutoservJob. An error is not returned for test failures.

func (*Result) Signaled

func (r *Result) Signaled() bool

Signaled returns true if autoserv exited from a signal.

func (*Result) Success

func (r *Result) Success() bool

Success returns true if autoserv exited with 0 and no tests failed.

type Test

type Test struct {
	Args             string
	ClientTest       bool
	ControlFile      string
	ControlName      string
	ExecutionTag     string
	Hosts            []string
	Keyvals          map[string]string
	Name             string
	Owner            string
	ParentJobID      int
	RequireSSP       bool
	ResultsDir       string
	SSPBaseImageName string
	TestSourceBuild  string
}

Test represents a test to run. Test implements AutoservJob.

func (*Test) AutoservArgs

func (t *Test) AutoservArgs() *autotest.AutoservArgs

AutoservArgs represents the CLI args for `autoserv`.

func (*Test) JobKeyvals

func (t *Test) JobKeyvals() map[string]string

JobKeyvals returns the autotest keyvals.

Jump to

Keyboard shortcuts

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