Re: Unit testing a wayland client

2016-04-01 Thread Sam Spilsbury
On Fri, Apr 1, 2016 at 9:30 PM, Pekka Paalanen  wrote:
>
> On Fri, 1 Apr 2016 12:57:18 +
> "Wagner, Michael"  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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>



-- 
Sam Spilsbury
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Unit testing a wayland client

2016-04-01 Thread Pekka Paalanen
On Fri, 1 Apr 2016 12:57:18 +
"Wagner, Michael"  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


pgpMaXOzKYY7r.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Unit testing a wayland client

2016-04-01 Thread Wagner, Michael
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?

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.


Thank you,

Michael

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel