summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-04-11 01:26:43 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-04-11 01:26:43 +0000
commit442d9de2d0ac48a407583abcc73677b8a7b80298 (patch)
treead4c8da28e495ff4c306bc3b4cca6070dbe3e1a3
parente623401a0f91b4402e240d8da78596a7adb0848b (diff)
parent7350b6fb645012e900c47a1022c6f6d4a879a383 (diff)
downloadzlib-sdk-release.tar.gz
Merge "Snap for 11699450 from b34cd2e4371556e913ad9801a924a891c74d1463 to sdk-release" into sdk-releasesdk-release
-rw-r--r--BUILD.bazel22
-rw-r--r--METADATA4
-rw-r--r--contrib/tests/utils_unittest.cc24
3 files changed, 24 insertions, 26 deletions
diff --git a/BUILD.bazel b/BUILD.bazel
deleted file mode 100644
index f0fc0f9..0000000
--- a/BUILD.bazel
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (C) 2024 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.
-
-load("@rules_pkg//pkg:mappings.bzl", "pkg_files")
-
-pkg_files(
- name = "test_mappings",
- srcs = ["TEST_MAPPING"],
- prefix = package_name(),
- visibility = ["//kernel/tests/test_mappings:__pkg__"],
-)
diff --git a/METADATA b/METADATA
index 28e6d50..65435cc 100644
--- a/METADATA
+++ b/METADATA
@@ -9,11 +9,11 @@ third_party {
last_upgrade_date {
year: 2024
month: 4
- day: 9
+ day: 10
}
identifier {
type: "Git"
value: "https://chromium.googlesource.com/chromium/src/third_party/zlib/"
- version: "37d9855c8db5a130571971e78fde2740314cd98a"
+ version: "7d77fb7fd66d8a5640618ad32c71fdeb7d3e02df"
}
}
diff --git a/contrib/tests/utils_unittest.cc b/contrib/tests/utils_unittest.cc
index 0cc1081..f487a06 100644
--- a/contrib/tests/utils_unittest.cc
+++ b/contrib/tests/utils_unittest.cc
@@ -20,7 +20,8 @@
#include "zlib.h"
-void TestPayloads(size_t input_size, zlib_internal::WrapperType type) {
+void TestPayloads(size_t input_size, zlib_internal::WrapperType type,
+ const int compression_level = Z_DEFAULT_COMPRESSION) {
std::vector<unsigned char> input;
input.reserve(input_size);
for (size_t i = 1; i <= input_size; ++i)
@@ -36,7 +37,7 @@ void TestPayloads(size_t input_size, zlib_internal::WrapperType type) {
unsigned long compressed_size = static_cast<unsigned long>(compressed.size());
int result = zlib_internal::CompressHelper(
type, compressed.data(), &compressed_size, input.data(), input.size(),
- Z_DEFAULT_COMPRESSION, nullptr, nullptr);
+ compression_level, nullptr, nullptr);
ASSERT_EQ(result, Z_OK);
unsigned long decompressed_size =
@@ -67,6 +68,25 @@ TEST(ZlibTest, RawWrapper) {
TestPayloads(i, zlib_internal::WrapperType::ZRAW);
}
+TEST(ZlibTest, LargePayloads) {
+ static const size_t lengths[] = { 6000, 8000, 10'000, 15'000, 20'000, 30'000,
+ 50'000, 100'000, 150'000, 2'500'000,
+ 5'000'000, 10'000'000, 20'000'000 };
+
+ for (size_t length: lengths) {
+ TestPayloads(length, zlib_internal::WrapperType::ZLIB);
+ TestPayloads(length, zlib_internal::WrapperType::GZIP);
+ }
+}
+
+TEST(ZlibTest, CompressionLevels) {
+ static const int levels[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ for (int level: levels) {
+ TestPayloads(5'000'000, zlib_internal::WrapperType::ZLIB, level);
+ TestPayloads(5'000'000, zlib_internal::WrapperType::GZIP, level);
+ }
+}
+
TEST(ZlibTest, InflateCover) {
cover_support();
cover_wrap();