GN: Add rtc_unittests

Everything except the dependency on
sdk/sdk_tests.gyp:rtc_sdk_peerconnection_objc_tests is included.
That one actually doesn't make those tests run as part of rtc_unittests
(by design). Fixing that + add them will done in aseparate CL.

BUG=webrtc:5949
TESTED=Built and ran rtc_unittests on Mac.
Verified the number of tests matched a run on the bot (1213 tests executed).

R=perkj@webrtc.org

Review URL: https://codereview.webrtc.org/2034923003 .

Cr-Commit-Position: refs/heads/master@{#13036}
This commit is contained in:
kjellander@webrtc.org 2016-06-03 15:57:02 +02:00
parent e80990f20f
commit 3ee5614650
3 changed files with 230 additions and 4 deletions

View File

@ -11,6 +11,7 @@
import("//build/config/linux/pkg_config.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("build/webrtc.gni")
import("//testing/test.gni")
import("//third_party/protobuf/proto_library.gni")
# Contains the defines and includes in common.gypi that are duplicated both as
@ -377,3 +378,197 @@ if (use_libfuzzer || use_drfuzz) {
]
}
}
# There's no point processing WebRTC standalone tests in a Chromium build.
if (!build_with_chromium) {
config("rtc_unittests_config") {
# GN orders flags on a target before flags from configs. The default config
# adds -Wall, and this flag have to be after -Wall -- so they need to
# come from a config and can"t be on the target directly.
if (is_clang) {
cflags = [
"-Wno-missing-braces",
"-Wno-sign-compare",
"-Wno-unused-const-variable",
]
}
}
test("rtc_unittests") {
testonly = true
sources = [
"base/array_view_unittest.cc",
"base/atomicops_unittest.cc",
"base/autodetectproxy_unittest.cc",
"base/bandwidthsmoother_unittest.cc",
"base/base64_unittest.cc",
"base/basictypes_unittest.cc",
"base/bind_unittest.cc",
"base/bitbuffer_unittest.cc",
"base/buffer_unittest.cc",
"base/bufferqueue_unittest.cc",
"base/bytebuffer_unittest.cc",
"base/byteorder_unittest.cc",
"base/callback_unittest.cc",
"base/copyonwritebuffer_unittest.cc",
"base/crc32_unittest.cc",
"base/criticalsection_unittest.cc",
"base/event_tracer_unittest.cc",
"base/event_unittest.cc",
"base/exp_filter_unittest.cc",
"base/fakeclock.cc",
"base/fakeclock.h",
"base/filerotatingstream_unittest.cc",
"base/fileutils_unittest.cc",
"base/helpers_unittest.cc",
"base/httpbase_unittest.cc",
"base/httpcommon_unittest.cc",
"base/httpserver_unittest.cc",
"base/ipaddress_unittest.cc",
"base/logging_unittest.cc",
"base/md5digest_unittest.cc",
"base/messagedigest_unittest.cc",
"base/messagequeue_unittest.cc",
"base/mod_ops_unittest.cc",
"base/multipart_unittest.cc",
"base/nat_unittest.cc",
"base/network_unittest.cc",
"base/onetimeevent_unittest.cc",
"base/optional_unittest.cc",
"base/optionsfile_unittest.cc",
"base/pathutils_unittest.cc",
"base/platform_thread_unittest.cc",
"base/profiler_unittest.cc",
"base/proxy_unittest.cc",
"base/proxydetect_unittest.cc",
"base/random_unittest.cc",
"base/rate_statistics_unittest.cc",
"base/ratelimiter_unittest.cc",
"base/ratetracker_unittest.cc",
"base/referencecountedsingletonfactory_unittest.cc",
"base/rollingaccumulator_unittest.cc",
"base/rtccertificate_unittest.cc",
"base/rtccertificategenerator_unittest.cc",
"base/scopedptrcollection_unittest.cc",
"base/sha1digest_unittest.cc",
"base/sharedexclusivelock_unittest.cc",
"base/signalthread_unittest.cc",
"base/sigslot_unittest.cc",
"base/sigslottester.h",
"base/sigslottester.h.pump",
"base/stream_unittest.cc",
"base/stringencode_unittest.cc",
"base/stringutils_unittest.cc",
"base/swap_queue_unittest.cc",
# TODO(ronghuawu): Reenable this test.
# "systeminfo_unittest.cc",
"base/task_queue_unittest.cc",
"base/task_unittest.cc",
"base/testclient_unittest.cc",
"base/thread_checker_unittest.cc",
"base/thread_unittest.cc",
"base/timedelta.h",
"base/timeutils_unittest.cc",
"base/urlencode_unittest.cc",
"base/versionparsing_unittest.cc",
# TODO(ronghuawu): Reenable this test.
# "windowpicker_unittest.cc",
"p2p/base/dtlstransportchannel_unittest.cc",
"p2p/base/fakeportallocator.h",
"p2p/base/faketransportcontroller.h",
"p2p/base/p2ptransportchannel_unittest.cc",
"p2p/base/port_unittest.cc",
"p2p/base/portallocator_unittest.cc",
"p2p/base/pseudotcp_unittest.cc",
"p2p/base/relayport_unittest.cc",
"p2p/base/relayserver_unittest.cc",
"p2p/base/stun_unittest.cc",
"p2p/base/stunport_unittest.cc",
"p2p/base/stunrequest_unittest.cc",
"p2p/base/stunserver_unittest.cc",
"p2p/base/tcpport_unittest.cc",
"p2p/base/testrelayserver.h",
"p2p/base/teststunserver.h",
"p2p/base/testturnserver.h",
"p2p/base/transport_unittest.cc",
"p2p/base/transportcontroller_unittest.cc",
"p2p/base/transportdescriptionfactory_unittest.cc",
"p2p/base/turnport_unittest.cc",
"p2p/client/basicportallocator_unittest.cc",
"p2p/stunprober/stunprober_unittest.cc",
]
if (is_linux) {
sources += [
"base/latebindingsymboltable_unittest.cc",
# TODO(ronghuawu): Reenable this test.
# "linux_unittest.cc",
"base/linuxfdwalk_unittest.cc",
]
}
if (is_win) {
sources += [
"base/win32_unittest.cc",
"base/win32regkey_unittest.cc",
"base/win32window_unittest.cc",
"base/win32windowpicker_unittest.cc",
"base/winfirewall_unittest.cc",
]
}
if (is_mac) {
sources += [ "base/macutils_unittest.cc" ]
}
if (is_posix) {
sources += [
"base/ssladapter_unittest.cc",
"base/sslidentity_unittest.cc",
"base/sslstreamadapter_unittest.cc",
]
}
if (is_ios || (is_mac && target_cpu != "x86")) {
defines = [ "CARBON_DEPRECATED=YES" ]
}
if (rtc_use_quic) {
sources += [
"p2p/quic/quicconnectionhelper_unittest.cc",
"p2p/quic/quicsession_unittest.cc",
"p2p/quic/quictransport_unittest.cc",
"p2p/quic/quictransportchannel_unittest.cc",
"p2p/quic/reliablequicstream_unittest.cc",
]
}
configs += [
":common_config",
":rtc_unittests_config",
]
public_configs = [ ":common_inherited_config" ]
if (is_clang) {
# Suppress warnings from the Chromium Clang plugin.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
configs -= [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
"base:rtc_base",
"base:rtc_base_test_utils",
"base:rtc_task_queue",
"p2p:libstunprober",
"p2p:rtc_p2p",
"//testing/gmock",
"//testing/gtest",
]
if (is_android) {
deps += [ "//testing/android/native_test:native_test_support" ]
}
}
}

View File

@ -631,3 +631,38 @@ source_set("gtest_prod") {
"gtest_prod_util.h",
]
}
# There's no point processing WebRTC standalone tests in a Chromium build.
if (!build_with_chromium) {
config("rtc_base_test_utils_exported_config") {
defines = [ "GTEST_RELATIVE_PATH" ]
}
source_set("rtc_base_test_utils") {
testonly = true
sources = [
# Also use this as a convenient dumping ground for misc files that are
# included by multiple targets below.
"fakenetwork.h",
"fakesslidentity.h",
"faketaskrunner.h",
"gunit.h",
"testbase64.h",
"testechoserver.h",
"testutils.h",
"unittest_main.cc",
]
configs += [ "..:common_config" ]
public_configs = [
"..:common_inherited_config",
":rtc_base_test_utils_exported_config",
]
deps = [
":rtc_base",
"../test:field_trial",
]
public_deps = [
"//testing/gtest",
]
}
}

View File

@ -137,10 +137,6 @@
'base/win32windowpicker_unittest.cc',
'base/winfirewall_unittest.cc',
],
'sources!': [
# TODO(pbos): Reenable this test.
'base/win32windowpicker_unittest.cc',
],
}],
['OS=="win" and clang==1', {
'msvs_settings': {