Merge "snapuserd_test: check writer != nullptr" into main am: 844ce86595

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

Change-Id: Ib9c27d895e4ebe3947984dc78a352da3794673a2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Akilesh Kailash 2024-03-21 03:08:46 +00:00 committed by Automerger Merge Worker
commit baae2f3a5c

View file

@ -126,7 +126,8 @@ void SnapuserdTestBase::CreateBaseDevice() {
}
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;
options.compression = "gz";
@ -147,7 +148,8 @@ std::unique_ptr<ICowWriter> SnapuserdTestBase::CreateV3Cow() {
options.batch_write = true;
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);
cow_system_->fd = -1;
@ -989,6 +991,7 @@ void SnapuserdVariableBlockSizeTest::SetupCowV3ForVariableBlockSize() {
void SnapuserdVariableBlockSizeTest::CreateV3CowDeviceForVariableBlockSize() {
auto writer = CreateV3Cow();
ASSERT_NE(writer, nullptr);
size_t total_data_to_write = size_;
size_t total_blocks_to_write = total_data_to_write / BLOCK_SZ;
@ -1337,6 +1340,7 @@ void HandlerTestV3::TearDown() {
void HandlerTestV3::SetUpV3Cow() {
auto writer = CreateV3Cow();
ASSERT_NE(writer, nullptr);
size_t total_data_to_write = size_;
size_t total_blocks_to_write = total_data_to_write / BLOCK_SZ;