summaryrefslogtreecommitdiffstats
path: root/tests/component/install_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/component/install_test.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/component/install_test.cpp b/tests/component/install_test.cpp
index 7bb496066..d19d788e4 100644
--- a/tests/component/install_test.cpp
+++ b/tests/component/install_test.cpp
@@ -37,7 +37,7 @@
TEST(InstallTest, verify_package_compatibility_no_entry) {
TemporaryFile temp_file;
- FILE* zip_file = fdopen(temp_file.fd, "w");
+ FILE* zip_file = fdopen(temp_file.release(), "w");
ZipWriter writer(zip_file);
// The archive must have something to be opened correctly.
ASSERT_EQ(0, writer.StartEntry("dummy_entry", 0));
@@ -54,7 +54,7 @@ TEST(InstallTest, verify_package_compatibility_no_entry) {
TEST(InstallTest, verify_package_compatibility_invalid_entry) {
TemporaryFile temp_file;
- FILE* zip_file = fdopen(temp_file.fd, "w");
+ FILE* zip_file = fdopen(temp_file.release(), "w");
ZipWriter writer(zip_file);
ASSERT_EQ(0, writer.StartEntry("compatibility.zip", 0));
ASSERT_EQ(0, writer.FinishEntry());
@@ -70,7 +70,7 @@ TEST(InstallTest, verify_package_compatibility_invalid_entry) {
TEST(InstallTest, read_metadata_from_package_smoke) {
TemporaryFile temp_file;
- FILE* zip_file = fdopen(temp_file.fd, "w");
+ FILE* zip_file = fdopen(temp_file.release(), "w");
ZipWriter writer(zip_file);
ASSERT_EQ(0, writer.StartEntry("META-INF/com/android/metadata", kCompressStored));
const std::string content("abcdefg");
@@ -87,7 +87,7 @@ TEST(InstallTest, read_metadata_from_package_smoke) {
CloseArchive(zip);
TemporaryFile temp_file2;
- FILE* zip_file2 = fdopen(temp_file2.fd, "w");
+ FILE* zip_file2 = fdopen(temp_file2.release(), "w");
ZipWriter writer2(zip_file2);
ASSERT_EQ(0, writer2.StartEntry("META-INF/com/android/metadata", kCompressDeflated));
ASSERT_EQ(0, writer2.WriteBytes(content.data(), content.size()));
@@ -104,7 +104,7 @@ TEST(InstallTest, read_metadata_from_package_smoke) {
TEST(InstallTest, read_metadata_from_package_no_entry) {
TemporaryFile temp_file;
- FILE* zip_file = fdopen(temp_file.fd, "w");
+ FILE* zip_file = fdopen(temp_file.release(), "w");
ZipWriter writer(zip_file);
ASSERT_EQ(0, writer.StartEntry("dummy_entry", kCompressStored));
ASSERT_EQ(0, writer.FinishEntry());
@@ -120,7 +120,7 @@ TEST(InstallTest, read_metadata_from_package_no_entry) {
TEST(InstallTest, verify_package_compatibility_with_libvintf_malformed_xml) {
TemporaryFile compatibility_zip_file;
- FILE* compatibility_zip = fdopen(compatibility_zip_file.fd, "w");
+ FILE* compatibility_zip = fdopen(compatibility_zip_file.release(), "w");
ZipWriter compatibility_zip_writer(compatibility_zip);
ASSERT_EQ(0, compatibility_zip_writer.StartEntry("system_manifest.xml", kCompressDeflated));
std::string malformed_xml = "malformed";
@@ -130,7 +130,7 @@ TEST(InstallTest, verify_package_compatibility_with_libvintf_malformed_xml) {
ASSERT_EQ(0, fclose(compatibility_zip));
TemporaryFile temp_file;
- FILE* zip_file = fdopen(temp_file.fd, "w");
+ FILE* zip_file = fdopen(temp_file.release(), "w");
ZipWriter writer(zip_file);
ASSERT_EQ(0, writer.StartEntry("compatibility.zip", kCompressStored));
std::string compatibility_zip_content;
@@ -165,7 +165,7 @@ TEST(InstallTest, verify_package_compatibility_with_libvintf_system_manifest_xml
ASSERT_TRUE(
android::base::ReadFileToString(system_manifest_xml_path, &system_manifest_xml_content));
TemporaryFile compatibility_zip_file;
- FILE* compatibility_zip = fdopen(compatibility_zip_file.fd, "w");
+ FILE* compatibility_zip = fdopen(compatibility_zip_file.release(), "w");
ZipWriter compatibility_zip_writer(compatibility_zip);
ASSERT_EQ(0, compatibility_zip_writer.StartEntry("system_manifest.xml", kCompressDeflated));
ASSERT_EQ(0, compatibility_zip_writer.WriteBytes(system_manifest_xml_content.data(),
@@ -175,7 +175,7 @@ TEST(InstallTest, verify_package_compatibility_with_libvintf_system_manifest_xml
ASSERT_EQ(0, fclose(compatibility_zip));
TemporaryFile temp_file;
- FILE* zip_file = fdopen(temp_file.fd, "w");
+ FILE* zip_file = fdopen(temp_file.release(), "w");
ZipWriter writer(zip_file);
ASSERT_EQ(0, writer.StartEntry("compatibility.zip", kCompressStored));
std::string compatibility_zip_content;
@@ -202,7 +202,7 @@ TEST(InstallTest, verify_package_compatibility_with_libvintf_system_manifest_xml
#ifdef AB_OTA_UPDATER
static void VerifyAbUpdateBinaryCommand(const std::string& serialno, bool success = true) {
TemporaryFile temp_file;
- FILE* zip_file = fdopen(temp_file.fd, "w");
+ FILE* zip_file = fdopen(temp_file.release(), "w");
ZipWriter writer(zip_file);
ASSERT_EQ(0, writer.StartEntry("payload.bin", kCompressStored));
ASSERT_EQ(0, writer.FinishEntry());
@@ -258,7 +258,7 @@ TEST(InstallTest, update_binary_command_smoke) {
VerifyAbUpdateBinaryCommand({});
#else
TemporaryFile temp_file;
- FILE* zip_file = fdopen(temp_file.fd, "w");
+ FILE* zip_file = fdopen(temp_file.release(), "w");
ZipWriter writer(zip_file);
static constexpr const char* UPDATE_BINARY_NAME = "META-INF/com/google/android/update-binary";
ASSERT_EQ(0, writer.StartEntry(UPDATE_BINARY_NAME, kCompressStored));
@@ -303,7 +303,7 @@ TEST(InstallTest, update_binary_command_smoke) {
TEST(InstallTest, update_binary_command_invalid) {
#ifdef AB_OTA_UPDATER
TemporaryFile temp_file;
- FILE* zip_file = fdopen(temp_file.fd, "w");
+ FILE* zip_file = fdopen(temp_file.release(), "w");
ZipWriter writer(zip_file);
// Missing payload_properties.txt.
ASSERT_EQ(0, writer.StartEntry("payload.bin", kCompressStored));
@@ -334,7 +334,7 @@ TEST(InstallTest, update_binary_command_invalid) {
CloseArchive(zip);
#else
TemporaryFile temp_file;
- FILE* zip_file = fdopen(temp_file.fd, "w");
+ FILE* zip_file = fdopen(temp_file.release(), "w");
ZipWriter writer(zip_file);
// The archive must have something to be opened correctly.
ASSERT_EQ(0, writer.StartEntry("dummy_entry", 0));