summaryrefslogtreecommitdiffstats
path: root/tests/unit/zip_test.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2017-05-31 23:59:21 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-05-31 23:59:21 +0200
commitd1b65aa645c14c47adde12887e323c73f1345a37 (patch)
treefa6dbca59888863fd350e40cd3e7cd7425c7a8b0 /tests/unit/zip_test.cpp
parentMerge "Implement a custom deflate sink function for bspatch" am: 764eb215af am: 0f8e67088a (diff)
parentMerge "kill package_extract_dir" am: 99e7216907 (diff)
downloadandroid_bootable_recovery-d1b65aa645c14c47adde12887e323c73f1345a37.tar
android_bootable_recovery-d1b65aa645c14c47adde12887e323c73f1345a37.tar.gz
android_bootable_recovery-d1b65aa645c14c47adde12887e323c73f1345a37.tar.bz2
android_bootable_recovery-d1b65aa645c14c47adde12887e323c73f1345a37.tar.lz
android_bootable_recovery-d1b65aa645c14c47adde12887e323c73f1345a37.tar.xz
android_bootable_recovery-d1b65aa645c14c47adde12887e323c73f1345a37.tar.zst
android_bootable_recovery-d1b65aa645c14c47adde12887e323c73f1345a37.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;