Unit testing a wayland client

Sam Spilsbury smspillaz at gmail.com
Fri Apr 1 14:09:42 UTC 2016


On Fri, Apr 1, 2016 at 9:30 PM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
>
> 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.

For a precedent, I did something similar for Kodi some time ago[0].
Its not really a mock of the server, as much as it is a protocol and
extension for the tests to interact with the client.

[0] https://github.com/MaxKellermann/xbmc/blob/master/xbmc/windowing/tests/wayland/XBMCWaylandTestExtension.cpp

(Sadly, it looks like wayland support was dropped from Kodi due to my
(admitted) failure to maintain it. But I'm glad others are looking
into getting it back into shape).

>
> You could also look for inspiration in the Wayland test suite, even
> though it is quite ad hoc.
>
>
> Thanks,
> pq
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>



-- 
Sam Spilsbury


More information about the wayland-devel mailing list