summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-08 16:00:15 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-08 16:00:15 +0000
commitaf5d509e34a95aedf6e2cb112329d7a39d398bb0 (patch)
tree04a59b88ccb4355fa29467c39487009c44a1e7d5
parent00b0eb0e298782437a74f214c930c8f4552a5aca (diff)
parent68a0ca2dade5b6707dd7068b3c59f3d1ead041be (diff)
downloadbsdiff-aml_tz2_305400100.tar.gz
Change-Id: I8087fdea5014b3ed5d6b3aa7ef640608fded26d7
-rw-r--r--Android.bp15
-rw-r--r--AndroidTest.xml26
-rw-r--r--METADATA3
l---------NOTICE1
-rw-r--r--TEST_MAPPING7
-rw-r--r--extents_file_unittest.cc3
-rw-r--r--test_utils.cc7
-rw-r--r--utils.cc5
8 files changed, 33 insertions, 34 deletions
diff --git a/Android.bp b/Android.bp
index ee6dc4f..9f68463 100644
--- a/Android.bp
+++ b/Android.bp
@@ -12,17 +12,6 @@
// 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,
@@ -51,7 +40,6 @@ cc_library_static {
"//bootable/recovery:__subpackages__",
"//external/puffin:__subpackages__",
"//system/update_engine:__subpackages__",
- "//system/core/fs_mgr/libsnapshot:__subpackages__",
],
srcs: [
@@ -163,7 +151,4 @@ cc_test {
cflags: ["-DBSDIFF_TARGET_UNITTEST"],
},
},
- test_options: {
- unit_test: true,
- },
}
diff --git a/AndroidTest.xml b/AndroidTest.xml
new file mode 100644
index 0000000..6394c0e
--- /dev/null
+++ b/AndroidTest.xml
@@ -0,0 +1,26 @@
+<?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
deleted file mode 100644
index d97975c..0000000
--- a/METADATA
+++ /dev/null
@@ -1,3 +0,0 @@
-third_party {
- license_type: NOTICE
-}
diff --git a/NOTICE b/NOTICE
new file mode 120000
index 0000000..7a694c9
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1 @@
+LICENSE \ No newline at end of file
diff --git a/TEST_MAPPING b/TEST_MAPPING
deleted file mode 100644
index 598f4c9..0000000
--- a/TEST_MAPPING
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "presubmit": [
- {
- "name": "bsdiff_unittest"
- }
- ]
-}
diff --git a/extents_file_unittest.cc b/extents_file_unittest.cc
index 38f288a..7dc23be 100644
--- a/extents_file_unittest.cc
+++ b/extents_file_unittest.cc
@@ -178,9 +178,8 @@ 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(buf, 100, &bytes_read));
+ EXPECT_TRUE(file.Read(nullptr, 100, &bytes_read));
EXPECT_EQ(1U, bytes_read);
}
diff --git a/test_utils.cc b/test_utils.cc
index c1350eb..eb079d5 100644
--- a/test_utils.cc
+++ b/test_utils.cc
@@ -53,8 +53,11 @@ namespace test_utils {
void BsdiffTestEnvironment::SetUp() {
#ifdef BSDIFF_TARGET_UNITTEST
-#define BSDIFF_TARGET_TMP_BASE "/data/local/tmp"
- setenv("TMPDIR", BSDIFF_TARGET_TMP_BASE, 1);
+#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);
#endif // defined (BSDIFF_TARGET_UNITTEST)
}
diff --git a/utils.cc b/utils.cc
index c82eb98..c3e613e 100644
--- a/utils.cc
+++ b/utils.cc
@@ -7,11 +7,6 @@
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;