Commit graph

12 commits

Author SHA1 Message Date
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