dep

package
v0.0.0-...-b5d9cbe Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package dep deals with dependencies of tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Test     string
	Var      []string
	Software map[string]SoftwareDeps
	Hardware map[string]HardwareDeps
}

Deps contains all information about dependencies tests have.

func (*Deps) Check

func (d *Deps) Check(f *protocol.Features) (reasons []string, err error)

Check performs dependency checks according to given features. On success, it returns a list of reasons for which a test should be skipped. If reasons is empty, a test should be run.

type HardwareCondition

type HardwareCondition struct {
	// Satisfied is a pointer to a function which checks if the given HardwareFeatures satisfies
	// the condition.
	Satisfied func(f *protocol.HardwareFeatures) (satisfied bool, reason string, err error)

	// Err is an error to be reported on Test registration
	// if instantiation of HardwareCondition fails.
	Err error
}

HardwareCondition is exported as go.chromium.org/tast/core/testing/hwdep.Condition. Please find its document for details. Either Satisfied or Err should be nil exclusively.

type HardwareDeps

type HardwareDeps struct {
	// contains filtered or unexported fields
}

HardwareDeps is exported as go.chromium.org/tast/core/testing/hwdep.Deps. Please find its document for details.

func MergeHardwareDeps

func MergeHardwareDeps(d1, d2 HardwareDeps) HardwareDeps

MergeHardwareDeps merges two HardwareDeps instance into one HardwareDeps instance. The returned HardwareDeps is satisfied iff all conditions in d1 and ones in d2 are satisfied.

func NewHardwareDeps

func NewHardwareDeps(conds ...HardwareCondition) HardwareDeps

NewHardwareDeps creates a HardwareDeps from a set of HWConditions.

func (*HardwareDeps) Satisfied

Satisfied returns whether the condition is satisfied. UnsatisfiedReasons is empty if the given device.Config satisfies the dependencies. i.e., the test can run on the current device setup. A non-nil error is returned when failed to evaluate the condition. Otherwise, the UnsatisfiedReasons instance contains a collection of reasons why any of the condition was not satisfied.

func (*HardwareDeps) Validate

func (d *HardwareDeps) Validate() error

Validate returns error if one of the conditions failed to be instantiated.

type SoftwareDeps

type SoftwareDeps = []string

SoftwareDeps represents dependencies to software features.

type UnsatisfiedReasons

type UnsatisfiedReasons []string

UnsatisfiedReasons contain the detailed reasons why Satisfied failed. An empty list means success.

Jump to

Keyboard shortcuts

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