pdfium: 7749 -> 8066; fix tests on macOS 27+ (#564983)

This commit is contained in:
Ihar Hrachyshka
2026-09-22 03:11:10 +00:00
committed by GitHub
11 changed files with 210 additions and 86 deletions

View File

@@ -1,15 +1,12 @@
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 58d3a1788e6d2..38f364c6b471d 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -1349,8 +1349,8 @@ config("compiler_cpu_abi") {
]
} else if (current_cpu == "arm64") {
if (is_clang && !is_android && !is_fuchsia && !is_chromeos_device) {
- cflags += [ "--target=aarch64-linux-gnu" ]
- ldflags += [ "--target=aarch64-linux-gnu" ]
+ cflags += [ "--target=aarch64-unknown-linux-gnu" ]
+ ldflags += [ "--target=aarch64-unknown-linux-gnu" ]
}
if (target_os == "chromeos" && cros_target_cpu_arch != "" &&
is_a_target_toolchain) {
--- a/build/config/compiler_cpu_abi.gn
+++ b/build/config/compiler_cpu_abi.gn
@@ -85,8 +85,8 @@
} else if (current_cpu == "arm64") {
if (is_clang && !is_android && !is_fuchsia && !is_chromeos_device) {
- cpu_abi_cflags += [ "--target=aarch64-linux-gnu" ]
- cpu_abi_ldflags += [ "--target=aarch64-linux-gnu" ]
+ cpu_abi_cflags += [ "--target=aarch64-unknown-linux-gnu" ]
+ cpu_abi_ldflags += [ "--target=aarch64-unknown-linux-gnu" ]
}
if (target_os == "chromeos" && cros_target_cpu_arch != "" &&
is_a_target_toolchain) {

View File

@@ -1,5 +1,19 @@
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -589,13 +589,5 @@
# Flags for diagnostics.
cflags += [ "-fcolor-diagnostics" ]
- if (!is_wasm) {
- if (!is_win) {
- cflags += [ "-fdiagnostics-show-inlining-chain" ]
- } else {
- # Combine after https://github.com/llvm/llvm-project/pull/192241
- cflags += [ "/clang:-fdiagnostics-show-inlining-chain" ]
- }
- }
if (diagnostics_print_source_range_info && !is_win) {
cflags += [ "-fdiagnostics-print-source-range-info" ]
}
@@ -613,12 +613,6 @@
]
}
@@ -13,15 +27,20 @@
# TODO(hans): Remove this once Clang generates better optimized debug info
# by default. https://crbug.com/765793
@@ -1881,11 +1875,6 @@
"-fsanitize=array-bounds",
"-fsanitize-trap=array-bounds",
- # Some code users feature detection to determine if UBSAN (or any
- # sanitizer) is enabled, they then do expensive debug like operations. We
- # want to suppress this behaviour since we want to keep performance costs
- # as low as possible while having these checks.
- "-fsanitize-ignore-for-ubsan-feature=array-bounds",
# Because we've enabled array-bounds sanitizing we also want to suppress
# the related warning about "unsafe-buffer-usage-in-static-sized-array",
--- a/build/config/sanitizers/sanitizers.gni
+++ b/build/config/sanitizers/sanitizers.gni
@@ -543,14 +543,7 @@
cflags = [
"-fsanitize=${invoker.sanitizer}",
"-fsanitize-trap=${invoker.sanitizer}",
-
- # Prevents `__has_feature(undefined_behavior_sanitizer)`
- # from evaluating true. Configs defined here are intended to
- # be usable even in release builds, i.e. as widely as possible.
- # It's important not to have full-on UBSan workarounds activate
- # just because we built support for a specific sanitizer.
- "-fsanitize-ignore-for-ubsan-feature=${invoker.sanitizer}",
]
if (defined(invoker.cflags)) {
cflags += invoker.cflags
}

View File

@@ -0,0 +1,77 @@
CPDFSecurityHandlerEmbedderTest.Bug1124998
CPDFSecurityHandlerEmbedderTest.OwnerPasswordVersion2Latin1
CPDFSecurityHandlerEmbedderTest.OwnerPasswordVersion2UTF8
CPDFSecurityHandlerEmbedderTest.OwnerPasswordVersion3Latin1
CPDFSecurityHandlerEmbedderTest.OwnerPasswordVersion3UTF8
CPDFSecurityHandlerEmbedderTest.OwnerPasswordVersion5Latin1
CPDFSecurityHandlerEmbedderTest.OwnerPasswordVersion5UTF8
CPDFSecurityHandlerEmbedderTest.OwnerPasswordVersion6Latin1
CPDFSecurityHandlerEmbedderTest.OwnerPasswordVersion6UTF8
CPDFSecurityHandlerEmbedderTest.PasswordAfterGenerateSave
CPDFSecurityHandlerEmbedderTest.UserPasswordVersion2Latin1
CPDFSecurityHandlerEmbedderTest.UserPasswordVersion2UTF8
CPDFSecurityHandlerEmbedderTest.UserPasswordVersion3Latin1
CPDFSecurityHandlerEmbedderTest.UserPasswordVersion3UTF8
CPDFSecurityHandlerEmbedderTest.UserPasswordVersion5Latin1
CPDFSecurityHandlerEmbedderTest.UserPasswordVersion5UTF8
CPDFSecurityHandlerEmbedderTest.UserPasswordVersion6Latin1
CPDFSecurityHandlerEmbedderTest.UserPasswordVersion6UTF8
FPDFAnnotEmbedderTest.AddAndModifyImage
FPDFAnnotEmbedderTest.AddAndModifyPath
FPDFAnnotEmbedderTest.AddAndModifyText
FPDFAnnotEmbedderTest.AddAndSaveLinkAnnotation
FPDFAnnotEmbedderTest.AnnotationBorderRendering
FPDFAnnotEmbedderTest.FocusableAnnotRendering
FPDFAnnotEmbedderTest.GetSetStringValue
FPDFAnnotEmbedderTest.ModifyRectQuadpointsWithAP
FPDFAnnotEmbedderTest.SetFontColor
FPDFEditEmbedderTest.AddExistingMarkCompressedStream
FPDFEditEmbedderTest.AddMarkCompressedStream
FPDFEditEmbedderTest.AddMarkedText
FPDFEditEmbedderTest.AddMarkedTextWithFloat
FPDFEditEmbedderTest.AddStandardFontText
FPDFEditEmbedderTest.AddStandardFontText2
FPDFEditEmbedderTest.AddTrueTypeFontText
FPDFEditEmbedderTest.Bug1574
FPDFEditEmbedderTest.Bug1893
FPDFEditEmbedderTest.Bug410996566
FPDFEditEmbedderTest.Bug461845674
FPDFEditEmbedderTest.GetAndSetMatrixForFormWithText
FPDFEditEmbedderTest.ModifyFormObject
FPDFEditEmbedderTest.PathOnTopOfText
FPDFEditEmbedderTest.RemoveAllFromStream
FPDFEditEmbedderTest.RemoveExistingPageObjectSplitStreamsLonely
FPDFEditEmbedderTest.RemoveExistingPageObjectSplitStreamsNotLonely
FPDFEditEmbedderTest.RemoveFirstFromSingleStream
FPDFEditEmbedderTest.RemoveLastFromSingleStream
FPDFEditEmbedderTest.RemoveMarkedObjectsPrime
FPDFEditEmbedderTest.RemoveTextObject
FPDFEditEmbedderTest.RemoveTextObjectWithTwoPagesSharingContentArrayAndResources
FPDFEditEmbedderTest.RemoveTextObjectWithTwoPagesSharingContentStreamAndResources
FPDFEditEmbedderTest.RemoveTextObjectWithTwoPagesSharingResourcesDict
FPDFEditEmbedderTest.SetPositions
FPDFEditEmbedderTest.SetText
FPDFEditEmbedderTest.SetTextKeepClippingPath
FPDFEditEmbedderTest.SetTextRenderMode
FPDFFlattenEmbedderTest.Bug861842
FPDFFlattenEmbedderTest.Bug889099
FPDFFormFillComboBoxFormEmbedderTest.FormComboBoxBiDiLiveEdit
FPDFFormFillEmbedderTest.Bug1302455EditBothForms
FPDFFormFillEmbedderTest.Bug1302455EditFirstForm
FPDFFormFillEmbedderTest.Bug1302455EditSecondForm
FPDFFormFillEmbedderTest.FormText
FPDFFormFillEmbedderTest.RemoveFormFieldHighlight
FPDFFormFillTextFormEmbedderTest.FormTextFieldBiDiLiveEdit
FPDFPPOEmbedderTest.ImportWithZeroLengthStream
FPDFParserDecodeEmbedderTest.Bug455199
FPDFProgressiveRenderEmbedderTest.RenderAnnotWithPause
FPDFProgressiveRenderEmbedderTest.RenderFormsWithPause
FPDFProgressiveRenderEmbedderTest.RenderHighlightWithColorScheme
FPDFProgressiveRenderEmbedderTest.RenderHighlightWithColorSchemeAndConvertFillToStroke
FPDFProgressiveRenderEmbedderTest.RenderStampWithColorScheme
FPDFProgressiveRenderEmbedderTest.RenderTextWithColorScheme
FPDFProgressiveRenderEmbedderTest.RenderWithPause
FPDFProgressiveRenderEmbedderTest.RenderWithoutPause
FPDFSaveWithFontSubsetEmbedderTest.SaveWithSubsetMultipleFontsMultipleTexts
FPDFViewEmbedderTest.RenderBug664284WithNoNativeText
FPDFViewEmbedderTest.RenderHelloWorldWithFlags

View File

@@ -1,13 +1,15 @@
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -1180,7 +1180,9 @@ void EmbedderTest::CompareBitmapWithExpectationSuffix(
@@ -1155,6 +1155,11 @@ void EmbedderTest::CompareBitmapWithExpectationSuffix(
SCOPED_TRACE(testing::Message()
<< "CompareBitmapWithExpectationSuffix() with " << png_path);
- CompareBitmapToPngFile(bitmap, png_path, max_pixel_per_channel_delta);
+ CompareBitmapToPngFile(
+ bitmap, png_path,
+ std::max(max_pixel_per_channel_delta, GetPlatformMaxPixelDelta()));
- CompareBitmapToPngFile(bitmap, png_path, options);
+ DiffOptions adjusted_options = options;
+#if BUILDFLAG(IS_MAC)
+ adjusted_options.max_pixel_per_channel_delta =
+ std::max(adjusted_options.max_pixel_per_channel_delta, 1);
+#endif
+ CompareBitmapToPngFile(bitmap, png_path, adjusted_options);
if (EmbedderTestEnvironment::GetInstance()->write_pngs()) {
WriteBitmapToPng(bitmap, png_path);
}

View File

@@ -68,6 +68,14 @@ let
};
};
"src/third_party/dragonbox/src" = {
fetcher = "fetchFromGitiles";
args = {
url = "https://chromium.googlesource.com/external/github.com/jk-jeon/dragonbox";
inherit (sources.dragonbox) rev hash;
};
};
"src/third_party/fast_float/src" = {
fetcher = "fetchFromGitiles";
args = {
@@ -171,6 +179,10 @@ let
"RetainPtr.SetContains"
];
darwin27FailingEmbedderTests = lib.filter (test: test != "") (
lib.splitString "\n" (builtins.readFile ./darwin-27-failing-embedder-tests.txt)
);
disabledEmbedderTests = [
# These assert exact serialized PDF and font-subset output. With system
# libraries, output differs from upstream's in-tree stack; known
@@ -181,12 +193,17 @@ let
# These render tests also differ from upstream's in-tree stack. The known
# FreeType difference is the system autofit/autohinting configuration.
"FPDFViewEmbedderTest.RenderAnnotsGrayScale"
# The embedded CID font renders with different edge shades from the
# shared PNG reference on both Linux and macOS.
"FPDFEditEmbedderTest.SetPositionsVertical"
]
++ lib.optionals stdenv.hostPlatform.isLinux [
"FPDFProgressiveRenderEmbedderTest.RenderHighlightWithColorScheme"
"FPDFProgressiveRenderEmbedderTest.RenderHighlightWithColorSchemeAndConvertFillToStroke"
"FPDFAnnotEmbedderTest.ModifyRectQuadpointsWithAP"
];
]
# Changes to CoreGraphics rendering broke these tests when run on macOS 27+.
++ lib.optionals stdenv.hostPlatform.isDarwin darwin27FailingEmbedderTests;
mkDisabledGtestFilter = disabledTests: "-${lib.concatStringsSep ":" disabledTests}";
unitTestFilter = mkDisabledGtestFilter disabledUnitTests;
@@ -264,6 +281,10 @@ stdenv.mkDerivation (finalAttrs: {
};
postPatch = ''
substituteInPlace .gn \
--replace-fail 'script_executable = "//third_party/cpython3/host/bin/python3"' \
'script_executable = "${lib.getExe buildPackages.python3}"'
substituteInPlace BUILD.gn \
--replace-fail 'component("pdfium")' 'shared_library("pdfium")'

View File

@@ -1,14 +1,14 @@
--- a/build/config/linux/pkg-config.py
+++ b/build/config/linux/pkg-config.py
@@ -96,8 +96,10 @@
@@ -97,9 +97,11 @@
def RewritePath(path, strip_prefix, sysroot):
"""Rewrites a path by stripping the prefix and prepending the sysroot."""
if os.path.isabs(path) and not path.startswith(sysroot):
- if path.startswith(strip_prefix):
+ if strip_prefix and path.startswith(strip_prefix):
path = path[len(strip_prefix):]
+ elif path != '/usr' and not path.startswith('/usr/'):
+ return path
path = path.lstrip('/')
return os.path.join(sysroot, path)
"""Rewrites a path by stripping the prefix and prepending the sysroot."""
if os.path.isabs(path) and not path.startswith(sysroot):
- if path.startswith(strip_prefix):
+ if strip_prefix and path.startswith(strip_prefix):
path = path[len(strip_prefix) :]
+ elif path != '/usr' and not path.startswith('/usr/'):
+ return path
path = path.lstrip('/')
return os.path.join(sysroot, path)
else:

View File

@@ -1,19 +1,18 @@
--- a/build/config/linux/pkg-config.py
+++ b/build/config/linux/pkg-config.py
@@ -122,16 +122,6 @@
dest='version_as_components')
(options, args) = parser.parse_args()
@@ -143,15 +143,5 @@
(options, args) = parser.parse_args()
- # If this is run on non-Linux platforms, just return nothing and indicate
- # success. This allows us to "kind of emulate" a Linux build from other
- # platforms.
- if "linux" not in sys.platform:
- if options.libdir:
- sys.stdout.write("")
- return 0
- print("[[],[],[],[],[]]")
- return 0
- # If this is run on non-Linux platforms, just return nothing and indicate
- # success. This allows us to "kind of emulate" a Linux build from other
- # platforms.
- if "linux" not in sys.platform:
- if options.dridriverdir or options.libdir:
- sys.stdout.write("")
- return 0
- print("[[],[],[],[],[]]")
- return 0
-
# Make a list of regular expressions to strip out.
strip_out = []
if options.strip_out != None:
# Make a list of regular expressions to strip out.
strip_out = []
if options.strip_out != None:

View File

@@ -1,34 +1,38 @@
{
"version": {
"major": 148,
"major": 156,
"minor": 0,
"build": 7749,
"build": 8066,
"patch": 2
},
"pdfium": {
"hash": "sha256-RMkVffwjC8W4YwjlssNIWX1n2CAl97kE7z11yuzMX2o="
"hash": "sha256-gABzgxJYoRvkGyWi9EwHGLq+gmdzJsQyzOeXKwbcx/0="
},
"build": {
"rev": "c9202dd8ca1d4255bd9e505988b945746ddb378a",
"hash": "sha256-ovdPiQ4i2sFzjiwG8vZAWVaFQ03OXNB9ZdUULU2/q9g="
"rev": "2cd94c0abeada712aeea6906d99021913c9fc28d",
"hash": "sha256-ZKYkK/h2Ll8Q2zp3CJlc+mZuZe6b55fwh7xUkT1x27U="
},
"chromiumBuildtools": {
"hash": "sha256-BvGCdJ3EgUZX6MC3jf86YNl4LzUxpxiptCEBv3bqBIo="
"hash": "sha256-hCMtQADZX2xHvnyZneNRuUEZlunLqyLp7cshudfPLuw="
},
"abseil": {
"rev": "2a7d49fc392cad55159d68d98aa3648bc89795d3",
"hash": "sha256-dz2DA+bw/QQcfI9d9AKP7dn0eW0aAnhH+RmSStKS/hY="
"rev": "435e7d977fb36fb47854a4c552c0706dad0bd7cf",
"hash": "sha256-khfl3Y7Q823BSBmQUgacU83HdODjhVRLY0pu4cGCoec="
},
"dragonbox": {
"rev": "beeeef91cf6fef89a4d4ba5e95d47ca64ccb3a44",
"hash": "sha256-j6swuGgYGfiFcK3iqd4EKTeU92rZHKTbF5T1fcak/ko="
},
"fastFloat": {
"rev": "cb1d42aaa1e14b09e1452cfdef373d051b8c02a4",
"hash": "sha256-CG5je117WYyemTe5PTqznDP0bvY5TeXn8Vu1Xh5yUzQ="
"rev": "34164f547b7df3f5d794ff67e9f885c36819ebfc",
"hash": "sha256-DOwDLnMwlXAP5SfDJuxhkmLmcBZ1wBvXEJr5RuHepp4="
},
"gtest": {
"rev": "4fe3307fb2d9f86d19777c7eb0e4809e9694dde7",
"hash": "sha256-gJhv3DQQSP5BQ6GmDobq42/Gkx4AbOg/ZS80bM0WpEw="
},
"generateShimHeaders": {
"hash": "sha256-tqhnqYoQeXUTN7OSSVwchpEkGJwhCUSk8TG8LUgrHdg="
"hash": "sha256-/ViuvxJjjJ4gixjoGu6GXxKX8iXSZuy3BL+Yi0GLVDQ="
},
"testFonts": {
"rev": "7f51783942943e965cd56facf786544ccfc07713",

View File

@@ -1,13 +1,12 @@
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 877728afe3b..53a7f7e62d9 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -2596,7 +2596,7 @@
@@ -2349,8 +2349,8 @@
# 2. Remove the thin_archive config, so that the .a file actually contains all
# .o files, instead of just references to .o files in the build directoy
config("thin_archive") {
- if ((is_apple && use_lld) || (is_linux && !is_clang) || current_os == "aix") {
+ if ((is_apple && use_lld) || (is_linux && (!is_clang || !use_lld)) || current_os == "aix") {
- if ((is_apple && use_lld) || (is_linux && !is_clang) || current_os == "aix" ||
+ if ((is_apple && use_lld) || (is_linux && (!is_clang || !use_lld)) || current_os == "aix" ||
current_os == "zos") {
# The macOS and iOS linker ld64.ldd doesn't support thin archive without
# symbol table, gcc on linux also throws the error `archive has no index`.
# AIX does support -s option, not -S option.

View File

@@ -73,12 +73,13 @@ pdfium_src=$(jq -er '.storePath' <<< "$pdfium_prefetch")
deps_file="$pdfium_src/DEPS"
build_rev=$(extract_deps_rev "$deps_file" build_revision)
abseil_rev=$(extract_deps_rev "$deps_file" abseil_revision)
dragonbox_rev=$(extract_deps_rev "$deps_file" dragonbox_revision)
fast_float_rev=$(extract_deps_rev "$deps_file" fast_float_revision)
gtest_rev=$(extract_deps_rev "$deps_file" gtest_revision)
test_fonts_rev=$(extract_deps_rev "$deps_file" test_fonts_revision)
simdutf_rev=$(extract_deps_rev "$deps_file" simdutf_revision)
for dep_var in build_rev abseil_rev fast_float_rev gtest_rev test_fonts_rev simdutf_rev; do
for dep_var in build_rev abseil_rev dragonbox_rev fast_float_rev gtest_rev test_fonts_rev simdutf_rev; do
if [[ -z ${!dep_var} ]]; then
echo "failed to extract $dep_var from $deps_file" >&2
exit 1
@@ -104,6 +105,7 @@ done
build_hash=$(prefetch_archive_hash "${chromium_git_url}/chromium/src/build.git/+archive/${build_rev}.tar.gz")
chromium_buildtools_hash=$(prefetch_archive_hash "${chromium_git_url}/chromium/src/+archive/refs/branch-heads/${target_version}/buildtools.tar.gz")
abseil_hash=$(prefetch_archive_hash "${chromium_git_url}/chromium/src/third_party/abseil-cpp/+archive/${abseil_rev}.tar.gz")
dragonbox_hash=$(prefetch_archive_hash "${chromium_git_url}/external/github.com/jk-jeon/dragonbox/+archive/${dragonbox_rev}.tar.gz")
fast_float_hash=$(prefetch_archive_hash "${chromium_git_url}/external/github.com/fastfloat/fast_float/+archive/${fast_float_rev}.tar.gz")
gtest_hash=$(prefetch_archive_hash "${chromium_git_url}/external/github.com/google/googletest/+archive/${gtest_rev}.tar.gz")
generate_shim_headers_hash=$(prefetch_subdir_archive_hash "${chromium_git_url}/chromium/src/+archive/refs/branch-heads/${target_version}/tools/generate_shim_headers.tar.gz")
@@ -137,6 +139,8 @@ jq -n \
--arg chromium_buildtools_hash "$chromium_buildtools_hash" \
--arg abseil_rev "$abseil_rev" \
--arg abseil_hash "$abseil_hash" \
--arg dragonbox_rev "$dragonbox_rev" \
--arg dragonbox_hash "$dragonbox_hash" \
--arg fast_float_rev "$fast_float_rev" \
--arg fast_float_hash "$fast_float_hash" \
--arg gtest_rev "$gtest_rev" \
@@ -165,6 +169,10 @@ jq -n \
rev: $abseil_rev,
hash: $abseil_hash
},
dragonbox: {
rev: $dragonbox_rev,
hash: $dragonbox_hash
},
fastFloat: {
rev: $fast_float_rev,
hash: $fast_float_hash

View File

@@ -1,14 +1,12 @@
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 58d3a1788e6d2..bf834504367d7 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -1989,13 +1989,3 @@ config("runtime_library") {
- # Rust and C++ both provide intrinsics for LLVM to call for math operations. We
- # want to use the C++ intrinsics, not the ones in the Rust compiler_builtins
- # library. The Rust symbols are marked as weak, so that they can be replaced by
- # the C++ symbols. This config ensures the C++ symbols exist and are strong in
- # order to cause that replacement to occur by explicitly linking in clang's
- # compiler-rt library.
@@ -1701,13 +1701,3 @@ config("runtime_library") {
- # Rust and C++ both provide intrinsics for LLVM to call for math operations.
- # We want to use the C++ intrinsics, not the ones in the Rust
- # compiler_builtins library. The Rust symbols are marked as weak, so that they
- # can be replaced by the C++ symbols. This config ensures the C++ symbols
- # exist and are strong in order to cause that replacement to occur by
- # explicitly linking in clang's compiler-rt library.
- if (is_clang && !(is_a_target_toolchain && is_cronet_build)) {
- configs += [ "//build/config/clang:compiler_builtins" ]
- }