[PATCH wayland 3/3] tests: Test proxy versions

Pekka Paalanen ppaalanen at gmail.com
Thu Jan 14 00:34:14 PST 2016


Oh wait!

One more thing...

On Thu, 14 Jan 2016 10:28:32 +0200
Pekka Paalanen <ppaalanen at gmail.com> wrote:

> On Tue, 12 Jan 2016 16:28:47 -0600
> Derek Foreman <derekf at osg.samsung.com> wrote:
> 
> > Add a test that confirms that proxy versions are always 0 for display
> > and correct otherwise.
> > 
> > Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
> > ---
> >  tests/display-test.c | 41 +++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 41 insertions(+)
> > 
> > diff --git a/tests/display-test.c b/tests/display-test.c
> > index 161a402..7a0aa91 100644
> > --- a/tests/display-test.c
> > +++ b/tests/display-test.c
> > @@ -609,3 +609,43 @@ TEST(threading_read_after_error_tst)
> >  
> >  	display_destroy(d);
> >  }
> > +
> > +static int expected_version;
> > +
> > +static void
> > +seat_version_main(void)
> > +{
> > +	struct client *c = client_connect();
> > +	struct wl_seat *seat = client_get_seat(c);
> > +	int ver;
> > +
> > +	/* display proxy should always be version 0 */
> > +	ver = wl_proxy_get_version((struct wl_proxy *) c->wl_display);
> > +	assert(ver == 0);
> > +
> > +	ver = wl_proxy_get_version((struct wl_proxy *) seat);
> > +	assert(ver == expected_version);
> > +
> > +	wl_proxy_destroy((struct wl_proxy *) seat);
> > +	client_disconnect_nocheck(c);
> > +}
> > +
> > +TEST(versions)
> > +{
> > +	struct display *d = display_create();
> > +	struct wl_global *global;
> > +	int i;
> > +
> > +	for (i = 0; i < 5; i++) {

This causes the tests to use versions 0..4 when I think the intention
was to use 1..5. It works, but we always start versioning from 1, so
should fix that here.


Thanks,
pq

> > +		expected_version = i;
> > +		global = wl_global_create(d->wl_display, &wl_seat_interface,
> > +					  expected_version, d, bind_seat);
> > +
> > +		client_create(d, seat_version_main);
> > +		display_run(d);
> > +
> > +		wl_global_destroy(global);
> > +	}
> > +
> > +	display_destroy(d);
> > +}  
> 
> Hi Derek,
> 
> yup, this is half of the minimal testing I was craving for. This test
> is checking that the version bound in wl_registry.bind gets recorded
> correctly.
> 
> Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> 
> It would also be nicer to have the global always at version 5 and then
> bind it with versions 1..5, but I can see that would be more work
> because of client_get_seat().
> 
> The static variable is also a lazy man's solution, but it's ok for now.
> client_create() could be extended to take a void *testdata.
> 
> The other half would be to create e.g. wl_pointer or something from the
> wl_seat and check that the version gets inherited properly.
> 
> Yet another future work item would be to add a test that explicitly
> uses the unversioned libwayland-client ABI to mimic "a software
> component built with old protocol headers" and check the wl_pointer
> version comes back as zero.
> 
> Anyway, I think this is enough to get wl_proxy_get_version() landed now.
> 
> Checking that the inheritance works would be the next most important
> test to add in this story.
> 
> 
> 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: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20160114/8ff4b839/attachment.sig>


More information about the wayland-devel mailing list