diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-06-21 14:49:31 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-06-21 14:49:31 +0000 |
commit | a040772150137253969eebfc7a4d65a491b353ce (patch) | |
tree | 6a5fca95ce93294ff06b53dbdfd4e3a81548cea3 | |
parent | 68a0ca2dade5b6707dd7068b3c59f3d1ead041be (diff) | |
parent | 069316a93cb305bf016310fa1bcbe6a34e83804c (diff) | |
download | bsdiff-android12-mainline-cellbroadcast-release.tar.gz |
Snap for 7478067 from 069316a93cb305bf016310fa1bcbe6a34e83804c to mainline-cellbroadcast-releaseandroid-mainline-12.0.0_r86android-mainline-12.0.0_r71android-mainline-12.0.0_r7android-mainline-12.0.0_r60android-mainline-12.0.0_r43android-mainline-12.0.0_r24android-mainline-12.0.0_r116android-mainline-12.0.0_r101android12-mainline-cellbroadcast-release
Change-Id: Ia7087c4be46dafc79895525c3b0bb3f999cd4fe5
-rw-r--r-- | Android.bp | 15 | ||||
-rw-r--r-- | AndroidTest.xml | 26 | ||||
-rw-r--r-- | METADATA | 3 | ||||
l--------- | NOTICE | 1 | ||||
-rw-r--r-- | TEST_MAPPING | 7 | ||||
-rw-r--r-- | extents_file_unittest.cc | 3 | ||||
-rw-r--r-- | test_utils.cc | 7 | ||||
-rw-r--r-- | utils.cc | 5 |
8 files changed, 34 insertions, 33 deletions
@@ -12,6 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + default_applicable_licenses: ["external_bsdiff_license"], +} + +license { + name: "external_bsdiff_license", + visibility: [":__subpackages__"], + license_kinds: ["SPDX-license-identifier-Apache-2.0","SPDX-license-identifier-BSD"], + license_text: ["LICENSE"], +} + cc_defaults { name: "bsdiff_defaults", host_supported: true, @@ -40,6 +51,7 @@ cc_library_static { "//bootable/recovery:__subpackages__", "//external/puffin:__subpackages__", "//system/update_engine:__subpackages__", + "//system/core/fs_mgr/libsnapshot:__subpackages__", ], srcs: [ @@ -151,4 +163,7 @@ cc_test { cflags: ["-DBSDIFF_TARGET_UNITTEST"], }, }, + test_options: { + unit_test: true, + }, } diff --git a/AndroidTest.xml b/AndroidTest.xml deleted file mode 100644 index 6394c0e..0000000 --- a/AndroidTest.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2017 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<configuration description="Config for bsdiff_unittest"> - <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> - <option name="cleanup" value="true" /> - <option name="push" value="bsdiff_unittest->/data/local/tmp/bsdiff_unittest" /> - </target_preparer> - <option name="test-suite-tag" value="apct" /> - <test class="com.android.tradefed.testtype.GTest" > - <option name="native-test-device-path" value="/data/local/tmp" /> - <option name="module-name" value="bsdiff_unittest" /> - </test> -</configuration> diff --git a/METADATA b/METADATA new file mode 100644 index 0000000..d97975c --- /dev/null +++ b/METADATA @@ -0,0 +1,3 @@ +third_party { + license_type: NOTICE +} @@ -1 +0,0 @@ -LICENSE
\ No newline at end of file diff --git a/TEST_MAPPING b/TEST_MAPPING new file mode 100644 index 0000000..598f4c9 --- /dev/null +++ b/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit": [ + { + "name": "bsdiff_unittest" + } + ] +} diff --git a/extents_file_unittest.cc b/extents_file_unittest.cc index 7dc23be..38f288a 100644 --- a/extents_file_unittest.cc +++ b/extents_file_unittest.cc @@ -178,8 +178,9 @@ TEST_F(ExtentsFileTest, ReadFailureFails) { // A second read that fails will succeed if there was partial data read. EXPECT_CALL(*mock_file_, Read(_, 10, _)).WillOnce(Return(false)); + char* buf = reinterpret_cast<char*>(0x1234); size_t bytes_read = 0; - EXPECT_TRUE(file.Read(nullptr, 100, &bytes_read)); + EXPECT_TRUE(file.Read(buf, 100, &bytes_read)); EXPECT_EQ(1U, bytes_read); } diff --git a/test_utils.cc b/test_utils.cc index eb079d5..c1350eb 100644 --- a/test_utils.cc +++ b/test_utils.cc @@ -53,11 +53,8 @@ namespace test_utils { void BsdiffTestEnvironment::SetUp() { #ifdef BSDIFF_TARGET_UNITTEST -#define BSDIFF_TARGET_TMP_BASE "/data/tmp" - if (access(BSDIFF_TARGET_TMP_BASE, F_OK) == -1) { - mkdir(BSDIFF_TARGET_TMP_BASE, S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH); - } - setenv("TMPDIR", BSDIFF_TARGET_TMP_BASE, 1); +#define BSDIFF_TARGET_TMP_BASE "/data/local/tmp" + setenv("TMPDIR", BSDIFF_TARGET_TMP_BASE, 1); #endif // defined (BSDIFF_TARGET_UNITTEST) } @@ -7,6 +7,11 @@ namespace bsdiff { int64_t ParseInt64(const uint8_t* buf) { + // BSPatch uses a non-standard encoding of integers. + // Highest bit of that integer is used as a sign bit, 1 = negative + // and 0 = positive. + // Therefore, if the highest bit is set, flip it, then do 2's complement + // to get the integer in standard form int64_t result = buf[7] & 0x7F; for (int i = 6; i >= 0; i--) { result <<= 8; |