Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
7 changes: 6 additions & 1 deletion impeller/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
39 changes: 18 additions & 21 deletions testing/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change allows us to stream the output to stdout but also capture it for inspection. The tests take a long enough time, it's a pain not seeing the streaming results.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously the test script would only generate output when a test fails. This is nice when diagnosing failures on CI since the succeeding tests add only minimal output to the logs. Am I misreading what this does? Is there some way to make this configurable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you are misremembering how it works. If collect_output == true the output would be printed on line 119. If collect_output == false it would get printed out by virtue of using stdout=sys.stdout.


sys.stdout.flush()
process.wait()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does process.stdout.readline drain the buffer to avoid the deadlock concern with wait() called out in the docs? https://docs.python.org/3/library/subprocess.html#subprocess.Popen.wait

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's my understanding. It's reading the pipe until EOF so there should be no more waiting on the pipe by the time we call wait.

end_time = time.time()

if process.returncode != 0 and not expect_failure:
Expand All @@ -97,32 +101,20 @@ 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:
raise RuntimeError(
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}'
)
Expand Down Expand Up @@ -489,7 +481,12 @@ def make_test(name, flags=None, extra_env=None):
'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'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment pointing to the GN file with the string that has to be the same as this one would be good?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

'VK_INSTANCE_LAYERS': 'VK_LAYER_KHRONOS_validation',
}
if is_aarm64():
extra_env.update({
Expand All @@ -501,7 +498,7 @@ def make_test(name, flags=None, extra_env=None):
build_dir,
'impeller_unittests',
executable_filter,
shuffle_flags,
shuffle_flags + ['--enable_vulkan_validation'],
coverage=coverage,
extra_env=extra_env,
# TODO(117122): Remove this allowlist.
Expand Down
3 changes: 2 additions & 1 deletion tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down