Recommended Practice for testing multiple images #809
Unanswered
JoshuaWatt
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have a test setup where different tests need to be run against different images programmed to the DUT; Ideally I would like something that looks like this:
So a given test can ensure that a specific image is programmed to the device before it's run by simply pulling in the correct fixture. Importantly, the fixtures should not do anything if they know the image is already programmed to the DUT because it can take a long time, so we don't want to program it every test function (counterintuitively, this is why the image fixtures are scoped to "function"; we want them to check the image every function, but only (re-)program the device if the image is different than the current one.
The methods for "programming" a device can very widely and some devices may have multiple choices for how to be programmed; to deal with this I've made a
ImageProgrammerProtocol
Abstract Base class that the specific methods can derive from to implement the specific method they what to use. That implementation and the implementation for a "manual" programmer that just requires to user to manually program the device via whatever means they want is shown below:The corresponding environment might look something like:
Now, our test file looks like:
This works really well for our fixed CI tests, since we know that we will always be using a specific image programming driver and flashing specific images to the device for testing, however it is inflexible because the images to be tested are hard coded in the code which means the environment must use the specific programmer the images required (for complex reasons, an image isn't always a binary that can be dd'd to some disk), even if the user would rather use a different method of programming that is more convenient for them. Ideally, there would be some way of specifying the images in environment file and then some way of "selecting" one of them to be programmed to the device.... my first though would be make some
ImageProtocol
class that contains the actual image programming parameters and then extend thestrategy
to allow switching between images, which might look something like this:This would allow the user to specify exactly which images and programming strategies should be used for the tests since it's all in the env file.
I think if I removed the "current image" state from our ImageProgrammerProtocol ABC, this would even allow mixing and matching programmers, although I'm not sure how the activation/deactivation would work:
Does this makes sense as a path forward? Is there a better way to do what we are trying to do?
Beta Was this translation helpful? Give feedback.
All reactions