howto run unit tests
Hi,
We are trying to run some built binaries as a task in a recipe as a part of unit testing. This can potentially get complicated (though I feel it could/should be abstracted away) as it may need to take care of architecture differences between the host and the build target but for now we are happy to just run for the cases where these match, and possibly later look at using qemu. We are struggling to find any examples of this being done in existing recipes. We managed to manually run what we want by copying built files into the recipe-sysroot directory and using fakechroot but feel there must be an existing way to achieve what we want, and that we just haven't looked for the right thing.
We have also found some docs re ptest however these seem to all relate to running tests on the final resulting image, we wish to be able to run some tests before this, on individual package builds as part of CI.
Can anyone give any pointer re this?
Many Thanks
Signature · 19 lines
*Dan Squires* Developer www.engineeredarts.co.uk <https://www.engineeredarts.co.uk/> EA Phone Number+44 (0)1326 378129 RoboThespian FB <https://www.facebook.com/RobotThespian> RoboThespian Twitter <https://twitter.com/robothespian> EA YouTube <http://youtube.com/EngineeredArts> Engineered Arts Logo <https://www.engineeredarts.co.uk/> * Engineered Arts Ltd * E1-E3 Church View Business Park, Bickland Water Road, Falmouth Cornwall, TR11 4FZ United Kingdom Subscribe to Mailing List <https://www.engineeredarts.co.uk/mailing-list/>
Quoted 8 lines · Daniel Squires
Hi,
We are trying to run some built binaries as a task in a recipe as a part of unit testing. This can potentially get complicated (though I feel it could/should be abstracted away) as it may need to take care of architecture differences between the host and the build target but for now we are happy to just run for the cases where these match, and possibly later look at using qemu. We are struggling to find any examples of this being done in existing recipes. We managed to manually run what we want by copying built files into the recipe-sysroot directory and using fakechroot but feel there must be an existing way to achieve what we want, and that we just haven't looked for the right thing.
We have also found some docs re ptest however these seem to all relate to running tests on the final resulting image, we wish to be able to run some tests before this, on individual package builds as part of CI.
Can anyone give any pointer re this?
Many Thanks
Hi there,
Dunno if this is what you need but these are some very simple examples I put together to exercise the meta-mono layer build.
https://github.com/DynamicDevices/meta-mono/blob/master/lib/oeqa/runtime/cases/mono.py
Cheers,
Alex
Quoted 7 lines · Daniel Squires
We are trying to run some built binaries as a task in a recipe as a part of unit testing. This can potentially get complicated (though I feel it could/should be abstracted away) as it may need to take care of architecture differences between the host and the build target but for now we are happy to just run for the cases where these match, and possibly later look at using qemu.
We are struggling to find any examples of this being done in existing
Quoted 9 lines
recipes. We managed to manually run what we want by copying built files into the recipe-sysroot directory and using fakechroot but feel there must be an existing way to achieve what we want, and that we just haven't looked for the right thing.
We have also found some docs re ptest however these seem to all relate to running tests on the final resulting image, we wish to be able to run some tests before this, on individual package builds as part of CI. Can anyone give any pointer re this?
My suggestion is that you do it right from the start, and use qemu even when the architectures match.
There is a helper class for this: meta/classes/qemu.bbclass. Look at existing uses of it for inspiration.
Alex
Quoted 6 lines · Daniel Squires
We are trying to run some built binaries as a task in a recipe as a part of unit testing. This can potentially get complicated (though I feel it could/should be abstracted away) as it may need to take care of architecture differences between the host and the build target but for now we are happy to just run for the cases where these match, and possibly later look at using qemu.
Quoted 8 lines
We are struggling to find any examples of this being done in existing recipes. We managed to manually run what we want by copying built files into the recipe-sysroot directory and using fakechroot but feel there must be an existing way to achieve what we want, and that we just haven't looked for the right thing.
We have also found some docs re ptest however these seem to all relate to running tests on the final resulting image, we wish to be able to run some tests before this, on individual package builds as part of CI.
Running stuff in qemu at build time is a bit of a pain as qemu-user has some rather sizable gaps, and you can't easily use qemu-system. If your host and target CPUs are compatible you can do horrible things involving fakechroot but that's not recommended.
I'd say it's best to install the tests with ptest, and run them in a complete image as part of the CI.
Ross