mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 12:50:33 +01:00
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> |
||
|---|---|---|
| .. | ||
| 50-litest.conf | ||
| build-cxx.cc | ||
| build-pedantic.c | ||
| device.c | ||
| keyboard.c | ||
| litest-alps-semi-mt.c | ||
| litest-atmel-hover.c | ||
| litest-bcm5974.c | ||
| litest-generic-singletouch.c | ||
| litest-int.h | ||
| litest-keyboard-razer-blackwidow.c | ||
| litest-keyboard.c | ||
| litest-logitech-trackball.c | ||
| litest-mouse-roccat.c | ||
| litest-mouse.c | ||
| litest-ms-surface-cover.c | ||
| litest-protocol-a-touch-screen.c | ||
| litest-qemu-usb-tablet.c | ||
| litest-selftest.c | ||
| litest-synaptics-hover.c | ||
| litest-synaptics-st.c | ||
| litest-synaptics-t440.c | ||
| litest-synaptics-x1-carbon-3rd.c | ||
| litest-synaptics.c | ||
| litest-trackpoint.c | ||
| litest-vmware-virtual-usb-mouse.c | ||
| litest-wacom-intuos-finger.c | ||
| litest-wacom-touch.c | ||
| litest-wheel-only.c | ||
| litest-xen-virtual-pointer.c | ||
| litest.c | ||
| litest.h | ||
| log.c | ||
| Makefile.am | ||
| misc.c | ||
| path.c | ||
| pointer.c | ||
| symbols-leak-test.in | ||
| touch.c | ||
| touchpad.c | ||
| trackpoint.c | ||
| udev.c | ||
| valgrind.suppressions | ||