diff --git a/.gn b/.gn index f968276c32..a6b4af7280 100644 --- a/.gn +++ b/.gn @@ -24,6 +24,7 @@ secondary_source = "//build/secondary/" check_targets = [ "//webrtc/api/*", "//webrtc/audio/*", + "//webrtc/base/*", "//webrtc/call/*", "//webrtc/common_video/*", "//webrtc/common_audio/*", diff --git a/webrtc/base/BUILD.gn b/webrtc/base/BUILD.gn index a3ee03f4ba..2a17d923ad 100644 --- a/webrtc/base/BUILD.gn +++ b/webrtc/base/BUILD.gn @@ -92,6 +92,10 @@ source_set("protobuf_utils") { # The subset of rtc_base approved for use outside of libjingle. rtc_static_library("rtc_base_approved") { + # TODO(kjellander): Remove (bugs.webrtc.org/7480) + # Enabling GN check triggers a cyclic dependency caused by rate_limiter.cc: + # :rtc_base_approved -> //webrtc/system_wrappers -> :rtc_base_approved + check_includes = false defines = [] libs = [] deps = [] @@ -136,8 +140,6 @@ rtc_static_library("rtc_base_approved") { "location.h", "md5.cc", "md5.h", - "md5digest.cc", - "md5digest.h", "mod_ops.h", "onetimeevent.h", "optional.cc", @@ -172,6 +174,7 @@ rtc_static_library("rtc_base_approved") { "string_to_number.h", "stringencode.cc", "stringencode.h", + "stringize_macros.h", "stringutils.cc", "stringutils.h", "swap_queue.h", @@ -655,78 +658,84 @@ rtc_source_set("gtest_prod") { ] } +config("rtc_base_tests_utils_exported_config") { + defines = [ "GTEST_RELATIVE_PATH" ] +} + +config("rtc_base_tests_utils_warnings_config") { + if (is_win && is_clang) { + cflags = [ + # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270 + "-Wno-reorder", + "-Wno-sign-compare", + ] + } +} + +rtc_source_set("rtc_base_tests_utils") { + testonly = true + sources = [ + # Also use this as a convenient dumping ground for misc files that are + # included by multiple targets below. + "cpu_time.cc", + "cpu_time.h", + "fakeclock.cc", + "fakeclock.h", + "fakenetwork.h", + "fakesslidentity.h", + "firewallsocketserver.cc", + "firewallsocketserver.h", + "gunit.h", + "httpserver.cc", + "httpserver.h", + "md5digest.cc", + "md5digest.h", + "memory_usage.cc", + "memory_usage.h", + "natserver.cc", + "natserver.h", + "natsocketfactory.cc", + "natsocketfactory.h", + "nattypes.cc", + "nattypes.h", + "proxyserver.cc", + "proxyserver.h", + "sigslottester.h", + "sigslottester.h.pump", + "testbase64.h", + "testechoserver.h", + "testutils.h", + "timedelta.h", + ] + configs += [ ":rtc_base_tests_utils_warnings_config" ] + public_configs = [ ":rtc_base_tests_utils_exported_config" ] + deps = [ + ":rtc_base", + "../test:field_trial", + "../test:test_support", + ] + public_deps = [ + "//testing/gmock", + "//testing/gtest", + ] + + if (!build_with_chromium && is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] + } +} + if (rtc_include_tests) { - config("rtc_base_tests_utils_exported_config") { - defines = [ "GTEST_RELATIVE_PATH" ] - } - - config("rtc_base_tests_utils_warnings_config") { - if (is_win && is_clang) { - cflags = [ - # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270 - "-Wno-reorder", - "-Wno-sign-compare", - ] - } - } - rtc_source_set("rtc_base_tests_main") { testonly = true sources = [ "unittest_main.cc", ] public_configs = [ ":rtc_base_tests_utils_exported_config" ] - deps = [ - ":rtc_base_tests_utils", - ] - public_deps = [ - "//testing/gmock", - "//testing/gtest", - ] - - if (!build_with_chromium && is_clang) { - # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). - suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] - } - } - - rtc_source_set("rtc_base_tests_utils") { - testonly = true - sources = [ - # Also use this as a convenient dumping ground for misc files that are - # included by multiple targets below. - "cpu_time.cc", - "cpu_time.h", - "fakeclock.cc", - "fakeclock.h", - "fakenetwork.h", - "fakesslidentity.h", - "firewallsocketserver.cc", - "firewallsocketserver.h", - "gunit.h", - "httpserver.cc", - "httpserver.h", - "memory_usage.cc", - "memory_usage.h", - "natserver.cc", - "natserver.h", - "natsocketfactory.cc", - "natsocketfactory.h", - "nattypes.cc", - "nattypes.h", - "proxyserver.cc", - "proxyserver.h", - "sigslottester.h", - "sigslottester.h.pump", - "testbase64.h", - "testechoserver.h", - "testutils.h", - "timedelta.h", - ] - configs += [ ":rtc_base_tests_utils_warnings_config" ] - public_configs = [ ":rtc_base_tests_utils_exported_config" ] deps = [ ":rtc_base", + ":rtc_base_approved", + ":rtc_base_tests_utils", "../test:field_trial", "../test:test_support", ] @@ -763,6 +772,9 @@ if (rtc_include_tests) { deps = [ ":rtc_base", ":rtc_base_tests_main", + ":rtc_base_tests_utils", + "../system_wrappers:system_wrappers", + "../test:test_support", "//testing/gtest", ] if (is_win) { @@ -817,6 +829,7 @@ if (rtc_include_tests) { "safe_minmax_unittest.cc", "string_to_number_unittest.cc", "stringencode_unittest.cc", + "stringize_macros_unittest.cc", "stringutils_unittest.cc", "swap_queue_unittest.cc", "thread_annotations_unittest.cc", @@ -825,8 +838,13 @@ if (rtc_include_tests) { "timeutils_unittest.cc", ] deps = [ + ":rtc_base", ":rtc_base_approved", ":rtc_base_tests_main", + ":rtc_base_tests_utils", + ":rtc_task_queue", + "../system_wrappers:system_wrappers", + "../test:test_support", ] if (!build_with_chromium && is_clang) { # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). @@ -850,7 +868,9 @@ if (rtc_include_tests) { ] deps = [ ":rtc_base_tests_main", + ":rtc_base_tests_utils", ":rtc_task_queue", + "../test:test_support", ] if (!build_with_chromium && is_clang) { # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). @@ -872,8 +892,10 @@ if (rtc_include_tests) { "numerics/percentile_filter_unittest.cc", ] deps = [ + ":rtc_base_approved", ":rtc_base_tests_main", ":rtc_numerics", + "../test:test_support", ] } @@ -939,6 +961,8 @@ if (rtc_include_tests) { } deps = [ ":rtc_base_tests_main", + ":rtc_base_tests_utils", + "../test:test_support", ] public_deps = [ ":rtc_base", diff --git a/webrtc/base/location.h b/webrtc/base/location.h index a541bbef51..541be9ac14 100644 --- a/webrtc/base/location.h +++ b/webrtc/base/location.h @@ -13,7 +13,7 @@ #include -#include "webrtc/system_wrappers/include/stringize_macros.h" +#include "webrtc/base/stringize_macros.h" namespace rtc { diff --git a/webrtc/base/pathutils.cc b/webrtc/base/pathutils.cc index 75dabb53e4..30367743bf 100644 --- a/webrtc/base/pathutils.cc +++ b/webrtc/base/pathutils.cc @@ -16,7 +16,6 @@ #endif // WEBRTC_WIN #include "webrtc/base/checks.h" -#include "webrtc/base/fileutils.h" #include "webrtc/base/logging.h" #include "webrtc/base/pathutils.h" #include "webrtc/base/stringutils.h" diff --git a/webrtc/system_wrappers/include/stringize_macros.h b/webrtc/base/stringize_macros.h similarity index 86% rename from webrtc/system_wrappers/include/stringize_macros.h rename to webrtc/base/stringize_macros.h index 9c8e7e9120..7e2f44da8a 100644 --- a/webrtc/system_wrappers/include/stringize_macros.h +++ b/webrtc/base/stringize_macros.h @@ -15,8 +15,8 @@ // symbols (or their output) and manipulating preprocessor symbols // that define strings. -#ifndef WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STRINGIZE_MACROS_H_ -#define WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STRINGIZE_MACROS_H_ +#ifndef WEBRTC_BASE_STRINGIZE_MACROS_H_ +#define WEBRTC_BASE_STRINGIZE_MACROS_H_ // This is not very useful as it does not expand defined symbols if // called directly. Use its counterpart without the _NO_EXPANSION @@ -35,4 +35,4 @@ // STRINGIZE(B(y)) produces "myobj->FunctionCall(y)" #define STRINGIZE(x) STRINGIZE_NO_EXPANSION(x) -#endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_STRINGIZE_MACROS_H_ +#endif // WEBRTC_BASE_STRINGIZE_MACROS_H_ diff --git a/webrtc/system_wrappers/source/stringize_macros_unittest.cc b/webrtc/base/stringize_macros_unittest.cc similarity index 95% rename from webrtc/system_wrappers/source/stringize_macros_unittest.cc rename to webrtc/base/stringize_macros_unittest.cc index 8b103c5d39..d0ba113d4d 100644 --- a/webrtc/system_wrappers/source/stringize_macros_unittest.cc +++ b/webrtc/base/stringize_macros_unittest.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "webrtc/system_wrappers/include/stringize_macros.h" +#include "webrtc/base/stringize_macros.h" #include "webrtc/test/gtest.h" diff --git a/webrtc/common_audio/resampler/sinc_resampler_unittest.cc b/webrtc/common_audio/resampler/sinc_resampler_unittest.cc index 82546d0360..990580dd2d 100644 --- a/webrtc/common_audio/resampler/sinc_resampler_unittest.cc +++ b/webrtc/common_audio/resampler/sinc_resampler_unittest.cc @@ -19,11 +19,11 @@ #include #include +#include "webrtc/base/stringize_macros.h" #include "webrtc/base/timeutils.h" #include "webrtc/common_audio/resampler/sinc_resampler.h" #include "webrtc/common_audio/resampler/sinusoidal_linear_chirp_source.h" #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" -#include "webrtc/system_wrappers/include/stringize_macros.h" #include "webrtc/test/gmock.h" #include "webrtc/test/gtest.h" diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn index 1867d93970..f50cf8273b 100644 --- a/webrtc/modules/audio_coding/BUILD.gn +++ b/webrtc/modules/audio_coding/BUILD.gn @@ -1621,6 +1621,7 @@ if (rtc_include_tests) { "..:module_api", "../..:webrtc_common", "../../base:rtc_base_approved", + "../../base:rtc_base_tests_utils", "../../common_audio", "../../test:rtp_test_utils", "../rtp_rtcp", diff --git a/webrtc/system_wrappers/BUILD.gn b/webrtc/system_wrappers/BUILD.gn index 6a056c2d9c..325c0166a0 100644 --- a/webrtc/system_wrappers/BUILD.gn +++ b/webrtc/system_wrappers/BUILD.gn @@ -27,7 +27,6 @@ rtc_static_library("system_wrappers") { "include/rw_lock_wrapper.h", "include/sleep.h", "include/static_instance.h", - "include/stringize_macros.h", "include/timestamp_extrapolator.h", "include/trace.h", "source/aligned_malloc.cc", @@ -211,7 +210,6 @@ if (rtc_include_tests) { "source/metrics_unittest.cc", "source/ntp_time_unittest.cc", "source/rtp_to_ntp_estimator_unittest.cc", - "source/stringize_macros_unittest.cc", ] configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] diff --git a/webrtc/test/BUILD.gn b/webrtc/test/BUILD.gn index c696979dd1..40ffc3854e 100644 --- a/webrtc/test/BUILD.gn +++ b/webrtc/test/BUILD.gn @@ -22,12 +22,17 @@ group("test") { ":field_trial", ":rtp_test_utils", ":test_common", - ":test_main", ":test_renderer", ":test_support", - ":test_support_unittests", ":video_test_common", ] + + if (!build_with_chromium) { + deps += [ + ":test_main", + ":test_support_unittests", + ] + } } rtc_source_set("video_test_common") { @@ -96,23 +101,50 @@ rtc_source_set("field_trial") { ] } -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", -] +rtc_source_set("test_support") { + testonly = true -if (is_ios) { - bundle_data("test_support_unittests_bundle_data") { - testonly = true - sources = test_support_unittests_resources - outputs = [ - "{{bundle_resources_dir}}/{{source_file_part}}", - ] + sources = [ + "gmock.h", + "gtest.h", + "testsupport/packet_reader.cc", + "testsupport/packet_reader.h", + "testsupport/perf_test.cc", + "testsupport/perf_test.h", + "testsupport/trace_to_stderr.cc", + "testsupport/trace_to_stderr.h", + "testsupport/unittest_utils.h", + ] + + deps = [ + "..:webrtc_common", + "../base:gtest_prod", + "../base:rtc_base_approved", + "../common_video", + "../system_wrappers", + "//testing/gmock", + "//testing/gtest", + ] + + public_deps = [ + ":fileutils", + ] + + if (!build_with_chromium && is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] + } + + if (is_android) { + deps += [ "//base:base" ] + } + + if (is_ios && !build_with_chromium) { + deps += [ "//webrtc/sdk:rtc_sdk_common_objc" ] + } + + if (rtc_use_memcheck) { + data = valgrind_webrtc_dependencies } } @@ -186,52 +218,36 @@ if (!build_with_chromium) { } } - rtc_source_set("test_support") { + rtc_source_set("test_support_isolated_output") { testonly = true - sources = [ - "gmock.h", - "gtest.h", "testsupport/isolated_output.cc", "testsupport/isolated_output.h", - "testsupport/packet_reader.cc", - "testsupport/packet_reader.h", - "testsupport/perf_test.cc", - "testsupport/perf_test.h", - "testsupport/trace_to_stderr.cc", - "testsupport/trace_to_stderr.h", - "testsupport/unittest_utils.h", ] - deps = [ - "../base:gtest_prod", + ":fileutils", "../base:rtc_base_approved", - "../common_video", - "../system_wrappers", - "//testing/gmock", - "//testing/gtest", "//third_party/gflags", ] + } - public_deps = [ - ":fileutils", - ] + 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 (!build_with_chromium && is_clang) { - # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). - suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] - } - - if (is_android) { - deps += [ "//base:base" ] - } - - if (is_ios) { - deps += [ "//webrtc/sdk:rtc_sdk_common_objc" ] - } - - if (rtc_use_memcheck) { - data = valgrind_webrtc_dependencies + if (is_ios) { + bundle_data("test_support_unittests_bundle_data") { + testonly = true + sources = test_support_unittests_resources + outputs = [ + "{{bundle_resources_dir}}/{{source_file_part}}", + ] } } @@ -281,6 +297,7 @@ if (!build_with_chromium) { ":fileutils_unittests", ":test_common", ":test_main", + ":test_support_isolated_output", ":video_test_common", ":video_test_support", "../modules/video_capture", @@ -423,7 +440,7 @@ rtc_source_set("test_common") { "//testing/gmock", "//testing/gtest", ] - if (!is_android) { + if (!is_android && !build_with_chromium) { deps += [ "../modules/video_capture:video_capture_internal_impl" ] } } diff --git a/webrtc/test/fuzzers/BUILD.gn b/webrtc/test/fuzzers/BUILD.gn index 92603eb9ce..9153cbc366 100644 --- a/webrtc/test/fuzzers/BUILD.gn +++ b/webrtc/test/fuzzers/BUILD.gn @@ -257,6 +257,8 @@ webrtc_fuzzer_test("neteq_rtp_fuzzer") { "neteq_rtp_fuzzer.cc", ] deps = [ + "../../base:rtc_base_approved", + "../../base:rtc_base_tests_utils", "../../modules/audio_coding:neteq", "../../modules/audio_coding:neteq_tools_minimal", "../../modules/audio_coding:pcm16b", diff --git a/webrtc/voice_engine/BUILD.gn b/webrtc/voice_engine/BUILD.gn index be6faabe39..1d15b7f9d3 100644 --- a/webrtc/voice_engine/BUILD.gn +++ b/webrtc/voice_engine/BUILD.gn @@ -186,6 +186,7 @@ if (rtc_include_tests) { ":file_player", ":voice_engine", "../base:rtc_base_approved", + "../base:rtc_base_tests_utils", "../modules:module_api", "../test:test_common", "//testing/gmock",