[Impeller] Turn on vulkan tests for mac CI. (flutter/engine#42225)
This uses swiftshader to run the tests on mac. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
2
DEPS
2
DEPS
@@ -256,7 +256,7 @@ allowed_hosts = [
|
||||
]
|
||||
|
||||
deps = {
|
||||
'src': 'https://github.com/flutter/buildroot.git' + '@' + '5cab8e095066d8f3de063943af26b7336aa52662',
|
||||
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'aee1094b10465e32972932e23b6799c3f8de244f',
|
||||
|
||||
# Fuchsia compatibility
|
||||
#
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
"debug",
|
||||
"--no-lto",
|
||||
"--prebuilt-dart-sdk",
|
||||
"--build-embedder-examples"
|
||||
"--build-embedder-examples",
|
||||
"--enable-impeller-vulkan",
|
||||
"--use-glfw-swiftshader"
|
||||
],
|
||||
"name": "host_debug",
|
||||
"ninja": {
|
||||
@@ -146,7 +148,8 @@
|
||||
"--no-lto",
|
||||
"--prebuilt-dart-sdk",
|
||||
"--build-embedder-examples",
|
||||
"--enable-impeller-vulkan"
|
||||
"--enable-impeller-vulkan",
|
||||
"--use-glfw-swiftshader"
|
||||
],
|
||||
"name": "host_release",
|
||||
"ninja": {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//third_party/glfw/glfw_args.gni")
|
||||
import("tools/impeller.gni")
|
||||
|
||||
config("impeller_public_config") {
|
||||
@@ -101,6 +102,10 @@ impeller_component("impeller_unittests") {
|
||||
deps += [ "//flutter/impeller/renderer/backend/vulkan:vulkan_unittests" ]
|
||||
}
|
||||
|
||||
if (glfw_vulkan_library != "") {
|
||||
deps += [ "//third_party/swiftshader" ]
|
||||
}
|
||||
|
||||
if (impeller_enable_compute) {
|
||||
deps += [ "renderer:compute_tessellation_unittests" ]
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ void Playground::SetupContext(PlaygroundBackend backend) {
|
||||
|
||||
impl_ = PlaygroundImpl::Create(backend, switches_);
|
||||
if (!impl_) {
|
||||
FML_LOG(WARNING) << "PlaygroundImpl::Create failed.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import typing
|
||||
import xvfb
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
@@ -56,13 +57,13 @@ def is_asan(build_dir):
|
||||
|
||||
|
||||
def run_cmd(
|
||||
cmd,
|
||||
forbidden_output=None,
|
||||
expect_failure=False,
|
||||
env=None,
|
||||
allowed_failure_output=None,
|
||||
cmd: typing.List[str],
|
||||
forbidden_output: typing.List[str] = None,
|
||||
expect_failure: bool = False,
|
||||
env: typing.Dict[str, str] = None,
|
||||
allowed_failure_output: typing.List[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
) -> None:
|
||||
if forbidden_output is None:
|
||||
forbidden_output = []
|
||||
if allowed_failure_output is None:
|
||||
@@ -71,12 +72,13 @@ def run_cmd(
|
||||
command_string = ' '.join(cmd)
|
||||
|
||||
print_divider('>')
|
||||
print('Running command "%s"' % command_string)
|
||||
print(f'Running command "{command_string}"')
|
||||
|
||||
start_time = time.time()
|
||||
collect_output = forbidden_output or allowed_failure_output
|
||||
stdout_pipe = sys.stdout if not collect_output else subprocess.PIPE
|
||||
stderr_pipe = sys.stderr if not collect_output else subprocess.PIPE
|
||||
|
||||
process = subprocess.Popen(
|
||||
cmd,
|
||||
stdout=stdout_pipe,
|
||||
@@ -92,15 +94,14 @@ def run_cmd(
|
||||
print_divider('!')
|
||||
|
||||
print(
|
||||
'Failed Command:\n\n%s\n\nExit Code: %d\n' %
|
||||
(command_string, process.returncode)
|
||||
f'Failed Command:\n\n{command_string}\n\nExit Code: {process.returncode}\n'
|
||||
)
|
||||
|
||||
if stdout:
|
||||
print('STDOUT: \n%s' % stdout)
|
||||
print(f'STDOUT: \n{stdout}')
|
||||
|
||||
if stderr:
|
||||
print('STDERR: \n%s' % stderr)
|
||||
print(f'STDERR: \n{stderr}')
|
||||
|
||||
print_divider('!')
|
||||
|
||||
@@ -111,9 +112,8 @@ def run_cmd(
|
||||
allowed_failure = True
|
||||
|
||||
if not allowed_failure:
|
||||
raise Exception(
|
||||
'Command "%s" exited with code %d.' %
|
||||
(command_string, process.returncode)
|
||||
raise RuntimeError(
|
||||
f'Command "{command_string}" exited with code {process.returncode}.'
|
||||
)
|
||||
|
||||
if stdout or stderr:
|
||||
@@ -123,15 +123,13 @@ def run_cmd(
|
||||
for forbidden_string in forbidden_output:
|
||||
if (stdout and forbidden_string in stdout) or (stderr and
|
||||
forbidden_string in stderr):
|
||||
raise Exception(
|
||||
'command "%s" contained forbidden string %s' %
|
||||
(command_string, forbidden_string)
|
||||
raise RuntimeError(
|
||||
f'command "{command_string}" contained forbidden string {forbidden_string}'
|
||||
)
|
||||
|
||||
print_divider('<')
|
||||
print(
|
||||
'Command run successfully in %.2f seconds: %s' %
|
||||
(end_time - start_time, command_string)
|
||||
f'Command run successfully in {end_time - start_time:.2f} seconds: {command_string}'
|
||||
)
|
||||
|
||||
|
||||
@@ -225,7 +223,7 @@ def run_engine_executable( # pylint: disable=too-many-arguments
|
||||
expect_failure=False,
|
||||
coverage=False,
|
||||
extra_env=None,
|
||||
gtest=False
|
||||
gtest=False,
|
||||
):
|
||||
if executable_filter is not None and executable_name not in executable_filter:
|
||||
print('Skipping %s due to filter.' % executable_name)
|
||||
@@ -282,7 +280,7 @@ def run_engine_executable( # pylint: disable=too-many-arguments
|
||||
forbidden_output=forbidden_output,
|
||||
expect_failure=expect_failure,
|
||||
env=env,
|
||||
allowed_failure_output=allowed_failure_output
|
||||
allowed_failure_output=allowed_failure_output,
|
||||
)
|
||||
except:
|
||||
# The LUCI environment may provide a variable containing a directory path
|
||||
@@ -503,7 +501,7 @@ def run_cc_tests(build_dir, executable_filter, coverage, capture_core_dump):
|
||||
build_dir,
|
||||
'impeller_unittests',
|
||||
executable_filter,
|
||||
['--gtest_filter=-*/Vulkan'] + shuffle_flags,
|
||||
shuffle_flags,
|
||||
coverage=coverage,
|
||||
extra_env=extra_env,
|
||||
# TODO(117122): Remove this allowlist.
|
||||
|
||||
@@ -593,6 +593,9 @@ def to_gn_args(args):
|
||||
if malioc_path:
|
||||
gn_args['impeller_malioc_path'] = malioc_path
|
||||
|
||||
if args.use_glfw_swiftshader:
|
||||
gn_args['glfw_vulkan_library'] = r'\"libvk_swiftshader.dylib\"'
|
||||
|
||||
# ANGLE is exclusively used for:
|
||||
# - Windows at runtime
|
||||
# - Non-fuchsia host unit tests (is_host_build evaluates to false).
|
||||
@@ -1124,6 +1127,13 @@ def parse_args(args):
|
||||
'in //flutter/tools/gn.',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--use-glfw-swiftshader',
|
||||
default=False,
|
||||
action='store_true',
|
||||
help='Forces glfw to use swiftshader.',
|
||||
)
|
||||
|
||||
return parser.parse_args(args)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user