I am looking to implement collection of code coverage data from running unit tests on target hardware. The project has been able to use the Unity test framework, and tests are built and run on the target using app runProc AppName --exe=TestAppExe
Ideally I’d use gcov as the compiler is gcc. I have previously used lcov to use this and generate visual output. Perhaps someone has already done this??
Some questions:
If a sandboxed application is writing files, where will they go and how can they be accessed?
Is there a straightforward way to install gcov and lcov tools onto the target, or do they need to cross-compiled from source?
Instead of running tests to get coverage on the target, is it easier to run them on the host, and if so, how can that be done (i.e. build and run a Legato application on a Linux build host)?
- If a sandboxed application is writing files, where will they go and how can they be accessed?
Legato sandboxes use chroot to limit a Legato App view to its own section of the file system only. Files are bound into the chroot jail using bind mounts. The process then only has access to files and directories under its root directory. Only processes with certain capabilities can find their way outside of their root directory; processes belonging to sandboxed Legato Apps run as unprivileged users that don’t have those capabilities. See also Security - Legato Docs
“sbtrace” (target tool) and “sbhelper” (host tool) can list the files a sandboxed Legato App is trying to access. See Sandbox Helper - Legato Docs
- Is there a straightforward way to install gcov and lcov tools onto the target, or do they need to cross-compiled from source?
- Instead of running tests to get coverage on the target, is it easier to run them on the host, and if so, how can that be done (i.e. build and run a Legato application on a Linux build host)?
It is possible to run a Legato Framework + Apps on a Linux host: see startlegato - Legato Docs
But, running your software outside of the target environment will result in some mobile-oriented features becoming either disabled or simulated.
So the code coverage area will become narrower.