tests: Use CLOCK_MONOTONIC_FAST on FreeBSD
authorNiclas Zeising <zeising@daemonic.se>
Mon, 10 Aug 2020 21:16:08 +0000 (23:16 +0200)
committerNiclas Zeising <zeising@daemonic.se>
Fri, 14 Aug 2020 15:50:56 +0000 (17:50 +0200)
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>
test/test-libevdev-init.c

index e413e75..87d2910 100644 (file)
@@ -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);