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: 14 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 TKOParse

func TKOParse(c autotest.Config, resultsDir string, level int, 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 returns arguments 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 tasks
	Verify
	// Cleanup tasks
	Cleanup
	// Reset tasks
	Reset
	// Repair tasks
	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 HostTest

type HostTest struct {
	HostlessTest
	Hosts             []string
	LocalOnlyHostInfo bool
	ParentJobID       int
	RequireSSP        bool
	TestSourceBuild   string
}

HostTest represents a host test to run. HostTest implements AutoservJob.

func (*HostTest) AutoservArgs

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

AutoservArgs returns arguments for autoserv.

type HostlessTest

type HostlessTest struct {
	Args         string
	ClientTest   bool
	ControlFile  string
	ControlName  string
	ExecutionTag string
	Keyvals      map[string]string
	Name         string
	Owner        string
	ResultsDir   string
}

HostlessTest represents a hostless test to run. HostlessTest implements AutoservJob.

func (*HostlessTest) AutoservArgs

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

AutoservArgs returns arguments for autoserv.

func (*HostlessTest) JobKeyvals

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

JobKeyvals returns the keyvals for the job.

type MainJob

type MainJob struct {
	AutotestConfig   autotest.Config
	ResultsDir       string
	UseLocalHostInfo bool
}

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

type Provision

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

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

func (*Provision) AutoservArgs

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

AutoservArgs returns arguments 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.

Jump to

Keyboard shortcuts

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