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

Commit 0ec9b0eb authored by David Anderson's avatar David Anderson
Browse files

snapuesrd: Build snapuserd_test on host.

Bug: 288273605
Test: snapuserd_test
Change-Id: I10e099feff30f09b8c9f0b9dcca64336cb0861b9
parent 27add511
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ cc_library_static {
    ramdisk_available: true,
    vendor_ramdisk_available: true,
    recovery_available: true,
    host_supported: true,
}

cc_defaults {
@@ -256,4 +257,5 @@ cc_test {
    },
    auto_gen_config: true,
    require_root: false,
    host_supported: true,
}
+4 −2
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@

#pragma once

#include <linux/types.h>

namespace android {
namespace snapshot {

@@ -70,7 +72,7 @@ struct disk_header {

    /* In sectors */
    uint32_t chunk_size;
} __packed;
} __attribute__((packed));

// A disk exception is a mapping of old_chunk to new_chunk
// old_chunk is the chunk ID of a dm-snapshot device.
@@ -78,7 +80,7 @@ struct disk_header {
struct disk_exception {
    uint64_t old_chunk;
    uint64_t new_chunk;
} __packed;
} __attribute__((packed));

// Control structures to communicate with dm-user
// It comprises of header and a payload
+8 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#include "handler_manager.h"
#include "snapuserd_core.h"
#include "testing/dm_user_harness.h"
#include "testing/host_harness.h"
#include "testing/temp_device.h"
#include "utility.h"

@@ -80,7 +81,11 @@ class SnapuserdTestBase : public ::testing::Test {
};

void SnapuserdTestBase::SetUp() {
#if __ANDROID__
    harness_ = std::make_unique<DmUserTestHarness>();
#else
    harness_ = std::make_unique<HostTestHarness>();
#endif
}

void SnapuserdTestBase::TearDown() {}
@@ -269,7 +274,9 @@ void SnapuserdTest::TearDown() {
}

void SnapuserdTest::Shutdown() {
    if (dmuser_dev_) {
        ASSERT_TRUE(dmuser_dev_->Destroy());
    }

    auto misc_device = "/dev/dm-user/" + system_device_ctrl_name_;
    ASSERT_TRUE(handlers_->DeleteHandler(system_device_ctrl_name_));