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):
parser.add_argument('--board')
parser.add_argument('--deploy-chrome', action='store_true')
parser.add_argument('--suite-name')
parser.add_argument('--tast-conditional')
parser.add_argument('--tast-tests', action='append')
args = parser.parse_args(args)
......@@ -72,14 +73,20 @@ def main(args):
'--test-exe',
args.test_exe,
])
elif args.tast_tests:
elif args.tast_conditional or args.tast_tests:
vm_test_args.extend([
'tast',
'--suite-name',
args.suite_name,
])
for t in args.tast_tests:
vm_test_args.extend(['-t', t])
if args.tast_conditional:
vm_test_args.extend([
'--conditional',
args.tast_conditional,
])
else:
for t in args.tast_tests:
vm_test_args.extend(['-t', t])
else:
vm_test_args.append('host-cmd')
if args.deploy_chrome:
......
......@@ -8,6 +8,7 @@ import argparse
import json
import logging
import os
import pipes
import re
import signal
import sys
......@@ -159,6 +160,7 @@ class TastTest(RemoteTest):
self._suite_name = args.suite_name
self._tests = args.tests
self._conditional = args.conditional
@property
def suite_name(self):
......@@ -177,7 +179,10 @@ class TastTest(RemoteTest):
'--',
'local_test_runner',
]
self._vm_test_cmd.extend(self._tests)
if self._conditional:
self._vm_test_cmd.append(pipes.quote(self._conditional))
else:
self._vm_test_cmd.extend(self._tests)
class GTestTest(RemoteTest):
......@@ -521,7 +526,11 @@ def main():
'--test-launcher-summary-output', type=str,
help='Generates a simple GTest-style JSON result file for the test run.')
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").')
add_common_args(gtest_parser)
......
......@@ -19,6 +19,7 @@ is_chromeos_chrome = cros_board != ""
# Args:
# test_exe: Name of test binary located in the out dir. This will get copied
# 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
# specified, the target name used to invoke this template will be
# designated as the "name" of this test and will primarly used for test
......@@ -39,6 +40,7 @@ template("generate_vm_runner_script") {
"deploy_chrome",
"generated_script",
"runtime_deps_file",
"tast_conditional",
"tast_tests",
"testonly",
"test_exe",
......@@ -50,7 +52,8 @@ template("generate_vm_runner_script") {
assert(defined(generated_script),
"Must specify where to place generated test launcher script via " +
"'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. " +
"There should be no locally built binary needed.")
......@@ -134,30 +137,41 @@ template("generate_vm_runner_script") {
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
# on the VM to run the set of tests.
args += [
"--suite-name",
target_name,
]
foreach(test, tast_tests) {
if (defined(tast_conditional)) {
args += [
"--tast-tests",
test,
"--tast-conditional",
tast_conditional,
]
} else {
foreach(test, tast_tests) {
args += [
"--tast-tests",
test,
]
}
}
}
}
}
# TODO(crbug.com/876587): Support Tast conditionals as well.
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) {
testonly = true
tast_tests = invoker.tast_tests
if (defined(invoker.tast_conditional)) {
tast_conditional = invoker.tast_conditional
} else if (defined(invoker.tast_tests)) {
tast_tests = invoker.tast_tests
}
generated_script = "$root_build_dir/bin/run_${target_name}"
runtime_deps_file = "$root_out_dir/${target_name}.runtime_deps"
deploy_chrome = true
......
......@@ -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") {
# The following run-time dependencies are needed to deploy chrome to a
# ChromeOS device. See the link for the full list:
......
......@@ -3086,6 +3086,21 @@
},
"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": {
"can_use_on_swarming_builders": true,
......
......@@ -279,6 +279,10 @@
"label": "//chrome:chrome",
"type": "additional_compile_target",
},
"chrome_all_tast_tests": {
"label": "//chromeos:chrome_all_tast_tests",
"type": "raw",
},
"chrome_app_unittests": {
"label": "//chrome/test:chrome_app_unittests",
"type": "console_test_launcher",
......
......@@ -430,6 +430,7 @@
'chromeos_gtests_experimental': {
'base_unittests': {},
'chrome_all_tast_tests': {},
'chrome_login_tast_tests': {},
'chromeos_unittests': {
'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