[WESTON patch 2/2] tests: add tests for devices handling

Pekka Paalanen ppaalanen at gmail.com
Mon Mar 23 04:39:29 PDT 2015


On Mon, 23 Mar 2015 07:21:24 -0400
Marek Chalupa <mchqwerty at gmail.com> wrote:

> Hi,
> 
> On Thu, Mar 19, 2015 at 10:51 AM, Pekka Paalanen <ppaalanen at gmail.com>
> wrote:
> 
> > On Thu, 19 Mar 2015 03:38:52 -0400
> > Marek Chalupa <mchqwerty at gmail.com> wrote:
> >
> > > Test misc races when adding/releasing devices. One of the
> > > tests reveals a race that is not currently handled by Weston.
> > >
> > > Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
> > > ---
> > >  Makefile.am          |   7 ++-
> > >  tests/devices-test.c | 160
> > +++++++++++++++++++++++++++++++++++++++++++++++++++
> > >  2 files changed, 166 insertions(+), 1 deletion(-)
> > >  create mode 100644 tests/devices-test.c
> > >

> > > +}
> > > +
> > > +TEST(get_device_afer_destroy_multiple)
> > > +{
> > > +     int i;
> > > +
> > > +     /* if weston crashed during this test, then there is
> > > +      * some inconsistency */
> > > +     for (i = 0; i < 100; ++i) {
> > > +             get_device_after_destroy();
> > > +     }
> > > +}
> >
> > I ran this series of 4 patches (one for wayland) and got:
> >
> > test-client: got global pointer 100 100
> > test-client: got keyboard keymap
> > test-client: got surface enter output 0x15d3720
> > test-client: got keyboard modifiers 0 0 0 0
> > test-client: got pointer enter 0 0, surface 0x15d3ad0
> > libwayland: wl_display at 1: error 1: invalid method 1 (since 1 < 3), object
> > wl_pointer at 13
> > devices.weston: tests/devices-test.c:133: get_device_after_destroy:
> > Assertion `wl_display_roundtrip((cl)->wl_display)
> > >= 0' failed.
> > test "get_device_afer_destroy_multiple":        signal 6, fail.
> >
> > I suppose the client helpers do not bind the correct version. I think
> > all tests that attempt to use release requests fail with this.
> >
> >
> Oops, yes. I have patched it locally but totally forgot about it. I'll send
> a patch.
> 
> 
> >
> > Is this the test that you expect Weston to fail?
> > devices.weston: tests/devices-test.c:40: seat_capabilities_test: Assertion
> > `!cl->input->pointer' failed.
> >
> 
> Nope, not at all. Do you have more output? I can't reproduce it.

I don't recall there was any other output, but I'll test again once
you've revised the series. I wonder if it is because I have a
trackpoint, touchpad, and an external mouse - maybe those get counted
as 2 or 3 mice. As they should, no?

> > There is also a fundamental weakness in all these tests. They assume
> > that the seat has a keyboard and a pointer to begin with. That might
> > not be the case when running with a real backend.
> >
> >
> Yep. Actually, more (all?) tests assume that. For example keyboard-test.c
> does not even check if the client has keyboard.
> Maybe we should just skip the tests when the backend has insufficient
> capabilities. (If we won't be using the test seat as you
> proposed below)
> 
> 
> > A obvious further addition would be the same for wl_touch.
> >
> 
> Yes. wl_touch is not implemented at all in tests, so I did do so in this
> test too. Once we implement it, we can add it.
> 
> 
> >
> > Maybe we should have a separate "test" seat, created by the test
> > plugin? But I'm not sure how test clients would know to pick the right
> > seat then.
> >
> >
> Maybe we could just create test seat with missing objects. I mean when
> backend provides seat with keyboard but nothing more,
> we would create another seat that would provide pointer and touch. How is
> it in such set-up? Can Weston handle multi-seat?
> 
> Or (almost) equivalently, the test plugin could just create the missing
> devices on the default seat when they are not present.

Weston should handle multiple wl_seats just fine. (Another thing to
test for!) Note that multiple wl_seats is not multi-seat, because the
latter refers to physical seats. It's more like multi-pointer.

However, I don't think we can make "add devices that didn't already
exist" work in all cases. What if the real seat has multiple mice
devices behind the same wl_pointer? Pointer capability in weston is
refcounted, you have to remove all pointer devices for it to disappear.

That's why I think we are going to need a separate test seat (or many!)
for tests, where we know what's in it.

Maybe test wl_seat should start with no devices, which would allow our
test clients to recognize it.


Thanks,
pq


More information about the wayland-devel mailing list