Documentation ¶
Overview ¶
Package reporters is a collection of canonical methods to obtain test-relevant information about a DUT. It should not modify the DUT state.
Index ¶
- func RootPartition(ctx context.Context, r *Reporter) (string, error)
- type BootedDeviceInfo
- type BootedDeviceType
- type CrossystemParam
- type Event
- type Reporter
- func (r *Reporter) BatteryStatus(ctx context.Context) (string, error)
- func (r *Reporter) Board(ctx context.Context) (string, error)
- func (r *Reporter) BootID(ctx context.Context) (string, error)
- func (r *Reporter) BootedDevice(ctx context.Context) (BootedDeviceType, error)
- func (r *Reporter) BuilderPath(ctx context.Context) (string, error)
- func (r *Reporter) CatFile(ctx context.Context, path string) (string, error)
- func (r *Reporter) CatFileLines(ctx context.Context, path string) ([]string, error)
- func (r *Reporter) CheckBootMode(ctx context.Context, expected fwCommon.BootMode) (bool, error)
- func (r *Reporter) CombinedOutput(ctx context.Context, format string, args ...string) (string, error)
- func (r *Reporter) CommandOutput(ctx context.Context, format string, args ...string) (string, error)
- func (r *Reporter) CommandOutputLines(ctx context.Context, format string, args ...string) ([]string, error)
- func (r *Reporter) Crossystem(ctx context.Context, requiredKeys ...CrossystemParam) (map[CrossystemParam]string, error)
- func (r *Reporter) CrossystemParam(ctx context.Context, param CrossystemParam) (string, error)
- func (r *Reporter) CurrentBootMode(ctx context.Context) (fwCommon.BootMode, error)
- func (r *Reporter) DoAllPathsExist(ctx context.Context, paths []string) (bool, error)
- func (r *Reporter) EventlogList(ctx context.Context) ([]Event, error)
- func (r *Reporter) EventlogListAfter(ctx context.Context, previousEvent Event) ([]Event, error)
- func (r *Reporter) FWTries(ctx context.Context) (fwCommon.RWSection, fwCommon.RWSection, uint, error)
- func (r *Reporter) Model(ctx context.Context) (string, error)
- func (r *Reporter) Now(ctx context.Context) (time.Time, error)
- func (r *Reporter) Vboot2(ctx context.Context) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BootedDeviceInfo ¶
BootedDeviceInfo groups all the info required to determine the correct BootedDeviceType
type BootedDeviceType ¶
type BootedDeviceType string
BootedDeviceType is the set of mode,device,kernel verifier for the DUT.
const ( BootedDeviceNormalInternalSig BootedDeviceType = "normal mode booted from internal device, signature verified kernel key" BootedDeviceDeveloperInternalSig BootedDeviceType = "developer mode booted from internal device, signature verified kernel key" BootedDeviceDeveloperRemovableSig BootedDeviceType = "developer mode booted from removable device, signature verified kernel key" BootedDeviceDeveloperRemovableHash BootedDeviceType = "developer mode booted from removable device, hash verified kernel key" BootedDeviceRecoveryRemovableSig BootedDeviceType = "recovery mode booted from removable device, signature verified kernel key" BootedDeviceRecoveryRemovableHash BootedDeviceType = "recovery mode booted from removable device, hash verified kernel key" )
The set of all possible BootedDeviceTypes, add more as needed.
type CrossystemParam ¶
type CrossystemParam string
CrossystemParam represents known Crossystem attributes.
const ( CrossystemParamBackupNvramRequest CrossystemParam = "backup_nvram_request" CrossystemParamDevBootUsb CrossystemParam = "dev_boot_usb" CrossystemParamDevDefaultBoot CrossystemParam = "dev_default_boot" CrossystemParamDevBootAltfw CrossystemParam = "dev_boot_altfw" CrossystemParamDevswBoot CrossystemParam = "devsw_boot" CrossystemParamFWBTries CrossystemParam = "fwb_tries" CrossystemParamFWTryNext CrossystemParam = "fw_try_next" CrossystemParamFWTryCount CrossystemParam = "fw_try_count" CrossystemParamFWUpdatetries CrossystemParam = "fwupdate_tries" CrossystemParamFWVboot2 CrossystemParam = "fw_vboot2" CrossystemParamKernkeyVfy CrossystemParam = "kernkey_vfy" CrossystemParamLocIdx CrossystemParam = "loc_idx" CrossystemParamMainfwAct CrossystemParam = "mainfw_act" CrossystemParamMainfwType CrossystemParam = "mainfw_type" CrossystemParamWpswCur CrossystemParam = "wpsw_cur" )
Crossystem params used by tests, add more as needed.
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
Reporter provides information about the DUT.
func (*Reporter) BatteryStatus ¶
BatteryStatus reports the device's battery status.
func (*Reporter) BootedDevice ¶
func (r *Reporter) BootedDevice(ctx context.Context) (BootedDeviceType, error)
BootedDevice reports the current BootedDeviceType of the DUT.
func (*Reporter) BuilderPath ¶
BuilderPath reports release path of the build, such as grunt-release/R93-14023.0.0.
func (*Reporter) CatFileLines ¶
CatFileLines parses file contents by line and reports the list of lines.
func (*Reporter) CheckBootMode ¶
CheckBootMode verifies that the DUT's active firmware boot mode (normal, dev, rec) matches an expected boot mode.
func (*Reporter) CombinedOutput ¶
func (r *Reporter) CombinedOutput(ctx context.Context, format string, args ...string) (string, error)
CombinedOutput reports the command stdout+stderr as a single string.
func (*Reporter) CommandOutput ¶
func (r *Reporter) CommandOutput(ctx context.Context, format string, args ...string) (string, error)
CommandOutput reports the command output as a single string.
func (*Reporter) CommandOutputLines ¶
func (r *Reporter) CommandOutputLines(ctx context.Context, format string, args ...string) ([]string, error)
CommandOutputLines parses command output by line and report the list of lines.
func (*Reporter) Crossystem ¶
func (r *Reporter) Crossystem(ctx context.Context, requiredKeys ...CrossystemParam) (map[CrossystemParam]string, error)
Crossystem returns crossystem output as a map. Any required params not found in the output will cause an error. You must add `SoftwareDeps: []string{"crossystem"},` to your `testing.Test` to use this.
func (*Reporter) CrossystemParam ¶
CrossystemParam returns the value of the param from crossystem <param> command.
func (*Reporter) CurrentBootMode ¶
CurrentBootMode reports the DUT's active firmware boot mode (normal, dev, rec). You must add `SoftwareDeps: []string{"crossystem"},` to your `testing.Test` to use this.
func (*Reporter) DoAllPathsExist ¶
DoAllPathsExist reports whether all given paths exist on the DUT.
func (*Reporter) EventlogList ¶
EventlogList returns the result of `elogtool list`. The returned events are sorted from oldest to newest.
func (*Reporter) EventlogListAfter ¶
EventlogListAfter returns a list of events that occurred after a given index.
func (*Reporter) FWTries ¶
func (r *Reporter) FWTries(ctx context.Context) (fwCommon.RWSection, fwCommon.RWSection, uint, error)
FWTries returns the currently booted firmware, the next firmware that should be booted, and the try_count.