Always check out google_benchmark, part 3.

Add a WebRTC-specific arg that can be used to control use of targets
that rely on //third_party/google_benchmarks, so the .gni in that
directory can eventually be removed.

Bug: chromium:1404759
Change-Id: I2a9422fae119ca13eb50028d962fc0a671b5fb33
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/297460
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#39553}
This commit is contained in:
Peter Kasting 2023-03-13 16:01:00 -07:00 committed by WebRTC LUCI CQ
parent 9a5de95af9
commit 1e6d77c29a
6 changed files with 266 additions and 264 deletions

View File

@ -628,7 +628,7 @@ if (rtc_include_tests && !build_with_chromium) {
} }
} }
if (enable_google_benchmarks) { if (enable_google_benchmarks && rtc_enable_google_benchmarks) {
rtc_test("benchmarks") { rtc_test("benchmarks") {
testonly = true testonly = true
deps = [ deps = [

View File

@ -13,9 +13,6 @@ enable_java_templates = true
# only needed to support both WebRTC standalone and Chromium builds. # only needed to support both WebRTC standalone and Chromium builds.
build_with_chromium = false build_with_chromium = false
# WebRTC checks out google_benchmark by default since it is always used.
checkout_google_benchmark = true
# Use our own suppressions files. # Use our own suppressions files.
asan_suppressions_file = "//build/sanitizers/asan_suppressions.cc" asan_suppressions_file = "//build/sanitizers/asan_suppressions.cc"
lsan_suppressions_file = "//tools_webrtc/sanitizers/lsan_suppressions_webrtc.cc" lsan_suppressions_file = "//tools_webrtc/sanitizers/lsan_suppressions_webrtc.cc"

View File

@ -2041,7 +2041,7 @@ if (rtc_include_tests) {
"synchronization:mutex", "synchronization:mutex",
"third_party/sigslot", "third_party/sigslot",
] ]
if (enable_google_benchmarks) { if (enable_google_benchmarks && rtc_enable_google_benchmarks) {
deps += [ "synchronization:synchronization_unittests" ] deps += [ "synchronization:synchronization_unittests" ]
} }
if (is_win) { if (is_win) {

View File

@ -73,36 +73,35 @@ rtc_library("yield_policy") {
] ]
} }
if (rtc_include_tests) { if (rtc_include_tests && enable_google_benchmarks &&
if (enable_google_benchmarks) { rtc_enable_google_benchmarks) {
rtc_library("synchronization_unittests") { rtc_library("synchronization_unittests") {
testonly = true testonly = true
sources = [ sources = [
"mutex_unittest.cc", "mutex_unittest.cc",
"yield_policy_unittest.cc", "yield_policy_unittest.cc",
] ]
deps = [ deps = [
":mutex", ":mutex",
":yield", ":yield",
":yield_policy", ":yield_policy",
"..:checks", "..:checks",
"..:macromagic", "..:macromagic",
"..:platform_thread", "..:platform_thread",
"..:rtc_event", "..:rtc_event",
"..:threading", "..:threading",
"../../test:test_support", "../../test:test_support",
"//third_party/google_benchmark", "//third_party/google_benchmark",
] ]
} }
rtc_library("mutex_benchmark") { rtc_library("mutex_benchmark") {
testonly = true testonly = true
sources = [ "mutex_benchmark.cc" ] sources = [ "mutex_benchmark.cc" ]
deps = [ deps = [
":mutex", ":mutex",
"../system:unused", "../system:unused",
"//third_party/google_benchmark", "//third_party/google_benchmark",
] ]
}
} }
} }

View File

@ -494,246 +494,248 @@ rtc_library("video_test_support") {
} }
} }
if (rtc_include_tests && enable_google_benchmarks) { if (rtc_include_tests) {
rtc_library("benchmark_main") { if (enable_google_benchmarks && rtc_enable_google_benchmarks) {
testonly = true rtc_library("benchmark_main") {
sources = [ "benchmark_main.cc" ]
deps = [ "//third_party/google_benchmark" ]
}
}
if (rtc_include_tests && !build_with_chromium) {
rtc_library("resources_dir_flag") {
testonly = true
visibility = [ "*" ]
sources = [
"testsupport/resources_dir_flag.cc",
"testsupport/resources_dir_flag.h",
]
absl_deps = [ "//third_party/abseil-cpp/absl/flags:flag" ]
}
rtc_library("test_flags") {
visibility = [ "*" ]
testonly = true
sources = [
"test_flags.cc",
"test_flags.h",
]
absl_deps = [ "//third_party/abseil-cpp/absl/flags:flag" ]
}
rtc_library("test_main_lib") {
visibility = [ "*" ]
testonly = true
sources = [
"test_main_lib.cc",
"test_main_lib.h",
]
deps = [
":field_trial",
":perf_test",
":resources_dir_flag",
":test_flags",
":test_support",
"../api/test/metrics:chrome_perf_dashboard_metrics_exporter",
"../api/test/metrics:global_metrics_logger_and_exporter",
"../api/test/metrics:metrics_exporter",
"../api/test/metrics:metrics_set_proto_file_exporter",
"../api/test/metrics:print_result_proxy_metrics_exporter",
"../api/test/metrics:stdout_metrics_exporter",
"../rtc_base:checks",
"../rtc_base:event_tracer",
"../rtc_base:logging",
"../rtc_base:ssl",
"../rtc_base:threading",
"../system_wrappers:field_trial",
"../system_wrappers:metrics",
]
absl_deps = [
"//third_party/abseil-cpp/absl/flags:flag",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings:strings",
"//third_party/abseil-cpp/absl/types:optional",
]
if (is_win) {
deps += [ "../rtc_base:win32_socket_init" ]
}
}
rtc_library("test_main") {
visibility = [ "*" ]
testonly = true
sources = [ "test_main.cc" ]
deps = [
":test_main_lib",
":test_support",
]
absl_deps = [
"//third_party/abseil-cpp/absl/debugging:failure_signal_handler",
"//third_party/abseil-cpp/absl/debugging:symbolize",
"//third_party/abseil-cpp/absl/flags:parse",
]
}
rtc_library("test_support_test_artifacts") {
testonly = true
sources = [
"testsupport/test_artifacts.cc",
"testsupport/test_artifacts.h",
]
deps = [
":fileutils",
"../rtc_base:logging",
"../rtc_base/system:file_wrapper",
]
absl_deps = [
"//third_party/abseil-cpp/absl/flags:flag",
"//third_party/abseil-cpp/absl/flags:parse",
]
}
test_support_unittests_resources = [
"../resources/foreman_cif_short.yuv",
"../resources/video_coding/frame-ethernet-ii.pcap",
"../resources/video_coding/frame-loopback.pcap",
"../resources/video_coding/pltype103.rtp",
"../resources/video_coding/pltype103_header_only.rtp",
"../resources/video_coding/ssrcs-2.pcap",
"../resources/video_coding/ssrcs-3.pcap",
]
if (is_ios) {
bundle_data("test_support_unittests_bundle_data") {
testonly = true testonly = true
sources = test_support_unittests_resources sources = [ "benchmark_main.cc" ]
outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
deps = [ "//third_party/google_benchmark" ]
} }
} }
rtc_library("fixed_fps_video_frame_writer_adapter_test") { if (!build_with_chromium) {
testonly = true rtc_library("resources_dir_flag") {
sources = [ "testsupport/fixed_fps_video_frame_writer_adapter_test.cc" ] testonly = true
deps = [ visibility = [ "*" ]
":fixed_fps_video_frame_writer_adapter", sources = [
":test_support", "testsupport/resources_dir_flag.cc",
":video_test_support", "testsupport/resources_dir_flag.h",
"../api/units:time_delta", ]
"../api/units:timestamp", absl_deps = [ "//third_party/abseil-cpp/absl/flags:flag" ]
"../api/video:video_frame",
"../rtc_base/synchronization:mutex",
"time_controller",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
rtc_test("test_support_unittests") {
deps = [
":call_config_utils",
":copy_to_file_audio_capturer_unittest",
":direct_transport",
":fake_video_codecs",
":fileutils",
":fileutils_unittests",
":fixed_fps_video_frame_writer_adapter_test",
":frame_generator_impl",
":perf_test",
":rtc_expect_death",
":rtp_test_utils",
":run_loop",
":scoped_key_value_config",
":test_main",
":test_support",
":test_support_test_artifacts",
":video_test_common",
":video_test_support",
":y4m_frame_generator",
"../api:array_view",
"../api:create_frame_generator",
"../api:create_simulcast_test_fixture_api",
"../api:frame_generator_api",
"../api:scoped_refptr",
"../api:simulcast_test_fixture_api",
"../api/task_queue:task_queue_test",
"../api/test/video:function_video_factory",
"../api/test/video:video_frame_writer",
"../api/units:time_delta",
"../api/video:encoded_image",
"../api/video:video_frame",
"../api/video_codecs:video_codecs_api",
"../call:video_stream_api",
"../common_video",
"../media:codec",
"../media:media_constants",
"../media:rtc_media_base",
"../modules/rtp_rtcp:rtp_rtcp_format",
"../modules/video_coding:simulcast_test_fixture_impl",
"../modules/video_coding:video_codec_interface",
"../modules/video_coding:video_coding_utility",
"../modules/video_coding:webrtc_h264",
"../modules/video_coding:webrtc_vp8",
"../modules/video_coding:webrtc_vp9",
"../rtc_base:criticalsection",
"../rtc_base:rtc_event",
"../rtc_base:rtc_task_queue",
"../rtc_base/synchronization:mutex",
"../rtc_base/system:file_wrapper",
"pc/e2e:e2e_unittests",
"pc/e2e/analyzer/video:video_analyzer_unittests",
"peer_scenario/tests",
"scenario:scenario_unittests",
"time_controller:time_controller",
"time_controller:time_controller_unittests",
]
absl_deps = [
"//third_party/abseil-cpp/absl/flags:flag",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
sources = [
"call_config_utils_unittest.cc",
"direct_transport_unittest.cc",
"fake_vp8_encoder_unittest.cc",
"frame_generator_capturer_unittest.cc",
"frame_generator_unittest.cc",
"rtp_file_reader_unittest.cc",
"rtp_file_writer_unittest.cc",
"run_loop_unittest.cc",
"testsupport/ivf_video_frame_generator_unittest.cc",
"testsupport/perf_test_unittest.cc",
"testsupport/test_artifacts_unittest.cc",
"testsupport/video_frame_writer_unittest.cc",
"testsupport/y4m_frame_generator_test.cc",
"testsupport/y4m_frame_reader_unittest.cc",
"testsupport/y4m_frame_writer_unittest.cc",
"testsupport/yuv_frame_reader_unittest.cc",
"testsupport/yuv_frame_writer_unittest.cc",
]
if (rtc_enable_protobuf) {
sources += [ "testsupport/perf_test_histogram_writer_unittest.cc" ]
deps += [ "//third_party/catapult/tracing/tracing:histogram" ]
} }
data = test_support_unittests_resources rtc_library("test_flags") {
if (is_android) { visibility = [ "*" ]
deps += [ "//testing/android/native_test:native_test_support" ] testonly = true
shard_timeout = 900 sources = [
"test_flags.cc",
"test_flags.h",
]
absl_deps = [ "//third_party/abseil-cpp/absl/flags:flag" ]
} }
rtc_library("test_main_lib") {
visibility = [ "*" ]
testonly = true
sources = [
"test_main_lib.cc",
"test_main_lib.h",
]
deps = [
":field_trial",
":perf_test",
":resources_dir_flag",
":test_flags",
":test_support",
"../api/test/metrics:chrome_perf_dashboard_metrics_exporter",
"../api/test/metrics:global_metrics_logger_and_exporter",
"../api/test/metrics:metrics_exporter",
"../api/test/metrics:metrics_set_proto_file_exporter",
"../api/test/metrics:print_result_proxy_metrics_exporter",
"../api/test/metrics:stdout_metrics_exporter",
"../rtc_base:checks",
"../rtc_base:event_tracer",
"../rtc_base:logging",
"../rtc_base:ssl",
"../rtc_base:threading",
"../system_wrappers:field_trial",
"../system_wrappers:metrics",
]
absl_deps = [
"//third_party/abseil-cpp/absl/flags:flag",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings:strings",
"//third_party/abseil-cpp/absl/types:optional",
]
if (is_win) {
deps += [ "../rtc_base:win32_socket_init" ]
}
}
rtc_library("test_main") {
visibility = [ "*" ]
testonly = true
sources = [ "test_main.cc" ]
deps = [
":test_main_lib",
":test_support",
]
absl_deps = [
"//third_party/abseil-cpp/absl/debugging:failure_signal_handler",
"//third_party/abseil-cpp/absl/debugging:symbolize",
"//third_party/abseil-cpp/absl/flags:parse",
]
}
rtc_library("test_support_test_artifacts") {
testonly = true
sources = [
"testsupport/test_artifacts.cc",
"testsupport/test_artifacts.h",
]
deps = [
":fileutils",
"../rtc_base:logging",
"../rtc_base/system:file_wrapper",
]
absl_deps = [
"//third_party/abseil-cpp/absl/flags:flag",
"//third_party/abseil-cpp/absl/flags:parse",
]
}
test_support_unittests_resources = [
"../resources/foreman_cif_short.yuv",
"../resources/video_coding/frame-ethernet-ii.pcap",
"../resources/video_coding/frame-loopback.pcap",
"../resources/video_coding/pltype103.rtp",
"../resources/video_coding/pltype103_header_only.rtp",
"../resources/video_coding/ssrcs-2.pcap",
"../resources/video_coding/ssrcs-3.pcap",
]
if (is_ios) { if (is_ios) {
deps += [ ":test_support_unittests_bundle_data" ] bundle_data("test_support_unittests_bundle_data") {
testonly = true
sources = test_support_unittests_resources
outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
}
} }
if (!is_android) { rtc_library("fixed_fps_video_frame_writer_adapter_test") {
# This is needed in order to avoid: testonly = true
# undefined symbol: webrtc::videocapturemodule::VideoCaptureImpl::Create sources = [ "testsupport/fixed_fps_video_frame_writer_adapter_test.cc" ]
deps += [ "../modules/video_capture:video_capture_internal_impl" ] deps = [
":fixed_fps_video_frame_writer_adapter",
":test_support",
":video_test_support",
"../api/units:time_delta",
"../api/units:timestamp",
"../api/video:video_frame",
"../rtc_base/synchronization:mutex",
"time_controller",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
rtc_test("test_support_unittests") {
deps = [
":call_config_utils",
":copy_to_file_audio_capturer_unittest",
":direct_transport",
":fake_video_codecs",
":fileutils",
":fileutils_unittests",
":fixed_fps_video_frame_writer_adapter_test",
":frame_generator_impl",
":perf_test",
":rtc_expect_death",
":rtp_test_utils",
":run_loop",
":scoped_key_value_config",
":test_main",
":test_support",
":test_support_test_artifacts",
":video_test_common",
":video_test_support",
":y4m_frame_generator",
"../api:array_view",
"../api:create_frame_generator",
"../api:create_simulcast_test_fixture_api",
"../api:frame_generator_api",
"../api:scoped_refptr",
"../api:simulcast_test_fixture_api",
"../api/task_queue:task_queue_test",
"../api/test/video:function_video_factory",
"../api/test/video:video_frame_writer",
"../api/units:time_delta",
"../api/video:encoded_image",
"../api/video:video_frame",
"../api/video_codecs:video_codecs_api",
"../call:video_stream_api",
"../common_video",
"../media:codec",
"../media:media_constants",
"../media:rtc_media_base",
"../modules/rtp_rtcp:rtp_rtcp_format",
"../modules/video_coding:simulcast_test_fixture_impl",
"../modules/video_coding:video_codec_interface",
"../modules/video_coding:video_coding_utility",
"../modules/video_coding:webrtc_h264",
"../modules/video_coding:webrtc_vp8",
"../modules/video_coding:webrtc_vp9",
"../rtc_base:criticalsection",
"../rtc_base:rtc_event",
"../rtc_base:rtc_task_queue",
"../rtc_base/synchronization:mutex",
"../rtc_base/system:file_wrapper",
"pc/e2e:e2e_unittests",
"pc/e2e/analyzer/video:video_analyzer_unittests",
"peer_scenario/tests",
"scenario:scenario_unittests",
"time_controller:time_controller",
"time_controller:time_controller_unittests",
]
absl_deps = [
"//third_party/abseil-cpp/absl/flags:flag",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
sources = [
"call_config_utils_unittest.cc",
"direct_transport_unittest.cc",
"fake_vp8_encoder_unittest.cc",
"frame_generator_capturer_unittest.cc",
"frame_generator_unittest.cc",
"rtp_file_reader_unittest.cc",
"rtp_file_writer_unittest.cc",
"run_loop_unittest.cc",
"testsupport/ivf_video_frame_generator_unittest.cc",
"testsupport/perf_test_unittest.cc",
"testsupport/test_artifacts_unittest.cc",
"testsupport/video_frame_writer_unittest.cc",
"testsupport/y4m_frame_generator_test.cc",
"testsupport/y4m_frame_reader_unittest.cc",
"testsupport/y4m_frame_writer_unittest.cc",
"testsupport/yuv_frame_reader_unittest.cc",
"testsupport/yuv_frame_writer_unittest.cc",
]
if (rtc_enable_protobuf) {
sources += [ "testsupport/perf_test_histogram_writer_unittest.cc" ]
deps += [ "//third_party/catapult/tracing/tracing:histogram" ]
}
data = test_support_unittests_resources
if (is_android) {
deps += [ "//testing/android/native_test:native_test_support" ]
shard_timeout = 900
}
if (is_ios) {
deps += [ ":test_support_unittests_bundle_data" ]
}
if (!is_android) {
# This is needed in order to avoid:
# undefined symbol: webrtc::videocapturemodule::VideoCaptureImpl::Create
deps += [ "../modules/video_capture:video_capture_internal_impl" ]
}
} }
} }
} }

View File

@ -54,6 +54,10 @@ declare_args() {
# This is useful for example to be able to get RTC_DLOGs on a release build. # This is useful for example to be able to get RTC_DLOGs on a release build.
rtc_dlog_always_on = false rtc_dlog_always_on = false
# Enables additional build targets that rely on
# //third_party/google_benchmarks.
rtc_enable_google_benchmarks = true
# Setting this to true will make RTC_OBJC_EXPORT expand to code that will # Setting this to true will make RTC_OBJC_EXPORT expand to code that will
# manage symbols visibility. By default, Obj-C/Obj-C++ symbols are exported # manage symbols visibility. By default, Obj-C/Obj-C++ symbols are exported
# if C++ symbols are but setting this arg to true while keeping # if C++ symbols are but setting this arg to true while keeping