Documentation
¶
Index ¶
- type DeviceInfo
- type DeviceRunner
- func (r *DeviceRunner) Cleanup(ctx context.Context, remotePath string) (_err error)
- func (r *DeviceRunner) PushBinary(ctx context.Context, localPath string, remotePath string) (_err error)
- func (r *DeviceRunner) Run(ctx context.Context, command string, timeout time.Duration) (_ *RunResult, _err error)
- type RunResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceInfo ¶
DeviceInfo describes a connected Android device.
func DiscoverDevices ¶
func DiscoverDevices( ctx context.Context, ) ([]DeviceInfo, error)
DiscoverDevices enumerates Android devices connected via ADB.
type DeviceRunner ¶
type DeviceRunner struct {
// contains filtered or unexported fields
}
DeviceRunner executes commands and transfers files on a single Android device via the gadb (pure-Go ADB) client library.
func NewDeviceRunner ¶
func NewDeviceRunner( serial string, ) (*DeviceRunner, error)
NewDeviceRunner connects to the ADB server and selects the device identified by serial.
func (*DeviceRunner) Cleanup ¶
func (r *DeviceRunner) Cleanup( ctx context.Context, remotePath string, ) (_err error)
Cleanup removes a file from the device.
func (*DeviceRunner) PushBinary ¶
func (r *DeviceRunner) PushBinary( ctx context.Context, localPath string, remotePath string, ) (_err error)
PushBinary transfers a local file to remotePath on the device and marks it executable (0755).
func (*DeviceRunner) Run ¶
func (r *DeviceRunner) Run( ctx context.Context, command string, timeout time.Duration, ) (_ *RunResult, _err error)
Run executes a shell command on the device. It captures combined stdout/stderr and parses the exit code by appending "; echo $?" to the command. If timeout is positive, the command is wrapped with the shell timeout utility.