Using External Files in Tests
You might want to use external libraries, binaries, or other tools depending on your use case. For instance, if your test requires a specific tool or script, you can include it in your test workflow.
This example demonstrates how to include custom tooling in a test that power-cycles a board using the latest firmware build.
Step-by-Step Guide
- Add the Files
Use the fwci CLI to add, update, list, and delete files. To add files:
This uploads one file under the specified file-name. The server detects the
format from the file’s content and unpacks it:
| You upload | Result on the server |
|---|---|
.tar, .zip, .7z | Unpacked, directory layout preserved |
.tar.gz, .tar.bz2, .tar.xz, .tar.zst | Unpacked, directory layout preserved |
Any single file (binary, script, .bin, no extension …) | Stored as the only file, original name kept |
A single compressed file is not an archive. Uploading
tool.gz,firmware.bin.zstor any other standalone compressed file fails. Wrap it in a tar instead:tar czf tool.tar.gz tool.
Two more things worth knowing before you pack:
- The extension must match the content. Detection uses both, so a text file
named
payload.zipis rejected withzip: not a valid zip file. - Symlinks inside an archive are skipped, without an error. Pack the real
files — e.g.
tar czhf lib.tar.gz lib/(-hfollows symlinks) — or the entry will be missing at test time.
The <file-name> may contain letters, digits and underscores only (my_python_lib,
not my-python-lib) and must be unique within your organization.
Listing files should now result in a representation of the uploaded files:
The File-Tree is what the test environment will see, so use it to check that
your archive unpacked the way you expected — the paths listed here are exactly
the ones you write into the paths map in the next step.
Adding more files to an existing entry
There is no incremental add. fwci files update replaces the whole entry:
the current contents are deleted, then the new upload is unpacked in their place.
To extend an entry, repack the old files together with the new ones and upload
the result:
Storage items reference the entry by name, so any storage.yaml with
uri: fwci://my_python_lib picks up the new contents with no change. If you also
rename the entry with -n, update every storage.yaml that points at the old
name.
An entry cannot be deleted while a storage item still references it — delete or re-point the storage item first.
- Reference the files in a storage item
After uploading a file, you can reference it within a storage item. Storage items not only link to the files but also include an optional array of commands that are executed within the testing environment.
For a comprehensive explanation, refer to the Storage Configuration documentation.
Examplary storage.yaml
Add the storage.yaml file into a subdirectory within the .firmwareci/storage directory. The file structure should resemble the following:
- Reference the Storage Inside a Test
Modify the boot test to add a command that executes the testing library. When storage is referenced in a test, it’s automatically included at a path in the testing environment. Access the path using the template [[storage.<storage-name>]].
First copy files from the storage path to the device, then run the library as an executable.
For a comprehensive explanation, refer to the Templating documentation.