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

Commit 3f89eb94 authored by Nikita Ioffe's avatar Nikita Ioffe Committed by Automerger Merge Worker
Browse files

Merge "Deflake libdm#CreateEmptyDevice test" am: 1a257af8

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1768205

Change-Id: I8f93d993529580170b294e4c18d3684376a03d42
parents 01f3306b 1a257af8
Loading
Loading
Loading
Loading
+2 −6
Original line number Original line Diff line number Diff line
@@ -684,13 +684,9 @@ TEST(libdm, DeleteDeviceDeferredWaitsForLastReference) {
TEST(libdm, CreateEmptyDevice) {
TEST(libdm, CreateEmptyDevice) {
    DeviceMapper& dm = DeviceMapper::Instance();
    DeviceMapper& dm = DeviceMapper::Instance();
    ASSERT_TRUE(dm.CreateEmptyDevice("empty-device"));
    ASSERT_TRUE(dm.CreateEmptyDevice("empty-device"));
    auto guard = android::base::make_scope_guard([&]() { dm.DeleteDevice("empty-device", 5s); });
    auto guard =
            android::base::make_scope_guard([&]() { dm.DeleteDeviceIfExists("empty-device", 5s); });


    // Empty device should be in suspended state.
    // Empty device should be in suspended state.
    ASSERT_EQ(DmDeviceState::SUSPENDED, dm.GetState("empty-device"));
    ASSERT_EQ(DmDeviceState::SUSPENDED, dm.GetState("empty-device"));

    std::string path;
    ASSERT_TRUE(dm.WaitForDevice("empty-device", 5s, &path));
    // Path should exist.
    ASSERT_EQ(0, access(path.c_str(), F_OK));
}
}