Commit graph

37 commits

Author SHA1 Message Date
Peter Hutterer
dabd48c028 util: add fd passing to the iobufs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 14:51:53 +10:00
Peter Hutterer
56ca4b4ac7 util: add sending and receiving fds to the io utilities
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 11:49:53 +10:00
Peter Hutterer
91c4bc2a93 libei: handle a late device connect correctly
Where the server connects a device after the client has already removed it, we
need to ignore that message silently.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
c4601b7196 Implement device suspend/resume with starting state of "suspended"
This was already spelled out in the documentation but just not yet
implemented. New starting state for any device added by EIS is "suspended",
the server needs to explicitly resume it before events are accepted.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
f8fa944262 test: add helper functions for checking for no events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
8bddc3008f test: expand the ei tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
a41a025b65 test: add some documentation for the test helpers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
8a8c72b24e test: rename a helper function
This function dispatches until a stable state is reached - that could be no
event waiting or some event waiting to be processed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
1fdbba2ec9 test: rename two tests to reflect current nomenclature
"reject" isn't a thing, "disconnect" is

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
1fe93ae8be Factor out munit test handling into a set of helpers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
4565fb6851 libei: add the hooks for pointer/touch ranges
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
4b0976c36c test: add helpers for the next event
Makes debugging easier since we can get the string event type that way.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
81d37cfde5 test: fix behavior handling for accepting/rejecting clients
Either of those should not modify the behavior for accepting or rejecting
devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
d65c678239 test: add a helper to wait until a stable state
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
a5ea7a6dd0 test: better event type logging
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
c39dc360d4 test: terminate the test list with NULL
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
537fdfde85 Drop ei_next_event_type() and eis_next_event_type()
Replaced by ei_peek_event() and eis_next_event_type()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
b052d30978 test: fix an unused variable complaint
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:34:36 +10:00
Peter Hutterer
8cdbcda7a7 test: add EIS integration tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-12 14:42:09 +10:00
Peter Hutterer
dd426757fb test: fix the suite name for the EI integration tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-12 14:36:10 +10:00
Peter Hutterer
efa01ffc38 test: move the with_server/with_client helper macros to eierpecken.h
We want to re-use those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-12 14:35:41 +10:00
Peter Hutterer
7d75b3eb8c test: use drop caps, not reject caps as terminology
And add a test that tests for dropped caps

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 13:01:36 +10:00
Peter Hutterer
7ae661a029 test: add a test for a device dropped to zero caps and refused
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 13:01:36 +10:00
Peter Hutterer
a95d2bdd8b test: fix the accept/reject behaviour for peck eis contexts
Rejecting means disabling the accept and vice versa

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 13:01:36 +10:00
Peter Hutterer
21d6b6a5ca test: fix the default behaviour of the peck EI context
This is a flag, not a value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 13:01:36 +10:00
Peter Hutterer
3db476930b Add a bunch of log_debug messages
We can remove those when we have a working implementation, for now it's too
painful to debug when an exchange doesn't  work for some reason.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 13:01:36 +10:00
Peter Hutterer
ce51392241 test: fix the device add test
Check that we're actually adding the device and getting the message back

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 10:51:30 +10:00
Peter Hutterer
fb707a3395 Add a prefix to the logger
Makes it easier to distinguish between ei and eis when everything in the tests
is just printed to stderr anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-10 13:50:13 +10:00
Peter Hutterer
626a13268e test: switch to SOCK_STREAM for the test sockets
SOCK_DGRAM gives us free message framing but the sockets we'll likely deal
with (or at least *have* to handle) are stream. This was a leftover anyway
from some debug testing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-07 16:56:10 +10:00
Peter Hutterer
9c2c912353 util: change the sources API to source_new and sink_add_source
This is a more explicit API that makes it more obvious where the ref/unref
calls need to go. The sink now has two refs to the sources as well (epoll data
pointer and the list) which means a caller cannot just source_unref() anymore
without removing a source. Since this is how we've been using it anyway - meh.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-07 14:46:20 +10:00
Peter Hutterer
e6b410a56a test: drain all events before exiting
We don't want valgrind to complain about leaks when we only handle a portion
of the events on the socket.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-07 14:46:20 +10:00
Peter Hutterer
119b9c74b0 test: fix a memleak in the unit tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-07 11:37:51 +10:00
Peter Hutterer
f0a65b3a0f test: add a test for the sources utility functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-07 09:42:37 +10:00
Peter Hutterer
e860d24763 Add a test suite 2020-08-06 16:20:35 +10:00
Peter Hutterer
6a164dfb3a test: remove an unnecssary arg for the iotest
That's what copy/pasting does... this argument is the user_data pointer which
we don't care about here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-06 14:47:40 +10:00
Peter Hutterer
0ab1458241 test: add some internal unit-tests to libei
Similar in style to Rust where the unit tests are in the same file. Let's see
how far we can get with that in C. Auto-discovery of tests by forcing the
respective suites into a special test section so we can collect it later from
our unit runner.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-06 14:47:40 +10:00
Peter Hutterer
f94a7bae85 test: add a test for the util-io helpers
Using munit via a wrap file, let's see if that test suite is scalable to what
we want.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-31 13:05:11 +10:00