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 command adds files under the specified file-name. Supported formats include single files, archives, and compressed archives.
Listing files should now result in a representation of the uploaded files:
- 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.