summaryrefslogtreecommitdiffstats
path: root/chromecast
diff options
context:
space:
mode:
authorslan <slan@chromium.org>2015-10-05 13:37:38 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-05 20:38:23 +0000
commit87db9d1c44344e7cff12e75214d71de8966f6014 (patch)
tree78a6f0d9a417b451aa72d1eab84e7a0c82e5575c /chromecast
parentcbc84eaf3e5233d7708f6bbcbec76267d738947d (diff)
downloadchromium_src-87db9d1c44344e7cff12e75214d71de8966f6014.zip
chromium_src-87db9d1c44344e7cff12e75214d71de8966f6014.tar.gz
chromium_src-87db9d1c44344e7cff12e75214d71de8966f6014.tar.bz2
[GN] Add a template which wraps generate_test_lists.py.
generate_test_lists.py is currently our solution for building and running tests in an automated fashion. This CL adds a GN target, cast_test_lists, which, when invoked, generates lists of tests to be built and run. Bug: b/23533616 BUG=516899 Review URL: https://codereview.chromium.org/1382713003 Cr-Commit-Position: refs/heads/master@{#352412}
Diffstat (limited to 'chromecast')
-rw-r--r--chromecast/BUILD.gn117
-rw-r--r--chromecast/browser/BUILD.gn5
-rw-r--r--chromecast/build/tests/cast_test.gni294
-rw-r--r--chromecast/chromecast.gni3
-rw-r--r--chromecast/chromecast_tests.gypi9
-rw-r--r--chromecast/media/audio/cast_audio_output_stream_unittest.cc2
6 files changed, 416 insertions, 14 deletions
diff --git a/chromecast/BUILD.gn b/chromecast/BUILD.gn
index f5712fe..f2169e3 100644
--- a/chromecast/BUILD.gn
+++ b/chromecast/BUILD.gn
@@ -2,10 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//chromecast/build/tests/cast_test.gni")
import("//chromecast/chromecast.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
-import("//testing/test.gni")
import("//tools/grit/repack.gni")
import("//ui/ozone/ozone.gni")
@@ -33,17 +33,118 @@ component("chromecast") {
]
}
-group("chromecast_unittests") {
- testonly = true
-
- deps = [
- # TODO(slan): Get this target building and comment it in.
- # "//chromecast/app:cast_shell_unittests",
+# A list of all public test() binaries. This is an organizational target that
+# cannot be depended upon or built directly. Build cast_group_test_list instead.
+cast_test_group("cast_tests") {
+ tests = [
+ "//base:base_unittests",
"//chromecast/base:cast_base_unittests",
"//chromecast/crypto:cast_crypto_unittests",
"//chromecast/crash:cast_crash_unittests",
- "//chromecast/media:cast_media_unittests",
+ "//content/test:content_unittests",
+ "//crypto:crypto_unittests",
+ "//ipc:ipc_tests",
+ "//jingle:jingle_unittests",
+ "//media:media_unittests",
+ "//media/midi:midi_unittests",
+ "//net:net_unittests",
+ "//ppapi:ppapi_unittests",
+ "//sandbox/linux:sandbox_linux_unittests",
+ "//sql:sql_unittests",
+ "//sync:sync_unit_tests",
+ "//third_party/cacheinvalidation:cacheinvalidation_unittests",
+ "//ui/base:ui_base_unittests",
+ "//url:url_unittests",
]
+
+ filters = []
+
+ if (target_cpu == "arm" && target_os == "linux") {
+ filters += [
+ # Run net_unittests first to avoid random failures due to slow python startup
+ # KeygenHandlerTest.SmokeTest and KeygenHandlerTest.ConcurrencyTest fail due to
+ # readonly certdb (b/8153161)
+ # URLRequestTestHTTP.GetTest_ManyCookies takes roughly 55s to run. Increase
+ # timeout to 90s from 45s to allow it to pass (b/19821476)
+ # ProxyScriptFetcherImplTest.HttpMimeType is flaking (b/19848784)
+ # Running a batch of net_unittests has high overhead. Run tests in batches of 25 to reduce number of batches (b/23156294).
+ "net_unittests --gtest_filter=-KeygenHandlerTest.SmokeTest:KeygenHandlerTest.ConcurrencyTest:ProxyScriptFetcherImplTest.HttpMimeType --test-launcher-timeout=90000 --test-launcher-batch-limit=25",
+
+ # Disable ProcessMetricsTest.GetNumberOfThreads (b/15610509)
+ # Disable ProcessUtilTest.* (need to define OS_ANDROID)
+ # Disable StackContainer.BufferAlignment (don't support 16-byte alignment)
+ # Disable SystemMetrics2Test.GetSystemMemoryInfo (buffers>0 can't be guaranteed)
+ "base_unittests --gtest_filter=-ProcessMetricsTest.GetNumberOfThreads:ProcessUtilTest.*:StackContainer.BufferAlignment:SystemMetrics2Test.GetSystemMemoryInfo",
+
+ # DesktopCaptureDeviceTest.*: No capture device on Eureka
+ # Disable PepperGamepadHostTest.WaitForReply (pepper not supported on Eureka)
+ # Disable GpuDataManagerImplPrivateTest.SetGLStrings and
+ # RenderWidgetHostTest.Background because we disable the blacklist to enable WebGL (b/16142554)
+ "content_unittests --gtest_filter=-DOMStorageDatabaseTest.TestCanOpenAndReadWebCoreDatabase:DesktopCaptureDeviceTest.Capture:GamepadProviderTest.PollingAccess:GpuDataManagerImplPrivateTest.SetGLStrings:PepperGamepadHostTest.WaitForReply:RenderWidgetHostTest.Background",
+
+ # Disable VP9 related tests (b/18593324)
+ # PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM
+ # PipelineIntegrationTest.BasicPlayback_VideoOnly_VP9_WebM
+ # PipelineIntegrationTest.BasicPlayback_VP9*
+ # PipelineIntegrationTest.P444_VP9_WebM
+ # Disable VP8A tests (b/18593324)
+ # PipelineIntegrationTest.BasicPlayback_VP8A*
+ # Disable OpusAudioDecoderTest/AudioDecoderTest.ProduceAudioSamples/0 (unit
+ # test fails when Opus decoder uses fixed-point)
+ # Due to b/16456550, disable the following four test cases:
+ # AudioOutputControllerTest.PlayDivertSwitchDeviceRevertClose
+ # AudioOutputControllerTest.PlaySwitchDeviceClose
+ # AudioStreamHandlerTest.Play
+ # SoundsManagerTest.Play
+ # Disable AudioStreamHandlerTest.ConsecutivePlayRequests (b/16539293)
+ "media_unittests --gtest_filter=-AudioOutputControllerTest.PlayDivertSwitchDeviceRevertClose:AudioOutputControllerTest.PlaySwitchDeviceClose:AudioStreamHandlerTest.Play:AudioStreamHandlerTest.ConsecutivePlayRequests:PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM:PipelineIntegrationTest.BasicPlayback_VideoOnly_VP9_WebM:PipelineIntegrationTest.BasicPlayback_VP9*:PipelineIntegrationTest.P444_VP9_WebM:PipelineIntegrationTest.BasicPlayback_VP8A*:OpusAudioDecoderTest/AudioDecoderTest.ProduceAudioSamples/0:SoundsManagerTest.Play",
+ "sync_unit_tests --gtest_filter=-SyncHttpBridgeTest.*",
+
+ # DoAppendUTF8Invalid fails because of dcheck_always_on flag in Eng builds
+ "url_unittests --gtest_filter=-URLCanonTest.DoAppendUTF8Invalid",
+ ]
+ } else if (target_cpu != "arm" || target_os == "android") {
+ filters += [
+ # Disable PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM (not supported)
+ "media_unittests --gtest_filter=-PipelineIntegrationTest.BasicPlayback_MediaSource_VP9_WebM",
+ ]
+ }
+
+ if (!is_android) {
+ tests += [
+ "//chromecast/app:cast_shell_unittests",
+ "//chromecast/browser:cast_shell_browser_test",
+ "//chromecast/media:cast_media_unittests",
+ ]
+
+ filters += [ "cast_shell_browser_test --no-sandbox --disable-gpu" ]
+ }
+
+ if (!disable_display) {
+ tests += [ "//gpu:gpu_unittests" ]
+ } else {
+ filters += [
+ # These are not supported by the backend right now. b/21737919
+ "cast_media_unittests --gtest_filter=-AudioVideoPipelineDeviceTest.VorbisPlayback:AudioVideoPipelineDeviceTest.WebmPlayback",
+ ]
+ }
+}
+
+# Creates the build and run lists for all test targets.
+cast_test_group_list("cast_test_lists") {
+ build_list_path = "$root_out_dir/tests/build_test_list.txt"
+
+ run_list_path = "$root_out_dir/tests/run_test_list.txt"
+
+ additional_options = [ "--ozone-platform=test" ]
+
+ build_tests = true
+
+ test_groups = [ ":cast_tests" ]
+
+ if (chromecast_branding != "public") {
+ test_groups += [ "//chromecast/internal:internal_cast_tests" ]
+ }
}
source_set("cast_shell_common") {
diff --git a/chromecast/browser/BUILD.gn b/chromecast/browser/BUILD.gn
index 4f6cc5a..c0bc4b7 100644
--- a/chromecast/browser/BUILD.gn
+++ b/chromecast/browser/BUILD.gn
@@ -151,4 +151,9 @@ test("cast_shell_browser_test") {
"//testing/gtest",
"//url",
]
+
+ # TODO(slan): Find a better way to do this.
+ if (chromecast_branding != "public") {
+ deps += [ "//chromecast/internal:cast_shell_internal" ]
+ }
}
diff --git a/chromecast/build/tests/cast_test.gni b/chromecast/build/tests/cast_test.gni
new file mode 100644
index 0000000..ee79bd0
--- /dev/null
+++ b/chromecast/build/tests/cast_test.gni
@@ -0,0 +1,294 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This file contains templates which are meant to simplify building and
+# running test binaries with the Chromecast build infrastructure. See
+# documentation above each template for specific use.
+#
+# Example Usage
+#
+# # This is a standard test() template from //testing/test.gni. This generates
+# # a binary called foo_unittests.
+# test("foo_unittests") {
+# sources = [ "foo_unittest.cc" ]
+#
+# deps = [
+# ":foo",
+# "//testing/gtest",
+# "//testing/gmock",
+# ]
+# }
+#
+# # And another standard test() target, which generates bar_unittests
+# test("bar_unittests") {
+# sources = [ "bar_unittest.cc" ]
+#
+# deps = [ ... ]
+# }
+#
+# # This is an organizational target. This cannot be built directly.
+# cast_test_group("cast_tests") {
+# tests = [
+# ":bar_unittests",
+# "//path/to:foo_unittests",
+# ]
+# }
+#
+# # Here is another cast_test_group target which builds a bunch of other
+# # test binaries, and wants to apply some filters.
+# cast_test_group("external_tests") {
+# tests = [
+# "//path/to/widget:widget_unittests",
+# "//even/more/foo:foo_unittests",
+# ]
+#
+# filters = [
+# "widget_unittests --gtest_filter=-WidgetTest.TestToBeFiltered",
+# ]
+# }
+#
+# # Build this to create build and run lists for bar and foo tests.
+# cast_test_group_list("cast_test_lists") {
+# test_groups = [
+# ":cast_tests",
+# ":external_tests",
+# ]
+#
+# build_list_paths = "$root_out_dir/path/to/test/build_list.txt"
+#
+# run_list_path = "$root_out_dir/path/to/list/run_list.txt"
+# }
+
+import("//testing/test.gni")
+
+# This directory must be the same for every cast_test_group instance.
+_shared_dir = "$root_gen_dir/chromecast/tests"
+
+# A group of test executables. Including test targets in this group makes it
+# possible for Chromecast build infrastructure to build and run them with
+# filters. To accomplish this, it defines two actions, one which generates a
+# build list of all |tests|, and one which generates a run list of all |tests|.
+# It also creates a group with dependencies on each test, to ensure that they
+# are valid targets. Do not build these targets. Build cast_test_group_list
+# instead.
+#
+# Parameters
+# tests (required)
+# A list of test targets included in the assembly. Do not include any
+# other type of target. Each target's name must match the name of the
+# executable it builds.
+#
+# filters (optional)
+# A list of strings of format: "<test_name> --gtest_filter=<filter_logic>"
+# The <test_name> used must correspond to a test in |tests|. Please see
+# //chromecast/tools/build/generate_test_lists.py for more information.
+# If this is not defined, no filters are applied.
+#
+# priority (optional)
+# A string which takes any single-digit integer bewtween "1" and "9",
+# inclusive. Assign this to prioritize filters applied by other
+# cast_test_groups, where a higher number trumps a lower number.
+# If not assigned, priority defaults to "1", the lowest priority.
+#
+template("cast_test_group") {
+ assert(defined(invoker.tests),
+ "$target_name needs 'tests' listing the test() targets")
+
+ # If a set of filters has not been defined, use the empty list.
+ _filters = []
+ if (defined(invoker.filters)) {
+ _filters = invoker.filters
+ }
+
+ # If priority has not been set, set the priority to "1", the lowest priority.
+ _priority = "1"
+ if (defined(invoker.priority)) {
+ _priority = invoker.priority
+ }
+
+ # Assert that |_priority| is an integer between "1" and "9", inclusive.
+ assert(_priority == "1" || _priority == "2" || _priority == "3" ||
+ _priority == "4" || _priority == "5" || _priority == "6" ||
+ _priority == "7" || _priority == "8" || _priority == "9")
+
+ # This will be the prefix of each output file.
+ _output_prefix = "$_shared_dir/$_priority-$target_name"
+
+ # Create a list of all the target names. These must correspond to the name of
+ # the test binary.
+ _test_names = []
+ foreach(_test, invoker.tests) {
+ _test_names += [ get_label_info(_test, "name") ]
+ }
+
+ # This action generates a list of target names to build and run. It will be
+ # depended upon by the "pack_build" action of the cast_test_group_list
+ # instance which depends on this cast_test_group.
+ action(target_name + "_create_list") {
+ script = "//chromecast/tools/build/generate_test_lists.py"
+
+ outputs = [
+ "$_output_prefix.tests",
+ ]
+
+ args = [
+ "-o",
+ rebase_path("$_output_prefix.tests"),
+ "create_list",
+ ]
+
+ args += _test_names
+ }
+
+ # This action generates a list of test filters, which will have a priority
+ # [1-9]. This will be depended upon by the "pack_run" action of the
+ # cast_test_group_list which depends on this group.
+ action(target_name + "_filters") {
+ script = "//chromecast/tools/build/generate_test_lists.py"
+
+ outputs = [
+ "$_output_prefix.filters",
+ ]
+
+ args = [
+ "-o",
+ rebase_path("$_output_prefix.filters"),
+ "create_list",
+ ]
+
+ args += _filters
+ }
+
+ # This target allows us to reference each test as a fully-qualified GN path,
+ # to ensure that each path is correct. If a test does not exist, gives a
+ # helpful error message at the line it is included. Do not build this target
+ # directly.
+ group(target_name + "_build_tests") {
+ testonly = true
+ deps = invoker.tests
+ }
+}
+
+# This template runs a script which generates lists of test to be built and run.
+#
+# Parameters
+# test_groups (required)
+# The cast_test_group() targets for which this binary is to be created.
+# The targets referenced here must be cast_test_group targets, or buiding
+# this target will fail.
+#
+# build_list_path (required)
+# The absolute filepath of the output file which will hold the list of
+# tests to be built.
+#
+# run_list_path (required)
+# The absolute filepath of the output file which will hold the list of
+# tests to be run, each with filters assigned by cast_groups.
+#
+# additional_options (optional)
+# Options which are passed to the python script, and applied to every test
+#
+# build_tests (optional)
+# Set this to true to build all of the tests included in |test_groups|.
+# Defaults to false. Note that if this is set to true, the test targets
+# will be built after all the lists are generated.
+#
+template("cast_test_group_list") {
+ assert(defined(invoker.test_groups), "$target_name needs 'test_groups'")
+ assert(defined(invoker.run_list_path), "$target_name needs 'run_list_path'")
+ assert(defined(invoker.build_list_path),
+ "$target_name needs 'build_list_path'")
+
+ _pack_build_action = target_name + "_pack_build"
+
+ # Generate a list of the "create_list" actions for each group. These will be
+ # depended upon to ensure they're run before the "pack_build" step.
+ _build_actions = []
+ foreach(_test_group, invoker.test_groups) {
+ _build_actions += [ _test_group + "_create_list" ]
+ }
+
+ # Generate a list of the "filter" actions for each group. These will be
+ # depended upon to ensure they're run before the "pack_run" step.
+ _filter_actions = []
+ foreach(_test_group, invoker.test_groups) {
+ _filter_actions += [ _test_group + "_filters" ]
+ }
+
+ # Generate a list of the groups of targets, so that they can be depended upon
+ # by the "pack_run" step and built when this target is invoked.
+ if (defined(invoker.build_tests) && invoker.build_tests) {
+ _build_tests = []
+ foreach(_test_group, invoker.test_groups) {
+ _build_tests += [ _test_group + "_build_tests" ]
+ }
+ }
+
+ # The "pack_build" step. This step looks in the common folder for files with
+ # the ".tests" extenstion, collecting these and packing them into an output
+ # file. The steps which create these files are depeneded upon, to ensure
+ # they're run before this step. Do not invoke this target directly.
+ action(_pack_build_action) {
+ script = "//chromecast/tools/build/generate_test_lists.py"
+
+ outputs = [
+ invoker.build_list_path,
+ ]
+
+ args = [
+ "-o",
+ rebase_path(invoker.build_list_path),
+ "-t",
+ rebase_path(_shared_dir),
+ "pack_build",
+ ]
+
+ deps = _build_actions
+ }
+
+ # The "pack_run" step. This step looks in the common folder for files with
+ # the ".tests" and ".filters" extensions, creating a script of tests to run,
+ # with filters and priorities. See
+ # //chromecast/tools/build/generate_test_lists.py for more information.
+ # Note that this target takes the name of the invoker, such that invoking the
+ # target runs this step.
+ action(target_name) {
+ testonly = true
+
+ script = "//chromecast/tools/build/generate_test_lists.py"
+
+ outputs = [
+ invoker.run_list_path,
+ ]
+
+ args = [
+ "-o",
+ rebase_path(invoker.run_list_path),
+ "-t",
+ rebase_path(_shared_dir),
+ "pack_run",
+ ]
+
+ # Add addtional options if they have been set.
+ if (defined(invoker.additional_options)) {
+ args += [ "-a" ]
+ args += invoker.additional_options
+ }
+
+ # Depend first on the "pack_build" step, so that the build lists are created.
+ deps = [
+ ":$_pack_build_action",
+ ]
+
+ # Next, depend on the filter steps, such that they are created before this
+ # script executes.
+ deps += _filter_actions
+
+ # If |build_tests| has been set to true, depend on the testing targets so
+ # that the tests are built.
+ if (defined(_build_tests)) {
+ deps += _build_tests
+ }
+ }
+}
diff --git a/chromecast/chromecast.gni b/chromecast/chromecast.gni
index 57adf10..2edb069 100644
--- a/chromecast/chromecast.gni
+++ b/chromecast/chromecast.gni
@@ -15,4 +15,7 @@ declare_args() {
# Use Playready CDMs.
use_playready = false
+
+ # Set this true to perform an audio-only build.
+ disable_display = false
}
diff --git a/chromecast/chromecast_tests.gypi b/chromecast/chromecast_tests.gypi
index 29d9811..068d6de 100644
--- a/chromecast/chromecast_tests.gypi
+++ b/chromecast/chromecast_tests.gypi
@@ -101,6 +101,7 @@
'../media/media.gyp:media_unittests',
'../media/midi/midi.gyp:midi_unittests',
'../net/net.gyp:net_unittests',
+ '../ppapi/ppapi_internal.gyp:ppapi_unittests',
'../sandbox/sandbox.gyp:sandbox_linux_unittests',
'../sql/sql.gyp:sql_unittests',
'../sync/sync.gyp:sync_unit_tests',
@@ -184,11 +185,6 @@
],
}
}],
- ['enable_plugins==1', {
- 'dependencies': [
- '../ppapi/ppapi_internal.gyp:ppapi_unittests',
- ],
- }],
],
'includes': ['build/tests/test_list.gypi'],
},
@@ -311,6 +307,7 @@
], # end of targets
}, { # OS!="android"
'targets': [
+ # GN target: //chromecast/browser:test_support
{
'target_name': 'cast_shell_test_support',
'type': '<(component)',
@@ -343,6 +340,7 @@
'browser/test/chromecast_shell_browser_test.cc',
],
},
+ # GN target: //chromecast/app:cast_shell_unittests
{
'target_name': 'cast_shell_unittests',
'type': '<(gtest_target_type)',
@@ -360,6 +358,7 @@
# Note: producing a predetermined list of dependent inputs on which to
# regenerate this output is difficult with GYP. This file is not
# guaranteed to be regenerated outside of a clean build.
+ # GN target: //chromecast:cast_test_lists
{
'target_name': 'cast_test_lists',
'type': 'none',
diff --git a/chromecast/media/audio/cast_audio_output_stream_unittest.cc b/chromecast/media/audio/cast_audio_output_stream_unittest.cc
index fdb44aa..a6679d8 100644
--- a/chromecast/media/audio/cast_audio_output_stream_unittest.cc
+++ b/chromecast/media/audio/cast_audio_output_stream_unittest.cc
@@ -4,7 +4,7 @@
#include "base/bind.h"
#include "base/synchronization/waitable_event.h"
-#include "chromecast/base/metrics/cast_metrics_test_helper.cc"
+#include "chromecast/base/metrics/cast_metrics_test_helper.h"
#include "chromecast/media/audio/cast_audio_manager.h"
#include "chromecast/media/audio/cast_audio_output_stream.h"
#include "chromecast/media/base/media_message_loop.h"