From 800946a6733f19e430fa87c3b30628149114d649 Mon Sep 17 00:00:00 2001 From: Niclas Zeising Date: Mon, 10 Aug 2020 23:16:08 +0200 Subject: [PATCH] tests: Use CLOCK_MONOTONIC_FAST on FreeBSD 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 --- test/test-libevdev-init.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/test-libevdev-init.c b/test/test-libevdev-init.c index e413e75..87d2910 100644 --- a/test/test-libevdev-init.c +++ b/test/test-libevdev-init.c @@ -559,6 +559,7 @@ START_TEST(test_set_clock_id) { struct uinput_device* uidev; struct libevdev *dev; + int clockid; int rc; test_create_device(&uidev, &dev, @@ -577,7 +578,13 @@ START_TEST(test_set_clock_id) rc = libevdev_set_clock_id(dev, CLOCK_MONOTONIC); ck_assert_int_eq(rc, 0); - rc = libevdev_set_clock_id(dev, CLOCK_MONOTONIC_RAW); +#ifdef __FreeBSD__ + clockid = CLOCK_MONOTONIC_FAST; +#else + clockid = CLOCK_MONOTONIC_RAW; +#endif + + rc = libevdev_set_clock_id(dev, clockid); ck_assert_int_eq(rc, -EINVAL); uinput_device_free(uidev); -- 2.34.1