summaryrefslogtreecommitdiffstats
path: root/tests/unit/zip_test.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2017-06-01 00:01:19 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-06-01 00:01:19 +0200
commit1905e3665a7180d75d1f4c69207fcb423b5de759 (patch)
tree68f6709c1ca338c095a82d8b53a370c97e6aba14 /tests/unit/zip_test.cpp
parentMerge "Implement a custom deflate sink function for bspatch" am: 764eb215af am: 0f8e67088a am: 4a2cfffd33 (diff)
parentMerge "kill package_extract_dir" am: 99e7216907 am: 49f9c969eb (diff)
downloadandroid_bootable_recovery-1905e3665a7180d75d1f4c69207fcb423b5de759.tar
android_bootable_recovery-1905e3665a7180d75d1f4c69207fcb423b5de759.tar.gz
android_bootable_recovery-1905e3665a7180d75d1f4c69207fcb423b5de759.tar.bz2
android_bootable_recovery-1905e3665a7180d75d1f4c69207fcb423b5de759.tar.lz
android_bootable_recovery-1905e3665a7180d75d1f4c69207fcb423b5de759.tar.xz
android_bootable_recovery-1905e3665a7180d75d1f4c69207fcb423b5de759.tar.zst
android_bootable_recovery-1905e3665a7180d75d1f4c69207fcb423b5de759.zip
Diffstat (limited to 'tests/unit/zip_test.cpp')
-rw-r--r--tests/unit/zip_test.cpp37
1 files changed, 0 insertions, 37 deletions
diff --git a/tests/unit/zip_test.cpp b/tests/unit/zip_test.cpp
index df4e38cae..827668521 100644
--- a/tests/unit/zip_test.cpp
+++ b/tests/unit/zip_test.cpp
@@ -24,47 +24,10 @@
#include <android-base/test_utils.h>
#include <gtest/gtest.h>
#include <otautil/SysUtil.h>
-#include <otautil/ZipUtil.h>
#include <ziparchive/zip_archive.h>
#include "common/test_constants.h"
-TEST(ZipTest, ExtractPackageRecursive) {
- std::string zip_path = from_testdata_base("ziptest_valid.zip");
- ZipArchiveHandle handle;
- ASSERT_EQ(0, OpenArchive(zip_path.c_str(), &handle));
-
- // Extract the whole package into a temp directory.
- TemporaryDir td;
- ASSERT_NE(nullptr, td.path);
- ExtractPackageRecursive(handle, "", td.path, nullptr, nullptr);
-
- // Make sure all the files are extracted correctly.
- std::string path(td.path);
- ASSERT_EQ(0, access((path + "/a.txt").c_str(), F_OK));
- ASSERT_EQ(0, access((path + "/b.txt").c_str(), F_OK));
- ASSERT_EQ(0, access((path + "/b/c.txt").c_str(), F_OK));
- ASSERT_EQ(0, access((path + "/b/d.txt").c_str(), F_OK));
-
- // The content of the file is the same as expected.
- std::string content1;
- ASSERT_TRUE(android::base::ReadFileToString(path + "/a.txt", &content1));
- ASSERT_EQ(kATxtContents, content1);
-
- std::string content2;
- ASSERT_TRUE(android::base::ReadFileToString(path + "/b/d.txt", &content2));
- ASSERT_EQ(kDTxtContents, content2);
-
- CloseArchive(handle);
-
- // Clean up.
- ASSERT_EQ(0, unlink((path + "/a.txt").c_str()));
- ASSERT_EQ(0, unlink((path + "/b.txt").c_str()));
- ASSERT_EQ(0, unlink((path + "/b/c.txt").c_str()));
- ASSERT_EQ(0, unlink((path + "/b/d.txt").c_str()));
- ASSERT_EQ(0, rmdir((path + "/b").c_str()));
-}
-
TEST(ZipTest, OpenFromMemory) {
std::string zip_path = from_testdata_base("ziptest_dummy-update.zip");
MemMapping map;