[Impeller] Turn on vulkan tests for mac CI. (#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
diff --git a/DEPS b/DEPS
index 5db9fd9..5a1e867 100644
--- a/DEPS
+++ b/DEPS
@@ -256,7 +256,7 @@
]
deps = {
- 'src': 'https://github.com/flutter/buildroot.git' + '@' + '5cab8e095066d8f3de063943af26b7336aa52662',
+ 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'aee1094b10465e32972932e23b6799c3f8de244f',
# Fuchsia compatibility
#
diff --git a/ci/builders/mac_host_engine.json b/ci/builders/mac_host_engine.json
index 21d80f8..79ce54e 100644
--- a/ci/builders/mac_host_engine.json
+++ b/ci/builders/mac_host_engine.json
@@ -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": {
diff --git a/impeller/BUILD.gn b/impeller/BUILD.gn
index fb111b0..a3c5e74 100644
--- a/impeller/BUILD.gn
+++ b/impeller/BUILD.gn
@@ -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 @@
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" ]
}
diff --git a/impeller/playground/playground.cc b/impeller/playground/playground.cc
index 769dc62..80cd412 100644
--- a/impeller/playground/playground.cc
+++ b/impeller/playground/playground.cc
@@ -116,6 +116,7 @@
impl_ = PlaygroundImpl::Create(backend, switches_);
if (!impl_) {
+ FML_LOG(WARNING) << "PlaygroundImpl::Create failed.";
return;
}
diff --git a/testing/run_tests.py b/testing/run_tests.py
index 8fcf8b30..c17bf21 100755
--- a/testing/run_tests.py
+++ b/testing/run_tests.py
@@ -22,6 +22,7 @@
import sys
import tempfile
import time
+import typing
import xvfb
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
@@ -56,13 +57,13 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
build_dir,
'impeller_unittests',
executable_filter,
- ['--gtest_filter=-*/Vulkan'] + shuffle_flags,
+ shuffle_flags,
coverage=coverage,
extra_env=extra_env,
# TODO(117122): Remove this allowlist.
diff --git a/tools/gn b/tools/gn
index 1b2b52f..03eacfb 100755
--- a/tools/gn
+++ b/tools/gn
@@ -593,6 +593,9 @@
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 @@
'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)