Run unit-test during development

Patrick Williams patrick at stwcx.xyz
Tue Dec 14 03:00:49 AEDT 2021


On Mon, Dec 13, 2021 at 04:46:13PM +0800, Deng Tyler wrote:
> Hi All:
>     Is there any easier way to run unit-test during development instead of
> running run-unit-test-docker.sh?

If the repository is built using autotools or CMake there probably aren't a lot
of other options.  Yocto has something called 'ptest' which would, in theory,
allow the package to build test-cases and deploy them onto the hardware to run
the unit tests.  We don't have many repositories configured to support ptest
though.

Any repository that is building using Meson should be able to run the unit tests
on a typical Linux development box.  Some of them have not fully implemented
this though.  What you want to look for is if the repository has a 'meson.build'
and 'subprojects' subdirectory that contains a number of 'foo.wrap' files.  If
it has this, you can probably build the repository outside of
`run-unit-test-docker.sh` or a Yocto OE-SDK environment.

In that case, simply `meson builddir && ninja -C builddir test`.

If you come across a repository that supports Meson (meson.build file) but
doesn't have correct wrap files, those can be added fairly easily.  I suspect
you could use these repositories as a reference:

```
$ ls */subprojects/phosphor-logging.wrap
dbus-sensors/subprojects/phosphor-logging.wrap
google-misc/subprojects/phosphor-logging.wrap
openpower-debug-collector/subprojects/phosphor-logging.wrap
openpower-occ-control/subprojects/phosphor-logging.wrap
openpower-vpd-parser/subprojects/phosphor-logging.wrap
phosphor-bmc-code-mgmt/subprojects/phosphor-logging.wrap
phosphor-certificate-manager/subprojects/phosphor-logging.wrap
phosphor-debug-collector/subprojects/phosphor-logging.wrap
phosphor-health-monitor/subprojects/phosphor-logging.wrap
phosphor-led-manager/subprojects/phosphor-logging.wrap
phosphor-networkd/subprojects/phosphor-logging.wrap
phosphor-objmgr/subprojects/phosphor-logging.wrap
phosphor-sel-logger/subprojects/phosphor-logging.wrap
phosphor-virtual-sensor/subprojects/phosphor-logging.wrap
phosphor-watchdog/subprojects/phosphor-logging.wrap
service-config-manager/subprojects/phosphor-logging.wrap
telemetry/subprojects/phosphor-logging.wrap
```

-- 
Patrick Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20211213/c5f3e623/attachment.sig>


More information about the openbmc mailing list