Firmware Images

Each build flavor names and packages its images differently. Images maps a role, such as spl or kernel, to a file using the artifacts.toml of the test category, so one test runs against every flavor. See Write a test.

Resolve firmware images by role from the artifacts.toml descriptor.

class hw_tests.images.Images(context, github)

Find and download the images used by a test.

Images are looked up by role (for example spl, uboot, kernel) in tests/<category>/artifacts.toml, under the table of the current flavor. Each role sets artifact (artifact name glob), file (file glob inside the artifact), and optionally source (a release from the [sources] table).

When several artifacts or files match, the ones containing all needs from the context are preferred.

Parameters:
  • context – Test context.

  • github – GitHub client to download with.

property flavor

Image flavor, such as br2-external or u-boot.

flavor from the context, else the name of the repository that built the images. Skips the test if neither is known.

get(role)

Download the artifact for role and return the image path.

Each artifact is downloaded once per instance. Release assets are also cached on disk across runs, see GitHub.download. To use local release files instead, put them in _artifacts/<test name>/release/<source>.

Skips the test if the flavor has no such role.

artifact_path(role)

Return the image path for role, relative to its artifact.

Use it to place the file at the same path on a target or server. Calls get() if needed.

hw_tests.images.find_one(items, what, needs=())

Return the single item, narrowed by needs then base-stem when several match.