Add update_engine_host_unittests
Some of update_engine's codebase (payload generator stuff) run on host.
So it make sense to test them on the host. Adding a new unittest target
update_engine_host_unittests, which includes a subset of unittest. After
this CL, the old update_engine_unittests target remains unchanged, it
still contains all 600 unittests. The new host target will contain a
subset of these.
Test: th
Change-Id: I49c8310cee9a2b2ea197b8ab60ea3b00bf5680cf
diff --git a/payload_generator/zip_unittest.cc b/payload_generator/zip_unittest.cc
index 10e899b..6e1f5a3 100644
--- a/payload_generator/zip_unittest.cc
+++ b/payload_generator/zip_unittest.cc
@@ -21,6 +21,7 @@
#include <string>
#include <vector>
+#include <brillo/secure_blob.h>
#include <gtest/gtest.h>
#include "update_engine/common/test_utils.h"
@@ -54,7 +55,6 @@
return true;
}
bool Write(const void* bytes, size_t count) override {
- data_->reserve(data_->size() + count);
data_->insert(data_->end(),
static_cast<const uint8_t*>(bytes),
static_cast<const uint8_t*>(bytes) + count);
@@ -67,6 +67,7 @@
template <typename W>
bool DecompressWithWriter(const brillo::Blob& in, brillo::Blob* out) {
+ out->reserve(in.size());
std::unique_ptr<ExtentWriter> writer(
new W(std::make_unique<MemoryExtentWriter>(out)));
// Init() parameters are ignored by the testing MemoryExtentWriter.
@@ -163,7 +164,7 @@
TYPED_TEST(ZipTest, CompressELFTest) {
string path = test_utils::GetBuildArtifactsPath("delta_generator");
brillo::Blob in;
- utils::ReadFile(path, &in);
+ ASSERT_TRUE(utils::ReadFile(path, &in));
brillo::Blob out;
EXPECT_TRUE(this->ZipCompress(in, &out));
EXPECT_LT(out.size(), in.size());