summaryrefslogtreecommitdiff
path: root/test/test-libevdev-init.c
Commit message (Collapse)AuthorAgeFilesLines
* tests: Use CLOCK_MONOTONIC_FAST on FreeBSDNiclas Zeising2020-08-141-1/+8
| | | | | | | | FreeBSD does not have CLOCK_MONOTONIC_RAW, instead use CLOCK_MONOTONIC_FAST. This test checks that libevdev_set_clock_id() fails when called with CLOCK_MONOTONIC_[RAW,FAST]. Signed-off-by: Niclas Zeising <zeising@daemonic.se>
* config.h is a local include pathPeter Hutterer2020-02-141-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: split the tests into one test case eachPeter Hutterer2020-02-111-32/+22
| | | | | | | | | For debugging it's more important to be able to quickly run a single test rather than grouping them together, we don't have thousands of tests here anyway. So let's add a macro to put every test func into its own TCase, allowing for test selection via the environment variable CK_RUN_CASE. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: sort-of autodetect whether we need root privilegesPeter Hutterer2018-06-151-1/+1
| | | | | | | | It's not really autodetection, we just declare the test suites that need root privs. But this way we can generically check for it from the main() that we re-use across tests. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: automate test suite handlingPeter Hutterer2018-06-151-2/+1
| | | | | | | | Move all tests to a special section, then loop through that section to fetch all test suite. The result is that new tests only need to add the source files without having to update everything else as well. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Update struct input_eventDeepa Dinamani2018-04-121-10/+10
| | | | | | | | | | The struct input_event is not y2038 safe. Update the struct according to the kernel patch: https://lkml.org/lkml/2018/1/6/324 Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* When changing the fd, reset our grab state to ungrabbedPeter Hutterer2017-12-131-0/+88
| | | | | | | | | | | | | | | | Previously, calling grabbing a device after changing the fd was a no-op because libevdev's grab state didn't match the fd: libevdev_grab(LIBEVDEV_GRAB); .. fd is grabbed .. internal state is 'grabbed' libevdev_change_fd(); .. new fd is ungrabbed .. internal state is 'grabbed' libevdev_grab(LIBEVDEV_GRAB); .. argument matches internal state and we exit without grabbing the device Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* cosmetic: fix a couple of duplicate/missing empty linesPeter Hutterer2015-03-041-1/+0
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: add test for clock id setting on an invalid devicePeter Hutterer2014-11-181-0/+33
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: add test case for grab calls on invalid devicesPeter Hutterer2014-11-181-0/+34
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add per-device log handlersPeter Hutterer2014-06-051-0/+74
| | | | | | | | | | | | | | | | | | | | | | The global log handler isn't a good choice for a low-level library. In the caser of the X server, both evdev and synaptics are now using the libevdev but are loaded from the same server process. Thus, there's only one log handler, but evdev and synaptics don't talk to each other (a bit childish, I know). Add a per-device log handler that overrides the global log handler, and fall back to the global log handler if no device log handler is set. The log macros take care of that automatically, especially as we can't do per-device log handlers for the uinput code. Note that we use the same struct for the global and device logging, so in each instance one of the two function pointers is NULL. Suicide triggers are in place in case we mess that up. This also makes libevdev_new_from_fd() a bit less useful since we can't set the log handler beforehand. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
* test: restore default log priority after testsPeter Hutterer2014-04-081-0/+15
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: remove checks for test device creation failurePeter Hutterer2014-04-021-30/+27
| | | | | | test_create_... fails on a non-zero return code anyway Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: whitespace fixes (newlines)Peter Hutterer2014-03-051-2/+0
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Actually filter by log priorityPeter Hutterer2014-02-131-0/+76
| | | | | | | | If a message is higher than the current priority, filter it. And add a few tests that the priority is handled the way it should. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
* test: abort on unexpected log messagesPeter Hutterer2014-01-221-0/+10
| | | | | | | | | | | Add two log functions, one that aborts on a received message. We know when we expect to receive an error, so anytime this happens unexpectedly should terminate the test. And for those tests do issue a log message, let them ignore it and don't print anything. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix wrong libevdev clock testDavid Herrmann2013-10-311-2/+5
| | | | | | | | | | | | | | | We can rely on CLOCK_MONOTONIC and CLOCK_REALTIME to be different at any time. However, this does not apply to the ms/us/ns parts of the current time. Both may be in sync regarding the current micro-seconds state. So remove the wrong clock us-comparison. I was able to trigger this on my machine. Chances that both are in sync are very low so I assume my RTC only provides low granularity and thus both clocks are sync during boot for higher granularity. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* wrap EVIOCSCLOCKID into an API callPeter Hutterer2013-09-131-0/+108
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* test: add a test for checking log data being passed around correctlyPeter Hutterer2013-09-121-0/+38
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Name-space the read flags betterPeter Hutterer2013-09-111-4/+4
| | | | | | | | Rename from LIBEVDEV_READ_foo to LIBEVDEV_READ_FLAG_foo to differentiate better from LIBEVDEV_READ_STATUS_foo. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* test: test for logging functionPeter Hutterer2013-09-101-8/+21
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Drop per-device logging function, use per-library one insteadPeter Hutterer2013-09-031-6/+9
| | | | | | | | | | | | | | | | There's no need to have separate logging function for each device created. More likely, libevdev will be hooked up once into the logging system and expected to deal with it. Plus, this allows us to log from the uinput code where we don't have the context anyway. Requires a rename to libevdev_set_log_function to avoid ABI breaks, and while we're breaking the ABI make the logging function more sophisticated to log line, number, etc. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
* test: define a common device namePeter Hutterer2013-07-051-3/+3
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: use new convenience function for uinput device creationPeter Hutterer2013-06-291-14/+10
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: prepare a common header file for all testsPeter Hutterer2013-06-291-4/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: fix a bunch of memory leaksPeter Hutterer2013-06-281-0/+4
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: add test case for device grabbingPeter Hutterer2013-06-271-0/+43
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Pull all tests together into one binaryPeter Hutterer2013-06-271-12/+0
| | | | | | Easier to monitor gcov coverage that way Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: add infrastructure for uinput device testsPeter Hutterer2013-06-261-0/+208
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>