diff options
author | Tianjie Xu <xunchang@google.com> | 2017-05-31 23:54:18 +0200 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-31 23:54:18 +0200 |
commit | 49f9c969eb9efe48ae8e5770767dc3a817e1bb8d (patch) | |
tree | 90e9a4b87ce3ecec7f05fb1bd0a5d75d39ab2674 /tests/unit/zip_test.cpp | |
parent | Merge "Implement a custom deflate sink function for bspatch" (diff) | |
parent | Merge "kill package_extract_dir" (diff) | |
download | android_bootable_recovery-49f9c969eb9efe48ae8e5770767dc3a817e1bb8d.tar android_bootable_recovery-49f9c969eb9efe48ae8e5770767dc3a817e1bb8d.tar.gz android_bootable_recovery-49f9c969eb9efe48ae8e5770767dc3a817e1bb8d.tar.bz2 android_bootable_recovery-49f9c969eb9efe48ae8e5770767dc3a817e1bb8d.tar.lz android_bootable_recovery-49f9c969eb9efe48ae8e5770767dc3a817e1bb8d.tar.xz android_bootable_recovery-49f9c969eb9efe48ae8e5770767dc3a817e1bb8d.tar.zst android_bootable_recovery-49f9c969eb9efe48ae8e5770767dc3a817e1bb8d.zip |
Diffstat (limited to '')
-rw-r--r-- | tests/unit/zip_test.cpp | 37 |
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; |