Started executing vulkan unit tests with validation on macos (flutter/engine#42337)

fixes https://github.com/flutter/flutter/issues/127634

This PR depends on a buildroot change at https://github.com/flutter/buildroot/pull/737

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
gaaclarke
2023-05-26 12:05:19 -07:00
committed by GitHub
parent 83b6fa4ff7
commit d73aac2434
4 changed files with 27 additions and 24 deletions

2
DEPS
View File

@@ -256,7 +256,7 @@ allowed_hosts = [
]
deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'e522d38d629d7522f0589e754886ed2b82232d9e',
'src': 'https://github.com/flutter/buildroot.git' + '@' + '859e7ccc38f55f89dac8aea49367b7a4c1656490',
# Fuchsia compatibility
#

View File

@@ -103,7 +103,12 @@ impeller_component("impeller_unittests") {
}
if (glfw_vulkan_library != "") {
deps += [ "//third_party/swiftshader" ]
deps += [
"//third_party/swiftshader",
"//third_party/vulkan-deps/vulkan-loader/src:libvulkan",
"//third_party/vulkan_validation_layers",
"//third_party/vulkan_validation_layers:vulkan_gen_json_files",
]
}
if (impeller_enable_compute) {

View File

@@ -75,19 +75,23 @@ def run_cmd(
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,
stderr=stderr_pipe,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
env=env,
universal_newlines=True,
**kwargs
)
stdout, stderr = process.communicate()
output = ''
for line in iter(process.stdout.readline, ''):
output += line
sys.stdout.write(line)
sys.stdout.flush()
process.wait()
end_time = time.time()
if process.returncode != 0 and not expect_failure:
@@ -97,18 +101,11 @@ def run_cmd(
f'Failed Command:\n\n{command_string}\n\nExit Code: {process.returncode}\n'
)
if stdout:
print(f'STDOUT: \n{stdout}')
if stderr:
print(f'STDERR: \n{stderr}')
print_divider('!')
allowed_failure = False
for allowed_string in allowed_failure_output:
if (stdout and allowed_string in stdout) or (stderr and
allowed_string in stderr):
if allowed_string in output:
allowed_failure = True
if not allowed_failure:
@@ -116,13 +113,8 @@ def run_cmd(
f'Command "{command_string}" exited with code {process.returncode}.'
)
if stdout or stderr:
print(stdout)
print(stderr)
for forbidden_string in forbidden_output:
if (stdout and forbidden_string in stdout) or (stderr and
forbidden_string in stderr):
if forbidden_string in output:
raise RuntimeError(
f'command "{command_string}" contained forbidden string {forbidden_string}'
)
@@ -489,7 +481,12 @@ def run_cc_tests(build_dir, executable_filter, coverage, capture_core_dump):
'1', # Validates accesses to threadgroup memory.
'MTL_SHADER_VALIDATION_TEXTURE_USAGE':
'1', # Validates that texture references are not nil.
# Note: built from //third_party/swiftshader
'VK_ICD_FILENAMES': os.path.join(build_dir, 'vk_swiftshader_icd.json'),
# Note: built from //third_party/vulkan_validation_layers:vulkan_gen_json_files
# and //third_party/vulkan_validation_layers.
'VK_LAYER_PATH': os.path.join(build_dir, 'vulkan-data'),
'VK_INSTANCE_LAYERS': 'VK_LAYER_KHRONOS_validation',
}
if is_aarm64():
extra_env.update({
@@ -501,7 +498,7 @@ def run_cc_tests(build_dir, executable_filter, coverage, capture_core_dump):
build_dir,
'impeller_unittests',
executable_filter,
shuffle_flags,
shuffle_flags + ['--enable_vulkan_validation'],
coverage=coverage,
extra_env=extra_env,
# TODO(117122): Remove this allowlist.

View File

@@ -594,7 +594,8 @@ def to_gn_args(args):
gn_args['impeller_malioc_path'] = malioc_path
if args.use_glfw_swiftshader:
gn_args['glfw_vulkan_library'] = r'\"libvk_swiftshader.dylib\"'
if get_host_os() == 'mac':
gn_args['glfw_vulkan_library'] = r'\"libvulkan.dylib\"'
# ANGLE is exclusively used for:
# - Windows at runtime