Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 717b97a2 authored by David Anderson's avatar David Anderson
Browse files

libdm: Fix failing test on older kernels.

This test was added only for behavior introduced in the 5.15 kernel, where uevents are delayed until a table is laoded.

Bug: 263291020
Test: libdm_test
Change-Id: I6236c4304d8e6b780704df405290f7361d5827cc
parent 0af9ab33
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <time.h>
#include <unistd.h>

@@ -692,7 +693,17 @@ TEST(libdm, CreateEmptyDevice) {
}

TEST(libdm, UeventAfterLoadTable) {
    static const char* kDeviceName = "libmd-test-uevent-load-table";
    static const char* kDeviceName = "libdm-test-uevent-load-table";

    struct utsname u;
    ASSERT_EQ(uname(&u), 0);

    unsigned int major, minor;
    ASSERT_EQ(sscanf(u.release, "%u.%u", &major, &minor), 2);

    if (major < 5 || (major == 5 && minor < 15)) {
        GTEST_SKIP() << "Skipping test on kernel < 5.15";
    }

    DeviceMapper& dm = DeviceMapper::Instance();
    ASSERT_TRUE(dm.CreateEmptyDevice(kDeviceName));