From 2f2749f2131775645f5eb8dcede90c6ea99cd469 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Tue, 12 Jan 2021 14:42:56 -0500 Subject: Switch imgdiff to use libz_stable libz contain platform dependent optimization flags, and sometimes that cause reconstruction of blobs to fail. Use libz_stable instead Bug: 177076632 Test: treehugger Change-Id: I3a8c1591672537d1c754b2bc5b26f939dd80ed47 --- applypatch/Android.bp | 15 ++++++++------- tests/Android.bp | 3 +-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/applypatch/Android.bp b/applypatch/Android.bp index 13a962584..80d8041b1 100644 --- a/applypatch/Android.bp +++ b/applypatch/Android.bp @@ -54,7 +54,7 @@ cc_library_static { "libbz", "libedify", "libotautil", - "libz", + "libz_stable", ], shared_libs: [ @@ -71,6 +71,7 @@ cc_library_static { cc_library_static { name: "libapplypatch_modes", vendor_available: true, + host_supported: true, defaults: [ "applypatch_defaults", @@ -95,6 +96,7 @@ cc_library_static { cc_binary { name: "applypatch", vendor: true, + host_supported: true, defaults: [ "applypatch_defaults", @@ -120,7 +122,7 @@ cc_binary { "libbase", "libcrypto", "liblog", - "libz", + "libz_stable", "libziparchive", ], @@ -129,9 +131,9 @@ cc_binary { ], } -cc_library_host_static { +cc_library_static { name: "libimgdiff", - + host_supported: true, defaults: [ "applypatch_defaults", ], @@ -152,14 +154,13 @@ cc_library_host_static { "liblog", "libotautil", "libutils", - "libz", + "libz_stable", "libziparchive", ], } cc_binary_host { name: "imgdiff", - srcs: [ "imgdiff_main.cpp", ], @@ -180,6 +181,6 @@ cc_binary_host { "liblog", "libbrotli", "libbz", - "libz", + "libz_stable", ], } diff --git a/tests/Android.bp b/tests/Android.bp index 19f2a6c64..d2179e494 100644 --- a/tests/Android.bp +++ b/tests/Android.bp @@ -31,7 +31,6 @@ cc_defaults { "libpng", "libprocessgroup", "libselinux", - "libz", "libziparchive", ], @@ -65,7 +64,7 @@ libapplypatch_static_libs = [ "libbase", "libbrotli", "libbz", - "libz", + "libz_stable", "libziparchive", ] -- cgit v1.2.3 From 07ba4483a6c6cff3a96deaab02fe95475f1123c8 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Tue, 12 Jan 2021 16:48:12 -0500 Subject: Re-enable failed imgpatch tests Now we added a libz variant without the offending optimizations, re-enable tests. Test: treehugger Bug: 177076632 Change-Id: I6969090b2cb4c059d952df7cc034d0ed1ac366b2 --- tests/testdata/recovery-from-boot.p | Bin 5404 -> 5410 bytes tests/unit/applypatch_modes_test.cpp | 4 ++-- tests/unit/applypatch_test.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/testdata/recovery-from-boot.p b/tests/testdata/recovery-from-boot.p index 06f6c299f..81738ed29 100644 Binary files a/tests/testdata/recovery-from-boot.p and b/tests/testdata/recovery-from-boot.p differ diff --git a/tests/unit/applypatch_modes_test.cpp b/tests/unit/applypatch_modes_test.cpp index 9e9797950..08414b796 100644 --- a/tests/unit/applypatch_modes_test.cpp +++ b/tests/unit/applypatch_modes_test.cpp @@ -100,7 +100,7 @@ TEST_F(ApplyPatchModesTest, InvalidArgs) { ASSERT_EQ(2, InvokeApplyPatchModes({ "applypatch", "-x" })); } -TEST_F(ApplyPatchModesTest, DISABLED_PatchModeEmmcTarget) { +TEST_F(ApplyPatchModesTest, PatchModeEmmcTarget) { std::vector args{ "applypatch", "--bonus", @@ -118,7 +118,7 @@ TEST_F(ApplyPatchModesTest, DISABLED_PatchModeEmmcTarget) { // Tests patching an eMMC target without a separate bonus file (i.e. recovery-from-boot patch has // everything). -TEST_F(ApplyPatchModesTest, DISABLED_PatchModeEmmcTargetWithoutBonusFile) { +TEST_F(ApplyPatchModesTest, PatchModeEmmcTargetWithoutBonusFile) { std::vector args{ "applypatch", "--patch", from_testdata_base("recovery-from-boot-with-bonus.p"), "--target", target, "--source", diff --git a/tests/unit/applypatch_test.cpp b/tests/unit/applypatch_test.cpp index 4b80dcee9..218a224f8 100644 --- a/tests/unit/applypatch_test.cpp +++ b/tests/unit/applypatch_test.cpp @@ -132,7 +132,7 @@ TEST_F(ApplyPatchTest, PatchPartitionCheck_UseBackup_BothCorrupted) { PatchPartitionCheck(target_partition, Partition(target_file, source_size, source_sha1))); } -TEST_F(ApplyPatchTest, DISABLED_PatchPartition) { +TEST_F(ApplyPatchTest, PatchPartition) { FileContents patch_fc; ASSERT_TRUE(LoadFileContents(from_testdata_base("recovery-from-boot.p"), &patch_fc)); Value patch(Value::Type::BLOB, std::string(patch_fc.data.cbegin(), patch_fc.data.cend())); @@ -146,7 +146,7 @@ TEST_F(ApplyPatchTest, DISABLED_PatchPartition) { // Tests patching an eMMC target without a separate bonus file (i.e. recovery-from-boot patch has // everything). -TEST_F(ApplyPatchTest, DISABLED_PatchPartitionWithoutBonusFile) { +TEST_F(ApplyPatchTest, PatchPartitionWithoutBonusFile) { FileContents patch_fc; ASSERT_TRUE(LoadFileContents(from_testdata_base("recovery-from-boot-with-bonus.p"), &patch_fc)); Value patch(Value::Type::BLOB, std::string(patch_fc.data.cbegin(), patch_fc.data.cend())); -- cgit v1.2.3