cros

package
v0.0.0-...-f4b31ea Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPingCount = 2
	// Default timeout for simple timeout check
	DefaultSSHTimeout = 10 * time.Second
)
View Source
const (
	PingRetryInterval = 5 * time.Second
	SSHRetryInterval  = 10 * time.Second
)
View Source
const (
	// WaitTimeToDownAtRestart is the time for the device to be down at reboot.
	WaitTimeToDownAtRestart = 120 * time.Second
	// WaitTimeToBoot is the time for the device to be up after reboot.
	WaitTimeToBootAfterRestart = 240 * time.Second
)
View Source
const (
	// The percentage of the battery that is considered to be not
	// enough.
	MinimumBatteryLevel = 70
)

Variables

This section is empty.

Functions

func BootFromServoUSBDriveInDevMode

func BootFromServoUSBDriveInDevMode(ctx context.Context, waitBootTimeout, waitBootInterval time.Duration, dutRun components.Runner, ping components.Pinger, servod components.Servod) error

BootFromServoUSBDriveInDevMode performs booting device from external storage when DUT is in DEV-mode. Device already should to be in DEV-mode and enabled to boot from USB-drive. The make to be able boot from USB-drive you need one of followed options: 1) Run enable_dev_usb_boot. 2) Set GBB with GBB_FLAG_FORCE_DEV_BOOT_USB flag.

Steps: 1) Power off the host. 2) Trigger reboot by servo. 3) Perform ctrl+u by servo to try out boot from external storage.

func BootID

func BootID(ctx context.Context, timeout time.Duration, run components.Runner) (string, error)

BootID gets a unique ID associated with the current boot.

@returns: A string unique to this boot if there is no error.

func BootInRecoveryMode

func BootInRecoveryMode(ctx context.Context, req *BootInRecoveryRequest, dutRun, dutBackgroundRun components.Runner, dutPing components.Pinger, ha components.HostAccess, servod components.Servod, log logger.Logger) (rErr error)

BootInRecoveryMode perform boot device in recovery mode.

Boot in recovery mode performed by RO firmware and in some cases required stopPD negotiation. Please specify callback function to perform needed actions when device booted in recovery mode.

func ExtractValueFromLeaseInfo

func ExtractValueFromLeaseInfo(ctx context.Context, run components.Runner, log logger.Logger, key string) (string, error)

ExtractValueFromLeaseInfo reads release info and extract value by provided key.

func IsChromeOSReleaseVersionLessThan

func IsChromeOSReleaseVersionLessThan(a ChromeOSReleaseVersion, b ChromeOSReleaseVersion) bool

IsChromeOSReleaseVersionLessThan compares two ChromeOSReleaseVersion instances, returning true if the first version comes before the second.

Can be used to sort a slice of ChromeOSReleaseVersion instances.

func IsFileSystemWritable

func IsFileSystemWritable(ctx context.Context, run components.Runner, testDirs []string) error

IsFileSystemWritable confirms the stateful file systems are writable.

The standard linux response to certain unexpected file system errors (including hardware errors in block devices) is to change the file system status to read-only. This checks that it hasn't happened.

The test doesn't check various bind mounts; those are expected to fail the same way as their underlying main mounts. Whether the Linux kernel can guarantee that is untested...

func IsKernelPriorityChanged

func IsKernelPriorityChanged(ctx context.Context, run components.Runner) (bool, error)

IsKernelPriorityChanged check if kernel priority changed and is waiting for reboot to apply the change.

func IsNotPingable

func IsNotPingable(ctx context.Context, count int, ping components.Pinger) error

IsNotPingable checks whether the resource is not pingable

func IsPingable

func IsPingable(ctx context.Context, count int, ping components.Pinger) error

IsPingable checks whether the resource is pingable

func IsRootFSVerityEnabled

func IsRootFSVerityEnabled(ctx context.Context, r components.Runner) (bool, error)

IsRootFSVerityEnabled checks if rootfs is setup using fs-verity

func IsSSHable

func IsSSHable(ctx context.Context, run components.Runner, timeout time.Duration) error

IsSSHable checks whether the resource is sshable

func KernelBootId

func KernelBootId(ctx context.Context, run components.Runner) (string, error)

KernelBootId extracts and return unique ID associated with the current boot.

If returns the same value then reboot was not performed.

func MatchCrossystemValueToExpectation

func MatchCrossystemValueToExpectation(ctx context.Context, run components.Runner, subcommand string, expectedValue string) error

MatchCrossystemValueToExpectation reads value from crossystem and compared to expected value.

func MatchSuffixValueToExpectation

func MatchSuffixValueToExpectation(ctx context.Context, run components.Runner, subcommand string, expectedValue string, delimiter string, log logger.Logger) error

MatchSuffixValueToExpectation reads value from crossystem, split both read out and expected value with a given delimiter and then compare their suffix.

func ParseReleaseVersionFromBuilderPath

func ParseReleaseVersionFromBuilderPath(releaseBuilderPath string) (string, error)

ParseReleaseVersionFromBuilderPath parses the ChromeOSReleaseVersion from a CHROMEOS_RELEASE_BUILDER_PATH from lsb-release.

For example, a releaseBuilderPath of "board-release/R90-13816.47.0" would have a release version of "13816.47.0".

func ProcessUptime

func ProcessUptime(uptimeVal string) (*time.Duration, error)

func Reboot

func Reboot(ctx context.Context, run components.Runner, timeout time.Duration) error

Reboot executes the reboot command using a command runner for a DUT.

This function executes an ellaborate reboot sequence that includes executing sync and then attempting forcible reboot etc.

func RebootECByEcTool

func RebootECByEcTool(ctx context.Context, r components.Runner) error

RebootECByEcTool finds the command to reboot ec and executes it.

func RebootWithCheck

func RebootWithCheck(ctx context.Context, ha components.HostAccess, timeToDown, timeToUp time.Duration) error

RebootWithCheck executes a simple reboot and check that host goes down and up.

func RecoveryModeRequiredPDOff

func RecoveryModeRequiredPDOff(ctx context.Context, run components.Runner, servod components.Servod, dut *tlw.Dut) (bool, error)

RecoveryModeRequiredPDOff examines whether servo_pd_role has to be set to `snk` before booting into recovery mode.

func ReleaseBoard

func ReleaseBoard(ctx context.Context, run components.Runner, log logger.Logger) (string, error)

ReleaseBoard reads release board info from lsb-release.

func ReleaseBuildPath

func ReleaseBuildPath(ctx context.Context, run components.Runner, log logger.Logger) (string, error)

ReleaseBuildPath reads release build info from lsb-release.

func ReleaseTrack

func ReleaseTrack(ctx context.Context, run components.Runner, log logger.Logger) (string, error)

ReleaseTrack reads release track info from lsb-release.

func SwitchKernelPriority

func SwitchKernelPriority(ctx context.Context, run components.Runner) error

SwitchKernelPriority updates kernel priority on the DUT, so next boot will be done with new kernel side.

func UpdateCrossystem

func UpdateCrossystem(ctx context.Context, run components.Runner, cmd string, val string, check bool) error

UpdateCrossystem sets value of the subcommand to the value passed in.

@params: check: bool value to check whether the crossystem command is being updated successfully.

func Uptime

func Uptime(ctx context.Context, run components.Runner) (*time.Duration, error)

Uptime returns uptime of resource.

func WaitUntilAccessible

func WaitUntilAccessible(ctx context.Context, waitTime, waitInterval time.Duration, run components.Runner, ping components.Pinger) error

WaitUntilAccessible waiting on resource until accessible. First try to ping and then SSH to the resource.

func WaitUntilNotPingable

func WaitUntilNotPingable(ctx context.Context, waitTime, waitInterval time.Duration, countPerAttempt int, ping components.Pinger) error

WaitUntilNotPingable waiting resource to be not pingable.

func WaitUntilPingable

func WaitUntilPingable(ctx context.Context, waitTime, waitInterval time.Duration, countPerAttempt int, ping components.Pinger) error

WaitUntilPingable waiting resource to be pingable.

func WaitUntilSSHable

func WaitUntilSSHable(ctx context.Context, waitTime, waitInterval time.Duration, run components.Runner) error

WaitUntilSSHable waiting resource to be sshable.

Types

type BootInRecoveryRequest

type BootInRecoveryRequest struct {
	DUT *tlw.Dut
	// Booting time value to verify when device booted and available for SSH.
	BootRetry    int
	BootTimeout  time.Duration
	BootInterval time.Duration
	// Prevent PD switch to snk before boot.
	PreventPowerSnk bool
	// Call function to cal after device booted in recovery mode.
	Callback       func(context.Context) error
	AddObservation func(*metrics.Observation)
	// Options to ignore errors happened during restoring stage.
	IgnoreServoRestoreFailure bool
	IgnoreRebootFailure       bool
	// After reboot params specified to check if device booted or not.
	AfterRebootVerify             bool
	AfterRebootTimeout            time.Duration
	AfterRebootAllowUseServoReset bool
}

BootInRecoveryRequest holds info to boot device in recovery mode.

type ChromeOSReleaseVersion

type ChromeOSReleaseVersion []int

ChromeOSReleaseVersion is the integral representation of a ChromeOS release version. The version is read from left to right, with each segment separated by "." parsed as individual integers.

For example, a version of "13816.47.0" is equivalent to ChromeOSReleaseVersion{13816,47,0}.

func ParseChromeOSReleaseVersion

func ParseChromeOSReleaseVersion(version string) (ChromeOSReleaseVersion, error)

ParseChromeOSReleaseVersion parses the release version string from the lsb-release into its integral parts as a ChromeOSReleaseVersion instance.

func (ChromeOSReleaseVersion) String

func (v ChromeOSReleaseVersion) String() string

String returns the ChromeOSReleaseVersion as a string, with each release segment joined by a period.

For example, ChromeOSReleaseVersion{13816,47,0} would return "13816.47.0".

Directories

Path Synopsis
Package amt implements just enough WS-Management to query and set the DUT's power state.
Package amt implements just enough WS-Management to query and set the DUT's power state.
Package android contains functions to work with AndroidOS on ChromeOS devices.
Package android contains functions to work with AndroidOS on ChromeOS devices.
Package camera contains utilities for auditing camera on DUTs.
Package camera contains utilities for auditing camera on DUTs.
CBI corruption detection and repair logic.
CBI corruption detection and repair logic.
Package cellular contains utilities for repairing cellular DUTs.
Package cellular contains utilities for repairing cellular DUTs.
starfish
Package starfish contains utilities for interacting with starfish devices.
Package starfish contains utilities for interacting with starfish devices.
Package firmware implements logic to update firmware for chromeOS devices.
Package firmware implements logic to update firmware for chromeOS devices.
Package storage implements function to work with cros storages.
Package storage implements function to work with cros storages.
Package tpm provides function to work with TPM.
Package tpm provides function to work with TPM.
Package vpd provide ability to read and update VPD values.
Package vpd provide ability to read and update VPD values.

Jump to

Keyboard shortcuts

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