Commit graph

14 commits

Author SHA1 Message Date
Peter Hutterer
2e25741061 test: grab the device before any lid or tablet mode switches
Putting an EVIOCGRAB on the device before sending those events means no-one
else sees those events - particularly upower. This means no-one else knows the
lid is on or off and thus we never blank the screen (or suspend/shut down but
those are inhibited anyway).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-07 18:51:33 +10:00
Peter Hutterer
c35e0e734f test: update valgrind suppressions for a glib leak
Fixed upstream, but it's not in F30 yet so the valgrind tests fail there.
https://gitlab.gnome.org/GNOME/glib/merge_requests/338

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-01 12:03:38 +10:00
Peter Hutterer
31d1aa7f28 test: add another valgrind suppression for Python
This triggers on Fedora 30, even though skip skip the tools options test when
running under valgrind.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-28 16:14:08 +10:00
Peter Hutterer
5cd27b070e tools: add a test for tool option parsing
We don't check for correctness in the output as such, just that whatever
combination of cmdline arguments still works/doesn't work. This is the
scaffolding and a few tests, but needs to be filled in, especially for
libinput measure and for some more complex combinations.

valgrind: requires one more python-related suppression
gitlab-ci: requires another environment variable so we know to skip the
	   --device tests (udev will time out on those)
meson: skip the test run in release builds, we pass the full path to the built
       libinput tool but rely on the subtool lookup that won't work in a
       release build

Fixes #174

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-11-07 05:03:52 +00:00
Peter Hutterer
7165a62e80 test: supress another bash warning
Failing the leftover-rules check in the valgrind stage because

==1491== Invalid read of size 16
==1491==    at 0x5320AE8: __wcsnlen_sse4_1 (in /usr/lib64/libc-2.27.so)
==1491==    by 0x5310AD1: wcsrtombs (in /usr/lib64/libc-2.27.so)
==1491==    by 0x1AA403: ??? (in /usr/bin/bash)
==1491==    by 0x1AB3E3: glob_filename (in /usr/bin/bash)
==1491==    by 0x179FF1: shell_glob_filename (in /usr/bin/bash)
==1491==    by 0x1752CD: ??? (in /usr/bin/bash)
==1491==    by 0x14C05F: ??? (in /usr/bin/bash)
==1491==    by 0x14E2E3: execute_command_internal (in /usr/bin/bash)
==1491==    by 0x14FBC5: execute_command (in /usr/bin/bash)
==1491==    by 0x137598: reader_loop (in /usr/bin/bash)
==1491==    by 0x135D38: main (in /usr/bin/bash)
==1491==  Address 0x5651fd0 is 32 bytes before a block of size 128 in arena "client"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-26 09:51:54 +10:00
Peter Hutterer
75aee30919 test: add a script to check for leftover litest rules
An aborted test run can sometimes leave udev rules as detritus. Test for that
so we don't get test case failures triggered by those rules.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-23 12:41:23 +10:00
Peter Hutterer
399c50dbeb evdev: recover from a lost button count
If the kernel sends us a button press for a button that is thought to be down
we have lost track of the state of the button. Ignore the button press event,
in the hope that the next release makes things right again.

A release event may be masked if another process grabs the device for some
period of time, e.g. libinput debug-events --grab.

https://bugs.freedesktop.org/show_bug.cgi?id=101796

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 09:30:24 +10:00
Peter Hutterer
e877fd605c test: suppress Python3 valgrind errors
Running through mesontest also runs parse-hwdb through valgrind and
gives us a bunch of leaks that originate within Python somewhere - we don't
care about those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-08 20:51:15 +10:00
Peter Hutterer
087d25a54e Merge branch 'master' into tablet-support 2015-05-22 14:21:21 +10:00
Peter Hutterer
84e6321f51 test: add a backtrace facility to litest
The check unit test framework isn't particularly suited to having ck_assert*
calls in helper functions. A failed assertion in a helper function or the
litest framework merely gives us a the failed line in litest.c.
which doesn't tell us which test actually failed.

Add a backtracing facility with litest_backtrace(). And since this requires
wrapping all ck_assert macros with litest_assert() this patch ended up
replacing/duplicating a bunch of ck_assert_* bits. So rather than
ck_assert_int_eq() we now use litest_assert_int_eq(), etc. in the litest
framework itself.

The int comparison macros are more type-safe than ck_assert()'s macros which
just cast all the ints to intmax_t.

Backtrace is spewed to stderr, which is good enough for debugging. Example
backtrace:

	FAILED COMPARISON: status != expected
	Resolved to: 0 != 0
	in disable_button_scrolling() (pointer.c:115)

	Backtrace:
	0: ./test/test-pointer (litest_fail_comparison_int+0xab) [0x40973b]
	1: ./test/test-pointer (disable_button_scrolling+0x174) [0x40421b]
	2: ./test/test-pointer (middlebutton_middleclick+0x40) [0x40829c]
	3: /lib64/libcheck.so.0 (srunner_run+0x7f5) [0x7f0e8a277025]
	4: ./test/test-pointer (litest_run+0x107) [0x40a42b]
	5: ./test/test-pointer (main+0x2fa) [0x4090e7]
	6: /lib64/libc.so.6 (__libc_start_main+0xf0) [0x7f0e88f5e790]
	7: ./test/test-pointer (_start+0x29) [0x403ce9]
	8: ? (?+0x29) [0x29]

litest_backtrace() itself is copied from xserver/os/backtrace.c which git
blame attributes to Marcin.

CC:  Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 20:55:48 +10:00
Peter Hutterer
ea77fd3272 Merge branch 'master' into tablet-support
Conflicts:
	test/litest.h
	test/valgrind.suppressions
2015-03-02 13:57:17 +10:00
Peter Hutterer
9c62daf1d8 tablet: use libwacom to identify tablets for left-handedness
A tablet hotplug event is rare and not a time-critical event, so we load the
database on tablet init and throw it away again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
2015-03-02 13:20:44 +10:00
Peter Hutterer
72cc601007 test: add protocol A touch screen tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-02 12:45:47 +10:00
Peter Hutterer
c073003691 test: automatically run the tests against valgrind for leaks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-04-10 11:11:56 +10:00