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

Commit 333639e9 authored by Akilesh Kailash's avatar Akilesh Kailash
Browse files

libsnaphot: Refactor cow_snapuserd test



Refact cow_snapuserd unit test. This will
test code changes in daemon in isolation. Currently it tests

1: Reading snapshot device and validate data
2: Merge and validate data.

More tests related to merge will be added later; but this
should provide a baseline unit test for daemon.

BUG: 168311203
Test: cow_snapuserd_test

Signed-off-by: default avatarAkilesh Kailash <akailash@google.com>
Change-Id: I4d77c435a9f045204a4ff3ece524c857f9fba50f
parent 03f4504f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -563,6 +563,7 @@ cc_test {
        "libsnapshot_snapuserd",
        "libcutils_sockets",
        "libz",
	"libfs_mgr",
        "libdm",
    ],
    header_libs: [
+276 −323

File changed.

Preview size limit exceeded, changes collapsed.

+2 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ bool EnsureSnapuserdStarted() {
SnapuserdClient::SnapuserdClient(android::base::unique_fd&& sockfd) : sockfd_(std::move(sockfd)) {}

static inline bool IsRetryErrno() {
    return errno == ECONNREFUSED || errno == EINTR;
    return errno == ECONNREFUSED || errno == EINTR || errno == ENOENT;
}

std::unique_ptr<SnapuserdClient> SnapuserdClient::Connect(const std::string& socket_name,
@@ -112,6 +112,7 @@ bool SnapuserdClient::ValidateConnection() {
}

bool SnapuserdClient::Sendmsg(const std::string& msg) {
    LOG(DEBUG) << "Sendmsg: msg " << msg << " sockfd: " << sockfd_;
    ssize_t numBytesSent = TEMP_FAILURE_RETRY(send(sockfd_, msg.data(), msg.size(), 0));
    if (numBytesSent < 0) {
        PLOG(ERROR) << "Send failed";