Unit testing a wayland client

Pekka Paalanen ppaalanen at gmail.com
Fri Apr 1 13:30:54 UTC 2016


On Fri, 1 Apr 2016 12:57:18 +0000
"Wagner, Michael" <Michael_Wagner at mentor.com> wrote:

> Hi,
> 
> I am currently looking into possibilities for unit testing our
> client whether it calls wayland functions in the correct
> form (order, content, etc.)
> 
> So I wanted to use fake wl_* functions for mocking
> purposes. This seems to be not possible as all the
> wayland-scanner generated protocol functions carry
> the function definition already in the header file.
> This leads to compiler errors (multiple definition).
> 
> My question would be, what is the reasoning behind
> putting all definitions already in the header?

This way we do not need to distribute a shim library along with every
protocol extension. See all the extensions in the wayland-protocols
repository.

> Maybe I'm completely looking into the wrong direction,
> and you have any suggestions on how to unit test a
> client application, any hints would be appreciated.

How about mocking libwayland-client ABI (wayland-client-core.h) instead
of the generated protocol API?

Or, maybe use the real deal and mock up a server instead? Though maybe
that's not unit-testing anymore.

You could also look for inspiration in the Wayland test suite, even
though it is quite ad hoc.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160401/cff7d81c/attachment.sig>


More information about the wayland-devel mailing list