Commit 09de3947 authored by Ben Pastene's avatar Ben Pastene Committed by Commit Bot

Support conditionals for tast cros vm tests.

And add a new test "chrome_all_tast_tests" that uses a conditional. And
add that test to the FYI bot.

Bug: 876587
Change-Id: I9518389338b99207ba045bfc62d87dda02c4e3e9
Reviewed-on: https://chromium-review.googlesource.com/c/1256209Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595905}
parent 35fdb442
...@@ -52,6 +52,7 @@ def main(args): ...@@ -52,6 +52,7 @@ def main(args):
parser.add_argument('--board') parser.add_argument('--board')
parser.add_argument('--deploy-chrome', action='store_true') parser.add_argument('--deploy-chrome', action='store_true')
parser.add_argument('--suite-name') parser.add_argument('--suite-name')
parser.add_argument('--tast-conditional')
parser.add_argument('--tast-tests', action='append') parser.add_argument('--tast-tests', action='append')
args = parser.parse_args(args) args = parser.parse_args(args)
...@@ -72,12 +73,18 @@ def main(args): ...@@ -72,12 +73,18 @@ def main(args):
'--test-exe', '--test-exe',
args.test_exe, args.test_exe,
]) ])
elif args.tast_tests: elif args.tast_conditional or args.tast_tests:
vm_test_args.extend([ vm_test_args.extend([
'tast', 'tast',
'--suite-name', '--suite-name',
args.suite_name, args.suite_name,
]) ])
if args.tast_conditional:
vm_test_args.extend([
'--conditional',
args.tast_conditional,
])
else:
for t in args.tast_tests: for t in args.tast_tests:
vm_test_args.extend(['-t', t]) vm_test_args.extend(['-t', t])
else: else:
......
...@@ -8,6 +8,7 @@ import argparse ...@@ -8,6 +8,7 @@ import argparse
import json import json
import logging import logging
import os import os
import pipes
import re import re
import signal import signal
import sys import sys
...@@ -159,6 +160,7 @@ class TastTest(RemoteTest): ...@@ -159,6 +160,7 @@ class TastTest(RemoteTest):
self._suite_name = args.suite_name self._suite_name = args.suite_name
self._tests = args.tests self._tests = args.tests
self._conditional = args.conditional
@property @property
def suite_name(self): def suite_name(self):
...@@ -177,6 +179,9 @@ class TastTest(RemoteTest): ...@@ -177,6 +179,9 @@ class TastTest(RemoteTest):
'--', '--',
'local_test_runner', 'local_test_runner',
] ]
if self._conditional:
self._vm_test_cmd.append(pipes.quote(self._conditional))
else:
self._vm_test_cmd.extend(self._tests) self._vm_test_cmd.extend(self._tests)
...@@ -521,7 +526,11 @@ def main(): ...@@ -521,7 +526,11 @@ def main():
'--test-launcher-summary-output', type=str, '--test-launcher-summary-output', type=str,
help='Generates a simple GTest-style JSON result file for the test run.') help='Generates a simple GTest-style JSON result file for the test run.')
tast_test_parser.add_argument( tast_test_parser.add_argument(
'--test', '-t', action='append', dest='tests', required=True, '--conditional', type=str,
help='A conditional whose matching tests will run '
'(eg: ("dep:chrome" || "dep:chrome_login")).')
tast_test_parser.add_argument(
'--test', '-t', action='append', dest='tests',
help='A Tast test to run in the VM (eg: "ui.ChromeLogin").') help='A Tast test to run in the VM (eg: "ui.ChromeLogin").')
add_common_args(gtest_parser) add_common_args(gtest_parser)
......
...@@ -19,6 +19,7 @@ is_chromeos_chrome = cros_board != "" ...@@ -19,6 +19,7 @@ is_chromeos_chrome = cros_board != ""
# Args: # Args:
# test_exe: Name of test binary located in the out dir. This will get copied # test_exe: Name of test binary located in the out dir. This will get copied
# to the VM and executed there. # to the VM and executed there.
# tast_conditional: Tast conditional to pass to local_test_runner on the VM.
# tast_tests: List of Tast tests to run on the VM. Note that when this is # tast_tests: List of Tast tests to run on the VM. Note that when this is
# specified, the target name used to invoke this template will be # specified, the target name used to invoke this template will be
# designated as the "name" of this test and will primarly used for test # designated as the "name" of this test and will primarly used for test
...@@ -39,6 +40,7 @@ template("generate_vm_runner_script") { ...@@ -39,6 +40,7 @@ template("generate_vm_runner_script") {
"deploy_chrome", "deploy_chrome",
"generated_script", "generated_script",
"runtime_deps_file", "runtime_deps_file",
"tast_conditional",
"tast_tests", "tast_tests",
"testonly", "testonly",
"test_exe", "test_exe",
...@@ -50,7 +52,8 @@ template("generate_vm_runner_script") { ...@@ -50,7 +52,8 @@ template("generate_vm_runner_script") {
assert(defined(generated_script), assert(defined(generated_script),
"Must specify where to place generated test launcher script via " + "Must specify where to place generated test launcher script via " +
"'generated_script'") "'generated_script'")
assert(!(defined(tast_tests) && defined(test_exe)), is_tast = defined(tast_conditional) || defined(tast_tests)
assert(!(is_tast && defined(test_exe)),
"Tast tests are invoked from binaries shipped with the VM image. " + "Tast tests are invoked from binaries shipped with the VM image. " +
"There should be no locally built binary needed.") "There should be no locally built binary needed.")
...@@ -134,13 +137,19 @@ template("generate_vm_runner_script") { ...@@ -134,13 +137,19 @@ template("generate_vm_runner_script") {
rebase_path(runtime_deps_file, root_build_dir), rebase_path(runtime_deps_file, root_build_dir),
] ]
} }
} else if (defined(tast_tests)) { } else if (is_tast) {
# When --tast-tests is specified, run_vm_test will call local_test_runner # When --tast-tests is specified, run_vm_test will call local_test_runner
# on the VM to run the set of tests. # on the VM to run the set of tests.
args += [ args += [
"--suite-name", "--suite-name",
target_name, target_name,
] ]
if (defined(tast_conditional)) {
args += [
"--tast-conditional",
tast_conditional,
]
} else {
foreach(test, tast_tests) { foreach(test, tast_tests) {
args += [ args += [
"--tast-tests", "--tast-tests",
...@@ -149,15 +158,20 @@ template("generate_vm_runner_script") { ...@@ -149,15 +158,20 @@ template("generate_vm_runner_script") {
} }
} }
} }
}
} }
# TODO(crbug.com/876587): Support Tast conditionals as well.
template("tast_test") { template("tast_test") {
assert(defined(invoker.tast_tests), "A list of tast_tests must be specified.") assert(defined(invoker.tast_conditional) != defined(invoker.tast_tests),
"Specify one of tast_tests or tast_conditional.")
generate_vm_runner_script(target_name) { generate_vm_runner_script(target_name) {
testonly = true testonly = true
if (defined(invoker.tast_conditional)) {
tast_conditional = invoker.tast_conditional
} else if (defined(invoker.tast_tests)) {
tast_tests = invoker.tast_tests tast_tests = invoker.tast_tests
}
generated_script = "$root_build_dir/bin/run_${target_name}" generated_script = "$root_build_dir/bin/run_${target_name}"
runtime_deps_file = "$root_out_dir/${target_name}.runtime_deps" runtime_deps_file = "$root_out_dir/${target_name}.runtime_deps"
deploy_chrome = true deploy_chrome = true
......
...@@ -801,6 +801,10 @@ if (is_chromeos_chrome) { ...@@ -801,6 +801,10 @@ if (is_chromeos_chrome) {
] ]
} }
tast_test("chrome_all_tast_tests") {
tast_conditional = "(!informational && !disabled && (\"dep:chrome\" || \"dep:chrome_login\"))"
}
group("cros_chrome_deploy") { group("cros_chrome_deploy") {
# The following run-time dependencies are needed to deploy chrome to a # The following run-time dependencies are needed to deploy chrome to a
# ChromeOS device. See the link for the full list: # ChromeOS device. See the link for the full list:
......
...@@ -3086,6 +3086,21 @@ ...@@ -3086,6 +3086,21 @@
}, },
"test": "base_unittests" "test": "base_unittests"
}, },
{
"swarming": {
"can_use_on_swarming_builders": true,
"dimension_sets": [
{
"kvm": "1",
"os": "Ubuntu-14.04",
"pool": "Chrome-CrOS-VM"
}
],
"hard_timeout": 3600,
"io_timeout": 3600
},
"test": "chrome_all_tast_tests"
},
{ {
"swarming": { "swarming": {
"can_use_on_swarming_builders": true, "can_use_on_swarming_builders": true,
......
...@@ -279,6 +279,10 @@ ...@@ -279,6 +279,10 @@
"label": "//chrome:chrome", "label": "//chrome:chrome",
"type": "additional_compile_target", "type": "additional_compile_target",
}, },
"chrome_all_tast_tests": {
"label": "//chromeos:chrome_all_tast_tests",
"type": "raw",
},
"chrome_app_unittests": { "chrome_app_unittests": {
"label": "//chrome/test:chrome_app_unittests", "label": "//chrome/test:chrome_app_unittests",
"type": "console_test_launcher", "type": "console_test_launcher",
......
...@@ -430,6 +430,7 @@ ...@@ -430,6 +430,7 @@
'chromeos_gtests_experimental': { 'chromeos_gtests_experimental': {
'base_unittests': {}, 'base_unittests': {},
'chrome_all_tast_tests': {},
'chrome_login_tast_tests': {}, 'chrome_login_tast_tests': {},
'chromeos_unittests': { 'chromeos_unittests': {
'args': [ 'args': [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment