Commit graph

16 commits

Author SHA1 Message Date
Peter Hutterer
99b36ba652 test: add a test for pointer vs abs pointer receiving 2023-04-06 13:57:20 +10:00
Peter Hutterer
7f7880d953 test: add test for receiving the device interfaces 2023-04-06 13:57:20 +10:00
Peter Hutterer
6179c91580 test: fix the exception check for the missing eiproto module
When running pytest from the source directory we get a
ModuleNotFoundError, not an ImportError.
2023-04-06 12:04:35 +10:00
Peter Hutterer
0aa8bab9c0 test: drop the default timeouts to 2
There's no need to wait any longer.
2023-04-05 14:22:31 +10:00
Peter Hutterer
a806968ec5 test: up the timeout for dispatch
10ms isn't enough, esp. when running under valgrind
2023-03-03 11:27:01 +10:00
Peter Hutterer
037e092b62 test: throw an exception if sock.connect fails
We don't want to drop the error here, we need to see why something
failed.
2023-03-03 11:27:01 +10:00
Peter Hutterer
9b390f5703 eis: don't send a disconnected event when the client requests disconnect
As the protocol spec says, EIS should treat this as already disconnected
and not touch the connection.

This fixes a memleak if a client connects and immediately disconnects -
when EIS processes the EIS_EVENT_CLIENT_CONNECT it may set up a bunch of
things like seats (the eis-demo-server does this). Then, later, when
the EIS_EVENTE_CLIENT_DISCONNECT is processed, it calls
eis_client_disconnect() but we were already in the disconnected state
and the seats would not get released.
2023-03-03 11:27:01 +10:00
Peter Hutterer
1b34bc6f7c test: distinguish better between stderr/stdout of the subprocess 2023-03-03 11:27:01 +10:00
Peter Hutterer
1a64b4963d Check incoming ids for validity
In libei we just check the range is correct.
In libeis we also check that the client is monotonically increasing the
id.
2023-03-03 11:27:01 +10:00
Peter Hutterer
c832ce3ddc protocol: split the handshake version negotiation from the other interfaces
Previously, we'd send one interface_version event for "ei_handshake"
immediately but all others after the client requests handshake.finish.
This was too confusing to document and not clear how it would work, so
let's make this simpler by splitting it up.

There is now a handshake_version event from the server, sent immediately
on connection that denotes the maximum version number for the interface.
And a handshake_version request from the client which must be the first
one by the client.
2023-03-03 11:27:01 +10:00
Peter Hutterer
35f5fa102c proto: rename ei_connection_setup to ei_handshake
This is a better name for the initial handshake and easier to
distinguish from the ei_connection this way too.

Suggested by Jonas Ådahl.
2023-03-03 11:27:01 +10:00
Peter Hutterer
2aaf7acdfc test: fix a ruff warning - f-string without placeholder 2023-03-03 11:27:01 +10:00
Peter Hutterer
705c5d79ac test: remove unused python import 2023-03-03 11:27:01 +10:00
Peter Hutterer
47467bfe0e proto: rename connection_setup.done to .finish
Avoids ambiguity with the .done events from e.g. the seat or the device.
2023-03-03 11:27:01 +10:00
Peter Hutterer
0897722493 proto: drop the seat caps and cross-reference device caps instead 2023-03-03 11:27:01 +10:00
Peter Hutterer
3fa396c012 test: add a framework for doing protocol tests directly
This tests the protocol layer which is hard to test using libei/libeis.
Similar to the generated C bindings we compile a eiproto.py file that is
then used in the test to talk protocol directly to the eis-demo-server
that we start up.

By sending the specific messages and checking things happen as we expect
on the socket we can verify that the EIS implementation is correct (and
robust enough).

In theory this could also be used to test some other binary with an EIS
implementation and the scaffolding is there to set LIBEI_TEST_SERVER to
that binary. Wether this works is untested though...
2023-03-03 11:27:01 +10:00