aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTao Bao2017-10-24 18:48:32 -0500
committerTao Bao2017-10-26 14:05:57 -0500
commitf29ed3e843409e77db2423e13ac4041cf1445229 (patch)
tree658ded1a6f64c7718101637bfee1007f918dbdfb /tests
parent1bc0117755615b0c022ca738cc40e47a243e3847 (diff)
downloadplatform-bootable-recovery-f29ed3e843409e77db2423e13ac4041cf1445229.tar.gz
platform-bootable-recovery-f29ed3e843409e77db2423e13ac4041cf1445229.tar.xz
platform-bootable-recovery-f29ed3e843409e77db2423e13ac4041cf1445229.zip
tests: Take the ownership of the FD when calling fdopen.
To avoid closing the same FD twice. Test: recovery_component_test && recovery_host_test Change-Id: I95195be8109101081410e9224efda535b2560e72
Diffstat (limited to 'tests')
-rw-r--r--tests/component/imgdiff_test.cpp32
-rw-r--r--tests/component/install_test.cpp26
2 files changed, 29 insertions, 29 deletions
diff --git a/tests/component/imgdiff_test.cpp b/tests/component/imgdiff_test.cpp
index bf591dae..f82a9db5 100644
--- a/tests/component/imgdiff_test.cpp
+++ b/tests/component/imgdiff_test.cpp
@@ -148,7 +148,7 @@ TEST(ImgdiffTest, image_mode_smoke) {
148TEST(ImgdiffTest, zip_mode_smoke_store) { 148TEST(ImgdiffTest, zip_mode_smoke_store) {
149 // Construct src and tgt zip files. 149 // Construct src and tgt zip files.
150 TemporaryFile src_file; 150 TemporaryFile src_file;
151 FILE* src_file_ptr = fdopen(src_file.fd, "wb"); 151 FILE* src_file_ptr = fdopen(src_file.release(), "wb");
152 ZipWriter src_writer(src_file_ptr); 152 ZipWriter src_writer(src_file_ptr);
153 ASSERT_EQ(0, src_writer.StartEntry("file1.txt", 0)); // Store mode. 153 ASSERT_EQ(0, src_writer.StartEntry("file1.txt", 0)); // Store mode.
154 const std::string src_content("abcdefg"); 154 const std::string src_content("abcdefg");
@@ -158,7 +158,7 @@ TEST(ImgdiffTest, zip_mode_smoke_store) {
158 ASSERT_EQ(0, fclose(src_file_ptr)); 158 ASSERT_EQ(0, fclose(src_file_ptr));
159 159
160 TemporaryFile tgt_file; 160 TemporaryFile tgt_file;
161 FILE* tgt_file_ptr = fdopen(tgt_file.fd, "wb"); 161 FILE* tgt_file_ptr = fdopen(tgt_file.release(), "wb");
162 ZipWriter tgt_writer(tgt_file_ptr); 162 ZipWriter tgt_writer(tgt_file_ptr);
163 ASSERT_EQ(0, tgt_writer.StartEntry("file1.txt", 0)); // Store mode. 163 ASSERT_EQ(0, tgt_writer.StartEntry("file1.txt", 0)); // Store mode.
164 const std::string tgt_content("abcdefgxyz"); 164 const std::string tgt_content("abcdefgxyz");
@@ -197,7 +197,7 @@ TEST(ImgdiffTest, zip_mode_smoke_store) {
197TEST(ImgdiffTest, zip_mode_smoke_compressed) { 197TEST(ImgdiffTest, zip_mode_smoke_compressed) {
198 // Construct src and tgt zip files. 198 // Construct src and tgt zip files.
199 TemporaryFile src_file; 199 TemporaryFile src_file;
200 FILE* src_file_ptr = fdopen(src_file.fd, "wb"); 200 FILE* src_file_ptr = fdopen(src_file.release(), "wb");
201 ZipWriter src_writer(src_file_ptr); 201 ZipWriter src_writer(src_file_ptr);
202 ASSERT_EQ(0, src_writer.StartEntry("file1.txt", ZipWriter::kCompress)); 202 ASSERT_EQ(0, src_writer.StartEntry("file1.txt", ZipWriter::kCompress));
203 const std::string src_content("abcdefg"); 203 const std::string src_content("abcdefg");
@@ -207,7 +207,7 @@ TEST(ImgdiffTest, zip_mode_smoke_compressed) {
207 ASSERT_EQ(0, fclose(src_file_ptr)); 207 ASSERT_EQ(0, fclose(src_file_ptr));
208 208
209 TemporaryFile tgt_file; 209 TemporaryFile tgt_file;
210 FILE* tgt_file_ptr = fdopen(tgt_file.fd, "wb"); 210 FILE* tgt_file_ptr = fdopen(tgt_file.release(), "wb");
211 ZipWriter tgt_writer(tgt_file_ptr); 211 ZipWriter tgt_writer(tgt_file_ptr);
212 ASSERT_EQ(0, tgt_writer.StartEntry("file1.txt", ZipWriter::kCompress)); 212 ASSERT_EQ(0, tgt_writer.StartEntry("file1.txt", ZipWriter::kCompress));
213 const std::string tgt_content("abcdefgxyz"); 213 const std::string tgt_content("abcdefgxyz");
@@ -246,7 +246,7 @@ TEST(ImgdiffTest, zip_mode_smoke_compressed) {
246TEST(ImgdiffTest, zip_mode_smoke_trailer_zeros) { 246TEST(ImgdiffTest, zip_mode_smoke_trailer_zeros) {
247 // Construct src and tgt zip files. 247 // Construct src and tgt zip files.
248 TemporaryFile src_file; 248 TemporaryFile src_file;
249 FILE* src_file_ptr = fdopen(src_file.fd, "wb"); 249 FILE* src_file_ptr = fdopen(src_file.release(), "wb");
250 ZipWriter src_writer(src_file_ptr); 250 ZipWriter src_writer(src_file_ptr);
251 ASSERT_EQ(0, src_writer.StartEntry("file1.txt", ZipWriter::kCompress)); 251 ASSERT_EQ(0, src_writer.StartEntry("file1.txt", ZipWriter::kCompress));
252 const std::string src_content("abcdefg"); 252 const std::string src_content("abcdefg");
@@ -256,7 +256,7 @@ TEST(ImgdiffTest, zip_mode_smoke_trailer_zeros) {
256 ASSERT_EQ(0, fclose(src_file_ptr)); 256 ASSERT_EQ(0, fclose(src_file_ptr));
257 257
258 TemporaryFile tgt_file; 258 TemporaryFile tgt_file;
259 FILE* tgt_file_ptr = fdopen(tgt_file.fd, "wb"); 259 FILE* tgt_file_ptr = fdopen(tgt_file.release(), "wb");
260 ZipWriter tgt_writer(tgt_file_ptr); 260 ZipWriter tgt_writer(tgt_file_ptr);
261 ASSERT_EQ(0, tgt_writer.StartEntry("file1.txt", ZipWriter::kCompress)); 261 ASSERT_EQ(0, tgt_writer.StartEntry("file1.txt", ZipWriter::kCompress));
262 const std::string tgt_content("abcdefgxyz"); 262 const std::string tgt_content("abcdefgxyz");
@@ -761,7 +761,7 @@ TEST(ImgdiffTest, zip_mode_store_large_apk) {
761 // 3 blocks 'a' 12 blocks 'd' (exceeds limit) 761 // 3 blocks 'a' 12 blocks 'd' (exceeds limit)
762 // 3 blocks 'e' 762 // 3 blocks 'e'
763 TemporaryFile tgt_file; 763 TemporaryFile tgt_file;
764 FILE* tgt_file_ptr = fdopen(tgt_file.fd, "wb"); 764 FILE* tgt_file_ptr = fdopen(tgt_file.release(), "wb");
765 ZipWriter tgt_writer(tgt_file_ptr); 765 ZipWriter tgt_writer(tgt_file_ptr);
766 construct_store_entry( 766 construct_store_entry(
767 { { "a", 3, 'a' }, { "b", 3, 'b' }, { "c", 8, 'c' }, { "d", 12, 'd' }, { "e", 3, 'e' } }, 767 { { "a", 3, 'a' }, { "b", 3, 'b' }, { "c", 8, 'c' }, { "d", 12, 'd' }, { "e", 3, 'e' } },
@@ -770,7 +770,7 @@ TEST(ImgdiffTest, zip_mode_store_large_apk) {
770 ASSERT_EQ(0, fclose(tgt_file_ptr)); 770 ASSERT_EQ(0, fclose(tgt_file_ptr));
771 771
772 TemporaryFile src_file; 772 TemporaryFile src_file;
773 FILE* src_file_ptr = fdopen(src_file.fd, "wb"); 773 FILE* src_file_ptr = fdopen(src_file.release(), "wb");
774 ZipWriter src_writer(src_file_ptr); 774 ZipWriter src_writer(src_file_ptr);
775 construct_store_entry({ { "d", 12, 'd' }, { "c", 8, 'c' }, { "b", 3, 'b' }, { "a", 3, 'a' } }, 775 construct_store_entry({ { "d", 12, 'd' }, { "c", 8, 'c' }, { "b", 3, 'b' }, { "a", 3, 'a' } },
776 &src_writer); 776 &src_writer);
@@ -792,7 +792,7 @@ TEST(ImgdiffTest, zip_mode_store_large_apk) {
792 std::string tgt; 792 std::string tgt;
793 ASSERT_TRUE(android::base::ReadFileToString(tgt_file.path, &tgt)); 793 ASSERT_TRUE(android::base::ReadFileToString(tgt_file.path, &tgt));
794 794
795 // Expect 4 pieces of patch.(Rougly 3'a',3'b'; 8'c'; 10'd'; 2'd'3'e') 795 // Expect 4 pieces of patch. (Roughly 3'a',3'b'; 8'c'; 10'd'; 2'd'3'e')
796 GenerateAndCheckSplitTarget(debug_dir.path, 4, tgt); 796 GenerateAndCheckSplitTarget(debug_dir.path, 4, tgt);
797} 797}
798 798
@@ -810,7 +810,7 @@ TEST(ImgdiffTest, zip_mode_deflate_large_apk) {
810 // 8 blocks, "c" 20 blocks, "d" (exceeds limit) 810 // 8 blocks, "c" 20 blocks, "d" (exceeds limit)
811 // 1 block, "f" 2 blocks, "e" 811 // 1 block, "f" 2 blocks, "e"
812 TemporaryFile tgt_file; 812 TemporaryFile tgt_file;
813 FILE* tgt_file_ptr = fdopen(tgt_file.fd, "wb"); 813 FILE* tgt_file_ptr = fdopen(tgt_file.release(), "wb");
814 ZipWriter tgt_writer(tgt_file_ptr); 814 ZipWriter tgt_writer(tgt_file_ptr);
815 815
816 construct_deflate_entry( 816 construct_deflate_entry(
@@ -821,7 +821,7 @@ TEST(ImgdiffTest, zip_mode_deflate_large_apk) {
821 ASSERT_EQ(0, fclose(tgt_file_ptr)); 821 ASSERT_EQ(0, fclose(tgt_file_ptr));
822 822
823 TemporaryFile src_file; 823 TemporaryFile src_file;
824 FILE* src_file_ptr = fdopen(src_file.fd, "wb"); 824 FILE* src_file_ptr = fdopen(src_file.release(), "wb");
825 ZipWriter src_writer(src_file_ptr); 825 ZipWriter src_writer(src_file_ptr);
826 826
827 construct_deflate_entry( 827 construct_deflate_entry(
@@ -911,7 +911,7 @@ TEST(ImgdiffTest, zip_mode_no_match_source) {
911 generate_n(back_inserter(random_data), 4096 * 20, []() { return rand() % 256; }); 911 generate_n(back_inserter(random_data), 4096 * 20, []() { return rand() % 256; });
912 912
913 TemporaryFile tgt_file; 913 TemporaryFile tgt_file;
914 FILE* tgt_file_ptr = fdopen(tgt_file.fd, "wb"); 914 FILE* tgt_file_ptr = fdopen(tgt_file.release(), "wb");
915 ZipWriter tgt_writer(tgt_file_ptr); 915 ZipWriter tgt_writer(tgt_file_ptr);
916 916
917 construct_deflate_entry({ { "a", 0, 4 }, { "b", 5, 5 }, { "c", 11, 5 } }, &tgt_writer, 917 construct_deflate_entry({ { "a", 0, 4 }, { "b", 5, 5 }, { "c", 11, 5 } }, &tgt_writer,
@@ -922,7 +922,7 @@ TEST(ImgdiffTest, zip_mode_no_match_source) {
922 922
923 // We don't have a matching source entry. 923 // We don't have a matching source entry.
924 TemporaryFile src_file; 924 TemporaryFile src_file;
925 FILE* src_file_ptr = fdopen(src_file.fd, "wb"); 925 FILE* src_file_ptr = fdopen(src_file.release(), "wb");
926 ZipWriter src_writer(src_file_ptr); 926 ZipWriter src_writer(src_file_ptr);
927 construct_store_entry({ { "d", 1, 'd' } }, &src_writer); 927 construct_store_entry({ { "d", 1, 'd' } }, &src_writer);
928 ASSERT_EQ(0, src_writer.Finish()); 928 ASSERT_EQ(0, src_writer.Finish());
@@ -954,7 +954,7 @@ TEST(ImgdiffTest, zip_mode_large_enough_limit) {
954 generate_n(back_inserter(random_data), 4096 * 20, []() { return rand() % 256; }); 954 generate_n(back_inserter(random_data), 4096 * 20, []() { return rand() % 256; });
955 955
956 TemporaryFile tgt_file; 956 TemporaryFile tgt_file;
957 FILE* tgt_file_ptr = fdopen(tgt_file.fd, "wb"); 957 FILE* tgt_file_ptr = fdopen(tgt_file.release(), "wb");
958 ZipWriter tgt_writer(tgt_file_ptr); 958 ZipWriter tgt_writer(tgt_file_ptr);
959 959
960 construct_deflate_entry({ { "a", 0, 10 }, { "b", 10, 5 } }, &tgt_writer, random_data); 960 construct_deflate_entry({ { "a", 0, 10 }, { "b", 10, 5 } }, &tgt_writer, random_data);
@@ -964,7 +964,7 @@ TEST(ImgdiffTest, zip_mode_large_enough_limit) {
964 964
965 // Construct 10 blocks of source. 965 // Construct 10 blocks of source.
966 TemporaryFile src_file; 966 TemporaryFile src_file;
967 FILE* src_file_ptr = fdopen(src_file.fd, "wb"); 967 FILE* src_file_ptr = fdopen(src_file.release(), "wb");
968 ZipWriter src_writer(src_file_ptr); 968 ZipWriter src_writer(src_file_ptr);
969 construct_deflate_entry({ { "a", 1, 10 } }, &src_writer, random_data); 969 construct_deflate_entry({ { "a", 1, 10 } }, &src_writer, random_data);
970 ASSERT_EQ(0, src_writer.Finish()); 970 ASSERT_EQ(0, src_writer.Finish());
@@ -985,6 +985,6 @@ TEST(ImgdiffTest, zip_mode_large_enough_limit) {
985 std::string tgt; 985 std::string tgt;
986 ASSERT_TRUE(android::base::ReadFileToString(tgt_file.path, &tgt)); 986 ASSERT_TRUE(android::base::ReadFileToString(tgt_file.path, &tgt));
987 987
988 // Expect 1 pieces of patch since limit is larger than the zip file size. 988 // Expect 1 piece of patch since limit is larger than the zip file size.
989 GenerateAndCheckSplitTarget(debug_dir.path, 1, tgt); 989 GenerateAndCheckSplitTarget(debug_dir.path, 1, tgt);
990} 990}
diff --git a/tests/component/install_test.cpp b/tests/component/install_test.cpp
index 7bb49606..d19d788e 100644
--- a/tests/component/install_test.cpp
+++ b/tests/component/install_test.cpp
@@ -37,7 +37,7 @@
37 37
38TEST(InstallTest, verify_package_compatibility_no_entry) { 38TEST(InstallTest, verify_package_compatibility_no_entry) {
39 TemporaryFile temp_file; 39 TemporaryFile temp_file;
40 FILE* zip_file = fdopen(temp_file.fd, "w"); 40 FILE* zip_file = fdopen(temp_file.release(), "w");
41 ZipWriter writer(zip_file); 41 ZipWriter writer(zip_file);
42 // The archive must have something to be opened correctly. 42 // The archive must have something to be opened correctly.
43 ASSERT_EQ(0, writer.StartEntry("dummy_entry", 0)); 43 ASSERT_EQ(0, writer.StartEntry("dummy_entry", 0));
@@ -54,7 +54,7 @@ TEST(InstallTest, verify_package_compatibility_no_entry) {
54 54
55TEST(InstallTest, verify_package_compatibility_invalid_entry) { 55TEST(InstallTest, verify_package_compatibility_invalid_entry) {
56 TemporaryFile temp_file; 56 TemporaryFile temp_file;
57 FILE* zip_file = fdopen(temp_file.fd, "w"); 57 FILE* zip_file = fdopen(temp_file.release(), "w");
58 ZipWriter writer(zip_file); 58 ZipWriter writer(zip_file);
59 ASSERT_EQ(0, writer.StartEntry("compatibility.zip", 0)); 59 ASSERT_EQ(0, writer.StartEntry("compatibility.zip", 0));
60 ASSERT_EQ(0, writer.FinishEntry()); 60 ASSERT_EQ(0, writer.FinishEntry());
@@ -70,7 +70,7 @@ TEST(InstallTest, verify_package_compatibility_invalid_entry) {
70 70
71TEST(InstallTest, read_metadata_from_package_smoke) { 71TEST(InstallTest, read_metadata_from_package_smoke) {
72 TemporaryFile temp_file; 72 TemporaryFile temp_file;
73 FILE* zip_file = fdopen(temp_file.fd, "w"); 73 FILE* zip_file = fdopen(temp_file.release(), "w");
74 ZipWriter writer(zip_file); 74 ZipWriter writer(zip_file);
75 ASSERT_EQ(0, writer.StartEntry("META-INF/com/android/metadata", kCompressStored)); 75 ASSERT_EQ(0, writer.StartEntry("META-INF/com/android/metadata", kCompressStored));
76 const std::string content("abcdefg"); 76 const std::string content("abcdefg");
@@ -87,7 +87,7 @@ TEST(InstallTest, read_metadata_from_package_smoke) {
87 CloseArchive(zip); 87 CloseArchive(zip);
88 88
89 TemporaryFile temp_file2; 89 TemporaryFile temp_file2;
90 FILE* zip_file2 = fdopen(temp_file2.fd, "w"); 90 FILE* zip_file2 = fdopen(temp_file2.release(), "w");
91 ZipWriter writer2(zip_file2); 91 ZipWriter writer2(zip_file2);
92 ASSERT_EQ(0, writer2.StartEntry("META-INF/com/android/metadata", kCompressDeflated)); 92 ASSERT_EQ(0, writer2.StartEntry("META-INF/com/android/metadata", kCompressDeflated));
93 ASSERT_EQ(0, writer2.WriteBytes(content.data(), content.size())); 93 ASSERT_EQ(0, writer2.WriteBytes(content.data(), content.size()));
@@ -104,7 +104,7 @@ TEST(InstallTest, read_metadata_from_package_smoke) {
104 104
105TEST(InstallTest, read_metadata_from_package_no_entry) { 105TEST(InstallTest, read_metadata_from_package_no_entry) {
106 TemporaryFile temp_file; 106 TemporaryFile temp_file;
107 FILE* zip_file = fdopen(temp_file.fd, "w"); 107 FILE* zip_file = fdopen(temp_file.release(), "w");
108 ZipWriter writer(zip_file); 108 ZipWriter writer(zip_file);
109 ASSERT_EQ(0, writer.StartEntry("dummy_entry", kCompressStored)); 109 ASSERT_EQ(0, writer.StartEntry("dummy_entry", kCompressStored));
110 ASSERT_EQ(0, writer.FinishEntry()); 110 ASSERT_EQ(0, writer.FinishEntry());
@@ -120,7 +120,7 @@ TEST(InstallTest, read_metadata_from_package_no_entry) {
120 120
121TEST(InstallTest, verify_package_compatibility_with_libvintf_malformed_xml) { 121TEST(InstallTest, verify_package_compatibility_with_libvintf_malformed_xml) {
122 TemporaryFile compatibility_zip_file; 122 TemporaryFile compatibility_zip_file;
123 FILE* compatibility_zip = fdopen(compatibility_zip_file.fd, "w"); 123 FILE* compatibility_zip = fdopen(compatibility_zip_file.release(), "w");
124 ZipWriter compatibility_zip_writer(compatibility_zip); 124 ZipWriter compatibility_zip_writer(compatibility_zip);
125 ASSERT_EQ(0, compatibility_zip_writer.StartEntry("system_manifest.xml", kCompressDeflated)); 125 ASSERT_EQ(0, compatibility_zip_writer.StartEntry("system_manifest.xml", kCompressDeflated));
126 std::string malformed_xml = "malformed"; 126 std::string malformed_xml = "malformed";
@@ -130,7 +130,7 @@ TEST(InstallTest, verify_package_compatibility_with_libvintf_malformed_xml) {
130 ASSERT_EQ(0, fclose(compatibility_zip)); 130 ASSERT_EQ(0, fclose(compatibility_zip));
131 131
132 TemporaryFile temp_file; 132 TemporaryFile temp_file;
133 FILE* zip_file = fdopen(temp_file.fd, "w"); 133 FILE* zip_file = fdopen(temp_file.release(), "w");
134 ZipWriter writer(zip_file); 134 ZipWriter writer(zip_file);
135 ASSERT_EQ(0, writer.StartEntry("compatibility.zip", kCompressStored)); 135 ASSERT_EQ(0, writer.StartEntry("compatibility.zip", kCompressStored));
136 std::string compatibility_zip_content; 136 std::string compatibility_zip_content;
@@ -165,7 +165,7 @@ TEST(InstallTest, verify_package_compatibility_with_libvintf_system_manifest_xml
165 ASSERT_TRUE( 165 ASSERT_TRUE(
166 android::base::ReadFileToString(system_manifest_xml_path, &system_manifest_xml_content)); 166 android::base::ReadFileToString(system_manifest_xml_path, &system_manifest_xml_content));
167 TemporaryFile compatibility_zip_file; 167 TemporaryFile compatibility_zip_file;
168 FILE* compatibility_zip = fdopen(compatibility_zip_file.fd, "w"); 168 FILE* compatibility_zip = fdopen(compatibility_zip_file.release(), "w");
169 ZipWriter compatibility_zip_writer(compatibility_zip); 169 ZipWriter compatibility_zip_writer(compatibility_zip);
170 ASSERT_EQ(0, compatibility_zip_writer.StartEntry("system_manifest.xml", kCompressDeflated)); 170 ASSERT_EQ(0, compatibility_zip_writer.StartEntry("system_manifest.xml", kCompressDeflated));
171 ASSERT_EQ(0, compatibility_zip_writer.WriteBytes(system_manifest_xml_content.data(), 171 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
175 ASSERT_EQ(0, fclose(compatibility_zip)); 175 ASSERT_EQ(0, fclose(compatibility_zip));
176 176
177 TemporaryFile temp_file; 177 TemporaryFile temp_file;
178 FILE* zip_file = fdopen(temp_file.fd, "w"); 178 FILE* zip_file = fdopen(temp_file.release(), "w");
179 ZipWriter writer(zip_file); 179 ZipWriter writer(zip_file);
180 ASSERT_EQ(0, writer.StartEntry("compatibility.zip", kCompressStored)); 180 ASSERT_EQ(0, writer.StartEntry("compatibility.zip", kCompressStored));
181 std::string compatibility_zip_content; 181 std::string compatibility_zip_content;
@@ -202,7 +202,7 @@ TEST(InstallTest, verify_package_compatibility_with_libvintf_system_manifest_xml
202#ifdef AB_OTA_UPDATER 202#ifdef AB_OTA_UPDATER
203static void VerifyAbUpdateBinaryCommand(const std::string& serialno, bool success = true) { 203static void VerifyAbUpdateBinaryCommand(const std::string& serialno, bool success = true) {
204 TemporaryFile temp_file; 204 TemporaryFile temp_file;
205 FILE* zip_file = fdopen(temp_file.fd, "w"); 205 FILE* zip_file = fdopen(temp_file.release(), "w");
206 ZipWriter writer(zip_file); 206 ZipWriter writer(zip_file);
207 ASSERT_EQ(0, writer.StartEntry("payload.bin", kCompressStored)); 207 ASSERT_EQ(0, writer.StartEntry("payload.bin", kCompressStored));
208 ASSERT_EQ(0, writer.FinishEntry()); 208 ASSERT_EQ(0, writer.FinishEntry());
@@ -258,7 +258,7 @@ TEST(InstallTest, update_binary_command_smoke) {
258 VerifyAbUpdateBinaryCommand({}); 258 VerifyAbUpdateBinaryCommand({});
259#else 259#else
260 TemporaryFile temp_file; 260 TemporaryFile temp_file;
261 FILE* zip_file = fdopen(temp_file.fd, "w"); 261 FILE* zip_file = fdopen(temp_file.release(), "w");
262 ZipWriter writer(zip_file); 262 ZipWriter writer(zip_file);
263 static constexpr const char* UPDATE_BINARY_NAME = "META-INF/com/google/android/update-binary"; 263 static constexpr const char* UPDATE_BINARY_NAME = "META-INF/com/google/android/update-binary";
264 ASSERT_EQ(0, writer.StartEntry(UPDATE_BINARY_NAME, kCompressStored)); 264 ASSERT_EQ(0, writer.StartEntry(UPDATE_BINARY_NAME, kCompressStored));
@@ -303,7 +303,7 @@ TEST(InstallTest, update_binary_command_smoke) {
303TEST(InstallTest, update_binary_command_invalid) { 303TEST(InstallTest, update_binary_command_invalid) {
304#ifdef AB_OTA_UPDATER 304#ifdef AB_OTA_UPDATER
305 TemporaryFile temp_file; 305 TemporaryFile temp_file;
306 FILE* zip_file = fdopen(temp_file.fd, "w"); 306 FILE* zip_file = fdopen(temp_file.release(), "w");
307 ZipWriter writer(zip_file); 307 ZipWriter writer(zip_file);
308 // Missing payload_properties.txt. 308 // Missing payload_properties.txt.
309 ASSERT_EQ(0, writer.StartEntry("payload.bin", kCompressStored)); 309 ASSERT_EQ(0, writer.StartEntry("payload.bin", kCompressStored));
@@ -334,7 +334,7 @@ TEST(InstallTest, update_binary_command_invalid) {
334 CloseArchive(zip); 334 CloseArchive(zip);
335#else 335#else
336 TemporaryFile temp_file; 336 TemporaryFile temp_file;
337 FILE* zip_file = fdopen(temp_file.fd, "w"); 337 FILE* zip_file = fdopen(temp_file.release(), "w");
338 ZipWriter writer(zip_file); 338 ZipWriter writer(zip_file);
339 // The archive must have something to be opened correctly. 339 // The archive must have something to be opened correctly.
340 ASSERT_EQ(0, writer.StartEntry("dummy_entry", 0)); 340 ASSERT_EQ(0, writer.StartEntry("dummy_entry", 0));