Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c30e8d5

Browse files
committed
turned it on only for aarm64
1 parent c23cdeb commit c30e8d5

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

testing/run_tests.py

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,16 @@ def is_mac():
138138
return sys.platform == 'darwin'
139139

140140

141+
def is_aarm64():
142+
assert (is_mac())
143+
output = subprocess.check_output(["sysctl", "machdep.cpu"])
144+
text = output.decode('utf-8')
145+
aarm64 = text.find("Apple") >= 0
146+
if not aarm64:
147+
assert (text.find("GenuineIntel") >= 0)
148+
return aarm64
149+
150+
141151
def is_linux():
142152
return sys.platform.startswith('linux')
143153

@@ -467,27 +477,30 @@ def make_test(name, flags=None, extra_env=None):
467477
shuffle_flags,
468478
coverage=coverage
469479
)
480+
extra_env = {
481+
# pylint: disable=line-too-long
482+
# See https://developer.apple.com/documentation/metal/diagnosing_metal_programming_issues_early?language=objc
483+
'MTL_SHADER_VALIDATION': '1', # Enables all shader validation tests.
484+
'MTL_SHADER_VALIDATION_GLOBAL_MEMORY':
485+
'1', # Validates accesses to device and constant memory.
486+
'MTL_SHADER_VALIDATION_THREADGROUP_MEMORY':
487+
'1', # Validates accesses to threadgroup memory.
488+
'MTL_SHADER_VALIDATION_TEXTURE_USAGE':
489+
'1', # Validates that texture references are not nil.
490+
}
491+
if is_aarm64():
492+
extra_env.append({
493+
'METAL_DEBUG_ERROR_MODE': '0', # Enables metal validation.
494+
'METAL_DEVICE_WRAPPER_TYPE': '1', # Enables metal validation.
495+
})
470496
# Impeller tests are only supported on macOS for now.
471497
run_engine_executable(
472498
build_dir,
473499
'impeller_unittests',
474500
executable_filter,
475501
shuffle_flags,
476502
coverage=coverage,
477-
extra_env={
478-
# pylint: disable=line-too-long
479-
# See https://developer.apple.com/documentation/metal/diagnosing_metal_programming_issues_early?language=objc
480-
'METAL_DEBUG_ERROR_MODE': '0', # Enables metal validation.
481-
'METAL_DEVICE_WRAPPER_TYPE': '1', # Enables metal validation.
482-
'MTL_SHADER_VALIDATION':
483-
'1', # Enables all shader validation tests.
484-
'MTL_SHADER_VALIDATION_GLOBAL_MEMORY':
485-
'1', # Validates accesses to device and constant memory.
486-
'MTL_SHADER_VALIDATION_THREADGROUP_MEMORY':
487-
'1', # Validates accesses to threadgroup memory.
488-
'MTL_SHADER_VALIDATION_TEXTURE_USAGE':
489-
'1', # Validates that texture references are not nil.
490-
},
503+
extra_env=extra_env,
491504
# TODO(117122): Remove this allowlist.
492505
# https://github.com/flutter/flutter/issues/114872
493506
allowed_failure_output=[

0 commit comments

Comments
 (0)