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

Commit 92b7d837 authored by Akilesh Kailash's avatar Akilesh Kailash
Browse files

snapuserd_test: check writer != nullptr



Cow Writer used to fail with ENOSPC during initialization.

Try temporaryFile creation with path set to current working directory.

Bug: 328879200
Test: th, snapuserd_test
Change-Id: I7b3833967952c74142f1d5a35cb8d94dd6d894fc
Signed-off-by: default avatarAkilesh Kailash <akailash@google.com>
parent 6ec79b56
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -126,7 +126,8 @@ void SnapuserdTestBase::CreateBaseDevice() {
}
}


std::unique_ptr<ICowWriter> SnapuserdTestBase::CreateCowDeviceInternal() {
std::unique_ptr<ICowWriter> SnapuserdTestBase::CreateCowDeviceInternal() {
    cow_system_ = std::make_unique<TemporaryFile>();
    std::string path = android::base::GetExecutableDirectory();
    cow_system_ = std::make_unique<TemporaryFile>(path);


    CowOptions options;
    CowOptions options;
    options.compression = "gz";
    options.compression = "gz";
@@ -147,7 +148,8 @@ std::unique_ptr<ICowWriter> SnapuserdTestBase::CreateV3Cow() {
    options.batch_write = true;
    options.batch_write = true;
    options.compression_factor = params.block_size;
    options.compression_factor = params.block_size;


    cow_system_ = std::make_unique<TemporaryFile>();
    std::string path = android::base::GetExecutableDirectory();
    cow_system_ = std::make_unique<TemporaryFile>(path);


    unique_fd fd(cow_system_->fd);
    unique_fd fd(cow_system_->fd);
    cow_system_->fd = -1;
    cow_system_->fd = -1;
@@ -989,6 +991,7 @@ void SnapuserdVariableBlockSizeTest::SetupCowV3ForVariableBlockSize() {
void SnapuserdVariableBlockSizeTest::CreateV3CowDeviceForVariableBlockSize() {
void SnapuserdVariableBlockSizeTest::CreateV3CowDeviceForVariableBlockSize() {
    auto writer = CreateV3Cow();
    auto writer = CreateV3Cow();


    ASSERT_NE(writer, nullptr);
    size_t total_data_to_write = size_;
    size_t total_data_to_write = size_;


    size_t total_blocks_to_write = total_data_to_write / BLOCK_SZ;
    size_t total_blocks_to_write = total_data_to_write / BLOCK_SZ;
@@ -1337,6 +1340,7 @@ void HandlerTestV3::TearDown() {
void HandlerTestV3::SetUpV3Cow() {
void HandlerTestV3::SetUpV3Cow() {
    auto writer = CreateV3Cow();
    auto writer = CreateV3Cow();


    ASSERT_NE(writer, nullptr);
    size_t total_data_to_write = size_;
    size_t total_data_to_write = size_;


    size_t total_blocks_to_write = total_data_to_write / BLOCK_SZ;
    size_t total_blocks_to_write = total_data_to_write / BLOCK_SZ;