Commit b3d78796 authored by Dirk Pranke's avatar Dirk Pranke Committed by Commit Bot

Convert "raw" test types to other test types in MB.

A "raw" test type in MB was a test executable that didn't conform to
one of the other supported test harness APIs (like the chromium
gtest api or the test executable API), and which we would
handle by simply running the executable and returning the status
code.

There was no real need to support this directly; it turns out
that every raw test that we current run should've either actually
been a gtest-based test or was handled by a generated wrapper
(for the ChromeOS Tast-based tests).

Fixing this and removing support for "raw" test types allows us
to simplify MB a bit but more importantly gets us one step
closer to having only one supported API for tests.

Bug: 816629
Change-Id: I831efa949614719a8aa5106c5ab5c1c0c48b5059
Cq-Include-Trybots: luci.chromium.try:linux_optional_gpu_tests_rel
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2380439
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: default avatarBen Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808606}
parent eb941220
...@@ -111,6 +111,8 @@ template("generate_runner_script") { ...@@ -111,6 +111,8 @@ template("generate_runner_script") {
} }
data = [ data = [
"//.vpython",
# We use android test-runner's results libs to construct gtest output # We use android test-runner's results libs to construct gtest output
# json. # json.
"//build/android/pylib/__init__.py", "//build/android/pylib/__init__.py",
......
...@@ -38,10 +38,6 @@ ...@@ -38,10 +38,6 @@
# ninja target to the GN label in order to analyze it. # ninja target to the GN label in order to analyze it.
# "junit_test" # "junit_test"
# : this is a JUnit test. # : this is a JUnit test.
# "raw"
# : the test is a standalone executable; it may take an optional list of
# command line arguments in the "args" field, but otherwise needs no
# extra files or special handling.
# "script" # "script"
# : the test is a python script; the path to the script is specified in # : the test is a python script; the path to the script is specified in
# the "script" field. # the "script" field.
...@@ -418,11 +414,11 @@ ...@@ -418,11 +414,11 @@
"type": "additional_compile_target", "type": "additional_compile_target",
}, },
"chrome_all_tast_tests": { "chrome_all_tast_tests": {
"label": "//chromeos:chrome_all_tast_tests",
"type": "generated_script",
"args": [ "args": [
"--vm-logs-dir=${ISOLATED_OUTDIR}", "--vm-logs-dir=${ISOLATED_OUTDIR}",
], ],
"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",
...@@ -751,11 +747,12 @@ ...@@ -751,11 +747,12 @@
"type": "console_test_launcher", "type": "console_test_launcher",
}, },
"cros_browser_sanity_test": { "cros_browser_sanity_test": {
"label": "//chromeos:cros_browser_sanity_test",
"type": "generated_script",
"args": [ "args": [
"--vm-logs-dir=${ISOLATED_OUTDIR}", "--vm-logs-dir=${ISOLATED_OUTDIR}",
"cros_browser_sanity_test",
], ],
"label": "//chromeos:cros_browser_sanity_test",
"type": "raw",
}, },
"crypto_unittests": { "crypto_unittests": {
"label": "//crypto:crypto_unittests", "label": "//crypto:crypto_unittests",
...@@ -763,7 +760,7 @@ ...@@ -763,7 +760,7 @@
}, },
"dawn_end2end_tests": { "dawn_end2end_tests": {
"label": "//third_party/dawn/src/tests:dawn_end2end_tests", "label": "//third_party/dawn/src/tests:dawn_end2end_tests",
"type": "raw", "type": "console_test_launcher",
}, },
"dawn_perf_tests": { "dawn_perf_tests": {
"args": [ "args": [
...@@ -794,11 +791,11 @@ ...@@ -794,11 +791,11 @@
"type": "console_test_launcher", "type": "console_test_launcher",
}, },
"disk_usage_tast_test": { "disk_usage_tast_test": {
"label": "//chromeos:disk_usage_tast_test",
"type": "generated_script",
"args": [ "args": [
"--vm-logs-dir=${ISOLATED_OUTDIR}", "--vm-logs-dir=${ISOLATED_OUTDIR}",
], ],
"label": "//chromeos:disk_usage_tast_test",
"type": "raw",
}, },
"display_unittests": { "display_unittests": {
"label": "//ui/display:display_unittests", "label": "//ui/display:display_unittests",
...@@ -1300,9 +1297,8 @@ ...@@ -1300,9 +1297,8 @@
"type": "additional_compile_target", "type": "additional_compile_target",
}, },
"nacl_helper_nonsfi_unittests": { "nacl_helper_nonsfi_unittests": {
"args": [],
"label": "//components/nacl/loader:nacl_helper_nonsfi_unittests", "label": "//components/nacl/loader:nacl_helper_nonsfi_unittests",
"type": "raw", "type": "console_test_launcher",
}, },
"nacl_loader_unittests": { "nacl_loader_unittests": {
"label": "//components/nacl/loader:nacl_loader_unittests", "label": "//components/nacl/loader:nacl_loader_unittests",
...@@ -1580,9 +1576,8 @@ ...@@ -1580,9 +1576,8 @@
"type": "console_test_launcher", "type": "console_test_launcher",
}, },
"swiftshader_unittests": { "swiftshader_unittests": {
"args": [],
"label": "//third_party/swiftshader/tests/GLESUnitTests:swiftshader_unittests", "label": "//third_party/swiftshader/tests/GLESUnitTests:swiftshader_unittests",
"type": "raw", "type": "console_test_launcher",
}, },
"symupload": { "symupload": {
"label": "//third_party/breakpad:symupload", "label": "//third_party/breakpad:symupload",
......
...@@ -1406,7 +1406,11 @@ class MetaBuildWrapper(object): ...@@ -1406,7 +1406,11 @@ class MetaBuildWrapper(object):
else: else:
default_script = 'bin/run_{}'.format(target) default_script = 'bin/run_{}'.format(target)
script = isolate_map[target].get('script', default_script) script = isolate_map[target].get('script', default_script)
cmdline += [script]
# TODO(crbug.com/816629): remove any use of 'args' from
# generated_scripts.
cmdline += [script] + isolate_map[target].get('args', [])
return cmdline, [] return cmdline, []
...@@ -1509,7 +1513,7 @@ class MetaBuildWrapper(object): ...@@ -1509,7 +1513,7 @@ class MetaBuildWrapper(object):
'../../testing/test_env.py', '../../testing/test_env.py',
'../../' + self.ToSrcRelPath(isolate_map[target]['script']) '../../' + self.ToSrcRelPath(isolate_map[target]['script'])
] ]
elif test_type in ('raw', 'additional_compile_target'): elif test_type == 'additional_compile_target':
cmdline = [ cmdline = [
'./' + str(target) + executable_suffix, './' + str(target) + executable_suffix,
] ]
......
...@@ -466,14 +466,13 @@ class UnitTest(unittest.TestCase): ...@@ -466,14 +466,13 @@ class UnitTest(unittest.TestCase):
def test_gen_swarming(self): def test_gen_swarming(self):
files = { files = {
'/tmp/swarming_targets': 'base_unittests\n', '/tmp/swarming_targets':
'/fake_src/testing/buildbot/gn_isolate_map.pyl': ( 'base_unittests\n',
"{'base_unittests': {" '/fake_src/testing/buildbot/gn_isolate_map.pyl':
" 'label': '//base:base_unittests'," ("{'base_unittests': {"
" 'type': 'raw'," " 'label': '//base:base_unittests',"
" 'args': []," " 'type': 'console_test_launcher',"
"}}\n" "}}\n"),
),
} }
mbw = self.fake_mbw(files) mbw = self.fake_mbw(files)
...@@ -506,7 +505,6 @@ class UnitTest(unittest.TestCase): ...@@ -506,7 +505,6 @@ class UnitTest(unittest.TestCase):
" 'label': '//cc:cc_perftests'," " 'label': '//cc:cc_perftests',"
" 'type': 'script'," " 'type': 'script',"
" 'script': '/fake_src/out/Default/test_script.py'," " 'script': '/fake_src/out/Default/test_script.py',"
" 'args': [],"
"}}\n" "}}\n"
), ),
} }
...@@ -536,21 +534,18 @@ class UnitTest(unittest.TestCase): ...@@ -536,21 +534,18 @@ class UnitTest(unittest.TestCase):
def test_multiple_isolate_maps(self): def test_multiple_isolate_maps(self):
files = { files = {
'/tmp/swarming_targets': 'cc_perftests\n', '/tmp/swarming_targets':
'/fake_src/testing/buildbot/gn_isolate_map.pyl': ( 'cc_perftests\n',
"{'cc_perftests': {" '/fake_src/testing/buildbot/gn_isolate_map.pyl':
" 'label': '//cc:cc_perftests'," ("{'cc_perftests': {"
" 'type': 'raw'," " 'label': '//cc:cc_perftests',"
" 'args': []," " 'type': 'console_test_launcher',"
"}}\n" "}}\n"),
), '/fake_src/testing/buildbot/gn_isolate_map2.pyl':
'/fake_src/testing/buildbot/gn_isolate_map2.pyl': ( ("{'cc_perftests2': {"
"{'cc_perftests2': {" " 'label': '//cc:cc_perftests',"
" 'label': '//cc:cc_perftests'," " 'type': 'console_test_launcher',"
" 'type': 'raw'," "}}\n"),
" 'args': [],"
"}}\n"
),
} }
mbw = self.fake_mbw(files=files) mbw = self.fake_mbw(files=files)
...@@ -581,24 +576,20 @@ class UnitTest(unittest.TestCase): ...@@ -581,24 +576,20 @@ class UnitTest(unittest.TestCase):
def test_duplicate_isolate_maps(self): def test_duplicate_isolate_maps(self):
files = { files = {
'/tmp/swarming_targets': 'cc_perftests\n', '/tmp/swarming_targets':
'/fake_src/testing/buildbot/gn_isolate_map.pyl': ( 'cc_perftests\n',
"{'cc_perftests': {" '/fake_src/testing/buildbot/gn_isolate_map.pyl':
" 'label': '//cc:cc_perftests'," ("{'cc_perftests': {"
" 'type': 'raw'," " 'label': '//cc:cc_perftests',"
" 'args': []," " 'type': 'console_test_launcher',"
"}}\n" "}}\n"),
), '/fake_src/testing/buildbot/gn_isolate_map2.pyl':
'/fake_src/testing/buildbot/gn_isolate_map2.pyl': ( ("{'cc_perftests': {"
"{'cc_perftests': {" " 'label': '//cc:cc_perftests',"
" 'label': '//cc:cc_perftests'," " 'type': 'console_test_launcher',"
" 'type': 'raw'," "}}\n"),
" 'args': []," 'c:\\fake_src\out\Default\cc_perftests.exe.runtime_deps':
"}}\n" ("cc_perftests\n"),
),
'c:\\fake_src\out\Default\cc_perftests.exe.runtime_deps': (
"cc_perftests\n"
),
} }
mbw = self.fake_mbw(files=files, win32=True) mbw = self.fake_mbw(files=files, win32=True)
# Check that passing duplicate targets into mb fails. # Check that passing duplicate targets into mb fails.
...@@ -614,17 +605,15 @@ class UnitTest(unittest.TestCase): ...@@ -614,17 +605,15 @@ class UnitTest(unittest.TestCase):
def test_isolate(self): def test_isolate(self):
files = { files = {
'/fake_src/out/Default/toolchain.ninja': "", '/fake_src/out/Default/toolchain.ninja':
'/fake_src/testing/buildbot/gn_isolate_map.pyl': ( "",
"{'base_unittests': {" '/fake_src/testing/buildbot/gn_isolate_map.pyl':
" 'label': '//base:base_unittests'," ("{'base_unittests': {"
" 'type': 'raw'," " 'label': '//base:base_unittests',"
" 'args': []," " 'type': 'console_test_launcher',"
"}}\n" "}}\n"),
), '/fake_src/out/Default/base_unittests.runtime_deps':
'/fake_src/out/Default/base_unittests.runtime_deps': ( ("base_unittests\n"),
"base_unittests\n"
),
} }
self.check(['isolate', '-c', 'debug_goma', '//out/Default', self.check(['isolate', '-c', 'debug_goma', '//out/Default',
'base_unittests'], files=files, ret=0) 'base_unittests'], files=files, ret=0)
...@@ -639,14 +628,13 @@ class UnitTest(unittest.TestCase): ...@@ -639,14 +628,13 @@ class UnitTest(unittest.TestCase):
def test_isolate_dir(self): def test_isolate_dir(self):
files = { files = {
'/fake_src/out/Default/toolchain.ninja': "", '/fake_src/out/Default/toolchain.ninja':
'/fake_src/testing/buildbot/gn_isolate_map.pyl': ( "",
"{'base_unittests': {" '/fake_src/testing/buildbot/gn_isolate_map.pyl':
" 'label': '//base:base_unittests'," ("{'base_unittests': {"
" 'type': 'raw'," " 'label': '//base:base_unittests',"
" 'args': []," " 'type': 'console_test_launcher',"
"}}\n" "}}\n"),
),
} }
mbw = self.fake_mbw(files=files) mbw = self.fake_mbw(files=files)
mbw.cmds.append((0, '', '')) # Result of `gn gen` mbw.cmds.append((0, '', '')) # Result of `gn gen`
...@@ -659,14 +647,13 @@ class UnitTest(unittest.TestCase): ...@@ -659,14 +647,13 @@ class UnitTest(unittest.TestCase):
def test_isolate_generated_dir(self): def test_isolate_generated_dir(self):
files = { files = {
'/fake_src/out/Default/toolchain.ninja': "", '/fake_src/out/Default/toolchain.ninja':
'/fake_src/testing/buildbot/gn_isolate_map.pyl': ( "",
"{'base_unittests': {" '/fake_src/testing/buildbot/gn_isolate_map.pyl':
" 'label': '//base:base_unittests'," ("{'base_unittests': {"
" 'type': 'raw'," " 'label': '//base:base_unittests',"
" 'args': []," " 'type': 'console_test_launcher',"
"}}\n" "}}\n"),
),
} }
mbw = self.fake_mbw(files=files) mbw = self.fake_mbw(files=files)
mbw.cmds.append((0, '', '')) # Result of `gn gen` mbw.cmds.append((0, '', '')) # Result of `gn gen`
...@@ -684,16 +671,13 @@ class UnitTest(unittest.TestCase): ...@@ -684,16 +671,13 @@ class UnitTest(unittest.TestCase):
def test_run(self): def test_run(self):
files = { files = {
'/fake_src/testing/buildbot/gn_isolate_map.pyl': ( '/fake_src/testing/buildbot/gn_isolate_map.pyl':
"{'base_unittests': {" ("{'base_unittests': {"
" 'label': '//base:base_unittests'," " 'label': '//base:base_unittests',"
" 'type': 'raw'," " 'type': 'console_test_launcher',"
" 'args': []," "}}\n"),
"}}\n" '/fake_src/out/Default/base_unittests.runtime_deps':
), ("base_unittests\n"),
'/fake_src/out/Default/base_unittests.runtime_deps': (
"base_unittests\n"
),
} }
self.check(['run', '-c', 'debug_goma', '//out/Default', self.check(['run', '-c', 'debug_goma', '//out/Default',
'base_unittests'], files=files, ret=0) 'base_unittests'], files=files, ret=0)
...@@ -703,8 +687,7 @@ class UnitTest(unittest.TestCase): ...@@ -703,8 +687,7 @@ class UnitTest(unittest.TestCase):
'/fake_src/testing/buildbot/gn_isolate_map.pyl': '/fake_src/testing/buildbot/gn_isolate_map.pyl':
("{'base_unittests': {" ("{'base_unittests': {"
" 'label': '//base:base_unittests'," " 'label': '//base:base_unittests',"
" 'type': 'raw'," " 'type': 'console_test_launcher',"
" 'args': [],"
"}}\n"), "}}\n"),
'/fake_src/out/Default/base_unittests.runtime_deps': '/fake_src/out/Default/base_unittests.runtime_deps':
("base_unittests\n"), ("base_unittests\n"),
...@@ -823,13 +806,14 @@ class UnitTest(unittest.TestCase): ...@@ -823,13 +806,14 @@ class UnitTest(unittest.TestCase):
def test_build_command_unix(self): def test_build_command_unix(self):
files = { files = {
'/fake_src/out/Default/toolchain.ninja': '', '/fake_src/out/Default/toolchain.ninja':
'/fake_src/testing/buildbot/gn_isolate_map.pyl': ( '',
'{"base_unittests": {' '/fake_src/testing/buildbot/gn_isolate_map.pyl':
' "label": "//base:base_unittests",' ('{"base_unittests": {'
' "type": "raw",' ' "label": "//base:base_unittests",'
' "args": [],' ' "type": "console_test_launcher",'
'}}\n') ' "args": [],'
'}}\n')
} }
mbw = self.fake_mbw(files) mbw = self.fake_mbw(files)
...@@ -839,13 +823,14 @@ class UnitTest(unittest.TestCase): ...@@ -839,13 +823,14 @@ class UnitTest(unittest.TestCase):
def test_build_command_windows(self): def test_build_command_windows(self):
files = { files = {
'c:\\fake_src\\out\\Default\\toolchain.ninja': '', 'c:\\fake_src\\out\\Default\\toolchain.ninja':
'c:\\fake_src\\testing\\buildbot\\gn_isolate_map.pyl': ( '',
'{"base_unittests": {' 'c:\\fake_src\\testing\\buildbot\\gn_isolate_map.pyl':
' "label": "//base:base_unittests",' ('{"base_unittests": {'
' "type": "raw",' ' "label": "//base:base_unittests",'
' "args": [],' ' "type": "console_test_launcher",'
'}}\n') ' "args": [],'
'}}\n')
} }
mbw = self.fake_mbw(files, True) mbw = self.fake_mbw(files, True)
......
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