From 5e80ea3371c2e074dafc22da1fede48794566910 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 5 May 2023 13:53:00 +0300 Subject: [PATCH] mac: Remove libtest_trace_processor.dylib as a runtime dependency --- BUILD.gn | 6 -- patch/patch.cfg | 5 ++ patch/patches/base_test_4396276.patch | 103 ++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 patch/patches/base_test_4396276.patch diff --git a/BUILD.gn b/BUILD.gn index f3b0e2655..3271460b0 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -443,12 +443,6 @@ source_set("libcef_test_support") { # Support for UI input events. "//ui/views:test_support", ] - - if (is_mac && enable_base_tracing && !is_component_build) { - # Add libtest_trace_processor.dylib as a runtime dependency. - # See https://crrev.com/8b18bd125d - deps += [ "//base/test:test_trace_processor_bundle_data" ] - } } diff --git a/patch/patch.cfg b/patch/patch.cfg index d7e6eb3b9..70068789c 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -609,5 +609,10 @@ patches = [ # Fix ThreadChecker crash on startup with Chrome runtime + multi-threaded # message loop. 'name': 'metrics_system_profile' + }, + { + # macOS: Remove run-time dependency on libtest_trace_processor.dylib + # Reverts the changes from https://crrev.com/8b18bd125d + 'name': 'base_test_4396276' } ] diff --git a/patch/patches/base_test_4396276.patch b/patch/patches/base_test_4396276.patch new file mode 100644 index 000000000..c1b686969 --- /dev/null +++ b/patch/patches/base_test_4396276.patch @@ -0,0 +1,103 @@ +diff --git base/test/BUILD.gn base/test/BUILD.gn +index cc75b7235f438..f5bbc354f7918 100644 +--- base/test/BUILD.gn ++++ base/test/BUILD.gn +@@ -175,7 +175,6 @@ static_library("test_support") { + if (!is_chromeos) { + # TODO(rasikan): Add to ios and chromeos when unblocked by the chromiumos + # change to add the shared lib to the chrome-binary-tests directory. +- public_deps += [ ":test_trace_processor" ] + if (is_ios) { + deps += [ + ":test_trace_processor+bundle", +@@ -490,7 +489,7 @@ if (enable_base_tracing) { + # processor depends on dev_sqlite. The two share the same symbols but have + # different implementations, so we need to hide dev_sqlite in this shared + # library even in non-component builds to prevent duplicate symbols. +- _target_type = "shared_library" ++ _target_type = "component" + if (is_ios) { + _target_type = "ios_framework_bundle" + } +@@ -516,32 +515,5 @@ if (enable_base_tracing) { + output_name = "TestTraceProcessor" + bundle_deps_filter = [ "//third_party/icu:icudata" ] + } +- +- # Set rpath on dependent tests so that they can find the shared library +- # in a non-component build. +- if (!is_component_build) { +- all_dependent_configs = [] +- if (is_linux || is_chromeos) { +- all_dependent_configs += +- [ "//build/config/gcc:rpath_for_built_shared_libraries" ] +- } +- if (is_mac) { +- # We need the lib to be in $root_out_dir/Libraries so the library is where +- # the linker expects it, since we set the install_name flag. We need to +- # set this flag so that the library can be found when it is bundled in the +- # Content Shell Framework (see test_trace_processor_bundle_data). +- output_dir = "$root_out_dir/Libraries" +- ldflags = [ "-Wl,-install_name,@loader_path/Libraries/libtest_trace_processor.dylib" ] +- } +- } +- } +- +- if (!is_component_build && is_mac) { +- bundle_data("test_trace_processor_bundle_data") { +- testonly = true +- sources = [ "$root_out_dir/Libraries/libtest_trace_processor.dylib" ] +- outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ] +- public_deps = [ ":test_trace_processor" ] +- } + } + } +diff --git base/test/test_trace_processor_export.h base/test/test_trace_processor_export.h +index f5191b804bc07..aadb7d66ba4c3 100644 +--- base/test/test_trace_processor_export.h ++++ base/test/test_trace_processor_export.h +@@ -5,6 +5,7 @@ + #ifndef BASE_TEST_TEST_TRACE_PROCESSOR_EXPORT_H_ + #define BASE_TEST_TEST_TRACE_PROCESSOR_EXPORT_H_ + ++#if defined(COMPONENT_BUILD) + #if defined(WIN32) + + #if defined(TEST_TRACE_PROCESSOR_IMPL) +@@ -23,4 +24,8 @@ + + #endif // defined(WIN32) + ++#else // defined(COMPONENT_BUILD) ++#define TEST_TRACE_PROCESSOR_EXPORT ++#endif ++ + #endif // BASE_TEST_TEST_TRACE_PROCESSOR_EXPORT_H_ +diff --git content/shell/BUILD.gn content/shell/BUILD.gn +index e0921c6326700..1d3fbfaa532a1 100644 +--- content/shell/BUILD.gn ++++ content/shell/BUILD.gn +@@ -809,7 +809,6 @@ if (is_mac) { + # Specify a sensible install_name for static builds. The library is + # dlopen()ed so this is not used to resolve the module. + ldflags = [ "-Wl,-install_name,@executable_path/../Frameworks/$output_name.framework/$output_name" ] +- deps += [ "//base/test:test_trace_processor_bundle_data" ] + } else { + # Both the main :content_shell and :content_shell_helper_app executables + # need to link the framework. Because they are at different directory +diff --git gpu/BUILD.gn gpu/BUILD.gn +index 7bbd7cb6be9c2..df9e0f2a93ad9 100644 +--- gpu/BUILD.gn ++++ gpu/BUILD.gn +@@ -730,10 +730,7 @@ test("gpu_unittests") { + "//url", + ] + +- # Cronet disables tracing (crbug.com/1400235). +- # TODO(rasikan): Remove when unblocked by chromiumos change to add shared lib +- # to add the shared lib to the chrome-binary-tests directory. +- if (enable_base_tracing && !is_cronet_build && is_chromeos) { ++ if (enable_base_tracing) { + deps += [ "//base/test:test_trace_processor" ] + } +