diff options
-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, 33 insertions, 34 deletions
@@ -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 -} @@ -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) } @@ -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; |