LabgridClient
To ensure the tests scope is to test a feature, the LabgridClient class
handles acquisition, authentication and lifespan. It picks a free place that
matches the needs of the test, acquires it, configures SSH, and releases.
- class hw_tests.labgrid.LabgridClient(context)
Select a labgrid place for a test and acquire it.
The coordinator is
labgrid_coordinatorfrom the context orLG_COORDINATOR. The place is selected on creation: the first free place, by name, whose tags include allneedsfrom the context. Iflabgrid_targetis set, only that place is considered. If all matches are acquired, waits up to one hour.In GitHub Actions, the labgrid user is set to
labgrid-client-<run id>-<attempt>, so places left acquired by a previous attempt of the same run can be taken over.- Parameters:
context – Test context.
- hw_tests.labgrid.exporter_http_server(ssh, files)
Serve files over HTTP from a remote host.
Copies
filesto a temporary directory on the host, startspython3 -m http.serveron a free port, and removes everything on exit.- Parameters:
ssh – Labgrid
SSHDriverof the host.files – Maps paths relative to the HTTP root to local files.
- Returns:
Context manager yielding
(directory, port), the remote directory and the HTTP port.